@@ -233,8 +233,9 @@ define(function (require, exports, module) {
233233
234234 if ( $ ( '.not-editor' ) . length === 1 ) {
235235 $tabBar = $ ( TabBarHTML ) ;
236- // since we need to add the tab bar before the editor area, we target the `#editor-holder` class and prepend
237- $ ( "#editor-holder" ) . prepend ( $tabBar ) ;
236+ // since we need to add the tab bar before the editor which has .not-editor class
237+ // we target the `.not-editor` class and add the tab bar before it
238+ $ ( ".not-editor" ) . before ( $tabBar ) ;
238239 setTimeout ( function ( ) {
239240 WorkspaceManager . recomputeLayout ( true ) ;
240241 } , 0 ) ;
@@ -452,9 +453,13 @@ define(function (require, exports, module) {
452453 * Registers the event handlers
453454 */
454455 function registerHandlers ( ) {
455- // For pane changes, still recreate the entire tab bar container.
456- MainViewManager . off ( "activePaneChange paneCreate paneDestroy paneLayoutChange" , createTabBar ) ;
457- MainViewManager . on ( "activePaneChange paneCreate paneDestroy paneLayoutChange" , createTabBar ) ;
456+ // For pane layout changes, recreate the entire tab bar container
457+ MainViewManager . off ( "paneCreate paneDestroy paneLayoutChange" , createTabBar ) ;
458+ MainViewManager . on ( "paneCreate paneDestroy paneLayoutChange" , createTabBar ) ;
459+
460+ // For active pane changes, update only the tabs
461+ MainViewManager . off ( "activePaneChange" , updateTabs ) ;
462+ MainViewManager . on ( "activePaneChange" , updateTabs ) ;
458463
459464 // For editor changes, update only the tabs.
460465 EditorManager . off ( "activeEditorChange" , updateTabs ) ;
@@ -474,16 +479,15 @@ define(function (require, exports, module) {
474479 MainViewManager . off ( events . join ( " " ) , updateTabs ) ;
475480 MainViewManager . on ( events . join ( " " ) , updateTabs ) ;
476481
477- // When the sidebar UI changes, update the tabs to ensure the overflow menu is correct.
478- // Without this, if the sidebar is hidden, and **all tabs become visible**, the overflow icon still appears.
482+ // When the sidebar UI changes, update the tabs to ensure the overflow menu is correct
479483 $ ( "#sidebar" ) . off ( "panelCollapsed panelExpanded panelResizeEnd" , updateTabs ) ;
480484 $ ( "#sidebar" ) . on ( "panelCollapsed panelExpanded panelResizeEnd" , updateTabs ) ;
481485
482486 // also update the tabs when the main plugin panel resizes
483487 // main-plugin-panel[0] = live preview panel
484488 new ResizeObserver ( updateTabs ) . observe ( $ ( "#main-plugin-panel" ) [ 0 ] ) ;
485489
486- // file dirty flag change remains unchanged.
490+ // File dirty flag change handling
487491 DocumentManager . on ( "dirtyFlagChange" , function ( event , doc ) {
488492 const filePath = doc . file . fullPath ;
489493
0 commit comments