Skip to content

Commit

Permalink
Undo changes from last commit where attributes get deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
Developer-Mike committed Jul 10, 2024
1 parent 833e5b9 commit 8a31488
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "advanced-canvas",
"name": "Advanced Canvas",
"version": "3.0.5",
"version": "3.0.6",
"minAppVersion": "1.1.0",
"description": "Supercharge your canvas experience! Create presentations, flowcharts and more!",
"author": "Developer-Mike",
Expand Down
9 changes: 4 additions & 5 deletions src/canvas-extensions/advanced-styles/edge-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,12 @@ export default class EdgeStylesExtension extends CanvasExtension {
for (const edge of selectedEdges) {
const edgeData = edge.getData()

const newStyleAttributes = { ...edgeData.styleAttributes }
if (value !== null) newStyleAttributes[attribute.datasetKey] = value
else delete newStyleAttributes[attribute.datasetKey]

edge.setData({
...edgeData,
styleAttributes: newStyleAttributes
styleAttributes: {
...edgeData.styleAttributes,
[attribute.datasetKey]: value
}
})
}

Expand Down
9 changes: 4 additions & 5 deletions src/canvas-extensions/advanced-styles/node-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ export default class NodeStylesExtension extends CanvasExtension {
// Only apply the attribute if the node type is allowed
if (attribute.nodeTypes && !attribute.nodeTypes.includes(nodeData.type)) continue

const newStyleAttributes = { ...nodeData.styleAttributes }
if (value !== null) newStyleAttributes[attribute.datasetKey] = value
else delete newStyleAttributes[attribute.datasetKey]

node.setData({
...nodeData,
styleAttributes: newStyleAttributes
styleAttributes: {
...nodeData.styleAttributes,
[attribute.datasetKey]: value
}
})
}

Expand Down

0 comments on commit 8a31488

Please sign in to comment.