feat(workspace,editor): creation dans le dossier courant + sync live du titre (sidebar/header)
FlowDeck CI / lint (push) Successful in 54s
FlowDeck CI / test (push) Successful in 5m50s
FlowDeck CI / docker (push) Successful in 47s

- 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:
2026-09-14 17:05:03 -04:00
parent 4038e9bdad
commit 41c1d315d3
8 changed files with 110 additions and 15 deletions
+18 -4
View File
@@ -648,6 +648,19 @@ window._wsInitData = (function() {
var self = this;
window.addEventListener('online', function() { self.online = true; });
window.addEventListener('offline', function() { self.online = false; });
// Side-peek editor posts renames here so the tree/peek title stay in sync.
window.addEventListener('message', function(ev) {
if (ev.origin !== window.location.origin) return;
var m = ev.data;
if (!m || m.type !== 'fd-page-renamed' || m.id == null) return;
var node = self._findNodeById(self.tree, m.id);
if (node) node.name = m.title || 'Untitled';
self.displayTree = self.displayTree.slice();
var t = document.getElementById('ws-preview-title');
if (t && self.previewItem && self.previewItem.id === m.id) t.textContent = m.title || 'Untitled';
var side = document.querySelector('.sidebar-item.ws-tree-item[data-id="' + m.id + '"] .page-name');
if (side) side.textContent = m.title || 'Untitled';
});
// Load workspace tags
this.loadWorkspaceTags();
} catch(e) { console.error('Tree load error:', e); this.loaded = true; }
@@ -864,6 +877,7 @@ window._wsInitData = (function() {
selectForPreview(node) {
var panel = document.getElementById('ws-preview-panel');
if (!panel) return;
this.previewItem = node;
document.getElementById('ws-preview-icon').innerHTML = this._fileIcon(node.name, node.is_folder, node.content_format, node.page_icon);
document.getElementById('ws-preview-title').textContent = node.name;
var openBtn = document.getElementById('ws-preview-open-btn');
@@ -1360,10 +1374,10 @@ window._wsInitData = (function() {
switch(action) {
case 'new-file':
window.FlowDeck.createPage();
window.FlowDeck.createPage(id);
break;
case 'new-folder':
window.FlowDeck.showCreateFolderModal();
window.FlowDeck.showCreateFolderModal(id);
break;
case 'rename':
this.startRename({db_id: id, name: name});
@@ -2724,8 +2738,8 @@ console.log('FLOWDECK v2.4.6 — IIFE done, _wsInitData keys:', Object.keys(wind
<div class="actions">
<template x-if="node.is_folder">
<span style="display:flex;gap:2px">
<button class="ws-act" @click.stop="window.FlowDeck.createPage()" title="New file">{{ fd_icon("file",14) }}</button>
<button class="ws-act" @click.stop="window.FlowDeck.showCreateFolderModal()" title="New folder">{{ fd_icon("folder",14) }}</button>
<button class="ws-act" @click.stop="window.FlowDeck.createPage(node.id)" title="New file">{{ fd_icon("file",14) }}</button>
<button class="ws-act" @click.stop="window.FlowDeck.showCreateFolderModal(node.id)" title="New folder">{{ fd_icon("folder",14) }}</button>
<a class="ws-act" href="/local-workspace" title="Open workspace page" style="text-decoration:none;display:inline-flex;align-items:center;">{{ fd_icon("external-link",14) }}</a>
</span>
</template>