asdasd
This commit is contained in:
@@ -333,6 +333,13 @@
|
||||
forceApply();
|
||||
setTimeout(forceApply, 0);
|
||||
setTimeout(forceApply, 50);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
if (component.view && component.view.el) {
|
||||
component.view.el.innerHTML = html;
|
||||
}
|
||||
} catch {}
|
||||
}, 120);
|
||||
closeModal();
|
||||
});
|
||||
|
||||
@@ -364,6 +371,31 @@
|
||||
|
||||
const setupRichTextEditor = (editor) => {
|
||||
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) {
|
||||
editor.Commands.add('bridge-open-richtext', {
|
||||
run(ed, sender, opts = {}) {
|
||||
|
||||
Reference in New Issue
Block a user