|
|
@@ -849,6 +849,25 @@ export default {
|
|
|
this.isAllSetting = false;
|
|
|
}
|
|
|
|
|
|
+ let _fontSize = styles['font-size'] ? styles['font-size'] : null;
|
|
|
+ if (!_fontSize) _fontSize = block.styleObj && block.styleObj.fontSize ? block.styleObj.fontSize : null;
|
|
|
+ if (!_fontSize && this.bodyStyles.fontSize) _fontSize = this.bodyStyles.fontSize;
|
|
|
+
|
|
|
+ if (_fontSize) {
|
|
|
+ // 取出字号里面的数字,做计算处理之后,自动加上原来的单位
|
|
|
+ const fontSizeMatch = _fontSize.match(/^([\d.]+)(\D*)$/);
|
|
|
+ if (fontSizeMatch) {
|
|
|
+ const fontSizeValue = parseFloat(fontSizeMatch[1]);
|
|
|
+ const fontSizeUnit = fontSizeMatch[2] || 'px';
|
|
|
+
|
|
|
+ // 根据字号大小确定比例:16号及以下75%,16号以上60%
|
|
|
+ const ratio = fontSizeValue <= 16 ? 0.75 : 0.6;
|
|
|
+ const calculatedSize = Math.round(fontSizeValue * ratio);
|
|
|
+
|
|
|
+ // 保留原始单位
|
|
|
+ styles['font-size'] = `${calculatedSize}${fontSizeUnit}`;
|
|
|
+ }
|
|
|
+ }
|
|
|
// 明确重置不应该继承的样式
|
|
|
styles['text-decoration'] = 'none';
|
|
|
styles['font-style'] = 'normal';
|