Schriftartformatierung
This commit is contained in:
@@ -424,7 +424,20 @@
|
||||
|
||||
const modelContent = (component.get && component.get('content')) || '';
|
||||
const viewHtml = (component.view && component.view.el && component.view.el.innerHTML) || '';
|
||||
let htmlSource = viewHtml || modelContent || '';
|
||||
const pickHtmlSource = (view, model) => {
|
||||
const v = String(view || '');
|
||||
const m = String(model || '');
|
||||
if (!v && m) return m;
|
||||
if (!m) return v;
|
||||
const vHasSpan = /<span\b/i.test(v);
|
||||
const mHasSpan = /<span\b/i.test(m);
|
||||
const vHasStyle = /\sstyle\s*=/i.test(v);
|
||||
const mHasStyle = /\sstyle\s*=/i.test(m);
|
||||
if ((!vHasSpan && mHasSpan) || (!vHasStyle && mHasStyle)) return m;
|
||||
if (m.length > v.length + 20) return m;
|
||||
return v;
|
||||
};
|
||||
let htmlSource = pickHtmlSource(viewHtml, modelContent) || '';
|
||||
if (!htmlSource && component && typeof component.toHTML === 'function') {
|
||||
try {
|
||||
const fullHtml = String(component.toHTML() || '');
|
||||
|
||||
Reference in New Issue
Block a user