adsad
This commit is contained in:
@@ -857,6 +857,9 @@
|
||||
container: '#gjs',
|
||||
height: '100vh',
|
||||
noticeOnUnload: 0,
|
||||
richTextEditor: {
|
||||
actions: ['bold', 'italic', 'underline'],
|
||||
},
|
||||
|
||||
// 🛑 KRITISCHE KORREKTUR: storageManager aktivieren und konfigurieren
|
||||
storageManager: storageConf,
|
||||
@@ -906,6 +909,56 @@
|
||||
} 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) => {
|
||||
if (!editor || !editor.Commands || !editor.Commands.add) return;
|
||||
editor.Commands.add('bridge-placeholder:edit', {
|
||||
@@ -969,10 +1022,22 @@
|
||||
setupPlainTextPreserver(ed);
|
||||
}
|
||||
configureInlineRte(ed);
|
||||
pruneInlineRteToolbar(ed);
|
||||
ensureInlineRtePruneObserver(ed);
|
||||
if (ed && ed.on) {
|
||||
ed.on('load', () => configureInlineRte(ed));
|
||||
ed.on('rte:custom', () => configureInlineRte(ed));
|
||||
ed.on('rte:enable', () => configureInlineRte(ed));
|
||||
ed.on('load', () => {
|
||||
configureInlineRte(ed);
|
||||
pruneInlineRteToolbar(ed);
|
||||
ensureInlineRtePruneObserver(ed);
|
||||
});
|
||||
ed.on('rte:custom', () => {
|
||||
configureInlineRte(ed);
|
||||
pruneInlineRteToolbar(ed);
|
||||
});
|
||||
ed.on('rte:enable', () => {
|
||||
configureInlineRte(ed);
|
||||
pruneInlineRteToolbar(ed);
|
||||
});
|
||||
}
|
||||
setupBlurLogger(ed);
|
||||
loadDynamicFonts();
|
||||
|
||||
Reference in New Issue
Block a user