1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Desktop: Resolves #4727: Add support for safe mode, which temporarily disables note rendering and plugins

This commit is contained in:
Laurent Cozic
2021-04-24 20:23:33 +02:00
parent 920f54f5d3
commit 3235f58f5a
13 changed files with 111 additions and 15 deletions

View File

@@ -0,0 +1,20 @@
import { _ } from '@joplin/lib/locale';
import Setting from '@joplin/lib/models/Setting';
import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/services/CommandService';
import bridge from '../services/bridge';
export const declaration: CommandDeclaration = {
name: 'toggleSafeMode',
label: () => _('Toggle safe mode'),
};
export const runtime = (): CommandRuntime => {
return {
execute: async (_context: CommandContext, enabled: boolean = null) => {
enabled = enabled !== null ? enabled : !Setting.value('isSafeMode');
Setting.setValue('isSafeMode', enabled);
await Setting.saveAll();
bridge().restart();
},
};
};