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

Add core:show-last-hidden-tab and update keymap

This commit is contained in:
Nick O'Leary 2021-08-26 22:20:25 +01:00
parent 7962278475
commit 0874ba7a03
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 19 additions and 4 deletions

View File

@ -26,8 +26,8 @@
"ctrl-g v": "core:show-version-control-tab", "ctrl-g v": "core:show-version-control-tab",
"ctrl-shift-l": "core:show-event-log", "ctrl-shift-l": "core:show-event-log",
"ctrl-shift-p":"core:show-action-list", "ctrl-shift-p":"core:show-action-list",
"ctrl-h": "core:hide-tab", "alt-w": "core:hide-tab",
"ctrl-shift-h": "core:toggle-tabs" "alt-shift-w": "core:show-last-hidden-tab"
}, },
"red-ui-sidebar-node-config": { "red-ui-sidebar-node-config": {
"backspace": "core:delete-config-selection", "backspace": "core:delete-config-selection",

View File

@ -21,6 +21,7 @@ RED.workspaces = (function() {
var workspaceIndex = 0; var workspaceIndex = 0;
var viewStack = []; var viewStack = [];
var hideStack = [];
var viewStackPos = 0; var viewStackPos = 0;
@ -30,7 +31,6 @@ RED.workspaces = (function() {
} }
viewStack.push(id); viewStack.push(id);
viewStackPos = viewStack.length; viewStackPos = viewStack.length;
// console.warn("addToViewStack",id,viewStack);
} }
function addWorkspace(ws,skipHistoryEntry,targetIndex) { function addWorkspace(ws,skipHistoryEntry,targetIndex) {
@ -296,6 +296,8 @@ RED.workspaces = (function() {
onremove: function(tab) { onremove: function(tab) {
if (tab.type === "tab") { if (tab.type === "tab") {
workspaceTabCount--; workspaceTabCount--;
} else {
hideStack.push(tab.id);
} }
RED.menu.setDisabled("menu-item-workspace-delete",activeWorkspace === 0 || workspaceTabCount <= 1); RED.menu.setDisabled("menu-item-workspace-delete",activeWorkspace === 0 || workspaceTabCount <= 1);
if (workspaceTabCount === 0) { if (workspaceTabCount === 0) {
@ -323,9 +325,14 @@ RED.workspaces = (function() {
} }
}, },
onhide: function(tab) { onhide: function(tab) {
hideStack.push(tab.id);
RED.events.emit("workspace:hide",{workspace: tab.id}) RED.events.emit("workspace:hide",{workspace: tab.id})
}, },
onshow: function(tab) { onshow: function(tab) {
var i = hideStack.indexOf(tab.id);
if (i > -1) {
hideStack.splice(i,1);
}
RED.events.emit("workspace:show",{workspace: tab.id}) RED.events.emit("workspace:show",{workspace: tab.id})
}, },
minimumActiveTabWidth: 150, minimumActiveTabWidth: 150,
@ -413,7 +420,10 @@ RED.workspaces = (function() {
} }
}) })
}) })
RED.actions.add("core:show-last-hidden-tab", function() {
var id = hideStack.pop();
RED.workspaces.show(id);
})
RED.actions.add("core:list-flows",function() { RED.actions.add("core:list-flows",function() {
RED.actions.invoke("core:search","type:tab "); RED.actions.invoke("core:search","type:tab ");
@ -545,6 +555,11 @@ RED.workspaces = (function() {
null, null,
workspace_tabs.activeIndex()+1 workspace_tabs.activeIndex()+1
); );
var i = hideStack.indexOf(id);
if (i > -1) {
hideStack.splice(i,1);
}
} else { } else {
return; return;
} }