Skip to content

Commit

Permalink
fix: Restore 'collapsed' state of Status setting sections
Browse files Browse the repository at this point in the history
There has been an un-reported bug for a long time, that the open/closed
state of the collapse buttons on the Core Status and Custom Status
sections of the Tasks Settings were not restored when the settings
were re-opened, either in the same session, or when restarting Obsidian.
  • Loading branch information
claremacrae committed Oct 10, 2024
1 parent ab669d1 commit 508c5f9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Config/SettingsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ export class SettingsTab extends PluginSettingTab {
const { headingOpened } = getSettings();

settingsJson.forEach((heading) => {
this.addOneSettingsBlock(containerEl, heading, headingOpened);
const initiallyOpen = headingOpened[heading.text] ?? true;
const detailsContainer = this.addOneSettingsBlock(containerEl, heading, headingOpened);
detailsContainer.open = initiallyOpen;
});

// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -379,7 +381,11 @@ export class SettingsTab extends PluginSettingTab {
});
}

private addOneSettingsBlock(containerEl: HTMLElement, heading: any, headingOpened: HeadingState) {
private addOneSettingsBlock(
containerEl: HTMLElement,
heading: any,
headingOpened: HeadingState,
): HTMLDetailsElement {
const detailsContainer = containerEl.createEl('details', {
cls: 'tasks-nested-settings',
attr: {
Expand Down Expand Up @@ -488,6 +494,8 @@ export class SettingsTab extends PluginSettingTab {
}
}
});

return detailsContainer;
}

private static parseCommaSeparatedFolders(input: string): string[] {
Expand Down

0 comments on commit 508c5f9

Please sign in to comment.