${badges.join("")}
${vaultStr}
diff --git a/frontend/js/ui.js b/frontend/js/ui.js
index 20158cc..5457878 100644
--- a/frontend/js/ui.js
+++ b/frontend/js/ui.js
@@ -1677,6 +1677,8 @@ export const ContextMenuManager = {
this._addItem('folder-plus', 'Nouveau sous-dossier', () => this._createDirectory(), isReadonly);
this._addItem('file-plus', 'Nouveau fichier ici', () => this._createFile(), isReadonly);
this._addSeparator();
+ this._addItem('bookmark-plus', 'Ajouter aux recherches sauvegardees', () => this._saveDirectorySearch(), false);
+ this._addSeparator();
this._addItem('edit', 'Renommer', () => this._renameItem(), isReadonly);
this._addItem('trash-2', 'Supprimer', () => this._deleteDirectory(), isReadonly);
} else if (type === 'file') {
@@ -1813,6 +1815,33 @@ export const ContextMenuManager = {
} catch (err) { showToast("Erreur: " + err.message, "error"); }
},
+ async _saveDirectorySearch() {
+ try {
+ var vault = this._targetVault || "all";
+ var dirPath = this._targetPath;
+ var dirName = dirPath.split("/").pop() || dirPath;
+ await api("/api/saved-searches", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ query: "",
+ vault: vault,
+ case_sensitive: false,
+ whole_word: false,
+ regex: false,
+ include_paths: dirPath + "/**",
+ exclude_paths: "",
+ }),
+ });
+ showToast("Repertoire sauvegarde dans les recherches", "success");
+ // Switch to saved searches tab
+ var savedTab = document.getElementById("sidebar-tab-saved");
+ if (savedTab) savedTab.click();
+ // Reload saved searches
+ import('./viewer.js').then(function(m) { m.loadSavedSearches(); });
+ } catch (err) { showToast("Erreur: " + err.message, "error"); }
+ },
+
_openBackupViewer() {
// Dynamically import the backup viewer module to avoid circular deps
import('./backups.js').then(mod => {
diff --git a/frontend/js/viewer.js b/frontend/js/viewer.js
index 804f738..1f39f38 100644
--- a/frontend/js/viewer.js
+++ b/frontend/js/viewer.js
@@ -1038,6 +1038,10 @@ export async function loadSavedSearches() {
}
if (empty) empty.style.display = "none";
list.innerHTML = searches.map(s => {
+ // Detect directory-based saved search (empty query + include_paths)
+ var isDirSearch = (!s.query || s.query.trim() === '') && s.include_paths;
+ var displayQuery = isDirSearch ? (s.include_paths || 'Dossier') : escapeHtml(s.query);
+ var dirIcon = isDirSearch ? '
' : '';
const badges = [];
if (s.case_sensitive) badges.push('
Aa');
if (s.whole_word) badges.push('
wd');
@@ -1047,8 +1051,8 @@ export async function loadSavedSearches() {
if (s.exclude_paths) pathFilters.push(`
📤 ${escapeHtml(s.exclude_paths)}`);
const vaultStr = s.vault && s.vault !== "all" ? `
📁 ${escapeHtml(s.vault)}` : "";
return `
-
-
${escapeHtml(s.query)}
+
+
${dirIcon}${displayQuery}
${badges.join("")}
${vaultStr}