Skip to content

Commit 8a31488

Browse files
Undo changes from last commit where attributes get deleted
1 parent 833e5b9 commit 8a31488

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "advanced-canvas",
33
"name": "Advanced Canvas",
4-
"version": "3.0.5",
4+
"version": "3.0.6",
55
"minAppVersion": "1.1.0",
66
"description": "Supercharge your canvas experience! Create presentations, flowcharts and more!",
77
"author": "Developer-Mike",

src/canvas-extensions/advanced-styles/edge-styles.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,12 @@ export default class EdgeStylesExtension extends CanvasExtension {
8585
for (const edge of selectedEdges) {
8686
const edgeData = edge.getData()
8787

88-
const newStyleAttributes = { ...edgeData.styleAttributes }
89-
if (value !== null) newStyleAttributes[attribute.datasetKey] = value
90-
else delete newStyleAttributes[attribute.datasetKey]
91-
9288
edge.setData({
9389
...edgeData,
94-
styleAttributes: newStyleAttributes
90+
styleAttributes: {
91+
...edgeData.styleAttributes,
92+
[attribute.datasetKey]: value
93+
}
9594
})
9695
}
9796

src/canvas-extensions/advanced-styles/node-styles.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@ export default class NodeStylesExtension extends CanvasExtension {
4747
// Only apply the attribute if the node type is allowed
4848
if (attribute.nodeTypes && !attribute.nodeTypes.includes(nodeData.type)) continue
4949

50-
const newStyleAttributes = { ...nodeData.styleAttributes }
51-
if (value !== null) newStyleAttributes[attribute.datasetKey] = value
52-
else delete newStyleAttributes[attribute.datasetKey]
53-
5450
node.setData({
5551
...nodeData,
56-
styleAttributes: newStyleAttributes
52+
styleAttributes: {
53+
...nodeData.styleAttributes,
54+
[attribute.datasetKey]: value
55+
}
5756
})
5857
}
5958

0 commit comments

Comments
 (0)