diff --git a/main.js b/main.js index e5d6aa1f..6c3d259c 100644 --- a/main.js +++ b/main.js @@ -22461,7 +22461,10 @@ const fallbackOppField = (field, dir) => `${field} <${ARROW_DIRECTIONS[getOppDir function getRealnImplied(plugin, currNode, dir = null) { const realsnImplieds = blankRealNImplied(); const { userHiers } = plugin.settings; - plugin.mainG.forEachEdge(currNode, (k, a, s, t) => { + const { mainG } = plugin; + if (!mainG.hasNode(currNode)) + return realsnImplieds; + mainG.forEachEdge(currNode, (k, a, s, t) => { var _a; const { field, dir: edgeDir } = a; const oppField = (_a = getOppFields(userHiers, field)[0]) !== null && _a !== void 0 ? _a : fallbackOppField(field, edgeDir); @@ -24882,6 +24885,8 @@ class MatrixView extends require$$0.ItemView { const { settings } = this.plugin; const { userHiers } = settings; const currFile = this.app.workspace.getActiveFile(); + if (!currFile) + return; contentEl.createEl("button", { text: this.matrixQ ? "List" : "Matrix", attr: { "aria-label": "Mode" }, @@ -52684,8 +52689,7 @@ class BCPlugin extends require$$0.Plugin { onunload() { console.log("unloading"); this.VIEWS.forEach(async (view) => { - var _a; - await ((_a = this.getActiveTYPEView(view.type)) === null || _a === void 0 ? void 0 : _a.close()); + // await this.getActiveTYPEView(view.type)?.close(); this.app.workspace.detachLeavesOfType(view.type); }); this.visited.forEach((visit) => visit[1].remove()); diff --git a/src/MatrixView.ts b/src/MatrixView.ts index 0b1cf96a..77d137d4 100644 --- a/src/MatrixView.ts +++ b/src/MatrixView.ts @@ -1,5 +1,5 @@ -import { debug, error, info } from "loglevel"; -import { ItemView, Notice, TFile, WorkspaceLeaf } from "obsidian"; +import { error, info } from "loglevel"; +import { ItemView, TFile, WorkspaceLeaf } from "obsidian"; import { Debugger } from "src/Debugger"; import Lists from "./Components/Lists.svelte"; import Matrix from "./Components/Matrix.svelte"; @@ -18,11 +18,7 @@ import type { UserHier, } from "./interfaces"; import type BCPlugin from "./main"; -import { - fallbackOppField, - getRealnImplied, - linkClass, -} from "./sharedFunctions"; +import { getRealnImplied, linkClass } from "./sharedFunctions"; export default class MatrixView extends ItemView { private plugin: BCPlugin; @@ -274,6 +270,7 @@ export default class MatrixView extends ItemView { const { userHiers } = settings; const currFile = this.app.workspace.getActiveFile(); + if (!currFile) return; contentEl.createEl( "button", diff --git a/src/main.ts b/src/main.ts index e834c956..431f0538 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1619,7 +1619,7 @@ export default class BCPlugin extends Plugin { onunload(): void { console.log("unloading"); this.VIEWS.forEach(async (view) => { - await this.getActiveTYPEView(view.type)?.close(); + // await this.getActiveTYPEView(view.type)?.close(); this.app.workspace.detachLeavesOfType(view.type); }); diff --git a/src/sharedFunctions.ts b/src/sharedFunctions.ts index 7067d08a..cb18fe56 100644 --- a/src/sharedFunctions.ts +++ b/src/sharedFunctions.ts @@ -45,7 +45,7 @@ export const dropDendron = (path: string, settings: BCSettings) => export const dropPathNDendron = (path: string, settings: BCSettings) => dropDendron(dropPath(path), settings); - + /** * Get basename from a **Markdown** `path` * @param {string} path @@ -259,8 +259,10 @@ export function getRealnImplied( ): RealNImplied { const realsnImplieds: RealNImplied = blankRealNImplied(); const { userHiers } = plugin.settings; + const { mainG } = plugin; - plugin.mainG.forEachEdge(currNode, (k, a, s, t) => { + if (!mainG.hasNode(currNode)) return realsnImplieds; + mainG.forEachEdge(currNode, (k, a, s, t) => { const { field, dir: edgeDir } = a as { field: string; dir: Directions }; const oppField = getOppFields(userHiers, field)[0] ?? fallbackOppField(field, edgeDir);