From 40b2cebc99405f74d272381d1d3bce01dee34f30 Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Wed, 29 Dec 2021 08:14:04 +0200 Subject: [PATCH] feat(Path View): :sparkles: Show "Index Note" instead of noPathFoundMessage when active note is an indexNote (fix #220) --- src/BreadcrumbsSettingTab.ts | 2 +- src/main.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/BreadcrumbsSettingTab.ts b/src/BreadcrumbsSettingTab.ts index 1b13b606..f1f5830d 100644 --- a/src/BreadcrumbsSettingTab.ts +++ b/src/BreadcrumbsSettingTab.ts @@ -534,7 +534,7 @@ export class BCSettingTab extends PluginSettingTab { new Setting(trailDetails) .setName("Index Note(s)") .setDesc( - "The note that all of your other notes lead back to. The parent of all your parent notes. Just enter the name. So if your index note is `000 Home.md`, enter `000 Home`. You can also have multiple index notes (comma-separated list). The breadcrumb trail will show the shortest path back to any one of the index notes listed. You can now leave this field empty, meaning the trail will show a path going as far up the parent-tree as possible." + "The note that all of your other notes lead back to. The parent of all your parent notes. Just enter the basename. So if your index note is `000 Home.md`, enter `000 Home`. You can also have multiple index notes (comma-separated list). The breadcrumb trail will show the shortest path back to any one of the index notes listed. You can now leave this field empty, meaning the trail will show a path going as far up the parent-tree as possible." ) .addText((text) => { text diff --git a/src/main.ts b/src/main.ts index 6125f815..d6d6e15c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1500,9 +1500,7 @@ export default class BCPlugin extends Plugin { ); } else { view = activeMDView.contentEl.querySelector("div.markdown-source-view"); - if (view.hasClass("is-live-preview")) { - livePreview = true; - } + if (view.hasClass("is-live-preview")) livePreview = true; } activeMDView.containerEl @@ -1579,6 +1577,11 @@ export default class BCPlugin extends Plugin { } trailDiv.empty(); + if (settings.indexNotes.includes(basename)) { + trailDiv.innerText = "Index Note"; + db.end2G(); + return; + } if (noItems) { trailDiv.innerText = noPathMessage;