mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 19:22:31 +08:00
refactor(deps): integrate force-graph into webpack
This commit is contained in:
parent
8d026c8134
commit
e7eb385b8f
@ -76,7 +76,6 @@ const copy = async () => {
|
|||||||
"node_modules/@excalidraw/excalidraw/dist/",
|
"node_modules/@excalidraw/excalidraw/dist/",
|
||||||
"node_modules/katex/dist/",
|
"node_modules/katex/dist/",
|
||||||
"node_modules/dayjs/",
|
"node_modules/dayjs/",
|
||||||
"node_modules/force-graph/dist/",
|
|
||||||
"node_modules/boxicons/css/",
|
"node_modules/boxicons/css/",
|
||||||
"node_modules/boxicons/fonts/",
|
"node_modules/boxicons/fonts/",
|
||||||
"node_modules/mermaid/dist/",
|
"node_modules/mermaid/dist/",
|
||||||
|
@ -68,10 +68,6 @@ const WHEEL_ZOOM: Library = {
|
|||||||
js: ["node_modules/vanilla-js-wheel-zoom/dist/wheel-zoom.min.js"]
|
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 = {
|
const MERMAID: Library = {
|
||||||
js: ["node_modules/mermaid/dist/mermaid.min.js"]
|
js: ["node_modules/mermaid/dist/mermaid.min.js"]
|
||||||
};
|
};
|
||||||
@ -201,7 +197,6 @@ export default {
|
|||||||
CALENDAR_WIDGET,
|
CALENDAR_WIDGET,
|
||||||
KATEX,
|
KATEX,
|
||||||
WHEEL_ZOOM,
|
WHEEL_ZOOM,
|
||||||
FORCE_GRAPH,
|
|
||||||
MERMAID,
|
MERMAID,
|
||||||
EXCALIDRAW,
|
EXCALIDRAW,
|
||||||
MARKJS,
|
MARKJS,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import libraryLoader from "../services/library_loader.js";
|
|
||||||
import server from "../services/server.js";
|
import server from "../services/server.js";
|
||||||
import attributeService from "../services/attributes.js";
|
import attributeService from "../services/attributes.js";
|
||||||
import hoistedNoteService from "../services/hoisted_note.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";
|
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 itself
|
//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 itself
|
||||||
|
|
||||||
let hoverNode = null;
|
let hoverNode = null;
|
||||||
const highlightLinks = new Set();
|
const highlightLinks = new Set();
|
||||||
const neighbours = new Set();
|
const neighbours = new Set();
|
||||||
|
|
||||||
|
const ForceGraph = (await import("force-graph")).default;
|
||||||
this.graph = ForceGraph()(this.$container[0])
|
this.graph = ForceGraph()(this.$container[0])
|
||||||
.width(this.$container.width())
|
.width(this.$container.width())
|
||||||
.height(this.$container.height())
|
.height(this.$container.height())
|
||||||
|
@ -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/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/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/css/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/boxicons/css/")));
|
||||||
app.use(`/${assetPath}/node_modules/boxicons/fonts/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/boxicons/fonts/")));
|
app.use(`/${assetPath}/node_modules/boxicons/fonts/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/boxicons/fonts/")));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user