This commit is contained in:
2026-01-31 00:55:46 +01:00
parent ca175cd858
commit 68f486236a
2 changed files with 69 additions and 4 deletions

View File

@@ -1 +1 @@
1.1.66 1.1.67

View File

@@ -857,6 +857,9 @@
container: '#gjs', container: '#gjs',
height: '100vh', height: '100vh',
noticeOnUnload: 0, noticeOnUnload: 0,
richTextEditor: {
actions: ['bold', 'italic', 'underline'],
},
// 🛑 KRITISCHE KORREKTUR: storageManager aktivieren und konfigurieren // 🛑 KRITISCHE KORREKTUR: storageManager aktivieren und konfigurieren
storageManager: storageConf, storageManager: storageConf,
@@ -906,6 +909,56 @@
} catch {} } catch {}
}; };
const INLINE_RTE_ALLOWED = ['bold', 'italic', 'underline', 'placeholder', 'bridge-placeholder', 'bridge-placeholder:edit'];
const INLINE_RTE_ALLOWED_TEXT = ['bold', 'italic', 'underline', 'fett', 'kursiv', 'unterstrichen', 'placeholder'];
const getInlineRteDoc = (editor) => {
try {
if (editor && editor.Canvas && typeof editor.Canvas.getDocument === 'function') {
return editor.Canvas.getDocument();
}
} catch {}
return document;
};
const pruneInlineRteToolbar = (editor) => {
try {
const doc = getInlineRteDoc(editor);
if (!doc || !doc.querySelectorAll) return;
const bars = doc.querySelectorAll(
'.gjs-rte-actionbar,.gjs-rte-toolbar,[class*="rte-actionbar"],[class*="rte-toolbar"]'
);
bars.forEach((bar) => {
const buttons = bar.querySelectorAll('[data-command],[data-action],[data-id],button,a,span');
buttons.forEach((btn) => {
const raw =
btn.getAttribute('data-command') ||
btn.getAttribute('data-action') ||
btn.getAttribute('data-id') ||
btn.getAttribute('data-title') ||
btn.getAttribute('aria-label') ||
btn.title ||
btn.textContent ||
'';
const value = String(raw).toLowerCase().trim();
if (!value) return;
if (INLINE_RTE_ALLOWED.some((key) => value.includes(key))) return;
if (INLINE_RTE_ALLOWED_TEXT.some((key) => value.includes(key))) return;
if (btn.className && String(btn.className).toLowerCase().includes('placeholder')) return;
const actionEl = btn.closest('[class*="rte-action"],.gjs-rte-action');
(actionEl || btn).remove();
});
});
} catch {}
};
const ensureInlineRtePruneObserver = (editor) => {
try {
const doc = getInlineRteDoc(editor);
if (!doc || doc.__bridgeInlineRteObserver) return;
const observer = new MutationObserver(() => pruneInlineRteToolbar(editor));
observer.observe(doc.body || doc.documentElement, { childList: true, subtree: true });
doc.__bridgeInlineRteObserver = observer;
} catch {}
};
const ensureCommandStubs = (editor) => { const ensureCommandStubs = (editor) => {
if (!editor || !editor.Commands || !editor.Commands.add) return; if (!editor || !editor.Commands || !editor.Commands.add) return;
editor.Commands.add('bridge-placeholder:edit', { editor.Commands.add('bridge-placeholder:edit', {
@@ -969,10 +1022,22 @@
setupPlainTextPreserver(ed); setupPlainTextPreserver(ed);
} }
configureInlineRte(ed); configureInlineRte(ed);
pruneInlineRteToolbar(ed);
ensureInlineRtePruneObserver(ed);
if (ed && ed.on) { if (ed && ed.on) {
ed.on('load', () => configureInlineRte(ed)); ed.on('load', () => {
ed.on('rte:custom', () => configureInlineRte(ed)); configureInlineRte(ed);
ed.on('rte:enable', () => configureInlineRte(ed)); pruneInlineRteToolbar(ed);
ensureInlineRtePruneObserver(ed);
});
ed.on('rte:custom', () => {
configureInlineRte(ed);
pruneInlineRteToolbar(ed);
});
ed.on('rte:enable', () => {
configureInlineRte(ed);
pruneInlineRteToolbar(ed);
});
} }
setupBlurLogger(ed); setupBlurLogger(ed);
loadDynamicFonts(); loadDynamicFonts();