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

Link Node - scroll to current flow in node list

This commit is contained in:
Nick O'Leary 2019-02-06 15:38:35 +00:00
parent 6e944485f0
commit 37b3601c47
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 22 additions and 4 deletions

View File

@ -327,6 +327,14 @@
}, },
length: function() { length: function() {
return this.element.children().length; return this.element.children().length;
},
show: function(item) {
var items = this.element.children().filter(function(f) {
return item === $(this).find(".red-ui-editableList-item-content").data('data');
});
if (items.length > 0) {
this.uiContainer.scrollTop(this.uiContainer.scrollTop()+items.position().top)
}
} }
}); });
})(jQuery); })(jQuery);

View File

@ -171,6 +171,13 @@
} else { } else {
return this._data; return this._data;
} }
},
show: function(id) {
for (var i=0;i<this._data.length;i++) {
if (this._data[i].id === id) {
this._topList.editableList('show',this._data[i]);
}
}
} }
}); });

View File

@ -54,7 +54,7 @@
flowMap[activeSubflow.id] = { flowMap[activeSubflow.id] = {
id: activeSubflow.id, id: activeSubflow.id,
class: 'palette-header', class: 'palette-header',
label: "Subflow : "+(activeSubflow.name || activeSubflow.id), label: "Subflow : "+(activeSubflow.name || activeSubflow.id)+(node.z===ws.id ? " *":""),
expanded: true, expanded: true,
children: [] children: []
}; };
@ -64,8 +64,8 @@
flowMap[ws.id] = { flowMap[ws.id] = {
id: ws.id, id: ws.id,
class: 'palette-header', class: 'palette-header',
label: (ws.label || ws.id), label: (ws.label || ws.id)+(node.z===ws.id ? " *":""),
expanded: ws.id === node.z, expanded: true,
children: [] children: []
} }
flows.push(flowMap[ws.id]) flows.push(flowMap[ws.id])
@ -88,7 +88,10 @@
} }
}); });
flows = flows.filter(function(f) { return f.children.length > 0 }) flows = flows.filter(function(f) { return f.children.length > 0 })
treeList.treeList('data',flows) treeList.treeList('data',flows);
setTimeout(function() {
treeList.treeList('show',node.z);
},100);
} }
function resizeNodeList() { function resizeNodeList() {