This commit is contained in:
Vanessa 2023-04-17 15:06:38 +08:00
parent fde48325e1
commit 88543c2587

View file

@ -22,7 +22,7 @@ export class Graph extends Model {
public rootId: string; // "local" 必填
private timeout: number;
public graphData: {
nodes: { box: string, id: string, path: string, type: string, color: string }[],
nodes: { box: string, id: string, path: string, type: string, color: IObject }[],
links: Record<string, unknown>[],
box: string
};
@ -497,45 +497,45 @@ export class Graph extends Model {
this.graphData.nodes.forEach(item => {
switch (item.type) {
case "NodeDocument":
item.color = rootStyle.getPropertyValue("--b3-graph-doc-point").trim()
item.color = {background: rootStyle.getPropertyValue("--b3-graph-doc-point").trim()}
break;
case "NodeParagraph":
item.color = rootStyle.getPropertyValue("--b3-graph-p-point").trim()
item.color = {background: rootStyle.getPropertyValue("--b3-graph-p-point").trim()}
break;
case "NodeHeading":
item.color = rootStyle.getPropertyValue("--b3-graph-heading-point").trim()
item.color = {background: rootStyle.getPropertyValue("--b3-graph-heading-point").trim()}
break;
case "NodeMathBlock":
item.color = rootStyle.getPropertyValue("--b3-graph-math-point").trim()
item.color = {background: rootStyle.getPropertyValue("--b3-graph-math-point").trim()}
break;
case "NodeCodeBlock":
item.color = rootStyle.getPropertyValue("--b3-graph-code-point").trim()
item.color = {background: rootStyle.getPropertyValue("--b3-graph-code-point").trim()}
break;
case "NodeTable":
item.color = rootStyle.getPropertyValue("--b3-graph-table-point").trim()
item.color = {background: rootStyle.getPropertyValue("--b3-graph-table-point").trim()}
break;
case "NodeList":
item.color = rootStyle.getPropertyValue("--b3-graph-list-point").trim()
item.color = {background: rootStyle.getPropertyValue("--b3-graph-list-point").trim()}
break;
case "NodeListItem":
item.color = rootStyle.getPropertyValue("--b3-graph-listitem-point").trim()
item.color = {background: rootStyle.getPropertyValue("--b3-graph-listitem-point").trim()}
break;
case "NodeBlockquote":
item.color = rootStyle.getPropertyValue("--b3-graph-bq-point").trim()
item.color = {background: rootStyle.getPropertyValue("--b3-graph-bq-point").trim()}
break;
case "NodeSuperBlock":
item.color = rootStyle.getPropertyValue("--b3-graph-super-point").trim()
item.color = {background: rootStyle.getPropertyValue("--b3-graph-super-point").trim()}
break;
default:
item.color = rootStyle.getPropertyValue("--b3-graph-p-point").trim()
item.color = {background: rootStyle.getPropertyValue("--b3-graph-p-point").trim()}
break;
}
})
this.graphData.links.forEach(item => {
if (item.ref) {
item.color = rootStyle.getPropertyValue("--b3-graph-ref-line").trim();
item.color = {color: rootStyle.getPropertyValue("--b3-graph-ref-line").trim()};
} else {
item.color = rootStyle.getPropertyValue("--b3-graph-line").trim();
item.color = {color: rootStyle.getPropertyValue("--b3-graph-line").trim()};
}
})
clearTimeout(this.timeout);