diff --git a/src/constants.ts b/src/constants.ts index a05c5eb5..0eff183f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,6 +1,7 @@ export const VIEW_TYPE_BREADCRUMBS_MATRIX = "breadcrumbs-matrix"; export const TRAIL_ICON = "breadcrumbs-trail-icon"; +export const TRAIL_ICON_SVG = '' export const splitLinksRegex = new RegExp(/\[\[(.+?)\]\]/g); export const dropHeaderOrAlias = new RegExp(/\[\[([^#|]+)\]\]/); diff --git a/src/main.ts b/src/main.ts index df4c4ff1..f89fc2f7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,6 +6,7 @@ import { BreadcrumbsSettingTab } from "src/BreadcrumbsSettingTab"; import { DATAVIEW_INDEX_DELAY, TRAIL_ICON, + TRAIL_ICON_SVG, VIEW_TYPE_BREADCRUMBS_MATRIX } from "src/constants"; import type { @@ -96,10 +97,7 @@ export default class BreadcrumbsPlugin extends Plugin { }, DATAVIEW_INDEX_DELAY); }); - addIcon( - TRAIL_ICON, - '' - ); + addIcon(TRAIL_ICON, TRAIL_ICON_SVG); this.addCommand({ id: "show-breadcrumbs-matrix-view", @@ -126,7 +124,6 @@ export default class BreadcrumbsPlugin extends Plugin { neighbours: neighbourObj, relationship: string ): void { - // NOTE I removed an if(neighbours[relationship]) check here g.setNode(currFileName, currFileName); neighbours[relationship].forEach((node) => g.setEdge(currFileName, node, relationship) @@ -265,56 +262,59 @@ export default class BreadcrumbsPlugin extends Plugin { } async drawTrail(): Promise { - if (this.settings.showTrail) { + if (!this.settings.showTrail) { return } - const { gParents, gChildren } = this.currGraphs; - const closedParents = closeImpliedLinks(gParents, gChildren) - const sortedTrails = this.getBreadcrumbs(closedParents); - const currFile = this.app.workspace.getActiveFile(); - const settings = this.settings + const currFile = this.app.workspace.getActiveFile(); + const frontm = this.app.metadataCache.getFileCache(currFile)?.frontmatter ?? {}; + if (frontm['kanban-plugin']) { return } - // Get the container div of the active note - const previewView = document.querySelector( - "div.mod-active div.view-content div.markdown-preview-view" - ); - previewView.querySelector('div.breadcrumbs-trail')?.remove() + const { gParents, gChildren } = this.currGraphs; + const closedParents = closeImpliedLinks(gParents, gChildren) + const sortedTrails = this.getBreadcrumbs(closedParents); + const settings = this.settings - const trailDiv = createDiv() - previewView.prepend(trailDiv) + // Get the container div of the active note + const previewView = document.querySelector( + "div.mod-active div.view-content div.markdown-preview-view" + ); + previewView.querySelector('div.breadcrumbs-trail')?.remove() - this.visited.push([currFile.path, trailDiv]) + const trailDiv = createDiv() + previewView.prepend(trailDiv) - trailDiv.className = `breadcrumbs-trail is-readable-line-width${settings.respectReadableLineLength - ? " markdown-preview-sizer markdown-preview-section" - : "" - }` + this.visited.push([currFile.path, trailDiv]) - previewView.prepend(trailDiv); + trailDiv.className = `breadcrumbs-trail is-readable-line-width${settings.respectReadableLineLength + ? " markdown-preview-sizer markdown-preview-section" + : "" + }` - trailDiv.empty(); + previewView.prepend(trailDiv); + trailDiv.empty(); - if (settings.trailOrTable === 1) { - new TrailPath({ - target: trailDiv, - props: { sortedTrails, app: this.app, settings, currFile } - }) - } else if (settings.trailOrTable === 2) { - new TrailGrid({ - target: trailDiv, - props: { sortedTrails, app: this.app, plugin: this } - }) - } else { - new TrailPath({ - target: trailDiv, - props: { sortedTrails, app: this.app, settings, currFile } - }); - new TrailGrid({ - target: trailDiv, - props: { sortedTrails, app: this.app, plugin: this } - }) - } + + if (settings.trailOrTable === 1) { + new TrailPath({ + target: trailDiv, + props: { sortedTrails, app: this.app, settings, currFile } + }) + } else if (settings.trailOrTable === 2) { + new TrailGrid({ + target: trailDiv, + props: { sortedTrails, app: this.app, plugin: this } + }) + } else { + new TrailPath({ + target: trailDiv, + props: { sortedTrails, app: this.app, settings, currFile } + }); + new TrailGrid({ + target: trailDiv, + props: { sortedTrails, app: this.app, plugin: this } + }) } + }