diff --git a/public/editor/bridge-core.js b/public/editor/bridge-core.js index a755fc7..85f6f1a 100644 --- a/public/editor/bridge-core.js +++ b/public/editor/bridge-core.js @@ -1096,6 +1096,41 @@ ensureTableTags(); }; + const setupBlurLogger = (editor) => { + if (!editor || !editor.Canvas || !editor.Canvas.getBody) return; + editor.on('canvas:frame:load', () => { + const body = editor.Canvas && editor.Canvas.getBody && editor.Canvas.getBody(); + if (!body || body.__bridgeBlurLoggerBound) return; + body.__bridgeBlurLoggerBound = true; + const logBlur = (evt) => { + const target = evt && evt.target; + if (!target) return; + const isEditable = !!(target.isContentEditable || (target.getAttribute && target.getAttribute('contenteditable') === 'true')); + if (!isEditable) return; + const selected = editor.getSelected && editor.getSelected(); + const selectedEl = selected && selected.view && selected.view.el; + const inSelected = !!(selectedEl && (selectedEl === target || selectedEl.contains(target))); + let modelContent = ''; + try { + modelContent = selected && selected.get ? String(selected.get('content') || '') : ''; + } catch {} + try { + console.warn('[BLUR LOG]', { + tag: target.tagName, + htmlLen: String(target.innerHTML || '').length, + textLen: String(target.textContent || '').length, + modelType: selected && selected.get ? selected.get('type') : undefined, + modelId: selected && (selected.getId ? selected.getId() : selected.get && selected.get('id')), + modelContentLen: modelContent.length, + inSelected, + }); + } catch {} + }; + body.addEventListener('blur', logBlur, true); + body.addEventListener('focusout', logBlur, true); + }); + }; + const loadDynamicFonts = async () => { try { const base = B.API_KERNEL_URL || '/api.php'; @@ -1181,32 +1216,37 @@ }, }); }; - ensureCommandStubs(ed); + if (!B.DISABLE_EDITOR_EXTENSIONS) { + ensureCommandStubs(ed); + } - try { - const textTags = ['p','span','div','br','b','strong','i','em','u','a','ul','ol','li']; - if (ed.Config) { - ed.Config.domComponents = ed.Config.domComponents || {}; - ed.Config.domComponents.textTags = textTags; + if (!B.DISABLE_EDITOR_EXTENSIONS) { + try { + const textTags = ['p','span','div','br','b','strong','i','em','u','a','ul','ol','li']; + if (ed.Config) { + ed.Config.domComponents = ed.Config.domComponents || {}; + ed.Config.domComponents.textTags = textTags; + } + if (ed.DomComponents && ed.DomComponents.getConfig) { + ed.DomComponents.getConfig().textTags = textTags; + } + if (ed.Parser && ed.Parser.getConfig) { + const parserCfg = ed.Parser.getConfig(); + parserCfg.textTags = textTags; + parserCfg.optionsHtml = parserCfg.optionsHtml || {}; + parserCfg.optionsHtml.textTags = textTags; + parserCfg.optionsHtml.keepEmptyTextNodes = true; + } + } catch (e) { + log('CORE WARN', `textTags Konfiguration fehlgeschlagen: ${e.message}`, 'orange', 'warn'); } - if (ed.DomComponents && ed.DomComponents.getConfig) { - ed.DomComponents.getConfig().textTags = textTags; - } - if (ed.Parser && ed.Parser.getConfig) { - const parserCfg = ed.Parser.getConfig(); - parserCfg.textTags = textTags; - parserCfg.optionsHtml = parserCfg.optionsHtml || {}; - parserCfg.optionsHtml.textTags = textTags; - parserCfg.optionsHtml.keepEmptyTextNodes = true; - } - } catch (e) { - log('CORE WARN', `textTags Konfiguration fehlgeschlagen: ${e.message}`, 'orange', 'warn'); } if (!B.DISABLE_EDITOR_EXTENSIONS) { setupTableBuilder(ed); + setupPlainTextPreserver(ed); } - setupPlainTextPreserver(ed); + setupBlurLogger(ed); loadDynamicFonts(); // Entfernt: jegliche Blur/RTE-Handler, die Inhalte verändern.