@@ -1215,10 +1215,10 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
12151215
12161216 async removeWorkspace ( windowID ) {
12171217 let workspacesData = await this . _workspaces ( ) ;
1218- this . _deleteAllTabsInWorkspace ( windowID ) ;
12191218 await this . changeWorkspace (
12201219 workspacesData . workspaces . find ( ( workspace ) => workspace . uuid !== windowID )
12211220 ) ;
1221+ this . _deleteAllTabsInWorkspace ( windowID ) ;
12221222 delete this . _lastSelectedWorkspaceTabs [ windowID ] ;
12231223 await ZenWorkspacesStorage . removeWorkspace ( windowID ) ;
12241224 // Remove the workspace from the cache
@@ -1227,12 +1227,8 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
12271227 ) ;
12281228 await this . _propagateWorkspaceData ( ) ;
12291229 await this . _updateWorkspacesChangeContextMenu ( ) ;
1230+ this . workspaceElement ( windowID ) ?. remove ( ) ;
12301231 this . onWindowResize ( ) ;
1231- for ( let container of document . querySelectorAll (
1232- `.zen-workspace-tabs-section[zen-workspace-id="${ windowID } "]`
1233- ) ) {
1234- container . remove ( ) ;
1235- }
12361232 this . registerPinnedResizeObserver ( ) ;
12371233 }
12381234
@@ -1379,7 +1375,9 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
13791375 gBrowser . removeTabs (
13801376 Array . from ( this . allStoredTabs ) . filter (
13811377 ( tab ) =>
1382- tab . getAttribute ( 'zen-workspace-id' ) === workspaceID && ! tab . hasAttribute ( 'zen-empty-tab' )
1378+ tab . getAttribute ( 'zen-workspace-id' ) === workspaceID &&
1379+ ! tab . hasAttribute ( 'zen-empty-tab' ) &&
1380+ ! tab . hasAttribute ( 'zen-essential' )
13831381 ) ,
13841382 {
13851383 animate : false ,
@@ -2395,12 +2393,13 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
23952393 }
23962394
23972395 async contextDeleteWorkspace ( ) {
2396+ const workspaceId = this . #contextMenuData?. workspaceId || this . activeWorkspace ;
23982397 const [ title , body ] = await document . l10n . formatValues ( [
23992398 { id : 'zen-workspaces-delete-workspace-title' } ,
24002399 { id : 'zen-workspaces-delete-workspace-body' } ,
24012400 ] ) ;
24022401 if ( Services . prompt . confirm ( null , title , body ) ) {
2403- await this . removeWorkspace ( this . #contextMenuData ?. workspaceId || this . activeWorkspace ) ;
2402+ await this . removeWorkspace ( workspaceId ) ;
24042403 }
24052404 }
24062405
0 commit comments