diff --git a/package.json b/package.json index 634d4cf2..d2ebd317 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@rollup/plugin-node-resolve": "^11.2.1", "@rollup/plugin-typescript": "^8.2.1", "@types/graphlib": "^2.1.7", + "@types/lodash": "^4.14.171", "@types/node": "^14.14.37", "@typescript-eslint/eslint-plugin": "^4.27.0", "@typescript-eslint/parser": "^4.27.0", diff --git a/src/MatrixView.ts b/src/MatrixView.ts index 940d9089..5c9faed6 100644 --- a/src/MatrixView.ts +++ b/src/MatrixView.ts @@ -1,4 +1,5 @@ import type { Graph } from "graphlib"; +import { cloneDeep } from "lodash"; import { ItemView, TFile, WorkspaceLeaf } from "obsidian"; import { closeImpliedLinks, copyToClipboard, debug } from "src/sharedFunctions"; import { @@ -132,7 +133,8 @@ export default class MatrixView extends ItemView { currFile: string, settings: BreadcrumbsSettings ): string { - const reversed = allPaths.map((path) => path.reverse()); + const copy = cloneDeep(allPaths); + const reversed = copy.map((path) => path.reverse()); reversed.forEach((path) => path.shift()); let txt = currFile + "\n"; @@ -194,7 +196,9 @@ export default class MatrixView extends ItemView { text: "Create Index ⚠️", }); createIndexButton.addEventListener("click", () => { - copyToClipboard(this.createIndex(allPaths, currFile.basename, settings)); + const index = this.createIndex(allPaths, currFile.basename, settings); + debug(settings, { index }); + copyToClipboard(index); }); const [parentFieldName, siblingFieldName, childFieldName] = [