@hailin-zheng/editor-core 1.1.31 → 1.1.33

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-cjs.js CHANGED
@@ -681,7 +681,9 @@ function insertEle(ele) {
681
681
  // return;
682
682
  // }
683
683
  appendToOps(options.doc, ele, {
684
- insert: ele.clone(true)
684
+ //如果当前插入的为单元格,由于新插入的单元格,内部的内容没有补足,导致后续计算索引会出现问题
685
+ //之前为ele.clone(true);
686
+ insert: ele
685
687
  });
686
688
  }
687
689
  function removeEle(ele) {
@@ -701,15 +703,18 @@ function appendToOps(doc, ele, ops) {
701
703
  if (!array) {
702
704
  docOpsMap.set(doc, array = []);
703
705
  }
706
+ const log = getOpsLog(ele, ops);
707
+ array.push(log);
708
+ }
709
+ function getOpsLog(ele, ops) {
704
710
  const prevEle = ElementUtil.getPrevSiblingElement(ele);
705
- const log = {
711
+ return {
706
712
  index: ElementUtil.getControlIndex(ele, true),
707
713
  parentIndex: ElementUtil.getControlIndex(ele.parent, true),
708
714
  prevIndex: prevEle ? ElementUtil.getControlIndex(prevEle, true) : -1,
709
715
  ele,
710
716
  ops
711
717
  };
712
- array.push(log);
713
718
  }
714
719
  function inputText(ele, startIndex, input) {
715
720
  const options = getDocCtx(ele);
@@ -818,6 +823,13 @@ function generatePatch(doc) {
818
823
  }
819
824
  formatOpsMap.set(ele, op);
820
825
  }
826
+ if ('insert' in op.ops) {
827
+ op.ops.insert = ele.clone(true);
828
+ const log = getOpsLog(ele, op.ops);
829
+ op.index = log.index;
830
+ op.prevIndex = log.prevIndex;
831
+ op.parentIndex = log.parentIndex;
832
+ }
821
833
  patchs.push({ index: op.index, parentIndex: op.parentIndex, prevIndex: op.prevIndex, ops: op.ops });
822
834
  }
823
835
  //清空
@@ -1231,6 +1243,7 @@ class BranchElement extends Element {
1231
1243
  removeChildByIndex(index) {
1232
1244
  const child = this.chilren[index];
1233
1245
  if (child) {
1246
+ removeEle(child);
1234
1247
  this.chilren.splice(index, 1);
1235
1248
  this.disposeChild(child);
1236
1249
  }
@@ -5262,8 +5275,10 @@ class TableUtil {
5262
5275
  currCell.props.hMerge = null;
5263
5276
  }
5264
5277
  if (currCell !== startCell) {
5265
- cellContents.push(...ElementUtil.getChildrenElements(currCell));
5266
- currCell.clearItems();
5278
+ if (currCell.getChildLength() !== 2) {
5279
+ cellContents.push(...ElementUtil.getChildrenElements(currCell.clone(true)));
5280
+ currCell.clearItems();
5281
+ }
5267
5282
  }
5268
5283
  }
5269
5284
  }
@@ -12274,9 +12289,10 @@ class DocumentArrange {
12274
12289
  }
12275
12290
  }
12276
12291
  cutRowRenderItem(render, limitHeight) {
12277
- if (render.element.props.minHeight > 0 && render.rect.height > limitHeight) {
12278
- return null;
12279
- }
12292
+ //可能当前行的高度就超过了限制高度,且存在最小高度
12293
+ // if (render.element.props.minHeight > 0 && render.rect.height < limitHeight) {
12294
+ // return null;
12295
+ // }
12280
12296
  const cloneRowRender = render.element.createRenderObject();
12281
12297
  cloneRowRender.rect.width = render.rect.width;
12282
12298
  //cloneRowRender.rect.maxWidth = render.rect.height;