fix(workspace): menu contextuel après navigation partielle + sync sidebar/header au rename
This commit is contained in:
@@ -816,6 +816,26 @@
|
||||
return m ? m[1] : '';
|
||||
},
|
||||
|
||||
/** Reflète le rename d'une page/dossier dans toute l'UI : sidebar gauche
|
||||
(Récents, Privé, Favoris + arbre du workspace), breadcrumb du header
|
||||
(event flowdeck:page-renamed) et frame parente (postMessage). */
|
||||
syncPageTitle: function(pid, title) {
|
||||
var t = (title || '').trim() || 'Untitled';
|
||||
document.querySelectorAll('.sidebar-item[data-page-id="page/' + pid + '"]').forEach(function(item) {
|
||||
var n = item.querySelector('.page-name');
|
||||
if (n) n.textContent = t;
|
||||
});
|
||||
document.querySelectorAll('.sidebar-item.ws-tree-item[data-id="' + pid + '"]').forEach(function(item) {
|
||||
item.setAttribute('data-name', t);
|
||||
var n = item.querySelector('.page-name');
|
||||
if (n) n.textContent = t;
|
||||
});
|
||||
window.dispatchEvent(new CustomEvent('flowdeck:page-renamed', { detail: { id: pid, title: t } }));
|
||||
if (window.parent && window.parent !== window) {
|
||||
try { window.parent.postMessage({ type: 'fd-page-renamed', id: pid, title: t }, window.location.origin); } catch (e) {}
|
||||
}
|
||||
},
|
||||
|
||||
/** Refresh CSRF token from the server. Returns a promise resolving to the new token. */
|
||||
refreshCsrfToken: async function() {
|
||||
try {
|
||||
@@ -1182,6 +1202,7 @@
|
||||
body: JSON.stringify({ name: newName.trim() })
|
||||
}).then(function(r) {
|
||||
if (r.ok) {
|
||||
if (window.FlowDeck && window.FlowDeck.syncPageTitle) window.FlowDeck.syncPageTitle(id, newName.trim());
|
||||
self.refreshSidebarTree();
|
||||
document.dispatchEvent(new CustomEvent('flowdeck:workspace-changed'));
|
||||
if (window._wsData && window._wsData._reloadAfterAction) {
|
||||
|
||||
Reference in New Issue
Block a user