mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Track hidden tabs in localStorage
This commit is contained in:
parent
ed8e7afdf6
commit
7026df7d96
@ -220,6 +220,16 @@ RED.settings = (function () {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
function getLocal(key) {
|
||||
return localStorage.getItem(key)
|
||||
}
|
||||
function setLocal(key, value) {
|
||||
localStorage.setItem(key, value);
|
||||
}
|
||||
function removeLocal(key) {
|
||||
localStorage.removeItem(key)
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
init: init,
|
||||
@ -228,6 +238,9 @@ RED.settings = (function () {
|
||||
set: set,
|
||||
get: get,
|
||||
remove: remove,
|
||||
theme: theme
|
||||
theme: theme,
|
||||
setLocal: setLocal,
|
||||
getLocal: getLocal,
|
||||
removeLocal: removeLocal
|
||||
}
|
||||
})();
|
||||
|
@ -57,6 +57,11 @@ RED.workspaces = (function() {
|
||||
ws.hideable = true;
|
||||
}
|
||||
workspace_tabs.addTab(ws,targetIndex);
|
||||
|
||||
var hiddenTabs = JSON.parse(RED.settings.getLocal("hiddenTabs")||"{}");
|
||||
if (hiddenTabs[ws.id]) {
|
||||
workspace_tabs.hideTab(ws.id);
|
||||
}
|
||||
workspace_tabs.resize();
|
||||
} else {
|
||||
var tabId = RED.nodes.id();
|
||||
@ -664,6 +669,9 @@ RED.workspaces = (function() {
|
||||
}
|
||||
if (workspace_tabs.contains(id)) {
|
||||
workspace_tabs.hideTab(id);
|
||||
var hiddenTabs = JSON.parse(RED.settings.getLocal("hiddenTabs")||"{}");
|
||||
hiddenTabs[id] = true;
|
||||
RED.settings.setLocal("hiddenTabs",JSON.stringify(hiddenTabs));
|
||||
}
|
||||
},
|
||||
show: function(id,skipStack,unhideOnly) {
|
||||
@ -688,6 +696,9 @@ RED.workspaces = (function() {
|
||||
}
|
||||
workspace_tabs.activateTab(id);
|
||||
}
|
||||
var hiddenTabs = JSON.parse(RED.settings.getLocal("hiddenTabs")||"{}");
|
||||
delete hiddenTabs[id];
|
||||
RED.settings.setLocal("hiddenTabs",JSON.stringify(hiddenTabs));
|
||||
},
|
||||
refresh: function() {
|
||||
RED.nodes.eachWorkspace(function(ws) {
|
||||
|
Loading…
Reference in New Issue
Block a user