You've already forked joplin
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:
@ -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);
|
||||
},
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user