From 866f305686119fea0cc0fb2f196c12a169dc8b5c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 13 May 2021 13:57:29 +0100 Subject: [PATCH] Open subflow tab next to active tab rather than at the end --- .../@node-red/editor-client/src/js/ui/common/tabs.js | 3 +++ .../@node-red/editor-client/src/js/ui/workspaces.js | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js index bcc0aef32..ee6ea1960 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js @@ -785,6 +785,9 @@ RED.tabs = (function() { count: function() { return ul.find("li.red-ui-tab").length; }, + activeIndex: function() { + return ul.find("li.active").index() + }, contains: function(id) { return ul.find("a[href='#"+id+"']").length > 0; }, diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/workspaces.js b/packages/node_modules/@node-red/editor-client/src/js/ui/workspaces.js index 606149bd5..a7a4e024f 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/workspaces.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/workspaces.js @@ -493,7 +493,11 @@ RED.workspaces = (function() { if (!workspace_tabs.contains(id)) { var sf = RED.nodes.subflow(id); if (sf) { - addWorkspace({type:"subflow",id:id,icon:"red/images/subflow_tab.svg",label:sf.name, closeable: true}); + addWorkspace( + {type:"subflow",id:id,icon:"red/images/subflow_tab.svg",label:sf.name, closeable: true}, + null, + workspace_tabs.activeIndex()+1 + ); } else { return; }