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

Import unknown config node breaks layout

Fixes #211
This commit is contained in:
Nick O'Leary 2014-04-28 21:40:32 +01:00
parent b2f4bc915e
commit 02eb1d9a64

View File

@ -260,7 +260,7 @@ RED.nodes = function() {
newNodes = [newNodes]; newNodes = [newNodes];
} }
var unknownTypes = []; var unknownTypes = [];
for (var i in newNodes) { for (var i=0;i<newNodes.length;i++) {
var n = newNodes[i]; var n = newNodes[i];
// TODO: remove workspace in next release+1 // TODO: remove workspace in next release+1
if (n.type != "workspace" && n.type != "tab" && !getType(n.type)) { if (n.type != "workspace" && n.type != "tab" && !getType(n.type)) {
@ -270,6 +270,11 @@ RED.nodes = function() {
if (unknownTypes.indexOf(n.name)==-1) { if (unknownTypes.indexOf(n.name)==-1) {
unknownTypes.push(n.name); unknownTypes.push(n.name);
} }
if (n.x == null && n.y == null) {
// config node - remove it
newNodes.splice(i,1);
i--;
}
} }
} }
if (unknownTypes.length > 0) { if (unknownTypes.length > 0) {