Skip to content

Commit

Permalink
fix: "Not path to..." was a link
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jun 27, 2021
1 parent afd2c89 commit 3d8e237
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
34 changes: 21 additions & 13 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
Expand Down
1 change: 1 addition & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 3d8e237

Please sign in to comment.