mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Support uri fragments for nodes and groups including edit support
This commit is contained in:
parent
44300dbb34
commit
1fa8f30550
@ -249,8 +249,35 @@ var RED = (function() {
|
|||||||
RED.nodes.import(nodes.flows);
|
RED.nodes.import(nodes.flows);
|
||||||
RED.nodes.dirty(false);
|
RED.nodes.dirty(false);
|
||||||
RED.view.redraw(true);
|
RED.view.redraw(true);
|
||||||
if (/^#flow\/.+$/.test(currentHash)) {
|
if (/^#(flow|node|group)\/.+$/.test(currentHash)) {
|
||||||
RED.workspaces.show(currentHash.substring(6),true);
|
const hashParts = currentHash.split('/')
|
||||||
|
const showEditDialog = hashParts.length > 2 && hashParts[2] === 'edit'
|
||||||
|
if (hashParts[0] === '#flow') {
|
||||||
|
RED.workspaces.show(hashParts[1], true);
|
||||||
|
if (showEditDialog) {
|
||||||
|
RED.workspaces.edit()
|
||||||
|
}
|
||||||
|
} else if (hashParts[0] === '#node') {
|
||||||
|
const nodeToShow = RED.nodes.node(hashParts[1])
|
||||||
|
if (nodeToShow) {
|
||||||
|
setTimeout(() => {
|
||||||
|
RED.view.reveal(nodeToShow.id)
|
||||||
|
window.location.hash = currentHash
|
||||||
|
if (showEditDialog) {
|
||||||
|
RED.editor.edit(nodeToShow)
|
||||||
|
}
|
||||||
|
}, 50)
|
||||||
|
}
|
||||||
|
} else if (hashParts[0] === '#group') {
|
||||||
|
const nodeToShow = RED.nodes.group(hashParts[1])
|
||||||
|
if (nodeToShow) {
|
||||||
|
RED.view.reveal(nodeToShow.id)
|
||||||
|
window.location.hash = currentHash
|
||||||
|
if (showEditDialog) {
|
||||||
|
RED.editor.editGroup(nodeToShow)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (RED.workspaces.count() > 0) {
|
if (RED.workspaces.count() > 0) {
|
||||||
const hiddenTabs = JSON.parse(RED.settings.getLocal("hiddenTabs")||"{}");
|
const hiddenTabs = JSON.parse(RED.settings.getLocal("hiddenTabs")||"{}");
|
||||||
|
@ -6137,7 +6137,9 @@ RED.view = (function() {
|
|||||||
if (node.z && (node.type === "group" || node._def.category !== 'config')) {
|
if (node.z && (node.type === "group" || node._def.category !== 'config')) {
|
||||||
node.dirty = true;
|
node.dirty = true;
|
||||||
RED.workspaces.show(node.z);
|
RED.workspaces.show(node.z);
|
||||||
|
if (node.type === "group" && !node.w && !node.h) {
|
||||||
|
_redraw();
|
||||||
|
}
|
||||||
var screenSize = [chart[0].clientWidth/scaleFactor,chart[0].clientHeight/scaleFactor];
|
var screenSize = [chart[0].clientWidth/scaleFactor,chart[0].clientHeight/scaleFactor];
|
||||||
var scrollPos = [chart.scrollLeft()/scaleFactor,chart.scrollTop()/scaleFactor];
|
var scrollPos = [chart.scrollLeft()/scaleFactor,chart.scrollTop()/scaleFactor];
|
||||||
var cx = node.x;
|
var cx = node.x;
|
||||||
|
@ -138,7 +138,7 @@ RED.workspaces = (function() {
|
|||||||
activeWorkspace = tab.id;
|
activeWorkspace = tab.id;
|
||||||
window.location.hash = 'flow/'+tab.id;
|
window.location.hash = 'flow/'+tab.id;
|
||||||
$("#red-ui-workspace").toggleClass("red-ui-workspace-disabled",!!tab.disabled);
|
$("#red-ui-workspace").toggleClass("red-ui-workspace-disabled",!!tab.disabled);
|
||||||
} else {
|
} else {
|
||||||
$("#red-ui-workspace-chart").hide();
|
$("#red-ui-workspace-chart").hide();
|
||||||
activeWorkspace = 0;
|
activeWorkspace = 0;
|
||||||
window.location.hash = '';
|
window.location.hash = '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user