mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add go-to-previous/next-location actions
This commit is contained in:
parent
99a9e3a91b
commit
5181890433
@ -66,6 +66,8 @@
|
|||||||
"shift-left": "core:step-selection-left",
|
"shift-left": "core:step-selection-left",
|
||||||
"ctrl-shift-j": "core:show-previous-tab",
|
"ctrl-shift-j": "core:show-previous-tab",
|
||||||
"ctrl-shift-k": "core:show-next-tab",
|
"ctrl-shift-k": "core:show-next-tab",
|
||||||
|
"ctrl-shift-left": "core:go-to-previous-location",
|
||||||
|
"ctrl-shift-right": "core:go-to-next-location",
|
||||||
"ctrl-shift-g": "core:group-selection",
|
"ctrl-shift-g": "core:group-selection",
|
||||||
"ctrl-shift-u": "core:ungroup-selection",
|
"ctrl-shift-u": "core:ungroup-selection",
|
||||||
"ctrl-shift-c": "core:copy-group-style",
|
"ctrl-shift-c": "core:copy-group-style",
|
||||||
|
@ -249,7 +249,7 @@ var RED = (function() {
|
|||||||
RED.nodes.dirty(false);
|
RED.nodes.dirty(false);
|
||||||
RED.view.redraw(true);
|
RED.view.redraw(true);
|
||||||
if (/^#flow\/.+$/.test(currentHash)) {
|
if (/^#flow\/.+$/.test(currentHash)) {
|
||||||
RED.workspaces.show(currentHash.substring(6));
|
RED.workspaces.show(currentHash.substring(6),true);
|
||||||
}
|
}
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.warn(err);
|
console.warn(err);
|
||||||
|
@ -20,6 +20,9 @@ RED.workspaces = (function() {
|
|||||||
var activeWorkspace = 0;
|
var activeWorkspace = 0;
|
||||||
var workspaceIndex = 0;
|
var workspaceIndex = 0;
|
||||||
|
|
||||||
|
var viewStack = [];
|
||||||
|
var viewStackPos = 0;
|
||||||
|
|
||||||
function addWorkspace(ws,skipHistoryEntry,targetIndex) {
|
function addWorkspace(ws,skipHistoryEntry,targetIndex) {
|
||||||
if (ws) {
|
if (ws) {
|
||||||
workspace_tabs.addTab(ws,targetIndex);
|
workspace_tabs.addTab(ws,targetIndex);
|
||||||
@ -245,6 +248,11 @@ RED.workspaces = (function() {
|
|||||||
RED.view.focus();
|
RED.view.focus();
|
||||||
},
|
},
|
||||||
onclick: function(tab) {
|
onclick: function(tab) {
|
||||||
|
if (viewStackPos !== viewStack.length) {
|
||||||
|
viewStack.splice(viewStackPos);
|
||||||
|
}
|
||||||
|
viewStack.push(activeWorkspace);
|
||||||
|
viewStackPos = viewStack.length;
|
||||||
RED.view.focus();
|
RED.view.focus();
|
||||||
},
|
},
|
||||||
ondblclick: function(tab) {
|
ondblclick: function(tab) {
|
||||||
@ -349,6 +357,21 @@ RED.workspaces = (function() {
|
|||||||
RED.actions.invoke("core:search","type:tab ");
|
RED.actions.invoke("core:search","type:tab ");
|
||||||
})
|
})
|
||||||
|
|
||||||
|
RED.actions.add("core:go-to-previous-location", function() {
|
||||||
|
if (viewStackPos > 0) {
|
||||||
|
if (viewStackPos === viewStack.length) {
|
||||||
|
viewStack.push(activeWorkspace);
|
||||||
|
}
|
||||||
|
RED.workspaces.show(viewStack[--viewStackPos],true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
RED.actions.add("core:go-to-next-location", function() {
|
||||||
|
if (viewStackPos < viewStack.length - 1) {
|
||||||
|
RED.workspaces.show(viewStack[++viewStackPos],true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
hideWorkspace();
|
hideWorkspace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,7 +467,7 @@ RED.workspaces = (function() {
|
|||||||
selection: function() {
|
selection: function() {
|
||||||
return workspace_tabs.selection();
|
return workspace_tabs.selection();
|
||||||
},
|
},
|
||||||
show: function(id) {
|
show: function(id,skipStack) {
|
||||||
if (!workspace_tabs.contains(id)) {
|
if (!workspace_tabs.contains(id)) {
|
||||||
var sf = RED.nodes.subflow(id);
|
var sf = RED.nodes.subflow(id);
|
||||||
if (sf) {
|
if (sf) {
|
||||||
@ -453,6 +476,13 @@ RED.workspaces = (function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!skipStack) {
|
||||||
|
if (viewStackPos !== viewStack.length) {
|
||||||
|
viewStack.splice(viewStackPos);
|
||||||
|
}
|
||||||
|
viewStack.push(activeWorkspace);
|
||||||
|
viewStackPos = viewStack.length;
|
||||||
|
}
|
||||||
workspace_tabs.activateTab(id);
|
workspace_tabs.activateTab(id);
|
||||||
},
|
},
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user