asdsad
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.1.78
|
1.1.79
|
||||||
@@ -484,7 +484,6 @@
|
|||||||
}
|
}
|
||||||
if (component && component.view && component.view.el) {
|
if (component && component.view && component.view.el) {
|
||||||
const viewEl = component.view.el;
|
const viewEl = component.view.el;
|
||||||
const hasInline = /<span\b|style\s*=/i.test(htmlSource);
|
|
||||||
const inlineComputedStyles = (sourceEl) => {
|
const inlineComputedStyles = (sourceEl) => {
|
||||||
try {
|
try {
|
||||||
const docRef = sourceEl.ownerDocument || document;
|
const docRef = sourceEl.ownerDocument || document;
|
||||||
@@ -532,38 +531,36 @@
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (!hasInline) {
|
const inlined = inlineComputedStyles(viewEl);
|
||||||
const inlined = inlineComputedStyles(viewEl);
|
if (inlined) {
|
||||||
if (inlined) {
|
htmlSource = inlined;
|
||||||
htmlSource = inlined;
|
} else {
|
||||||
} else {
|
try {
|
||||||
try {
|
const cs = (viewEl.ownerDocument || document).defaultView.getComputedStyle(viewEl);
|
||||||
const cs = (viewEl.ownerDocument || document).defaultView.getComputedStyle(viewEl);
|
const styles = [];
|
||||||
const styles = [];
|
const pushStyle = (prop, val) => {
|
||||||
const pushStyle = (prop, val) => {
|
if (val) styles.push(`${prop}:${val}`);
|
||||||
if (val) styles.push(`${prop}:${val}`);
|
};
|
||||||
};
|
pushStyle('font-family', cs.fontFamily);
|
||||||
pushStyle('font-family', cs.fontFamily);
|
pushStyle('font-size', cs.fontSize);
|
||||||
pushStyle('font-size', cs.fontSize);
|
pushStyle('font-weight', cs.fontWeight);
|
||||||
pushStyle('font-weight', cs.fontWeight);
|
pushStyle('font-style', cs.fontStyle);
|
||||||
pushStyle('font-style', cs.fontStyle);
|
if (cs.textDecorationLine && cs.textDecorationLine !== 'none') {
|
||||||
if (cs.textDecorationLine && cs.textDecorationLine !== 'none') {
|
pushStyle('text-decoration', cs.textDecorationLine);
|
||||||
pushStyle('text-decoration', cs.textDecorationLine);
|
}
|
||||||
}
|
if (cs.textAlign && cs.textAlign !== 'start') {
|
||||||
if (cs.textAlign && cs.textAlign !== 'start') {
|
pushStyle('text-align', cs.textAlign);
|
||||||
pushStyle('text-align', cs.textAlign);
|
}
|
||||||
}
|
if (cs.lineHeight && cs.lineHeight !== 'normal') {
|
||||||
if (cs.lineHeight && cs.lineHeight !== 'normal') {
|
pushStyle('line-height', cs.lineHeight);
|
||||||
pushStyle('line-height', cs.lineHeight);
|
}
|
||||||
}
|
if (cs.color) {
|
||||||
if (cs.color) {
|
pushStyle('color', cs.color);
|
||||||
pushStyle('color', cs.color);
|
}
|
||||||
}
|
if (styles.length) {
|
||||||
if (styles.length) {
|
htmlSource = `<span style="${styles.join(';')}">${htmlSource}</span>`;
|
||||||
htmlSource = `<span style="${styles.join(';')}">${htmlSource}</span>`;
|
}
|
||||||
}
|
} catch {}
|
||||||
} catch {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const initialHtml = this.sanitizeInlineHtml(htmlSource, modelContent || '');
|
const initialHtml = this.sanitizeInlineHtml(htmlSource, modelContent || '');
|
||||||
|
|||||||
Reference in New Issue
Block a user