mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Ensure exclusive conf node is removed on edit cancel
- If an exclusive conf node was added to a node, but the node's own edit dialog was canceled, the conf node remained but not associated with the node - effectively orphaning it
This commit is contained in:
parent
08d687ad60
commit
6b03379e4e
@ -303,6 +303,28 @@ RED.editor = (function() {
|
|||||||
if (editing_node._def.oneditcancel) {
|
if (editing_node._def.oneditcancel) {
|
||||||
editing_node._def.oneditcancel.call(editing_node);
|
editing_node._def.oneditcancel.call(editing_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (var d in editing_node._def.defaults) {
|
||||||
|
if (editing_node._def.defaults.hasOwnProperty(d)) {
|
||||||
|
var def = editing_node._def.defaults[d];
|
||||||
|
if (def.type) {
|
||||||
|
var configTypeDef = RED.nodes.getType(def.type);
|
||||||
|
if (configTypeDef && configTypeDef.exclusive) {
|
||||||
|
var input = $("#node-input-"+d).val()||"";
|
||||||
|
if (input !== "" && !editing_node[d]) {
|
||||||
|
// This node has an exclusive config node that
|
||||||
|
// has just been added. As the user is cancelling
|
||||||
|
// the edit, need to delete the just-added config
|
||||||
|
// node so that it doesn't get orphaned.
|
||||||
|
RED.nodes.remove(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
$( this ).dialog( "close" );
|
$( this ).dialog( "close" );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user