@@ -908,23 +908,12 @@ define(function (require, exports, module) {
908908 _showOverflowMenu ( ) ;
909909 } ) ;
910910
911- // Hide-panel button collapses the container but keeps tabs intact.
912- // Maximize state is preserved so the panel re-opens maximized.
911+ // Hide-panel button collapses the container but keeps the active
912+ // panel logically active so re-opening (drawer / Escape) restores it
913+ // with its content already mounted.
913914 _$tabBar . on ( "click" , ".bottom-panel-hide-btn" , function ( e ) {
914915 e . stopPropagation ( ) ;
915- if ( _$container && _$container . is ( ":visible" ) ) {
916- if ( _activeId ) {
917- const activePanel = _panelMap [ _activeId ] ;
918- if ( activePanel ) {
919- activePanel . $panel . removeClass ( "active-bottom-panel" ) ;
920- }
921- }
922- _activeId = null ;
923- _updateActiveTabHighlight ( ) ;
924- restoreIfMaximized ( ) ;
925- Resizer . hide ( _$container [ 0 ] ) ;
926- exports . trigger ( EVENT_PANEL_HIDDEN , _defaultPanelId ) ;
927- }
916+ collapseContainer ( ) ;
928917 } ) ;
929918
930919 // Maximize/restore toggle button
@@ -1132,6 +1121,39 @@ define(function (require, exports, module) {
11321121 return _isMaximized ;
11331122 }
11341123
1124+ /**
1125+ * Collapse the bottom panel container (transient hide) without touching
1126+ * which panel is logically active. Fires EVENT_PANEL_HIDDEN with the
1127+ * default panel id as a "container collapsed" signal so toolbar icons
1128+ * and menu items that mirror container visibility deselect.
1129+ * No-op if the container is already hidden.
1130+ */
1131+ function collapseContainer ( ) {
1132+ if ( ! _$container || ! _$container . is ( ":visible" ) ) {
1133+ return ;
1134+ }
1135+ restoreIfMaximized ( ) ;
1136+ Resizer . hide ( _$container [ 0 ] ) ;
1137+ exports . trigger ( EVENT_PANEL_HIDDEN , _defaultPanelId ) ;
1138+ }
1139+
1140+ /**
1141+ * Re-show the bottom panel container after a previous collapse, with the
1142+ * previously active panel still mounted. Fires EVENT_PANEL_SHOWN for the
1143+ * active panel id so toolbar icons / menu items that mirror visibility
1144+ * re-select. No-op if the container is already visible or there's no
1145+ * active panel to restore.
1146+ */
1147+ function restoreContainer ( ) {
1148+ if ( ! _$container || _$container . is ( ":visible" ) ) {
1149+ return ;
1150+ }
1151+ Resizer . show ( _$container [ 0 ] ) ;
1152+ if ( _activeId ) {
1153+ exports . trigger ( EVENT_PANEL_SHOWN , _activeId ) ;
1154+ }
1155+ }
1156+
11351157 /**
11361158 * Returns a copy of the currently open bottom panel IDs in tab order.
11371159 * @return {string[] }
@@ -1226,6 +1248,8 @@ define(function (require, exports, module) {
12261248 exports . restoreIfMaximized = restoreIfMaximized ;
12271249 exports . isMaximized = isMaximized ;
12281250 exports . MAXIMIZE_THRESHOLD = MAXIMIZE_THRESHOLD ;
1251+ exports . collapseContainer = collapseContainer ;
1252+ exports . restoreContainer = restoreContainer ;
12291253 //events
12301254 exports . EVENT_PANEL_HIDDEN = EVENT_PANEL_HIDDEN ;
12311255 exports . EVENT_PANEL_SHOWN = EVENT_PANEL_SHOWN ;
0 commit comments