@hailin-zheng/editor-core 2.0.38 → 2.0.39

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
@@ -12484,6 +12484,17 @@ class ElementUtil {
12484
12484
  offset = offset === -1 ? 1 : offset;
12485
12485
  return offset;
12486
12486
  }
12487
+ /**
12488
+ * 设置光标在数据元内容末尾
12489
+ */
12490
+ static setDataElemEndFocus(ss, ele) {
12491
+ if (ele.length === 2) {
12492
+ ss.resetRange(ele.getChild(0), 1);
12493
+ }
12494
+ else {
12495
+ ss.resetRange(ele.getChild(ele.length - 2), -1);
12496
+ }
12497
+ }
12487
12498
  }
12488
12499
 
12489
12500
  class RenderContext {
@@ -14687,9 +14698,9 @@ class DocumentArrange {
14687
14698
  blockLine = children[++j];
14688
14699
  }
14689
14700
  }
14690
- // if (cloneRender.length === 0 && sumHeight === 0) {
14691
- // return null;
14692
- // }
14701
+ if (cloneRender.length === 0 && sumHeight === 0) {
14702
+ return null;
14703
+ }
14693
14704
  ElementUtil.remeasure(cloneRender);
14694
14705
  ElementUtil.remeasure(render);
14695
14706
  if (cloneRender.length === 0) {
@@ -18812,8 +18823,10 @@ class DocumentChange {
18812
18823
  else {
18813
18824
  this.deleteRange(selectedRange);
18814
18825
  }
18815
- this.selectionState.resetRange(startPointElement, startPointOffset);
18816
- return { cursorEle: startPointElement, cursorOffset: startPointOffset };
18826
+ if (startPointElement) {
18827
+ this.selectionState.resetRange(startPointElement, startPointOffset);
18828
+ }
18829
+ //return {cursorEle: startPointElement, cursorOffset: startPointOffset};
18817
18830
  }
18818
18831
  /**
18819
18832
  * backspace删除
@@ -18876,9 +18889,8 @@ class DocumentChange {
18876
18889
  return;
18877
18890
  }
18878
18891
  if (control.isPrefix && this.viewOptions.docMode === DocMode.FormEdit) {
18879
- if (this.jumpToPrevDataElement(dataEle)) {
18880
- return;
18881
- }
18892
+ this.selectionState.resetRange(dataEle.startDecorate, 1);
18893
+ return;
18882
18894
  }
18883
18895
  }
18884
18896
  if (control.isDecorate) {
@@ -18902,7 +18914,7 @@ class DocumentChange {
18902
18914
  return false;
18903
18915
  }
18904
18916
  if (prevEle) {
18905
- this.selectionState.resetRange(prevEle.endDecorate, 0);
18917
+ ElementUtil.setDataElemEndFocus(this.selectionState, prevEle);
18906
18918
  return true;
18907
18919
  }
18908
18920
  return false;
@@ -19259,6 +19271,7 @@ class DocumentChange {
19259
19271
  //在数据元内删除,调用普通的删除处理
19260
19272
  if (dataElement) {
19261
19273
  this.deleteRange(range);
19274
+ this.selectionState.resetRange(dataElement.startDecorate, 1);
19262
19275
  return;
19263
19276
  }
19264
19277
  //在数据元外删除
@@ -19847,6 +19860,14 @@ class DocumentChange {
19847
19860
  }
19848
19861
  }
19849
19862
  getCursorElementByDeleteAction(control) {
19863
+ if (this.viewOptions.docMode === DocMode.FormEdit) {
19864
+ if (control.parent instanceof DataElementInlineGroup) {
19865
+ return {
19866
+ ele: control.parent.startDecorate,
19867
+ offset: 1
19868
+ };
19869
+ }
19870
+ }
19850
19871
  const prevLeafElementInPara = ElementUtil.getRecursionPrevSiblingElement(control, false, true, this.viewOptions);
19851
19872
  //是否为同一段落
19852
19873
  if (prevLeafElementInPara && ElementUtil.isInSameParagraph(prevLeafElementInPara, control)) {
@@ -27310,6 +27331,8 @@ class DocEditor {
27310
27331
  this.editInput.style.width = "1px";
27311
27332
  this.editInput.readOnly = false;
27312
27333
  this.setCursorVisibility(true);
27334
+ //判断光标位置是否被可见,如果不可见,需要将其设置到可见区域
27335
+ //TODO:暂时不做处理
27313
27336
  //this.setCursorInputStatus();
27314
27337
  }
27315
27338
  /**
@@ -28076,12 +28099,7 @@ class DocEditor {
28076
28099
  * 设置光标在数据元内容末尾
28077
28100
  */
28078
28101
  setDataElemEndFocus(ele) {
28079
- if (ele.length === 2) {
28080
- this.selectionState.resetRange(ele.getChild(0), 1);
28081
- }
28082
- else {
28083
- this.selectionState.resetRange(ele.getChild(ele.length - 2), -1);
28084
- }
28102
+ ElementUtil.setDataElemEndFocus(this.selectionState, ele);
28085
28103
  }
28086
28104
  /**
28087
28105
  * 渲染下拉框数据元
@@ -28308,7 +28326,7 @@ class DocEditor {
28308
28326
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28309
28327
  }
28310
28328
  version() {
28311
- return "2.0.38";
28329
+ return "2.0.39";
28312
28330
  }
28313
28331
  }
28314
28332