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
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:
+21
-12
@@ -156,6 +156,12 @@ function createPaneTabManager(paneId) {
|
|||||||
this._dirtyTabs.delete(tabId);
|
this._dirtyTabs.delete(tabId);
|
||||||
if (this._tabs.length === 0) {
|
if (this._tabs.length === 0) {
|
||||||
this._activeTabId = null;
|
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();
|
this._showDashboard();
|
||||||
if (this._tabBar) this._tabBar.hidden = true;
|
if (this._tabBar) this._tabBar.hidden = true;
|
||||||
} else if (this._activeTabId === tabId) {
|
} else if (this._activeTabId === tabId) {
|
||||||
@@ -216,9 +222,14 @@ function createPaneTabManager(paneId) {
|
|||||||
// Add to target
|
// Add to target
|
||||||
targetTm._tabs.push({ ...tab, preview: false });
|
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 };
|
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) {
|
if (this._tabs.length === 0) {
|
||||||
this._activeTabId = null;
|
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();
|
this._showDashboard();
|
||||||
if (this._tabBar) this._tabBar.hidden = true;
|
if (this._tabBar) this._tabBar.hidden = true;
|
||||||
} else if (this._activeTabId === tabId) {
|
} else if (this._activeTabId === tabId) {
|
||||||
@@ -236,15 +247,13 @@ function createPaneTabManager(paneId) {
|
|||||||
// Set temporary override so getContentArea() returns this pane's area
|
// Set temporary override so getContentArea() returns this pane's area
|
||||||
const prev = window._activePaneContentArea;
|
const prev = window._activePaneContentArea;
|
||||||
window._activePaneContentArea = area;
|
window._activePaneContentArea = area;
|
||||||
try {
|
// Use dynamic import to call viewer.js renderFile in the right context
|
||||||
// Dynamic import to avoid circular dep — renderFile is in viewer.js
|
import('./viewer.js').then(m => {
|
||||||
import('./viewer.js').then(m => {
|
m.renderFile(data);
|
||||||
m.renderFile(data);
|
|
||||||
window._activePaneContentArea = prev;
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
window._activePaneContentArea = prev;
|
window._activePaneContentArea = prev;
|
||||||
}
|
}).catch(() => {
|
||||||
|
window._activePaneContentArea = prev;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_saveCurrentTabState() {
|
_saveCurrentTabState() {
|
||||||
@@ -910,9 +919,9 @@ if (typeof window !== 'undefined') {
|
|||||||
});
|
});
|
||||||
// Init — wait for DOM + singleton TabManager to be ready
|
// Init — wait for DOM + singleton TabManager to be ready
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// Store singleton TabManager reference
|
// Use window.TabManager (set by ui.js init) as the singleton fallback
|
||||||
if (typeof TabManager !== 'undefined')
|
if (!window._singletonTabManager && window.TabManager)
|
||||||
window._singletonTabManager = TabManager;
|
window._singletonTabManager = window.TabManager;
|
||||||
PaneManager.init();
|
PaneManager.init();
|
||||||
}, 150);
|
}, 150);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1880,6 +1880,9 @@ export const TabManager = {
|
|||||||
init() {
|
init() {
|
||||||
this._tabBar = document.getElementById("tab-bar");
|
this._tabBar = document.getElementById("tab-bar");
|
||||||
this._tabList = document.getElementById("tab-list");
|
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).
|
/** Open a file as a preview tab (single-click).
|
||||||
|
|||||||
Reference in New Issue
Block a user