diff --git a/public/assets/js/bridge/rte-editor.js b/public/assets/js/bridge/rte-editor.js index 72fae6d..2342ead 100644 --- a/public/assets/js/bridge/rte-editor.js +++ b/public/assets/js/bridge/rte-editor.js @@ -67,8 +67,11 @@ let html = wrapper.innerHTML .replace(//gi, '
') - .replace(/(
)+$/g, '') .trim(); + const brCount = (html.match(/
/g) || []).length; + if (brCount <= 1) { + html = html.replace(/(
)+$/g, '').trim(); + } if (!html) { const text = String(fallbackText || wrapper.textContent || '').trim(); if (text) html = escapeHtml(text); @@ -103,6 +106,11 @@ if (!component) return; const content = String(html || ''); try { + const isText = (component.is && component.is('text')) + || (component.get && component.get('type') === 'text'); + if (isText && component.components) { + component.components(content); + } if (component.set) component.set('content', content); } catch {} if (component.view && component.view.el) {