From 4939eb5a12496ac3c8d89a91144d085f2ca56193 Mon Sep 17 00:00:00 2001 From: bruno Date: Wed, 22 Jul 2026 19:41:03 -0400 Subject: [PATCH] fix(database): save embed block properties (embed_type, collection_id, dbs, file_*) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The save() function's blocks.map() only copied 7 properties, missing: embed_type, collection_id, dbs, file_name, file_size, file_mime. Embed blocks lost their collection reference on save → page reload showed empty page instead of database table. --- app/templates/_page_editor_scripts.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/_page_editor_scripts.html b/app/templates/_page_editor_scripts.html index 9b16f8f..436b908 100644 --- a/app/templates/_page_editor_scripts.html +++ b/app/templates/_page_editor_scripts.html @@ -453,7 +453,7 @@ const t=document.getElementById('_titleEl');if(t)this.pageTitle=t.textContent?.trim()||'New page'; this.saving=true; const csrf=document.cookie.match(/csrf_token=([^;]+)/); - fetch(`/board/api/pages/${this.pid}/blocks`,{method:'POST',headers:{'Content-Type':'application/json','X-CSRF-Token':csrf?csrf[1]:''},body:JSON.stringify({title:this.pageTitle,blocks:this.blocks.map(b=>{const c={id:b.id,type:b.type,content:b.content};['checked','expanded','language','icon','src','alt','style'].forEach(k=>{if(b[k]!=null)c[k]=b[k];});return c;})})}) + fetch(`/board/api/pages/${this.pid}/blocks`,{method:'POST',headers:{'Content-Type':'application/json','X-CSRF-Token':csrf?csrf[1]:''},body:JSON.stringify({title:this.pageTitle,blocks:this.blocks.map(b=>{const c={id:b.id,type:b.type,content:b.content};['checked','expanded','language','icon','src','alt','style','embed_type','collection_id','dbs','file_name','file_size','file_mime'].forEach(k=>{if(b[k]!=null)c[k]=b[k];});return c;})})}) .then(r=>r.json()).then(()=>{this.saving=false;this.dirty=false;this.lastSaved=new Date().toLocaleTimeString(); document.querySelectorAll(`.sidebar-item[data-page-id="page/${this.pid}"]`).forEach(item=>{const n=item.querySelector('.page-name');if(n)n.textContent=this.pageTitle||'New page';}); }).catch(()=>{this.saving=false;});