Skip to content

Commit

Permalink
Fix the remove node button. Before this fix the remove node only remo…
Browse files Browse the repository at this point in the history
…ved the node visually but not in the data. See #68572
  • Loading branch information
novaxpro committed May 25, 2023
1 parent 96fe301 commit a5ad061
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/webfrontend/SequencePluginPool.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ class ez5.SequencePluginPool extends ez5.PoolPlugin
ui: "tag.form.remove.button"
group: "plus-minus"
onClick: =>
@tree.getSelectedNode()?.remove(false, false)
CUI.Events.trigger
type: "data-changed"
node: @tree
@removeSequenceNode()
]

@tree.render()
Expand All @@ -73,6 +70,21 @@ class ez5.SequencePluginPool extends ez5.PoolPlugin
type: "data-changed"
node: @tree

removeSequenceNode: ->
selectedNode = @tree.getSelectedNode()
if not selectedNode
return

selectedNode.remove(false, false)
updatedData = []
for node in @tree.nodes
updatedData.push(node.getData())
@data = updatedData

CUI.Events.trigger
type: "data-changed"
node: @tree

getSaveData: (save_data) ->
if not @__canSave()
throw new InvalidSaveDataException()
Expand Down

0 comments on commit a5ad061

Please sign in to comment.