diff --git a/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js index 2b1962922b..75a137ac0f 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js +++ b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js @@ -56,6 +56,12 @@ plugin_handler.add('goldenlayout', (function () { }, }; + var newInputConfig = { + title: 'input', + type: 'component', + componentName: 'input', + id: 'inputComponent', + }; // helper function: filter vals out of array function filter (vals, array) { @@ -340,6 +346,23 @@ plugin_handler.add('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 ); + + tab.header.parent.on( 'activeContentItemChanged', onActiveTabChange ); + } + // // var scrollAll = function () { @@ -511,6 +534,7 @@ plugin_handler.add('goldenlayout', (function () { $( $(evnt.target).siblings('.inputfield')[0] ).trigger(e); }); + container.on('tab', onInputCreate); }); myLayout.registerComponent( 'evennia', function (container, componentState) {