mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Merge pull request #185 from xorvoid/folder-overview-collapse
Added feature to always collapse elements in the folder overview expl…
This commit is contained in:
commit
ba4069fe7d
3 changed files with 17 additions and 2 deletions
|
|
@ -70,7 +70,9 @@ export class FileExplorerOverview {
|
|||
newFolderElement.querySelectorAll('div.nav-folder-title').forEach((el) => {
|
||||
const folder = plugin.app.vault.getAbstractFileByPath(el.getAttribute('data-path') || '');
|
||||
if (!(folder instanceof TFolder)) return;
|
||||
if (yaml.storeFolderCondition) {
|
||||
if (yaml.alwaysCollapse) {
|
||||
folder.collapsed = true;
|
||||
} else if (yaml.storeFolderCondition) {
|
||||
if (folder.collapsed) {
|
||||
el.classList.add('is-collapsed');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ export type yamlSettings = {
|
|||
storeFolderCondition: boolean;
|
||||
showFolderNotes: boolean;
|
||||
disableCollapseIcon: boolean;
|
||||
alwaysCollapse: boolean;
|
||||
};
|
||||
|
||||
export class FolderOverview {
|
||||
|
|
@ -74,6 +75,7 @@ export class FolderOverview {
|
|||
storeFolderCondition: yaml?.storeFolderCondition === undefined || yaml?.storeFolderCondition === null ? plugin.settings.defaultOverview.storeFolderCondition : yaml?.storeFolderCondition,
|
||||
showFolderNotes: yaml?.showFolderNotes === undefined || yaml?.showFolderNotes === null ? plugin.settings.defaultOverview.showFolderNotes : yaml?.showFolderNotes,
|
||||
disableCollapseIcon: yaml?.disableCollapseIcon === undefined || yaml?.disableCollapseIcon === null ? plugin.settings.defaultOverview.disableCollapseIcon : yaml?.disableCollapseIcon,
|
||||
alwaysCollapse: yaml?.alwaysCollapse || plugin.settings.defaultOverview.alwaysCollapse,
|
||||
}
|
||||
|
||||
const customChild = new CustomMarkdownRenderChild(el, this);
|
||||
|
|
|
|||
|
|
@ -244,6 +244,17 @@ export async function renderFolderOverview(settingsTab: SettingsTab) {
|
|||
plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Collapse all in the tree by default')
|
||||
.setDesc('Collapse every folder in the file explorer in the overview by default')
|
||||
.addToggle((toggle) => {
|
||||
toggle
|
||||
.setValue(overviewSettings.alwaysCollapse)
|
||||
.onChange(async (value) => {
|
||||
overviewSettings.alwaysCollapse = value;
|
||||
plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue