1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-06 23:56:13 +02:00

Desktop: Make "toggle all folders" button also expand the folder list (#11917)

This commit is contained in:
Henry Heino
2025-03-04 03:58:31 -08:00
committed by GitHub
parent b831d8c068
commit 1924dd31d2
4 changed files with 43 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import { CommandRuntime, CommandDeclaration, CommandContext } from '../services/CommandService';
import { _ } from '../locale';
import getCanBeCollapsedFolderIds from '../models/utils/getCanBeCollapsedFolderIds';
import Setting from '../models/Setting';
export const declaration: CommandDeclaration = {
name: 'toggleAllFolders',
@ -10,6 +11,10 @@ export const declaration: CommandDeclaration = {
export const runtime = (): CommandRuntime => {
return {
execute: async (context: CommandContext, collapseAll: boolean) => {
if (!collapseAll && !Setting.value('folderHeaderIsExpanded')) {
Setting.setValue('folderHeaderIsExpanded', true);
}
context.dispatch({
type: 'FOLDER_SET_COLLAPSED',
ids: collapseAll ? getCanBeCollapsedFolderIds(context.state.folders) : [],