mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-08 13:06:15 +02:00
19 lines
663 B
TypeScript
19 lines
663 B
TypeScript
import { CommandContext, CommandDeclaration, CommandRuntime } from '@joplin/lib/services/CommandService';
|
|
import { CommandRuntimeProps } from '../types';
|
|
|
|
export const declaration: CommandDeclaration = {
|
|
// For compatibility with the desktop app, this command is called "toggleVisiblePanes".
|
|
name: 'toggleVisiblePanes',
|
|
label: () => 'Start/stop editing',
|
|
};
|
|
|
|
export const runtime = (props: CommandRuntimeProps): CommandRuntime => {
|
|
return {
|
|
execute: async (_context: CommandContext) => {
|
|
// For now, the only two "panes" on mobile are view and edit.
|
|
const newMode = props.getMode() === 'edit' ? 'view' : 'edit';
|
|
props.setMode(newMode);
|
|
},
|
|
};
|
|
};
|