From 5cdafc50fb73b8363e96ce0493ccbf03fd3f7211 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 4 Nov 2016 14:29:04 +0000 Subject: [PATCH] Add node delete button to edit dialog --- editor/js/ui/editor.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/editor/js/ui/editor.js b/editor/js/ui/editor.js index ea2e97dd4..111200de5 100644 --- a/editor/js/ui/editor.js +++ b/editor/js/ui/editor.js @@ -525,6 +525,33 @@ RED.editor = (function() { var trayOptions = { title: getEditStackTitle(), buttons: [ + { + id: "node-dialog-delete", + class: 'leftButton', + text: RED._("common.label.delete"), + click: function() { + var startDirty = RED.nodes.dirty(); + var removedNodes = []; + var removedLinks = []; + var removedEntities = RED.nodes.remove(editing_node.id); + removedNodes.push(editing_node); + removedNodes = removedNodes.concat(removedEntities.nodes); + removedLinks = removedLinks.concat(removedEntities.links); + + var historyEvent = { + t:'delete', + nodes:removedNodes, + links:removedLinks, + changes: {}, + dirty: startDirty + } + + RED.nodes.dirty(true); + RED.view.redraw(true); + RED.history.push(historyEvent); + RED.tray.close(); + } + }, { id: "node-dialog-cancel", text: RED._("common.label.cancel"),