Font 2
This commit is contained in:
@@ -482,6 +482,38 @@
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
if (component && component.view && component.view.el) {
|
||||
const viewEl = component.view.el;
|
||||
const hasInline = /<span\b|style\s*=/i.test(htmlSource);
|
||||
if (!hasInline) {
|
||||
try {
|
||||
const cs = (viewEl.ownerDocument || document).defaultView.getComputedStyle(viewEl);
|
||||
const styles = [];
|
||||
const pushStyle = (prop, val) => {
|
||||
if (val) styles.push(`${prop}:${val}`);
|
||||
};
|
||||
pushStyle('font-family', cs.fontFamily);
|
||||
pushStyle('font-size', cs.fontSize);
|
||||
pushStyle('font-weight', cs.fontWeight);
|
||||
pushStyle('font-style', cs.fontStyle);
|
||||
if (cs.textDecorationLine && cs.textDecorationLine !== 'none') {
|
||||
pushStyle('text-decoration', cs.textDecorationLine);
|
||||
}
|
||||
if (cs.textAlign && cs.textAlign !== 'start') {
|
||||
pushStyle('text-align', cs.textAlign);
|
||||
}
|
||||
if (cs.lineHeight && cs.lineHeight !== 'normal') {
|
||||
pushStyle('line-height', cs.lineHeight);
|
||||
}
|
||||
if (cs.color) {
|
||||
pushStyle('color', cs.color);
|
||||
}
|
||||
if (styles.length) {
|
||||
htmlSource = `<span style="${styles.join(';')}">${htmlSource}</span>`;
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
const initialHtml = this.sanitizeInlineHtml(htmlSource, modelContent || '');
|
||||
content.innerHTML = initialHtml;
|
||||
const existingStyle = component && component.get && component.get('style') ? component.get('style') : null;
|
||||
|
||||
Reference in New Issue
Block a user