From 68f486236ab50f30c6959eaae278ef0287bdb357 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Sat, 31 Jan 2026 00:55:46 +0100 Subject: [PATCH] adsad --- config/current.ver | 2 +- public/editor/bridge-core.js | 71 ++++++++++++++++++++++++++++++++++-- 2 files changed, 69 insertions(+), 4 deletions(-) diff --git a/config/current.ver b/config/current.ver index 54c1137..3ec33c0 100644 --- a/config/current.ver +++ b/config/current.ver @@ -1 +1 @@ -1.1.66 \ No newline at end of file +1.1.67 \ No newline at end of file diff --git a/public/editor/bridge-core.js b/public/editor/bridge-core.js index c1158d7..d06b21c 100644 --- a/public/editor/bridge-core.js +++ b/public/editor/bridge-core.js @@ -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();