@hailin-zheng/editor-core 2.1.22 → 2.1.23

Sign up to get free protection for your applications and to get access to all the features.
package/index-cjs.js CHANGED
@@ -4678,7 +4678,9 @@ class TableRowElement extends BlockContainerElement {
4678
4678
  }
4679
4679
  }
4680
4680
  createRenderObject() {
4681
- return new TableRowRenderObject(this);
4681
+ const rowRender = new TableRowRenderObject(this);
4682
+ rowRender.minHeight = this.props.minHeight;
4683
+ return rowRender;
4682
4684
  }
4683
4685
  serialize(viewOptions) {
4684
4686
  return {
@@ -4711,10 +4713,13 @@ class TableRowRenderObject extends MuiltBlockLineRenderObject {
4711
4713
  remeasureState = true;
4712
4714
  //当前行是否存在合并单元格
4713
4715
  hasMergeCells = undefined;
4716
+ //行最小高度,用于标记当前行临时的最小高度状态
4717
+ minHeight = -1;
4714
4718
  clone() {
4715
4719
  const cloneRender = new TableRowRenderObject(this.element);
4716
4720
  cloneRender.remeasureState = this.remeasureState;
4717
4721
  cloneRender.hasMergeCells = this.hasMergeCells;
4722
+ cloneRender.minHeight = this.minHeight;
4718
4723
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
4719
4724
  for (let i = 0; i < this.length; i++) {
4720
4725
  cloneRender.addChild(this.getChild(i).clone());
@@ -11100,7 +11105,7 @@ class ElementUtil {
11100
11105
  canvas.style.height = scaleHeight + 'px';
11101
11106
  canvas.width = scaleWidth * dpr;
11102
11107
  canvas.height = scaleHeight * dpr;
11103
- ctx.textBaseline = 'top';
11108
+ //ctx.textBaseline = 'top';
11104
11109
  ctx.scale(dpr, dpr);
11105
11110
  }
11106
11111
  // static setOffscreenCanvas(canvas: OffscreenCanvas, ctx: OffscreenCanvasRenderingContext2D, viewOptions: { width: number, height: number }, scale: number = 1): void {
@@ -11250,8 +11255,7 @@ class ElementUtil {
11250
11255
  return innerRect.height;
11251
11256
  }
11252
11257
  static remeasureTableRow(rowRender, forceColIndex = -1) {
11253
- const rowEle = rowRender.element;
11254
- let maxCellHeight = rowEle.props.minHeight > 20 ? rowEle.props.minHeight : 20;
11258
+ let maxCellHeight = rowRender.minHeight > 20 ? rowRender.minHeight : 20;
11255
11259
  //限制行最小高度
11256
11260
  maxCellHeight = maxCellHeight < 20 ? 20 : maxCellHeight;
11257
11261
  //获取行内非纵向合并单元格的最高单元格高度
@@ -12799,6 +12803,13 @@ class ElementUtil {
12799
12803
  }
12800
12804
  }
12801
12805
 
12806
+ exports.TextUnitsHolder = void 0;
12807
+ (function (TextUnitsHolder) {
12808
+ TextUnitsHolder[TextUnitsHolder["char"] = 0] = "char";
12809
+ TextUnitsHolder[TextUnitsHolder["sourceSize"] = 1] = "sourceSize";
12810
+ TextUnitsHolder[TextUnitsHolder["actualSize"] = 2] = "actualSize";
12811
+ TextUnitsHolder[TextUnitsHolder["actualBoundingBoxAscent"] = 3] = "actualBoundingBoxAscent";
12812
+ })(exports.TextUnitsHolder || (exports.TextUnitsHolder = {}));
12802
12813
  class RenderContext {
12803
12814
  mainContext;
12804
12815
  contentContext;
@@ -15014,13 +15025,15 @@ class DocumentArrange {
15014
15025
  let currRow = rows[j];
15015
15026
  const cutRows = [];
15016
15027
  while (currRow) {
15017
- const minHeight = currRow.element.props.minHeight;
15028
+ const minHeight = currRow.minHeight;
15018
15029
  const rowContentHeight = this.getBlockLineHeight(currRow);
15019
15030
  if (rowContentHeight + sumHeight > limitHeight) {
15020
15031
  //行存在最小高度,且当前行内容的高度小于最小高度,且当前行跨页的情况下,不截断该行
15021
15032
  if (minHeight > 0 && minHeight > rowContentHeight) {
15022
15033
  break;
15023
15034
  }
15035
+ //设定最小高度不生效
15036
+ currRow.minHeight = -1;
15024
15037
  //限制的外框尺寸
15025
15038
  const availHeight = limitHeight - sumHeight;
15026
15039
  const limitRenderInnerHeight = ElementUtil.innerRectMaxHeight(tbRender, availHeight);
@@ -15071,6 +15084,9 @@ class DocumentArrange {
15071
15084
  // }
15072
15085
  render.remeasureState = true;
15073
15086
  const cloneRowRender = render.element.createRenderObject();
15087
+ if (cloneRowRender.minHeight > 0 && render.minHeight <= 0) {
15088
+ cloneRowRender.minHeight = render.minHeight;
15089
+ }
15074
15090
  cloneRowRender.rect.width = render.rect.width;
15075
15091
  //cloneRowRender.rect.maxWidth = render.rect.height;
15076
15092
  const cellRenders = [...render.getItems()];
@@ -27849,7 +27865,7 @@ class DocEditor {
27849
27865
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
27850
27866
  }
27851
27867
  version() {
27852
- return "2.1.22";
27868
+ return "2.1.23";
27853
27869
  }
27854
27870
  switchPageHeaderEditor() {
27855
27871
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);