This commit is contained in:
2026-01-16 01:06:58 +01:00
parent ac7dd71a65
commit 97fb2bb860

View File

@@ -617,6 +617,16 @@
if (!editor || !editor.RichTextEditor) return;
const rte = editor.RichTextEditor;
const icon = (path) => `<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="${path}" fill="currentColor"/></svg>`;
const logRteBlur = (label, detail) => {
const msg = `[RTE BLUR] ${label}${detail ? ' | ' + detail : ''}`;
try { console.log(msg); } catch {}
log('RTE BLUR', msg, '#888');
try {
if (window.parent && window.parent !== window) {
window.parent.postMessage({ source: 'bridge-core', type: 'rte-blur', detail: msg }, '*');
}
} catch {}
};
const resolveFontOptions = () => (B.RTE_FONTS && Array.isArray(B.RTE_FONTS) && B.RTE_FONTS.length)
? B.RTE_FONTS
: [
@@ -739,13 +749,28 @@
openRichTextModal(editor, selected);
}
}, true);
const blurHandler = (evt) => {
const target = evt && evt.target;
if (!target) return;
const isEditable = !!(target.isContentEditable || (target.getAttribute && target.getAttribute('contenteditable') === 'true'));
if (!isEditable) return;
let contentInfo = '';
try {
const selected = editor.getSelected && editor.getSelected();
const content = selected && selected.get ? selected.get('content') : '';
contentInfo = String(content || '').trim() ? 'Content vorhanden' : 'Content leer';
} catch {}
logRteBlur('contenteditable blur', contentInfo);
};
body.addEventListener('blur', blurHandler, true);
body.addEventListener('focusout', blurHandler, true);
});
editor.on('rte:disable', (model) => {
const target = model || (editor.getSelected && editor.getSelected());
if (!isTextLike(target)) return;
const content = target && target.get ? target.get('content') : '';
const msg = String(content || '').trim() ? 'Content vorhanden' : 'Content leer';
log('RTE BLUR', `rte:disable fuer Text-Komponente: ${msg}`, '#888');
logRteBlur('rte:disable fuer Text-Komponente', msg);
});
};