@@ -26,8 +26,6 @@ const cerateDockview = (el, options) => {
2626 return dockview ;
2727}
2828
29- // Carry the `maximizing` flag on EVERY exit-maximize, not just the toggle button: the core also exits
30- // maximize when a group is removed/hidden/moved/added, and without the flag the restored siblings blank.
3129const guardMaximizeExit = dockview => {
3230 const gridview = dockview . gridview ;
3331 if ( ! gridview ) return ;
@@ -45,15 +43,11 @@ const guardMaximizeExit = dockview => {
4543 } ;
4644}
4745
48- // Fix "groups evenly split after refresh": while collapsed (size 0) skip overwriting existing
49- // proportions, else saveProportions freezes the collapsed equal-minimums as the split. _proportions is
50- // undefined only on the first deserialize save — let that through. Upstream fix: add `size > 0` to
51- // dockview-core's Splitview.saveProportions, then drop this patch.
5246const guardCollapsedSaveProportions = dockview => {
5347 const splitview = dockview . gridview ?. root ?. splitview ;
5448 if ( ! splitview ) return ;
5549 const proto = Object . getPrototypeOf ( splitview ) ;
56- if ( proto . __bbCollapseGuard ) return ; // Splitview.prototype is shared by all instances; patch once
50+ if ( proto . __bbCollapseGuard ) return ;
5751 proto . __bbCollapseGuard = true ;
5852 const original = proto . saveProportions ;
5953 proto . saveProportions = function ( ) {
@@ -123,8 +117,8 @@ const postLayoutInit = (dockview, options) => {
123117 } )
124118
125119 if ( options . renderer === 'onlyWhenVisible' ) {
126- const visiblePanels = dockview . groups . filter ( g => g . isVisible ) . map ( g => g . panels . find ( p => p . params . isActive ) || g . panels . find ( p => p . api . isVisible ) )
127- dockview . _loadTabs ?. fire ( visiblePanels . filter ( p => p . params . key ) . map ( p => p . params . key ) ) ;
120+ const visiblePanels = dockview . groups . filter ( g => g . isVisible ) . map ( g => g . activePanel )
121+ dockview . _loadTabs ?. fire ( visiblePanels . filter ( p => p && p . params . key ) . map ( p => p . params . key ) ) ;
128122 }
129123 dockview . _initialized ?. fire ( ) ;
130124 } )
@@ -213,6 +207,20 @@ const initDockview = (dockview, options, template) => {
213207 saveConfig ( dockview )
214208 } )
215209
210+ dockview . onDidActivePanelChange ( ( ) => {
211+ saveConfig ( dockview )
212+ } )
213+
214+ let movePanelTimer = null
215+ dockview . onDidMovePanel ( ( ) => {
216+ if ( movePanelTimer ) return
217+ movePanelTimer = setTimeout ( ( ) => {
218+ movePanelTimer = null
219+ if ( dockview . _isDisposed ) return
220+ saveConfig ( dockview )
221+ } , 0 )
222+ } )
223+
216224 dockview . _rootDropTarget . onDrop ( ( ) => {
217225 saveConfig ( dockview )
218226 } )
@@ -249,15 +257,12 @@ const setWidth = (target, dockview) => {
249257 let dropdown = header . querySelector ( '.dv-right-actions-container>.dropdown' )
250258 if ( ! dropdown ) return
251259 let dropMenu = dropdown . querySelector ( '.dropdown-menu' )
252- // `shrinking` (a strict width drop) gates the active-panel switch below — it must NOT fire during the
253- // transient expand a group goes through when a hidden view becomes visible (would switch + blank it).
254260 const group = dockview . params . inited ? dockview . groups . find ( g => g . element === header . parentElement ) : null
255261 const shrinking = group && group . _lastHeaderWidth !== undefined && header . offsetWidth < group . _lastHeaderWidth
256262 if ( group ) group . _lastHeaderWidth = header . offsetWidth
257263
258264 if ( voidWidth === 0 ) {
259265 if ( tabsContainer . children . length <= 1 ) return
260- // On shrink, if the active tab would overflow, switch to the first panel before tucking it away.
261266 if ( shrinking ) {
262267 const activeTab = tabsContainer . querySelector ( '.dv-tab.dv-active-tab' )
263268 if ( activeTab && activeTab . offsetLeft + activeTab . offsetWidth > tabsContainer . offsetWidth ) {
@@ -288,7 +293,6 @@ const setWidth = (target, dockview) => {
288293 }
289294 }
290295 }
291- // Fallback: keep an active panel when the group has none (e.g. the active one was closed).
292296 if ( group && ! group . activePanel ) {
293297 group . panels [ 0 ] ?. api . setActive ( )
294298 }
0 commit comments