font , correction p

This commit is contained in:
2026-02-01 00:50:04 +01:00
parent 45789e8ad2
commit 025c6835ab
2 changed files with 20 additions and 17 deletions

View File

@@ -1 +1 @@
1.1.79 1.1.80

View File

@@ -499,25 +499,28 @@
'line-height', 'line-height',
'color', 'color',
]; ];
const styleTags = new Set(['SPAN', 'B', 'STRONG', 'I', 'EM', 'U', 'A', 'SUB', 'SUP']);
const walk = (orig, copy) => { const walk = (orig, copy) => {
if (!orig || !copy) return; if (!orig || !copy) return;
if (orig.nodeType === 1 && copy.nodeType === 1) { if (orig.nodeType === 1 && copy.nodeType === 1) {
const cs = winRef.getComputedStyle(orig); if (styleTags.has(orig.tagName) && orig.getAttribute('data-gjs-type') !== 'default') {
let style = copy.getAttribute('style') || ''; const cs = winRef.getComputedStyle(orig);
const hasStyle = (name) => new RegExp(`${name}\\s*:`, 'i').test(style); let style = copy.getAttribute('style') || '';
const pushStyle = (name, value) => { const hasStyle = (name) => new RegExp(`${name}\\s*:`, 'i').test(style);
if (!value || hasStyle(name)) return; const pushStyle = (name, value) => {
style += `${style && !style.trim().endsWith(';') ? ';' : ''}${name}:${value};`; if (!value || hasStyle(name)) return;
}; style += `${style && !style.trim().endsWith(';') ? ';' : ''}${name}:${value};`;
props.forEach((prop) => { };
let value = cs.getPropertyValue(prop); props.forEach((prop) => {
if (!value) return; let value = cs.getPropertyValue(prop);
if (prop === 'text-decoration-line' && value === 'none') return; if (!value) return;
if (prop === 'text-align' && value === 'start') return; if (prop === 'text-decoration-line' && value === 'none') return;
if (prop === 'line-height' && value === 'normal') return; if (prop === 'text-align' && value === 'start') return;
pushStyle(prop === 'text-decoration-line' ? 'text-decoration' : prop, value.trim()); 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 (style) copy.setAttribute('style', style.trim());
}
} }
const origChildren = orig.childNodes || []; const origChildren = orig.childNodes || [];
const copyChildren = copy.childNodes || []; const copyChildren = copy.childNodes || [];