2020-07-03 22:32:39 +01:00
|
|
|
import { CommandRuntime, CommandDeclaration } from '../../../lib/services/CommandService';
|
2020-10-09 18:35:46 +01:00
|
|
|
import { _ } from 'lib/locale';
|
2020-07-03 22:32:39 +01:00
|
|
|
|
|
|
|
export const declaration:CommandDeclaration = {
|
|
|
|
name: 'focusElementNoteBody',
|
|
|
|
label: () => _('Note body'),
|
2020-09-13 17:21:11 +01:00
|
|
|
parentLabel: () => _('Focus'),
|
2020-07-03 22:32:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export const runtime = (comp:any):CommandRuntime => {
|
|
|
|
return {
|
|
|
|
execute: async () => {
|
|
|
|
comp.editorRef.current.execCommand({ name: 'focus' });
|
|
|
|
},
|
2020-10-09 18:35:46 +01:00
|
|
|
isEnabled: (props:any):boolean => {
|
|
|
|
return props.hasOneNoteSelected;
|
|
|
|
},
|
|
|
|
mapStateToProps: (state:any):any => {
|
|
|
|
return {
|
|
|
|
hasOneNoteSelected: state.selectedNoteIds.length === 1,
|
|
|
|
};
|
|
|
|
},
|
2020-07-03 22:32:39 +01:00
|
|
|
};
|
|
|
|
};
|