2020-11-05 16:58:23 +00:00
|
|
|
import { CommandRuntime, CommandDeclaration } from '@joplinapp/lib/services/CommandService';
|
|
|
|
import { _ } from '@joplinapp/lib/locale';
|
2020-07-03 22:32:39 +01:00
|
|
|
|
|
|
|
export const declaration:CommandDeclaration = {
|
|
|
|
name: 'focusElementNoteTitle',
|
|
|
|
label: () => _('Note title'),
|
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 () => {
|
|
|
|
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
|
|
|
};
|
|
|
|
};
|