From cf476632e20e59cdc0a7ccf56249d55e6f102d4e Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Tue, 27 Jan 2026 01:36:23 +0100 Subject: [PATCH] asdasd --- config/current.ver | 2 +- public/assets/js/bridge/rte-editor.js | 5 ++-- public/editor/bridge-core.js | 33 +++++++++++++++++---------- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/config/current.ver b/config/current.ver index f662c7e..8d2c87f 100644 --- a/config/current.ver +++ b/config/current.ver @@ -1 +1 @@ -1.1.14 \ No newline at end of file +1.1.15 \ No newline at end of file diff --git a/public/assets/js/bridge/rte-editor.js b/public/assets/js/bridge/rte-editor.js index 790e4c1..34c7e68 100644 --- a/public/assets/js/bridge/rte-editor.js +++ b/public/assets/js/bridge/rte-editor.js @@ -173,12 +173,13 @@ const isText = (component.is && component.is('text')) || (component.get && component.get('type') === 'text'); try { - if (component.set) component.set('content', content); if (isText && component.components) { try { - component.components(content); + const comps = component.components(); + if (comps && comps.length) comps.reset(); } catch {} } + if (component.set) component.set('content', content); } catch {} if (isText && component.view && component.view.el) { try { diff --git a/public/editor/bridge-core.js b/public/editor/bridge-core.js index a47a537..55ea207 100644 --- a/public/editor/bridge-core.js +++ b/public/editor/bridge-core.js @@ -372,28 +372,37 @@ el.__bridgeLastNormalized = snap.normalized; } }; + const syncTextFromView = (model) => { + const target = resolveTextModel(model); + if (!isTextLike(target) || !target.view || !target.view.el) return; + const html = String(target.view.el.innerHTML || '').trim(); + if (!html) return; + const current = target.get ? String(target.get('content') || '').trim() : ''; + if (current === html) return; + try { + syncing.add(target); + if (target.components) { + const comps = target.components(); + if (comps && comps.length) comps.reset(); + } + if (target.set) target.set('content', html); + target.trigger && target.trigger('change:content'); + } catch {} finally { + syncing.delete(target); + } + }; const rememberIfPresent = (model) => { const target = resolveTextModel(model); if (!isTextLike(target)) return; const snap = snapshotContent(target); if (!snap.normalized) return; - if (!syncing.has(target)) { - const currentContent = target.get ? String(target.get('content') || '').trim() : ''; - if (currentContent !== snap.html) { - try { - syncing.add(target); - if (target.set) target.set('content', snap.html); - if (target.components) target.components(snap.html); - } catch {} finally { - syncing.delete(target); - } - } - } + if (!syncing.has(target)) syncTextFromView(target); storeSnapshot(target, snap); }; const restoreIfEmpty = (model) => { const target = resolveTextModel(model); if (!isTextLike(target) || !target.get) return; + if (!syncing.has(target)) syncTextFromView(target); const current = snapshotContent(target); if (current.normalized) { rememberIfPresent(target);