Skip to content

Commit dc8b153

Browse files
committed
Designer: fix graph reset by restoring missing graphModel methods
- Ensure `graphModel.removeEdge` and `removeNode` are redefined after reset
1 parent d1205c2 commit dc8b153

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

resources/KnowledgeGraph.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,17 @@ ${propertyOptions}|show-property-type=true
842842
nodes: Nodes,
843843
edges: Edges,
844844
addNode: function(node) { if (!this.nodes.get(node.id)) this.nodes.add(node); },
845-
addEdge: function(edge) { if (!this.edges.get(edge.id)) this.edges.add(edge); }
845+
addEdge: function(edge) { if (!this.edges.get(edge.id)) this.edges.add(edge); },
846+
removeNode: function(nodeId) {
847+
if (this.nodes.get(nodeId)) {
848+
this.nodes.remove(nodeId);
849+
}
850+
},
851+
removeEdge: function(edgeId) {
852+
if (this.edges.get(edgeId)) {
853+
this.edges.remove(edgeId);
854+
}
855+
}
846856
};
847857

848858
Network = new vis.Network(Container, { nodes: Nodes, edges: Edges }, Config.graphOptions);

0 commit comments

Comments
 (0)