feat: onglet de navigation avec facettes, tris et retour Home complet #158
- clic sur un repertoire de l'arbre (modes focus vault et All) ouvre un onglet de navigation dedie qui coexiste avec les onglets de fichiers ouverts
- vue: sous-repertoires cliquables, facettes Vaults/Tags/Extensions (meme mecanisme que la recherche), tris Pertinence/Date, bouton Sauver; tags indexes exposes par GET /api/vault/{v}/files
- BUG-100: showWelcome re-injecte la section Raccourcis & Astuces et goHome efface la recherche globale + le filtre de la sidebar
This commit is contained in:
@@ -2105,6 +2105,41 @@ export const TabManager = {
|
||||
this.activate(tabId);
|
||||
},
|
||||
|
||||
/** Open (or retarget) the navigation tab for a vault directory (#158).
|
||||
* One navigation tab per vault: clicking another directory reuses it and
|
||||
* updates its directory, so open file tabs are never displaced. */
|
||||
async openNav(vault, dir = "") {
|
||||
if (!vault || vault === "all") return;
|
||||
dir = dir || "";
|
||||
const tabId = `nav::${vault}`;
|
||||
const name = dir ? dir.split("/").pop() : vault;
|
||||
|
||||
const existing = this._tabs.find(t => t.id === tabId);
|
||||
if (existing) {
|
||||
existing.path = dir;
|
||||
existing.name = name;
|
||||
this._tabCache[tabId].path = dir;
|
||||
this._tabCache[tabId].title = name;
|
||||
// Force a re-render when it is already the active tab
|
||||
if (this._activeTabId === tabId) this._activeTabId = null;
|
||||
this._renderTabs();
|
||||
this.activate(tabId);
|
||||
return;
|
||||
}
|
||||
|
||||
this._tabs.push({ id: tabId, vault, path: dir, name, icon: "folder", nav: true });
|
||||
this._tabCache[tabId] = { vault, path: dir, title: name, data: null, rawSource: null, sourceView: false, scrollTop: 0, icon: "folder", nav: true };
|
||||
this._renderTabs();
|
||||
this.activate(tabId);
|
||||
},
|
||||
|
||||
/** Drop the active-tab marker — the dashboard/home page is showing.
|
||||
* Keeps the tabs open; clicking one re-activates (and re-renders) it. */
|
||||
deactivate() {
|
||||
this._activeTabId = null;
|
||||
this._renderTabs();
|
||||
},
|
||||
|
||||
/** Activate a specific tab */
|
||||
async activate(tabId) {
|
||||
if (this._activeTabId === tabId && this._tabs.length > 0) return;
|
||||
@@ -2125,6 +2160,18 @@ export const TabManager = {
|
||||
const cache = this._tabCache[tabId];
|
||||
if (!cache) return;
|
||||
|
||||
// Navigation tab — render the directory view instead of fetching a file
|
||||
if (cache.nav) {
|
||||
state.currentVault = cache.vault;
|
||||
state.currentPath = cache.path || null;
|
||||
const navMod = await import("./vaulthome.js");
|
||||
await navMod.showVaultHome(cache.vault, cache.path);
|
||||
if (history.pushState) {
|
||||
history.pushState(null, "", `#/nav/${encodeURIComponent(cache.vault)}/${encodeURIComponent(cache.path)}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Update global state
|
||||
state.currentVault = cache.vault;
|
||||
state.currentPath = cache.path;
|
||||
|
||||
Reference in New Issue
Block a user