@hailin-zheng/editor-core 1.1.29 → 1.1.30

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
@@ -673,13 +673,18 @@ function appendToOps(doc, ele, ops) {
673
673
  docOpsMap.set(doc, array = []);
674
674
  }
675
675
  const prevEle = ElementUtil.getPrevSiblingElement(ele);
676
- array.push({
676
+ const log = {
677
677
  index: ElementUtil.getControlIndex(ele, true),
678
678
  parentIndex: ElementUtil.getControlIndex(ele.parent, true),
679
679
  prevIndex: prevEle ? ElementUtil.getControlIndex(prevEle, true) : -1,
680
680
  ele,
681
681
  ops
682
- });
682
+ };
683
+ if (log.prevIndex === -1) {
684
+ const nextEle = ElementUtil.getNextSiblingElement(ele);
685
+ log.nextIndex = nextEle ? ElementUtil.getControlIndex(nextEle, true) : -1;
686
+ }
687
+ array.push(log);
683
688
  }
684
689
  function inputText(ele, startIndex, input) {
685
690
  const options = getDocCtx(ele);
@@ -3831,7 +3836,7 @@ class TableCellElement extends BlockContainerElement {
3831
3836
  }
3832
3837
  beginMeasure(data) {
3833
3838
  //不被合并的单元格
3834
- if (!this.length && this.isNotBeMergedCell()) {
3839
+ if (!this.length) {
3835
3840
  this.addChild(data.createParaFn());
3836
3841
  }
3837
3842
  super.beginMeasure(data);
@@ -5105,7 +5110,7 @@ class TableUtil {
5105
5110
  const hMergeEndIndex = this.getHMergeEndIndex(tb, i, colIndex);
5106
5111
  if (hMergeEndIndex > colIndex) {
5107
5112
  const nextCell = row.getChild(colIndex + 1);
5108
- nextCell.props.hMerge = hMergeEndIndex - colIndex > 2 ? 'restart' : null;
5113
+ nextCell.props.hMerge = hMergeEndIndex - colIndex >= 2 ? 'restart' : null;
5109
5114
  }
5110
5115
  }
5111
5116
  else if (cell.props.hMerge === 'continue') {
@@ -14920,7 +14925,8 @@ class DocumentEvent {
14920
14925
  if (!this.selectionState.cursorPos) {
14921
14926
  return;
14922
14927
  }
14923
- let { x, y } = this.selectionState.cursorPos;
14928
+ let { x, y, height } = this.selectionState.cursorPos;
14929
+ y = y + (height / 2 * (up ? -1 : 1));
14924
14930
  //y -= this.viewOptions.pageOffset.y;
14925
14931
  for (let i = 0; i < 50; i++) {
14926
14932
  const docEvent = new MouseElementEvent(this.docCtx);
@@ -15072,7 +15078,7 @@ class DocumentInput {
15072
15078
  const evt = nodeEvt.sourceEvt;
15073
15079
  const keyEvent = new KeyboradElementEvent(this.docCtx);
15074
15080
  keyEvent.sourceEvent = evt;
15075
- if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'Capture')) {
15081
+ if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'All')) {
15076
15082
  return;
15077
15083
  }
15078
15084
  if (evt.keyCode === 8) {
@@ -17307,28 +17313,25 @@ class ElementTrackManage {
17307
17313
  }
17308
17314
  }
17309
17315
  restoreToInsert(index, parentIndex, prevIndex, data) {
17310
- const prevSiblingEle = prevIndex !== -1 ? this.getControl(prevIndex) : null;
17316
+ const prevSiblingEle = prevIndex !== -1 ? this.getControl(prevIndex, true) : null;
17317
+ //const nextSiblingEle = prevSiblingEle ? prevSiblingEle.nextSibling : null;
17311
17318
  //获取插入位置之前的元素,然后向后插入目标元素
17312
- const ele = this.getControl(index - 1);
17319
+ //const ele = this.getControl(index - 1,true);
17320
+ const parent = this.getControl(parentIndex, true);
17313
17321
  const target = data.clone(true);
17314
17322
  if (prevSiblingEle) {
17315
17323
  prevSiblingEle.parent.addChild(target, prevSiblingEle.getIndex() + 1);
17316
17324
  }
17317
17325
  else {
17318
- //ele获取的为父容器
17319
- if (index === parentIndex + 1) {
17320
- if (ele instanceof BranchElement) {
17321
- if (ele.type === 'tbc' && ele.getChildLength() === 2) {
17322
- ele.clearItems();
17323
- }
17324
- ele.addChild(target, 0);
17325
- return;
17326
- }
17327
- else {
17328
- throw new Error('父级类型不正确');
17326
+ if (parent instanceof BranchElement) {
17327
+ if (parent.type === 'tbc' && parent.getChildLength() === 2) {
17328
+ parent.clearItems();
17329
17329
  }
17330
+ parent.addChild(target, 0);
17331
+ }
17332
+ else {
17333
+ throw new Error('父级类型不正确');
17330
17334
  }
17331
- ele.parent.addChild(target, ele.getIndex() + 1);
17332
17335
  }
17333
17336
  }
17334
17337
  /**