From b7dfef47bae44507612c239272e7b4f8e36d2ce1 Mon Sep 17 00:00:00 2001 From: selberhad Date: Thu, 6 Oct 2022 20:53:37 -0400 Subject: [PATCH] feat: consolidate input tab close buttons --- .../web/static/webclient/css/goldenlayout.css | 1 + .../webclient/js/plugins/goldenlayout.js | 27 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/evennia/web/static/webclient/css/goldenlayout.css b/evennia/web/static/webclient/css/goldenlayout.css index 4c0e77d254..7fee79654c 100644 --- a/evennia/web/static/webclient/css/goldenlayout.css +++ b/evennia/web/static/webclient/css/goldenlayout.css @@ -46,6 +46,7 @@ label { .lm_title { text-align: center; margin-right: 2px; + padding-right: 8px; } .lm_tab.lm_active { diff --git a/evennia/web/static/webclient/js/plugins/goldenlayout.js b/evennia/web/static/webclient/js/plugins/goldenlayout.js index e0147c4b36..f1acec6d94 100644 --- a/evennia/web/static/webclient/js/plugins/goldenlayout.js +++ b/evennia/web/static/webclient/js/plugins/goldenlayout.js @@ -264,7 +264,19 @@ let goldenlayout = (function () { // // ensure only one handler is set up on the parent with once var registerInputTabChangeHandler = once(function (tab) { - tab.header.parent.on( "activeContentItemChanged", onActiveInputTabChange ); + // Set up the control to add new tabs + let splitControl = $( + "+" + ); + + // Handler for adding a new tab + splitControl.click( tab, function (evnt) { + evnt.data.header.parent.addChild( newInputConfig ); + }); + + // Position it after the tab list + $('ul.lm_tabs', tab.header.element).after(splitControl).css("position", "relative"); + tab.header.parent.on( "activeContentItemChanged", onActiveInputTabChange ); }); // @@ -382,19 +394,6 @@ let goldenlayout = (function () { // // var onInputCreate = function (tab) { - //HTML for the typeDropdown - let splitControl = $( - "+" - ); - - // track adding a new tab - splitControl.click( tab, function (evnt) { - evnt.data.header.parent.addChild( newInputConfig ); - }); - - // Add the typeDropdown to the header - tab.element.append( splitControl ); - registerInputTabChangeHandler(tab); }