2020-11-07 15:59:37 +00:00
|
|
|
import { CommandRuntime, CommandDeclaration } from '@joplin/lib/services/CommandService';
|
|
|
|
import { _ } from '@joplin/lib/locale';
|
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: 'focusElementNoteTitle',
|
|
|
|
label: () => _('Note title'),
|
2020-09-13 17:21:11 +01:00
|
|
|
parentLabel: () => _('Focus'),
|
2020-07-03 22:32:39 +01:00
|
|
|
};
|
|
|
|
|
2020-11-12 19:13:28 +00:00
|
|
|
export const runtime = (comp: any): CommandRuntime => {
|
2020-07-03 22:32:39 +01:00
|
|
|
return {
|
|
|
|
execute: async () => {
|
|
|
|
if (!comp.titleInputRef.current) return;
|
|
|
|
comp.titleInputRef.current.focus();
|
|
|
|
},
|
2020-10-18 21:52:10 +01:00
|
|
|
enabledCondition: 'oneNoteSelected',
|
2020-07-03 22:32:39 +01:00
|
|
|
};
|
|
|
|
};
|