diff --git a/main.js b/main.js index 7eeb1388..a22101ce 100644 --- a/main.js +++ b/main.js @@ -24764,6 +24764,17 @@ class BreadcrumbsSettingTab extends obsidian.PluginSettingTab { await plugin.saveSettings(); await plugin.drawTrail(); })); + const writeBCsToFileDetails = containerEl.createEl("details"); + writeBCsToFileDetails.createEl("summary", { text: "Write Breadcrumbs to File" }); + new obsidian.Setting(writeBCsToFileDetails) + .setName("Show the `Write Breadcrumbs to ALL Files` command") + .setDesc("This command attempts to update ALL files with implied breadcrumbs pointing to them. So, it is not even shown by default (even though it has 3 confirmation boxes to ensure you want to run it") + .addToggle((toggle) => toggle + .setValue(settings.showWriteAllBCsCmd) + .onChange(async (value) => { + settings.showWriteAllBCsCmd = value; + await plugin.saveSettings(); + })); const visModalDetails = containerEl.createEl("details"); visModalDetails.createEl("summary", { text: "Visualisation Modal" }); new obsidian.Setting(visModalDetails) @@ -37102,6 +37113,7 @@ const DEFAULT_SETTINGS = { noPathMessage: `This note has no real or implied parents`, trailSeperator: "→", respectReadableLineLength: true, + showWriteAllBCsCmd: false, visGraph: "Force Directed Graph", visRelation: "Parent", visClosed: "Real", @@ -37411,6 +37423,7 @@ class BreadcrumbsPlugin extends obsidian.Plugin { } } }, + checkCallback: () => this.settings.showWriteAllBCsCmd }); this.addRibbonIcon("dice", "Breadcrumbs Visualisation", () => new VisModal(this.app, this).open()); this.addSettingTab(new BreadcrumbsSettingTab(this.app, this)); diff --git a/src/BreadcrumbsSettingTab.ts b/src/BreadcrumbsSettingTab.ts index abc61185..ec148785 100644 --- a/src/BreadcrumbsSettingTab.ts +++ b/src/BreadcrumbsSettingTab.ts @@ -731,6 +731,23 @@ export class BreadcrumbsSettingTab extends PluginSettingTab { }) ); + const writeBCsToFileDetails: HTMLDetailsElement = containerEl.createEl("details"); + writeBCsToFileDetails.createEl("summary", { text: "Write Breadcrumbs to File" }); + + new Setting(writeBCsToFileDetails) + .setName("Show the `Write Breadcrumbs to ALL Files` command") + .setDesc( + "This command attempts to update ALL files with implied breadcrumbs pointing to them. So, it is not even shown by default (even though it has 3 confirmation boxes to ensure you want to run it" + ) + .addToggle((toggle) => + toggle + .setValue(settings.showWriteAllBCsCmd) + .onChange(async (value) => { + settings.showWriteAllBCsCmd = value; + await plugin.saveSettings(); + }) + ); + const visModalDetails: HTMLDetailsElement = containerEl.createEl("details"); visModalDetails.createEl("summary", { text: "Visualisation Modal" }); diff --git a/src/interfaces.ts b/src/interfaces.ts index 4f9adb0e..802cf6df 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -29,6 +29,7 @@ export interface BreadcrumbsSettings { noPathMessage: string; trailSeperator: string; respectReadableLineLength: boolean; + showWriteAllBCsCmd: boolean; visGraph: visTypes; visRelation: Relations; visClosed: string; diff --git a/src/main.ts b/src/main.ts index 334dd78b..d7bd9b76 100644 --- a/src/main.ts +++ b/src/main.ts @@ -73,6 +73,7 @@ const DEFAULT_SETTINGS: BreadcrumbsSettings = { noPathMessage: `This note has no real or implied parents`, trailSeperator: "→", respectReadableLineLength: true, + showWriteAllBCsCmd: false, visGraph: "Force Directed Graph", visRelation: "Parent", visClosed: "Real", @@ -328,7 +329,6 @@ export default class BreadcrumbsPlugin extends Plugin { name: "Write Breadcrumbs to **ALL** Files", callback: () => { const first = window.confirm("This action will write the implied Breadcrumbs of each file to that file.\nIt uses the MetaEdit plugins API to update the YAML, so it should only affect that frontmatter of your note.\nI can't promise that nothing bad will happen. **This operation cannot be undone**."); - if (first) { const second = window.confirm('Are you sure? You have been warned that this operation will attempt to update all files with implied breadcrumbs.'); if (second) { @@ -347,6 +347,7 @@ export default class BreadcrumbsPlugin extends Plugin { } }, + checkCallback: () => this.settings.showWriteAllBCsCmd }); this.addRibbonIcon("dice", "Breadcrumbs Visualisation", () =>