This commit is contained in:
2025-12-06 01:36:08 +01:00
parent a8aa34baee
commit 9171bec0a5
2 changed files with 18 additions and 11 deletions

View File

@@ -173,9 +173,16 @@
} }
// 1. Daten extrahieren // 1. Daten extrahieren
const htmlContent = editor.getHtml() + '<style>' + editor.getCss() + '</style>'; const htmlContent = editor.getHtml() + '<style>' + editor.getCss() + '</style>';
// 2. KRITISCH: Holt die JSON-Repräsentation des Editors // 2. KRITISCH: Holt die JSON-Repräsentation des Editors
const jsonProjectData = editor.getProjectData(); let jsonProjectDataRaw = '';
try {
const jsonProjectData = editor.getProjectData();
jsonProjectDataRaw = JSON.stringify(jsonProjectData);
} catch (e) {
console.error('[bridge-blocks-api] getProjectData stringify failed', e);
jsonProjectDataRaw = '';
}
const resource = EDITOR_MODE; const resource = EDITOR_MODE;
const action = `${resource}.update`; const action = `${resource}.update`;
@@ -183,13 +190,13 @@
log('SAVE START', 'Starte Speichern des Inhalts an die API...', '#FF4500'); log('SAVE START', 'Starte Speichern des Inhalts an die API...', '#FF4500');
// 3. Daten für den POST-Request vorbereiten // 3. Daten für den POST-Request vorbereiten
const dataToSend = { const dataToSend = {
action, action,
id: CURRENT_ENTITY_ID, id: CURRENT_ENTITY_ID,
html: htmlContent, html: htmlContent,
// 🚨 KRITISCH: Server erwartet das Feld 'json' // 🚨 KRITISCH: Server erwartet das Feld 'json'
json: jsonProjectData, json: jsonProjectDataRaw,
}; };
if (B.CURRENT_ENTITY_NAME) { if (B.CURRENT_ENTITY_NAME) {
dataToSend.name = B.CURRENT_ENTITY_NAME; dataToSend.name = B.CURRENT_ENTITY_NAME;

View File

@@ -10,7 +10,7 @@ $ts = time();
<title>Editor</title> <title>Editor</title>
<link rel="stylesheet" href="../vendor/grapesjs/grapes.min.css" /> <link rel="stylesheet" href="../vendor/grapesjs/grapes.min.css" />
<style> <style>
html,body{height:100%}body{margin:0;background:#f8fafc;color:#0f172a}#gjs{height:100vh} html,body{height:100%}body{margin:0;background:#f8fafc;color:#0f172a;overflow:auto;}#gjs{min-height:100vh}
.gjs-one-bg{background-color:#fff!important}.gjs-two-color{color:#0f172a!important} .gjs-one-bg{background-color:#fff!important}.gjs-two-color{color:#0f172a!important}
.gjs-three-bg{background-color:#f8fafc!important}.gjs-four-color{color:#334155!important} .gjs-three-bg{background-color:#f8fafc!important}.gjs-four-color{color:#334155!important}