This commit is contained in:
2026-01-17 02:51:47 +01:00
parent 6710448fec
commit e3428fd095

View File

@@ -333,6 +333,13 @@
forceApply(); forceApply();
setTimeout(forceApply, 0); setTimeout(forceApply, 0);
setTimeout(forceApply, 50); setTimeout(forceApply, 50);
setTimeout(() => {
try {
if (component.view && component.view.el) {
component.view.el.innerHTML = html;
}
} catch {}
}, 120);
closeModal(); closeModal();
}); });
@@ -364,6 +371,31 @@
const setupRichTextEditor = (editor) => { const setupRichTextEditor = (editor) => {
if (!editor) return; if (!editor) return;
if (!editor.__bridgeGetHtmlPatched) {
editor.__bridgeGetHtmlPatched = true;
const originalGetHtml = editor.getHtml ? editor.getHtml.bind(editor) : null;
if (originalGetHtml) {
editor.getHtml = function (...args) {
let html = originalGetHtml(...args);
try {
const wrapper = editor.getWrapper && editor.getWrapper();
if (wrapper && wrapper.find) {
const candidates = wrapper.find('[data-gjs-type="text"], [data-gjs-type="link"], [data-gjs-type="button"]');
candidates.forEach((model) => {
const content = model && model.get ? String(model.get('content') || '') : '';
const id = model && (model.getId ? model.getId() : model.get && model.get('id'));
const tag = (model && model.get && model.get('tagName') ? model.get('tagName') : (model && model.get && model.get('tag'))) || 'div';
if (!content || !id) return;
const tagName = String(tag).toLowerCase();
const rx = new RegExp(`<${tagName}([^>]*\\bid=["']${id}["'][^>]*)>([\\s\\S]*?)<\\/${tagName}>`, 'i');
html = html.replace(rx, `<${tagName}$1>${content}</${tagName}>`);
});
}
} catch {}
return html;
};
}
}
if (editor.Commands && editor.Commands.add) { if (editor.Commands && editor.Commands.add) {
editor.Commands.add('bridge-open-richtext', { editor.Commands.add('bridge-open-richtext', {
run(ed, sender, opts = {}) { run(ed, sender, opts = {}) {