Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(deps): integrate force-graph into webpack
Elian Dorane7eb385b8f1a
diff --git a/bin/copy-dist.ts b/bin/copy-dist.tsindex fc2e3b2ff4..39ddd6cdf6 100644--- a/bin/copy-dist.ts+++ b/bin/copy-dist.ts@@ -76,7 +76,6 @@ const copy = async () => {"node_modules/@excalidraw/excalidraw/dist/","node_modules/katex/dist/","node_modules/dayjs/",- "node_modules/force-graph/dist/","node_modules/boxicons/css/","node_modules/boxicons/fonts/","node_modules/mermaid/dist/",diff --git a/src/public/app/services/library_loader.ts b/src/public/app/services/library_loader.tsindex d94e6bed72..2fa6b950e5 100644--- a/src/public/app/services/library_loader.ts+++ b/src/public/app/services/library_loader.ts@@ -68,10 +68,6 @@ const WHEEL_ZOOM: Library = {js: ["node_modules/vanilla-js-wheel-zoom/dist/wheel-zoom.min.js"]};-const FORCE_GRAPH: Library = {- js: ["node_modules/force-graph/dist/force-graph.min.js"]-};-const MERMAID: Library = {js: ["node_modules/mermaid/dist/mermaid.min.js"]};@@ -201,7 +197,6 @@ export default {CALENDAR_WIDGET,KATEX,WHEEL_ZOOM,- FORCE_GRAPH,MERMAID,EXCALIDRAW,MARKJS,diff --git a/src/public/app/widgets/note_map.js b/src/public/app/widgets/note_map.jsindex 6e91ff2ed6..cde0d07ee7 100644--- a/src/public/app/widgets/note_map.js+++ b/src/public/app/widgets/note_map.js@@ -1,4 +1,3 @@-import libraryLoader from "../services/library_loader.js";import server from "../services/server.js";import attributeService from "../services/attributes.js";import hoistedNoteService from "../services/hoisted_note.js";@@ -149,14 +148,13 @@ export default class NoteMapWidget extends NoteContextAwareWidget {this.mapType = this.note.getLabelValue("mapType") === "tree" ? "tree" : "link";- await libraryLoader.requireLibrary(libraryLoader.FORCE_GRAPH);-//variables for the hover effekt. We have to save the neighbours of a hovered node in a set. Also we need to save the links as well as the hovered node itselflet hoverNode = null;const highlightLinks = new Set();const neighbours = new Set();+ const ForceGraph = (await import("force-graph")).default;this.graph = ForceGraph()(this.$container[0]).width(this.$container.width()).height(this.$container.height())diff --git a/src/routes/assets.ts b/src/routes/assets.tsindex 6cf0202a02..ff31da4325 100644--- a/src/routes/assets.ts+++ b/src/routes/assets.ts@@ -63,7 +63,6 @@ async function register(app: express.Application) {app.use(`/${assetPath}/node_modules/katex/dist/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/katex/dist/")));app.use(`/${assetPath}/node_modules/dayjs/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/dayjs/")));- app.use(`/${assetPath}/node_modules/force-graph/dist/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/force-graph/dist/")));app.use(`/${assetPath}/node_modules/boxicons/css/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/boxicons/css/")));app.use(`/${assetPath}/node_modules/boxicons/fonts/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/boxicons/fonts/")));