mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Option to disable the sidebar on desktop
Added a setting to also disable the sidebar from automatically opening when you click on a folder name in the path on desktop
This commit is contained in:
parent
65503affd0
commit
c72697b81b
3 changed files with 24 additions and 6 deletions
|
|
@ -28,9 +28,9 @@ export async function handleViewHeaderClick(event: MouseEvent, plugin: FolderNot
|
|||
await openFolderNote(plugin, folderNote, event).then(async () => {
|
||||
// @ts-ignore
|
||||
const fileExplorerPlugin = plugin.app.internalPlugins.getEnabledPluginById('file-explorer');
|
||||
if (fileExplorerPlugin && Platform.isMobile && plugin.settings.openSidebarWhenClickingOnPath) {
|
||||
if (fileExplorerPlugin && Platform.isMobile && plugin.settings.openSidebar.mobile) {
|
||||
setTimeout(() => { fileExplorerPlugin.revealInFolder(folderNote); }, 200);
|
||||
} else if (fileExplorerPlugin) {
|
||||
} else if (fileExplorerPlugin && Platform.isDesktop && plugin.settings.openSidebar.desktop) {
|
||||
fileExplorerPlugin.revealInFolder(folderNote);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,9 +20,21 @@ export async function renderPath(settingsTab: SettingsTab) {
|
|||
.setDesc('Open the sidebar when opening a folder note through the path on mobile')
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(settingsTab.plugin.settings.openSidebarWhenClickingOnPath)
|
||||
.setValue(settingsTab.plugin.settings.openSidebar.mobile)
|
||||
.onChange(async (value) => {
|
||||
settingsTab.plugin.settings.openSidebarWhenClickingOnPath = value;
|
||||
settingsTab.plugin.settings.openSidebar.mobile = value;
|
||||
await settingsTab.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Open sidebar when opening a folder note through path (Desktop only)')
|
||||
.setDesc('Open the sidebar when opening a folder note through the path on desktop')
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(settingsTab.plugin.settings.openSidebar.desktop)
|
||||
.onChange(async (value) => {
|
||||
settingsTab.plugin.settings.openSidebar.desktop = value;
|
||||
await settingsTab.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,10 @@ export interface FolderNotesSettings {
|
|||
hideCollapsingIcon: boolean;
|
||||
ignoreAttachmentFolder: boolean;
|
||||
tabManagerEnabled: boolean;
|
||||
openSidebarWhenClickingOnPath: boolean;
|
||||
openSidebar: {
|
||||
mobile: boolean;
|
||||
desktop: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: FolderNotesSettings = {
|
||||
|
|
@ -150,7 +153,10 @@ export const DEFAULT_SETTINGS: FolderNotesSettings = {
|
|||
hideCollapsingIcon: false,
|
||||
tabManagerEnabled: true,
|
||||
ignoreAttachmentFolder: true,
|
||||
openSidebarWhenClickingOnPath: false,
|
||||
openSidebar: {
|
||||
mobile: false,
|
||||
desktop: true,
|
||||
}
|
||||
};
|
||||
|
||||
export class SettingsTab extends PluginSettingTab {
|
||||
|
|
|
|||
Loading…
Reference in a new issue