From 714e075a76868cb7cc67e1cee3b63b861f9cb077 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Sat, 6 Dec 2025 23:58:40 +0100 Subject: [PATCH] asd --- public/assets/js/ui-editor.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/public/assets/js/ui-editor.js b/public/assets/js/ui-editor.js index 355c0ce..269da7e 100644 --- a/public/assets/js/ui-editor.js +++ b/public/assets/js/ui-editor.js @@ -207,7 +207,7 @@ export function initEditor() {   }   // ---------- Initialen HTML-Inhalt in Editor pushen (mit Token/Race-Schutz) ---------- - async function pushInitialHtmlToEditor({ mode, html, snippets, ref, token, hasJson }) { + async function pushInitialHtmlToEditor({ mode, html, snippets, ref, token, hasJson, json }) { if (token !== reqToken) return; // veraltete Anfrage ignorieren const win = iframe?.contentWindow; @@ -216,7 +216,7 @@ export function initEditor() {     // NEU: HTML wird NUR über postMessage gesendet. Die Bridge im iFrame ist verantwortlich     // dafür, das HTML in GrapesJS zu setzen, NACHDEM ihre Plugins fertig sind.     try { - win?.postMessage({ source:'admin', type:'init', mode, html: html || '', snippets: snippets || [], ref: ref || {}, hasJson: !!hasJson }, '*'); + win?.postMessage({ source:'admin', type:'init', mode, html: html || '', snippets: snippets || [], ref: ref || {}, hasJson: !!hasJson, json: json || '' }, '*');     } catch {}     try { @@ -261,14 +261,19 @@ export function initEditor() {     let snippets = []; let refLib = { sections: [], blocks: [] }; let hasJson = false; + let jsonState = '';     await Promise.all([       (async() => { try { const row = await apiGet(current.resource, current.id); - hasJson = !!(row?.content); + jsonState = row?.content ?? row?.item?.content ?? ''; + hasJson = !!jsonState; // API liefert jetzt top-level html/content; fallback auf item.* - fresh = row?.html ?? row?.content ?? row?.item?.html ?? row?.item?.content ?? ''; + fresh = row?.html ?? row?.item?.html ?? ''; + if (!fresh && !hasJson) { + fresh = row?.content ?? row?.item?.content ?? ''; + } } catch {}       })(),       (async() => { snippets = await buildSnippetsForContext(current); })(), @@ -310,7 +315,8 @@ export function initEditor() { blocks: (refLib.blocks || []).map(r => ({ id:r.id, name:r.name, html:r.html || '' })) }, token: myToken, - hasJson + hasJson, + json: jsonState }); } }; @@ -327,7 +333,8 @@ export function initEditor() { blocks: (refLib.blocks || []).map(r => ({ id:r.id, name:r.name, html:r.html || '' })) }, token: myToken, - hasJson + hasJson, + json: jsonState }); }, 1200);     };