diff --git a/config/current.ver b/config/current.ver index f821c29..a88dc16 100644 --- a/config/current.ver +++ b/config/current.ver @@ -1 +1 @@ -1.2.59 \ No newline at end of file +1.2.60 \ No newline at end of file diff --git a/public/assets/js/bridge/blocks-api.js b/public/assets/js/bridge/blocks-api.js index e40356d..d3afc33 100644 --- a/public/assets/js/bridge/blocks-api.js +++ b/public/assets/js/bridge/blocks-api.js @@ -543,7 +543,8 @@ } return rawHtml; }; - const htmlContent = serializeHtml() + ''; + const htmlBody = serializeHtml(); + const htmlContent = htmlBody + ''; // 2. KRITISCH: Holt die JSON-Repräsentation des Editors let jsonProjectDataRaw = ''; try { @@ -553,6 +554,17 @@ console.error('[bridge-blocks-api] getProjectData stringify failed', e); jsonProjectDataRaw = ''; } + // Wenn gerade aktiv editiert wird, JSON durch HTML ersetzen, + // damit der Live-Text ohne Blur gespeichert wird. + try { + const doc = editor.Canvas && editor.Canvas.getDocument ? editor.Canvas.getDocument() : null; + const selectionNode = doc && doc.getSelection ? (doc.getSelection().focusNode || doc.getSelection().anchorNode) : null; + const selectionEl = selectionNode ? (selectionNode.nodeType === 1 ? selectionNode : selectionNode.parentElement) : null; + const isEditable = !!(selectionEl && (selectionEl.isContentEditable || (selectionEl.getAttribute && selectionEl.getAttribute('contenteditable') === 'true'))); + if (isEditable && htmlBody) { + jsonProjectDataRaw = htmlBody; + } + } catch {} const resource = 'content'; const action = `${resource}.update`;