From 025c6835abb01cdadc8d8abfe902292622cac4ae Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Sun, 1 Feb 2026 00:50:04 +0100 Subject: [PATCH] font , correction p --- config/current.ver | 2 +- public/assets/js/bridge/rte-editor.js | 35 +++++++++++++++------------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/config/current.ver b/config/current.ver index cd03ed9..38e6647 100644 --- a/config/current.ver +++ b/config/current.ver @@ -1 +1 @@ -1.1.79 \ No newline at end of file +1.1.80 \ No newline at end of file diff --git a/public/assets/js/bridge/rte-editor.js b/public/assets/js/bridge/rte-editor.js index fedb024..47617a0 100644 --- a/public/assets/js/bridge/rte-editor.js +++ b/public/assets/js/bridge/rte-editor.js @@ -499,25 +499,28 @@ 'line-height', 'color', ]; + const styleTags = new Set(['SPAN', 'B', 'STRONG', 'I', 'EM', 'U', 'A', 'SUB', 'SUP']); const walk = (orig, copy) => { if (!orig || !copy) return; if (orig.nodeType === 1 && copy.nodeType === 1) { - const cs = winRef.getComputedStyle(orig); - let style = copy.getAttribute('style') || ''; - const hasStyle = (name) => new RegExp(`${name}\\s*:`, 'i').test(style); - const pushStyle = (name, value) => { - if (!value || hasStyle(name)) return; - style += `${style && !style.trim().endsWith(';') ? ';' : ''}${name}:${value};`; - }; - props.forEach((prop) => { - let value = cs.getPropertyValue(prop); - if (!value) return; - if (prop === 'text-decoration-line' && value === 'none') return; - if (prop === 'text-align' && value === 'start') return; - if (prop === 'line-height' && value === 'normal') return; - pushStyle(prop === 'text-decoration-line' ? 'text-decoration' : prop, value.trim()); - }); - if (style) copy.setAttribute('style', style.trim()); + if (styleTags.has(orig.tagName) && orig.getAttribute('data-gjs-type') !== 'default') { + const cs = winRef.getComputedStyle(orig); + let style = copy.getAttribute('style') || ''; + const hasStyle = (name) => new RegExp(`${name}\\s*:`, 'i').test(style); + const pushStyle = (name, value) => { + if (!value || hasStyle(name)) return; + style += `${style && !style.trim().endsWith(';') ? ';' : ''}${name}:${value};`; + }; + props.forEach((prop) => { + let value = cs.getPropertyValue(prop); + if (!value) return; + if (prop === 'text-decoration-line' && value === 'none') return; + if (prop === 'text-align' && value === 'start') return; + if (prop === 'line-height' && value === 'normal') return; + pushStyle(prop === 'text-decoration-line' ? 'text-decoration' : prop, value.trim()); + }); + if (style) copy.setAttribute('style', style.trim()); + } } const origChildren = orig.childNodes || []; const copyChildren = copy.childNodes || [];