mirror of https://github.com/node-red/node-red.git
Merge pull request #5583 from GogoVega/show-first-and-last-tab
Introduce `show-first-tab` and `show-last-tab` actionspull/5584/head
commit
7674cbfffa
|
|
@ -1288,6 +1288,8 @@
|
|||
"toggle-show-tips": "Basculer l'affichage des astuces",
|
||||
"show-about": "Afficher la description de Node-RED",
|
||||
"show-welcome-tour": "Afficher la visite de bienvenue",
|
||||
"show-first-tab": "Afficher le premier onglet",
|
||||
"show-last-tab": "Afficher le dernier onglet",
|
||||
"show-next-tab": "Afficher l'onglet suivant",
|
||||
"show-previous-tab": "Afficher l'onglet précédent",
|
||||
"add-flow": "Ajouter un flux",
|
||||
|
|
|
|||
|
|
@ -605,6 +605,20 @@ RED.tabs = (function() {
|
|||
}
|
||||
}
|
||||
|
||||
function activateFirstTab() {
|
||||
const first = ul.find("li.red-ui-tab:not(.hide-tab)").first();
|
||||
if (first.length > 0) {
|
||||
activateTab(first.find("a"));
|
||||
}
|
||||
}
|
||||
|
||||
function activateLastTab() {
|
||||
const last = ul.find("li.red-ui-tab:not(.hide-tab)").last();
|
||||
if (last.length > 0) {
|
||||
activateTab(last.find("a"));
|
||||
}
|
||||
}
|
||||
|
||||
function findPreviousVisibleTab(li) {
|
||||
if (!li) {
|
||||
li = ul.find("li.active");
|
||||
|
|
@ -963,6 +977,8 @@ RED.tabs = (function() {
|
|||
},
|
||||
removeTab: removeTab,
|
||||
activateTab: activateTab,
|
||||
firstTab: activateFirstTab,
|
||||
lastTab: activateLastTab,
|
||||
nextTab: activateNextTab,
|
||||
previousTab: activatePreviousTab,
|
||||
resize: updateTabWidths,
|
||||
|
|
|
|||
|
|
@ -514,6 +514,20 @@ RED.workspaces = (function() {
|
|||
workspaceIndex = 0
|
||||
})
|
||||
|
||||
RED.actions.add("core:show-first-tab", function () {
|
||||
const oldActive = activeWorkspace;
|
||||
workspace_tabs.firstTab();
|
||||
if (oldActive !== activeWorkspace) {
|
||||
addToViewStack(oldActive);
|
||||
}
|
||||
});
|
||||
RED.actions.add("core:show-last-tab", function () {
|
||||
const oldActive = activeWorkspace;
|
||||
workspace_tabs.lastTab();
|
||||
if (oldActive !== activeWorkspace) {
|
||||
addToViewStack(oldActive);
|
||||
}
|
||||
});
|
||||
RED.actions.add("core:show-next-tab",function() {
|
||||
var oldActive = activeWorkspace;
|
||||
workspace_tabs.nextTab();
|
||||
|
|
|
|||
Loading…
Reference in New Issue