2023-02-17 10:07:18 -03:00
|
|
|
import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/services/CommandService';
|
|
|
|
|
import { _ } from '@joplin/lib/locale';
|
2025-01-27 08:18:37 -08:00
|
|
|
import shim from '@joplin/lib/shim';
|
2023-02-17 10:07:18 -03:00
|
|
|
|
|
|
|
|
export const declaration: CommandDeclaration = {
|
|
|
|
|
name: 'resetLayout',
|
|
|
|
|
label: () => _('Reset application layout'),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const runtime = (): CommandRuntime => {
|
|
|
|
|
return {
|
|
|
|
|
execute: async (context: CommandContext) => {
|
|
|
|
|
|
|
|
|
|
const message = _('Are you sure you want to return to the default layout? The current layout configuration will be lost.');
|
2025-01-27 08:18:37 -08:00
|
|
|
const isConfirmed = await shim.showConfirmationDialog(message);
|
2023-02-17 10:07:18 -03:00
|
|
|
|
|
|
|
|
if (!isConfirmed) return;
|
|
|
|
|
|
|
|
|
|
context.dispatch({
|
|
|
|
|
type: 'RESET_LAYOUT',
|
|
|
|
|
value: true,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|