@hailin-zheng/editor-core 1.0.60 → 1.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1416,6 +1416,7 @@ class ViewOptions {
1416
1416
  viewBackcolor = 'rgb(230,230,230)';
1417
1417
  paraSymbolColor = 'rgb(128,128,128)';
1418
1418
  dataGroupColor = 'rgb(0,80,179)';
1419
+ defaultLineHeight = 1.3;
1419
1420
  //新增-留痕块文本颜色
1420
1421
  trackInsColor = '#ff4d4f';
1421
1422
  //删除-留痕块文本颜色
@@ -1753,7 +1754,7 @@ class ParagraphProps extends INotifyPropertyChanged {
1753
1754
  if (this.hanging) {
1754
1755
  props["hanging"] = this.hanging;
1755
1756
  }
1756
- if (this.lineHeight && this.lineHeight !== 1.3) {
1757
+ if (this.lineHeight && this.lineHeight !== viewOptions.defaultLineHeight) {
1757
1758
  props["lineHeight"] = this.lineHeight;
1758
1759
  }
1759
1760
  if (this.textAlign && this.textAlign !== "left") {
@@ -3384,7 +3385,7 @@ class ParagraphFactory extends ElementFactory {
3384
3385
  paraElement.props.hanging = props?.hanging ?? 0;
3385
3386
  paraElement.props.textAlign = props?.textAlign ?? 'left';
3386
3387
  paraElement.props.numberType = props?.numberType ?? -1;
3387
- paraElement.props.lineHeight = props?.lineHeight ?? 1.3;
3388
+ paraElement.props.lineHeight = props?.lineHeight ?? this.options.defaultLineHeight;
3388
3389
  paraElement.props.pageBreak = props?.pageBreak ?? false;
3389
3390
  return paraElement;
3390
3391
  }
@@ -10065,7 +10066,7 @@ class ElementMeasure {
10065
10066
  const innerLineRect = innerLineRects[i];
10066
10067
  innerLineRect.rect.x = this.getParaLineRectStartX(innerLineRects.length, i, paragraph, render, innerLineRect);
10067
10068
  //限制最大行高
10068
- const maxLineHeight = Math.floor(14 * 1.3);
10069
+ const maxLineHeight = paragraph.props.lineHeight !== this.options.defaultLineHeight ? 100 : Math.floor(14 * 2);
10069
10070
  //fillLineHeight填充行高
10070
10071
  let fillLineHeight = Math.ceil(innerLineRect.rect.height * (paragraph.props.lineHeight - 1));
10071
10072
  fillLineHeight = fillLineHeight > maxLineHeight ? maxLineHeight : fillLineHeight;