Skip to content

Commit b032eb8

Browse files
committed
fix: node size calculation
1 parent 8aa515e commit b032eb8

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/features/editor/views/GraphView/lib/jsonParser.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,7 @@ export function parser(jsonStr: string): Graph {
7676
// filter parent nodes that have no children
7777
// not the best way to do this, but it works
7878
const filteredNodes = states.graph.nodes.filter(node => {
79-
if (node.data.isParent && node.data.childrenCount === 0) {
80-
return false;
81-
}
82-
83-
return true;
79+
return !(node.data.isParent && node.data.childrenCount === 0);
8480
});
8581

8682
// add path to nodes

src/features/editor/views/GraphView/lib/utils/calculateNodeSize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const calculateWidthAndHeight = (str: string, single = false) => {
2626

2727
const dummyElement = document.createElement("div");
2828
dummyElement.style.whiteSpace = single ? "nowrap" : "pre-wrap";
29-
dummyElement.innerHTML = str;
29+
dummyElement.innerText = str;
3030
dummyElement.style.fontSize = "12px";
3131
dummyElement.style.width = "fit-content";
3232
dummyElement.style.padding = "0 10px";

0 commit comments

Comments
 (0)