@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.js CHANGED
@@ -652,7 +652,9 @@ function insertEle(ele) {
652
652
  // return;
653
653
  // }
654
654
  appendToOps(options.doc, ele, {
655
- insert: ele.clone(true)
655
+ //如果当前插入的为单元格,由于新插入的单元格,内部的内容没有补足,导致后续计算索引会出现问题
656
+ //之前为ele.clone(true);
657
+ insert: ele
656
658
  });
657
659
  }
658
660
  function removeEle(ele) {
@@ -672,15 +674,18 @@ function appendToOps(doc, ele, ops) {
672
674
  if (!array) {
673
675
  docOpsMap.set(doc, array = []);
674
676
  }
677
+ const log = getOpsLog(ele, ops);
678
+ array.push(log);
679
+ }
680
+ function getOpsLog(ele, ops) {
675
681
  const prevEle = ElementUtil.getPrevSiblingElement(ele);
676
- const log = {
682
+ return {
677
683
  index: ElementUtil.getControlIndex(ele, true),
678
684
  parentIndex: ElementUtil.getControlIndex(ele.parent, true),
679
685
  prevIndex: prevEle ? ElementUtil.getControlIndex(prevEle, true) : -1,
680
686
  ele,
681
687
  ops
682
688
  };
683
- array.push(log);
684
689
  }
685
690
  function inputText(ele, startIndex, input) {
686
691
  const options = getDocCtx(ele);
@@ -789,6 +794,13 @@ function generatePatch(doc) {
789
794
  }
790
795
  formatOpsMap.set(ele, op);
791
796
  }
797
+ if ('insert' in op.ops) {
798
+ op.ops.insert = ele.clone(true);
799
+ const log = getOpsLog(ele, op.ops);
800
+ op.index = log.index;
801
+ op.prevIndex = log.prevIndex;
802
+ op.parentIndex = log.parentIndex;
803
+ }
792
804
  patchs.push({ index: op.index, parentIndex: op.parentIndex, prevIndex: op.prevIndex, ops: op.ops });
793
805
  }
794
806
  //清空
@@ -1202,6 +1214,7 @@ class BranchElement extends Element {
1202
1214
  removeChildByIndex(index) {
1203
1215
  const child = this.chilren[index];
1204
1216
  if (child) {
1217
+ removeEle(child);
1205
1218
  this.chilren.splice(index, 1);
1206
1219
  this.disposeChild(child);
1207
1220
  }
@@ -5233,8 +5246,10 @@ class TableUtil {
5233
5246
  currCell.props.hMerge = null;
5234
5247
  }
5235
5248
  if (currCell !== startCell) {
5236
- cellContents.push(...ElementUtil.getChildrenElements(currCell));
5237
- currCell.clearItems();
5249
+ if (currCell.getChildLength() !== 2) {
5250
+ cellContents.push(...ElementUtil.getChildrenElements(currCell.clone(true)));
5251
+ currCell.clearItems();
5252
+ }
5238
5253
  }
5239
5254
  }
5240
5255
  }
@@ -12245,9 +12260,10 @@ class DocumentArrange {
12245
12260
  }
12246
12261
  }
12247
12262
  cutRowRenderItem(render, limitHeight) {
12248
- if (render.element.props.minHeight > 0 && render.rect.height > limitHeight) {
12249
- return null;
12250
- }
12263
+ //可能当前行的高度就超过了限制高度,且存在最小高度
12264
+ // if (render.element.props.minHeight > 0 && render.rect.height < limitHeight) {
12265
+ // return null;
12266
+ // }
12251
12267
  const cloneRowRender = render.element.createRenderObject();
12252
12268
  cloneRowRender.rect.width = render.rect.width;
12253
12269
  //cloneRowRender.rect.maxWidth = render.rect.height;