diff --git a/config/current.ver b/config/current.ver index 243e79a..63b41b2 100644 --- a/config/current.ver +++ b/config/current.ver @@ -1 +1 @@ -1.1.27 \ No newline at end of file +1.1.28 \ 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 b506bd0..5d60195 100644 --- a/public/assets/js/bridge/rte-editor.js +++ b/public/assets/js/bridge/rte-editor.js @@ -179,7 +179,23 @@ if (comps && comps.reset) comps.reset(); } catch {} try { - component.components(content); + const wrapper = document.createElement('div'); + wrapper.innerHTML = content; + const newComps = []; + wrapper.childNodes.forEach((node) => { + if (node.nodeType === 3) { + const text = node.textContent || ''; + if (text) newComps.push({ type: 'textnode', content: text }); + } else if (node.nodeType === 1) { + const tag = node.tagName ? node.tagName.toLowerCase() : ''; + if (tag === 'br') { + newComps.push({ tagName: 'br', void: true }); + } else { + newComps.push(node.outerHTML); + } + } + }); + component.components(newComps.length ? newComps : content); } catch {} } if (component.set) component.set('content', content);