1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Allow importing an unknown config node to be undone

Fixes #1681
This commit is contained in:
Nick O'Leary 2018-04-16 11:20:03 +01:00
parent a327fd85e2
commit 9f703de5ec
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -1012,6 +1012,13 @@ RED.nodes = (function() {
set: registry.getNodeSet("node-red/unknown") set: registry.getNodeSet("node-red/unknown")
}; };
node.users = []; node.users = [];
// This is a config node, so delete the default
// non-config node properties
delete node.x;
delete node.y;
delete node.wires;
delete node.inputLabels;
delete node.outputLabels;
} }
var orig = {}; var orig = {};
for (var p in n) { for (var p in n) {
@ -1047,7 +1054,9 @@ RED.nodes = (function() {
addNode(node); addNode(node);
RED.editor.validateNode(node); RED.editor.validateNode(node);
node_map[n.id] = node; node_map[n.id] = node;
if (node._def.category != "config") { // If an 'unknown' config node, it will not have been caught by the
// proper config node handling, so needs adding to new_nodes here
if (node.type === "unknown" || node._def.category !== "config") {
new_nodes.push(node); new_nodes.push(node);
} }
} }