diff --git a/manifest.json b/manifest.json index c7ed29d6..1021cfb5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "breadcrumbs", "name": "Breadcrumbs", - "version": "0.4.9", + "version": "0.4.10", "minAppVersion": "0.12.5", "description": "Visualise the hierarchy of your vault using a breadcrumb trail", "author": "SkepticMystic", diff --git a/package.json b/package.json index e2577a86..073191ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "breadcrumbs-plugin", - "version": "0.4.9", + "version": "0.4.10", "description": "Visualise the hierarchy of your vault using a breadcrumb trail", "main": "main.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index 4265e708..86bb15b1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -181,20 +181,28 @@ export default class BreadcrumbsPlugin extends Plugin { } fillTrailDiv(breadcrumbs: string[], currFile: TFile): void { - breadcrumbs.forEach((crumb) => { - const link = this.trailDiv.createEl("a", { - text: crumb, - cls: "internal-link breadcrumbs-link", - }); - link.href = null; - // A link in the trail will never be unresolved, so no need to check - // link.classList.add(...this.resolvedClass(crumb, currFile).split(" ")); - link.addEventListener("click", async () => { - await this.app.workspace.openLinkText(crumb, currFile.path); + // If a path exists + if (!breadcrumbs[0].startsWith("No path to ")) { + breadcrumbs.forEach((crumb) => { + const link = this.trailDiv.createEl("a", { + text: crumb, + cls: "internal-link breadcrumbs-link", + }); + link.href = null; + // A link in the trail will never be unresolved, so no need to check + link.addEventListener("click", async () => { + await this.app.workspace.openLinkText(crumb, currFile.path); + }); + this.trailDiv.createSpan({ + text: ` ${this.settings.trailSeperator} `, + }); }); - this.trailDiv.createSpan({ text: ` ${this.settings.trailSeperator} ` }); - }); - this.trailDiv.removeChild(this.trailDiv.lastChild); + this.trailDiv.removeChild(this.trailDiv.lastChild); + } + // Otherwise don't add any links, just text + else { + this.trailDiv.createSpan({ text: breadcrumbs[0] }); + } } async drawTrail(): Promise { diff --git a/versions.json b/versions.json index 421d0a72..e813079b 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,5 @@ { + "0.4.10": "0.12.7", "0.4.9": "0.12.7", "0.4.8": "0.12.7", "0.4.6": "0.12.5",