@hailin-zheng/editor-core 1.1.14 → 1.1.16

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
@@ -1308,6 +1308,7 @@ class BranchElement extends Element {
1308
1308
  }
1309
1309
  }
1310
1310
  function clearChildrenRenderCache(ele) {
1311
+ ele.cacheRender = null;
1311
1312
  for (let i = 0; i < ele.length; i++) {
1312
1313
  const curr = ele.getChild(i);
1313
1314
  curr.cacheRender = null;
@@ -3934,12 +3935,33 @@ class TableRowElement extends BlockContainerElement {
3934
3935
  //在差异更新中,由于行内单元格存在合并行的情况,需要将当前行内存在合并的单元格,将其修改标志改为修改
3935
3936
  const changeSub = this.onChangeSubject.subscribe(() => {
3936
3937
  if (this.modifyFlag === ModifyFlag$1.Track) {
3937
- //this.checkRowModifyState();
3938
+ this.checkRowModifyState();
3938
3939
  this.pubOnChange('to-child');
3939
3940
  }
3940
3941
  });
3941
3942
  this.addsubscribe(this, changeSub);
3942
3943
  }
3944
+ /**
3945
+ * 解决纵向合并行的行缓存高度bug
3946
+ * @private
3947
+ */
3948
+ checkRowModifyState() {
3949
+ const tb = ElementUtil.getParentByType(this, TableElement);
3950
+ if (!tb) {
3951
+ return;
3952
+ }
3953
+ const currRowIndex = this.getIndex();
3954
+ for (let i = 0; i < this.length; i++) {
3955
+ const cell = this.getChild(i);
3956
+ if (cell.props.vMerge === 'continue') {
3957
+ const endRowIndex = TableUtil.getVMergeEndIndex(tb, currRowIndex, i);
3958
+ const startRowIndex = TableUtil.getVMergeStartIndex(tb, currRowIndex, i);
3959
+ for (let j = startRowIndex; j <= endRowIndex; j++) {
3960
+ clearChildrenRenderCache(tb.getChild(j));
3961
+ }
3962
+ }
3963
+ }
3964
+ }
3943
3965
  createRenderObject() {
3944
3966
  return new TableRowRenderObject(this);
3945
3967
  }
@@ -5114,7 +5136,7 @@ class TextGroupElement extends LeafElement {
5114
5136
  * @param format
5115
5137
  */
5116
5138
  setFormat(format) {
5117
- formatEle(this, format);
5139
+ //History.formatEle(this, format);
5118
5140
  Object.keys(format).forEach(key => {
5119
5141
  this.props[key] = format[key];
5120
5142
  });
@@ -9224,7 +9246,9 @@ class TableSplitCell {
9224
9246
  if (rows === 1 && cols === 1) {
9225
9247
  return;
9226
9248
  }
9249
+ //获取当前单元格
9227
9250
  const focusCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
9251
+ //获取当前行
9228
9252
  const focusRow = ElementUtil.getParentByType(focusCell, TableRowElement);
9229
9253
  const tb = ElementUtil.getParentByType(focusRow, TableElement);
9230
9254
  if (!focusCell || !focusRow || !tb) {
@@ -9240,7 +9264,7 @@ class TableSplitCell {
9240
9264
  const mergeCols = this.getHMergeColsCount(tb, focusRowIndex, focusCellIndex);
9241
9265
  //只有拆分的行数需要满足此条件
9242
9266
  if (mergeRows > 1 && rows > 1) {
9243
- if (rows % mergeRows !== 0) {
9267
+ if (mergeRows % rows !== 0) {
9244
9268
  throw new Error(`当前合并的行数为:${mergeRows},当前可拆分的行数是${mergeRows}的约数`);
9245
9269
  }
9246
9270
  }