feat(workspace,editor): creation dans le dossier courant + sync live du titre (sidebar/header)
- creation fichier/dossier a la racine du dossier courant ou d'un dossier cible (context-menu, boutons de survol) via createPage/showCreateFolderModal(parentId)
- instances de modeles en tant qu'enfant d'un dossier (parent_id) ; nom vide -> 'Untitled'
- sidebar de la librairie rafraichi apres delete/move/duplicate/rename (_syncSidebar)
- editeur: le titre se synchronise en direct dans le sidebar, le breadcrumb et l'onglet (pages et fichiers) et persiste via PUT /board/api/pages/{id}
This commit is contained in:
@@ -824,6 +824,11 @@ function libraryPage() {
|
||||
return m ? m[1] : '';
|
||||
},
|
||||
|
||||
_syncSidebar() {
|
||||
if (window.appState && window.appState.refreshSidebarTree) window.appState.refreshSidebarTree();
|
||||
if (window.appState && window.appState.refreshFavorites) window.appState.refreshFavorites();
|
||||
},
|
||||
|
||||
_isDescendant(node, targetId) {
|
||||
if (!node || !node.children) return false;
|
||||
for (var i = 0; i < node.children.length; i++) {
|
||||
@@ -846,6 +851,7 @@ function libraryPage() {
|
||||
}
|
||||
this.clearSelection();
|
||||
this.loadTab();
|
||||
this._syncSidebar();
|
||||
},
|
||||
|
||||
// ── Empty states ──
|
||||
@@ -1088,6 +1094,7 @@ function libraryPage() {
|
||||
}
|
||||
this.clearSelection();
|
||||
this.loadTab();
|
||||
this._syncSidebar();
|
||||
if (window.showToast) window.showToast('Moved to trash', 'success');
|
||||
},
|
||||
|
||||
@@ -1097,6 +1104,7 @@ function libraryPage() {
|
||||
var csrf = this._getCsrf();
|
||||
await fetch('/board/api/pages/' + item.id, {method:'DELETE', headers:{'X-CSRF-Token': csrf}});
|
||||
this.loadTab();
|
||||
this._syncSidebar();
|
||||
if (window.showToast) window.showToast('Moved to trash', 'success');
|
||||
},
|
||||
|
||||
@@ -1257,6 +1265,7 @@ function libraryPage() {
|
||||
await fetch(updUrl, { method: 'PUT', headers: {'X-CSRF-Token': csrf} });
|
||||
}
|
||||
this.loadTab();
|
||||
this._syncSidebar();
|
||||
if (window.showToast) window.showToast('Page duplicated', 'success');
|
||||
} catch(e) {
|
||||
if (window.showToast) window.showToast('Failed to duplicate page', 'error');
|
||||
@@ -1332,6 +1341,7 @@ function libraryPage() {
|
||||
}
|
||||
} catch(e) {}
|
||||
this._renderTable();
|
||||
this._syncSidebar();
|
||||
},
|
||||
|
||||
// ── Add new ──
|
||||
@@ -1423,6 +1433,7 @@ function libraryPage() {
|
||||
await fetch('/board/api/pages/' + this.peekItem.id, {method:'DELETE', headers:{'X-CSRF-Token': csrf}});
|
||||
this.closePeek();
|
||||
this.loadTab();
|
||||
this._syncSidebar();
|
||||
if (window.showToast) window.showToast('Moved to trash', 'success');
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user