sasadasd
This commit is contained in:
@@ -75,9 +75,6 @@
|
|||||||
if (!component) return;
|
if (!component) return;
|
||||||
const content = String(html || '');
|
const content = String(html || '');
|
||||||
try {
|
try {
|
||||||
if (component.components) {
|
|
||||||
component.components(content);
|
|
||||||
}
|
|
||||||
if (component.set) component.set('content', content);
|
if (component.set) component.set('content', content);
|
||||||
} catch {}
|
} catch {}
|
||||||
if (component.view && component.view.el) {
|
if (component.view && component.view.el) {
|
||||||
@@ -291,6 +288,7 @@
|
|||||||
saveBtn.addEventListener('click', () => {
|
saveBtn.addEventListener('click', () => {
|
||||||
const rawHtml = content.innerHTML || '';
|
const rawHtml = content.innerHTML || '';
|
||||||
const html = sanitizeInlineHtml(rawHtml, content.textContent || '');
|
const html = sanitizeInlineHtml(rawHtml, content.textContent || '');
|
||||||
|
component.__bridgeRteLastContent = html;
|
||||||
applyContentToComponent(editor, component, html);
|
applyContentToComponent(editor, component, html);
|
||||||
closeModal();
|
closeModal();
|
||||||
});
|
});
|
||||||
@@ -341,6 +339,20 @@
|
|||||||
if (!actions.includes('bridge-open-richtext')) actions.push('bridge-open-richtext');
|
if (!actions.includes('bridge-open-richtext')) actions.push('bridge-open-richtext');
|
||||||
cfg.richTextEditor.actions = actions;
|
cfg.richTextEditor.actions = actions;
|
||||||
|
|
||||||
|
const restoreIfCollapsed = (model) => {
|
||||||
|
if (!model || model.__bridgeRteRestoring) return;
|
||||||
|
const last = model.__bridgeRteLastContent;
|
||||||
|
if (!last || !model.get) return;
|
||||||
|
const current = String(model.get('content') || '').trim();
|
||||||
|
if (!current || current === '<div></div>' || current === '<div><br></div>' || current === '<div><br></div><br>') {
|
||||||
|
model.__bridgeRteRestoring = true;
|
||||||
|
applyContentToComponent(editor, model, last);
|
||||||
|
model.__bridgeRteRestoring = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
editor.on('component:update', (model) => restoreIfCollapsed(model));
|
||||||
|
editor.on('component:input', (model) => restoreIfCollapsed(model));
|
||||||
editor.on('component:selected', (model) => ensureTextToolbarButton(model));
|
editor.on('component:selected', (model) => ensureTextToolbarButton(model));
|
||||||
editor.on('component:add', (model) => ensureTextToolbarButton(model));
|
editor.on('component:add', (model) => ensureTextToolbarButton(model));
|
||||||
editor.on('component:dblclick', (model) => {
|
editor.on('component:dblclick', (model) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user