From e761b62ac28c010c5a912be1400942b52e1e9b4b Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Mon, 19 Jan 2026 00:59:24 +0100 Subject: [PATCH] asdasd --- public/editor/bridge-core.js | 46 +++++++++++++++++++++++++----------- src/ApiKernel.php | 5 ---- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/public/editor/bridge-core.js b/public/editor/bridge-core.js index e399370..daaf4d6 100644 --- a/public/editor/bridge-core.js +++ b/public/editor/bridge-core.js @@ -947,24 +947,42 @@ && !hasPages && (parsedState.components || parsedState.styles); if (isArray) { - ed.setComponents(parsedState); - applied = true; - log('CONTENT', 'JSON-Komponenten (Array) angewendet.', 'orange'); - } else if (isLegacy) { - if (parsedState.components) { - ed.setComponents(parsedState.components); - } else { + const looksHtmlWrapper = parsedState.length === 1 && parsedState[0] && parsedState[0].type === 'html'; + if (!looksHtmlWrapper) { ed.setComponents(parsedState); + applied = true; + log('CONTENT', 'JSON-Komponenten (Array) angewendet.', 'orange'); + } else { + log('CONTENT WARN', 'JSON enthält nur HTML-Wrapper, nutze HTML-Fallback.', 'orange', 'warn'); + applied = false; } - if (parsedState.styles) { - ed.setStyle(parsedState.styles); + } else if (isLegacy) { + const legacyComponents = parsedState.components || parsedState; + const looksHtmlWrapper = Array.isArray(legacyComponents) + && legacyComponents.length === 1 + && legacyComponents[0] + && legacyComponents[0].type === 'html'; + if (!looksHtmlWrapper) { + ed.setComponents(legacyComponents); + if (parsedState.styles) { + ed.setStyle(parsedState.styles); + } + applied = true; + log('CONTENT', 'Legacy JSON (components/styles) angewendet.', 'orange'); + } else { + log('CONTENT WARN', 'Legacy JSON enthält nur HTML-Wrapper, nutze HTML-Fallback.', 'orange', 'warn'); + applied = false; } - applied = true; - log('CONTENT', 'Legacy JSON (components/styles) angewendet.', 'orange'); } else if (parsedState && typeof parsedState === 'object' && !hasPages) { - ed.setComponents(parsedState); - applied = true; - log('CONTENT', 'JSON ohne Pages als Komponenten angewendet.', 'orange'); + const looksHtmlWrapper = parsedState && parsedState.type === 'html'; + if (!looksHtmlWrapper) { + ed.setComponents(parsedState); + applied = true; + log('CONTENT', 'JSON ohne Pages als Komponenten angewendet.', 'orange'); + } else { + log('CONTENT WARN', 'JSON ohne Pages ist HTML-Wrapper, nutze HTML-Fallback.', 'orange', 'warn'); + applied = false; + } } else { ed.loadProjectData(parsedState); applied = true; diff --git a/src/ApiKernel.php b/src/ApiKernel.php index 67b29ae..c81b07e 100644 --- a/src/ApiKernel.php +++ b/src/ApiKernel.php @@ -481,11 +481,6 @@ class ApiKernel $gjsComponents = $this->parseHtmlToGjsComponents($topHtml); } - if ($editorType === 'grapesjs' && $jsonCol && empty($topContent) && $topHtml !== null) { - $pendingUpdate[$jsonCol] = $this->encodeJson($gjsComponents); - $topContent = $pendingUpdate[$jsonCol]; - $rowOut[$jsonCol] = $pendingUpdate[$jsonCol]; - } if ($editorType === 'craftjs' && $craftCol) { $craftPayload = isset($row[$craftCol]) ? (string)$row[$craftCol] : ''; if ($craftPayload === '') {