mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add node delete button to edit dialog
This commit is contained in:
parent
0ca3cdb9ae
commit
5cdafc50fb
@ -525,6 +525,33 @@ RED.editor = (function() {
|
|||||||
var trayOptions = {
|
var trayOptions = {
|
||||||
title: getEditStackTitle(),
|
title: getEditStackTitle(),
|
||||||
buttons: [
|
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",
|
id: "node-dialog-cancel",
|
||||||
text: RED._("common.label.cancel"),
|
text: RED._("common.label.cancel"),
|
||||||
|
Loading…
Reference in New Issue
Block a user