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
const htmlContent = editor.getHtml() + '<style>' + editor.getCss() + '</style>';
// 2. KRITISCH: Holt die JSON-Repräsentation des Editors
const jsonProjectData = editor.getProjectData();
const htmlContent = editor.getHtml() + '<style>' + editor.getCss() + '</style>';
// 2. KRITISCH: Holt die JSON-Repräsentation des Editors
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 action = `${resource}.update`;
@@ -183,13 +190,13 @@
log('SAVE START', 'Starte Speichern des Inhalts an die API...', '#FF4500');
// 3. Daten für den POST-Request vorbereiten
const dataToSend = {
action,
id: CURRENT_ENTITY_ID,
html: htmlContent,
// 🚨 KRITISCH: Server erwartet das Feld 'json'
json: jsonProjectData,
};
const dataToSend = {
action,
id: CURRENT_ENTITY_ID,
html: htmlContent,
// 🚨 KRITISCH: Server erwartet das Feld 'json'
json: jsonProjectDataRaw,
};
if (B.CURRENT_ENTITY_NAME) {
dataToSend.name = B.CURRENT_ENTITY_NAME;