1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-05 12:50:29 +02:00
joplin/ElectronClient/gui/NoteEditor/commands/focusElementNoteBody.ts

25 lines
630 B
TypeScript

import { CommandRuntime, CommandDeclaration } from '../../../lib/services/CommandService';
import { _ } from 'lib/locale';
export const declaration:CommandDeclaration = {
name: 'focusElementNoteBody',
label: () => _('Note body'),
parentLabel: () => _('Focus'),
};
export const runtime = (comp:any):CommandRuntime => {
return {
execute: async () => {
comp.editorRef.current.execCommand({ name: 'focus' });
},
isEnabled: (props:any):boolean => {
return props.hasOneNoteSelected;
},
mapStateToProps: (state:any):any => {
return {
hasOneNoteSelected: state.selectedNoteIds.length === 1,
};
},
};
};