You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-06 23:56:13 +02:00
20 lines
616 B
TypeScript
20 lines
616 B
TypeScript
import { CommandRuntime, CommandDeclaration, CommandContext } from '../services/CommandService';
|
|
import { _ } from '../locale';
|
|
import getCanBeCollapsedFolderIds from '../models/utils/getCanBeCollapsedFolderIds';
|
|
|
|
export const declaration: CommandDeclaration = {
|
|
name: 'toggleAllFolders',
|
|
label: () => _('Toggle all notebooks'),
|
|
};
|
|
|
|
export const runtime = (): CommandRuntime => {
|
|
return {
|
|
execute: async (context: CommandContext, collapseAll: boolean) => {
|
|
context.dispatch({
|
|
type: 'FOLDER_SET_COLLAPSED',
|
|
ids: collapseAll ? getCanBeCollapsedFolderIds(context.state.folders) : [],
|
|
});
|
|
},
|
|
};
|
|
};
|