diff --git a/main.js b/main.js index 205cad04..03b94db7 100644 --- a/main.js +++ b/main.js @@ -4871,6 +4871,8 @@ function getOppFields(userHiers, field) { if (field.endsWith(">")) return field.slice(0, -4); const { fieldHier, fieldDir } = getFieldInfo(userHiers, field); + if (!fieldHier || !fieldDir) + return undefined; const oppDir = getOppDir(fieldDir); return fieldHier[oppDir]; } @@ -25173,16 +25175,9 @@ async function drawTrail(plugin) { db.end2G(); return; } - let view; - let livePreview = false; - if (mode === "preview") { - view = activeMDView.previewMode.containerEl.querySelector("div.markdown-preview-view"); - } - else { - view = activeMDView.contentEl.querySelector("div.markdown-source-view"); - if (view.hasClass("is-live-preview")) - livePreview = true; - } + const view = mode === "preview" + ? activeMDView.previewMode.containerEl.querySelector("div.markdown-preview-view") + : activeMDView.contentEl.querySelector("div.markdown-source-view"); (_c = activeMDView.containerEl .querySelectorAll(".BC-trail")) === null || _c === void 0 ? void 0 : _c.forEach((trail) => trail.remove()); const closedUp = getLimitedTrailSub(plugin); diff --git a/src/Views/TrailView.ts b/src/Views/TrailView.ts index 041648e4..e6c8256f 100644 --- a/src/Views/TrailView.ts +++ b/src/Views/TrailView.ts @@ -42,6 +42,13 @@ function getLimitedTrailSub(plugin: BCPlugin) { return getSubInDirs(closed, "up"); } +function getGraphForTrail(plugin: BCPlugin) { + const { closedG } = plugin; + const { userHiers, limitTrailCheckboxes } = plugin.settings; + + closedG; +} + function getBreadcrumbs( settings: BCSettings, g: MultiGraph, @@ -140,16 +147,12 @@ export async function drawTrail(plugin: BCPlugin): Promise { return; } - let view: HTMLElement; - let livePreview: boolean = false; - if (mode === "preview") { - view = activeMDView.previewMode.containerEl.querySelector( - "div.markdown-preview-view" - ); - } else { - view = activeMDView.contentEl.querySelector("div.markdown-source-view"); - if (view.hasClass("is-live-preview")) livePreview = true; - } + const view = + mode === "preview" + ? activeMDView.previewMode.containerEl.querySelector( + "div.markdown-preview-view" + ) + : activeMDView.contentEl.querySelector("div.markdown-source-view"); activeMDView.containerEl .querySelectorAll(".BC-trail") diff --git a/src/graphUtils.ts b/src/graphUtils.ts index 9e9b7083..ec6a08f4 100644 --- a/src/graphUtils.ts +++ b/src/graphUtils.ts @@ -186,6 +186,7 @@ export function getOppFields(userHiers: UserHier[], field: string) { // If the field ends with `>`, it is already the opposite field we need (coming from getOppFallback`) if (field.endsWith(">")) return field.slice(0, -4); const { fieldHier, fieldDir } = getFieldInfo(userHiers, field); + if (!fieldHier || !fieldDir) return undefined; const oppDir = getOppDir(fieldDir); return fieldHier[oppDir]; }