Vanessa 2024-04-08 12:15:34 +08:00
parent 2b273974b4
commit 5fcd59146e

View file

@ -551,6 +551,13 @@ export class Graph extends Model {
clearTimeout(this.timeout);
addScript(`${Constants.PROTYLE_CDN}/js/vis/vis-network.min.js?v=9.1.2`, "protyleVisScript").then(() => {
this.timeout = window.setTimeout(() => {
if (!this.graphData || !this.graphData.nodes || this.graphData.nodes.length === 0) {
if (this.network) {
this.network.destroy();
}
this.graphElement.firstElementChild.classList.add("fn__none");
return;
}
this.graphElement.firstElementChild.classList.remove("fn__none");
this.graphElement.firstElementChild.firstElementChild.setAttribute("style", "width:3%");
const config = window.siyuan.config.graph[this.type === "global" ? "global" : "local"];