You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Desktop: Add a button to collapse or expand all folders (#11905)
This commit is contained in:
19
packages/lib/commands/toggleAllFolders.ts
Normal file
19
packages/lib/commands/toggleAllFolders.ts
Normal file
@ -0,0 +1,19 @@
|
||||
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) : [],
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user