2020-11-07 15:59:37 +00:00
|
|
|
import { CommandRuntime, CommandDeclaration } from '@joplin/lib/services/CommandService';
|
|
|
|
import { _ } from '@joplin/lib/locale';
|
2024-08-27 10:05:48 -07:00
|
|
|
import { FocusElementOptions } from '../../../commands/focusElement';
|
2020-07-03 22:32:39 +01:00
|
|
|
|
2020-11-12 19:13:28 +00:00
|
|
|
export const declaration: CommandDeclaration = {
|
2020-07-03 22:32:39 +01:00
|
|
|
name: 'focusElementNoteBody',
|
|
|
|
label: () => _('Note body'),
|
2020-09-13 17:21:11 +01:00
|
|
|
parentLabel: () => _('Focus'),
|
2020-07-03 22:32:39 +01:00
|
|
|
};
|
|
|
|
|
2024-04-05 12:16:49 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2020-11-12 19:13:28 +00:00
|
|
|
export const runtime = (comp: any): CommandRuntime => {
|
2020-07-03 22:32:39 +01:00
|
|
|
return {
|
2024-08-27 10:05:48 -07:00
|
|
|
execute: async (_context: unknown, options?: FocusElementOptions) => {
|
|
|
|
comp.editorRef.current.execCommand({ name: 'editor.focus', value: options });
|
2020-07-03 22:32:39 +01:00
|
|
|
},
|
2020-10-18 21:52:10 +01:00
|
|
|
enabledCondition: 'oneNoteSelected',
|
2020-07-03 22:32:39 +01:00
|
|
|
};
|
|
|
|
};
|