You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
23 lines
744 B
TypeScript
23 lines
744 B
TypeScript
import { CommandRuntime, CommandDeclaration } from '@joplin/lib/services/CommandService';
|
|
import { _ } from '@joplin/lib/locale';
|
|
import { FocusElementOptions } from '../../../commands/focusElement';
|
|
import { WindowCommandDependencies } from '../utils/types';
|
|
|
|
export const declaration: CommandDeclaration = {
|
|
name: 'focusElementNoteViewer',
|
|
label: () => _('Note viewer'),
|
|
parentLabel: () => _('Focus'),
|
|
};
|
|
|
|
export const runtime = (dependencies: WindowCommandDependencies): CommandRuntime => {
|
|
return {
|
|
execute: async (_context: unknown, options?: FocusElementOptions) => {
|
|
await dependencies.editorRef.current.execCommand({
|
|
name: 'viewer.focus',
|
|
value: options,
|
|
});
|
|
},
|
|
enabledCondition: 'markdownEditorVisible',
|
|
};
|
|
};
|