1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Mobile: Plugin API: Implement the toggleVisiblePanes command (#11496)

This commit is contained in:
Henry Heino
2024-12-13 04:55:37 -08:00
committed by GitHub
parent 154b78f7ce
commit 81f3a02dba
7 changed files with 57 additions and 5 deletions

View File

@ -0,0 +1,18 @@
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);
},
};
};