fix: TabManager exposé sur window + fermeture auto du panneau vide
CI / lint (push) Failing after 9s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / e2e (push) Has been skipped
CI / security (push) Successful in 20s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled

- ui.js: window.TabManager et window._singletonTabManager exposés dans init()
- pane-manager.js: référence corrigée vers window.TabManager (n'était pas en scope)
- PaneTabManager.close/transferTabTo: ferme automatiquement le panneau quand vide (sauf dernier)
- Déployé sur 192.168.30.101:2020, 307 tests verts
This commit is contained in:
2026-07-27 21:51:19 -04:00
parent ed4c1dcf07
commit e5cd656c6e
2 changed files with 24 additions and 12 deletions
+21 -12
View File
@@ -156,6 +156,12 @@ function createPaneTabManager(paneId) {
this._dirtyTabs.delete(tabId);
if (this._tabs.length === 0) {
this._activeTabId = null;
// If this pane has no more tabs and isn't the last pane, close it
if (window.PaneManager && window.PaneManager.isSplit() && window.PaneManager.panes.length > 1) {
this._renderTabs();
window.PaneManager.closePane(this.paneId);
return;
}
this._showDashboard();
if (this._tabBar) this._tabBar.hidden = true;
} else if (this._activeTabId === tabId) {
@@ -216,9 +222,14 @@ function createPaneTabManager(paneId) {
// Add to target
targetTm._tabs.push({ ...tab, preview: false });
targetTm._tabCache[tabId] = cache || { vault: tab.vault, path: tab.path, title: tab.name, data: null, rawSource: null, sourceView: false, scrollTop: 0, icon: tab.icon };
// Activate in source what's left, or show dashboard
// If source is now empty and not the last pane, close it
if (this._tabs.length === 0) {
this._activeTabId = null;
if (window.PaneManager && window.PaneManager.isSplit() && window.PaneManager.panes.length > 1) {
this._renderTabs();
window.PaneManager.closePane(this.paneId);
return true;
}
this._showDashboard();
if (this._tabBar) this._tabBar.hidden = true;
} else if (this._activeTabId === tabId) {
@@ -236,15 +247,13 @@ function createPaneTabManager(paneId) {
// Set temporary override so getContentArea() returns this pane's area
const prev = window._activePaneContentArea;
window._activePaneContentArea = area;
try {
// Dynamic import to avoid circular dep — renderFile is in viewer.js
import('./viewer.js').then(m => {
m.renderFile(data);
window._activePaneContentArea = prev;
});
} catch (e) {
// Use dynamic import to call viewer.js renderFile in the right context
import('./viewer.js').then(m => {
m.renderFile(data);
window._activePaneContentArea = prev;
}
}).catch(() => {
window._activePaneContentArea = prev;
});
},
_saveCurrentTabState() {
@@ -910,9 +919,9 @@ if (typeof window !== 'undefined') {
});
// Init — wait for DOM + singleton TabManager to be ready
setTimeout(() => {
// Store singleton TabManager reference
if (typeof TabManager !== 'undefined')
window._singletonTabManager = TabManager;
// Use window.TabManager (set by ui.js init) as the singleton fallback
if (!window._singletonTabManager && window.TabManager)
window._singletonTabManager = window.TabManager;
PaneManager.init();
}, 150);
});
+3
View File
@@ -1880,6 +1880,9 @@ export const TabManager = {
init() {
this._tabBar = document.getElementById("tab-bar");
this._tabList = document.getElementById("tab-list");
// Expose on window so pane-manager.js can reference the singleton
window.TabManager = this;
window._singletonTabManager = this;
},
/** Open a file as a preview tab (single-click).