@hailin-zheng/editor-core 2.0.36 → 2.0.38

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
@@ -11884,7 +11884,7 @@ class ElementUtil {
11884
11884
  }
11885
11885
  const lastLeafElement = ElementUtil.getLastLeafElement(prevElement);
11886
11886
  //用于光标定位
11887
- if (forCursor && lastLeafElement && lastLeafElement.disableClick) {
11887
+ if (forCursor && lastLeafElement && !ElementUtil.canSetCursor(lastLeafElement, 0, true, viewOptions)) {
11888
11888
  return this.getRecursionPrevSiblingElement(lastLeafElement, inPara, forCursor, viewOptions);
11889
11889
  }
11890
11890
  if (lastLeafElement) {
@@ -11960,13 +11960,20 @@ class ElementUtil {
11960
11960
  */
11961
11961
  static getRecursionNextSiblingElement(currElement, inPara = false, forCursor = false, viewOptions) {
11962
11962
  const parent = currElement?.parent;
11963
- if (!currElement || !parent || !currElement.paintRenders.length) {
11963
+ if (!currElement || !parent) {
11964
11964
  return null;
11965
11965
  }
11966
+ // if (!currElement.paintRenders.length) {
11967
+ // return this.getRecursionNextSiblingElement(currElement, inPara, forCursor, viewOptions);
11968
+ // }
11966
11969
  //如果当前数据元不可编辑,则直接跳过
11967
11970
  if (parent instanceof DataElementInlineGroup && !parent.props.editable && viewOptions.docMode === DocMode.FormEdit) {
11968
11971
  return this.getRecursionNextSiblingElement(parent, inPara, forCursor, viewOptions);
11969
11972
  }
11973
+ //如果当前为数据组,且数据组被隐藏,则直接跳过
11974
+ if (parent instanceof DataElementGroupElement && parent.props.hidden) {
11975
+ return this.getRecursionNextSiblingElement(parent, inPara, forCursor, viewOptions);
11976
+ }
11970
11977
  if (forCursor && parent.disableClick) {
11971
11978
  return this.getRecursionNextSiblingElement(parent, inPara, forCursor, viewOptions);
11972
11979
  }
@@ -11990,7 +11997,7 @@ class ElementUtil {
11990
11997
  }
11991
11998
  const lastLeafElement = ElementUtil.getFirstLeafElement(nextElement);
11992
11999
  //用于光标定位
11993
- if (forCursor && lastLeafElement && lastLeafElement.disableClick) {
12000
+ if (forCursor && lastLeafElement && !ElementUtil.canSetCursor(lastLeafElement, ElementUtil.getElementEndOffset(lastLeafElement), true, viewOptions)) {
11994
12001
  return this.getRecursionNextSiblingElement(lastLeafElement, inPara, forCursor, viewOptions);
11995
12002
  }
11996
12003
  if (lastLeafElement) {
@@ -12442,13 +12449,16 @@ class ElementUtil {
12442
12449
  if (!startControl || !editable) {
12443
12450
  return false;
12444
12451
  }
12445
- if (viewOptions.docMode === DocMode.Design) {
12446
- return true;
12447
- }
12448
12452
  //浏览模式
12449
12453
  if (viewOptions.docMode === DocMode.View) {
12450
12454
  return false;
12451
12455
  }
12456
+ if (startControl.paintRenders.length === 0) {
12457
+ return false;
12458
+ }
12459
+ if (viewOptions.docMode === DocMode.Design) {
12460
+ return true;
12461
+ }
12452
12462
  //表单模式下,如果不在数据元素中,则不显示光标
12453
12463
  if (viewOptions.docMode === DocMode.FormEdit) {
12454
12464
  if (!IsInSideDataElement(startControl, startOffset)) {
@@ -28183,7 +28193,14 @@ class DocEditor {
28183
28193
  elm.style.left = (position.x - elmRect.width + 10) + 'px';
28184
28194
  }
28185
28195
  if (elmRect.top + elmRect.height > parentRect.top + parentRect.height) {
28186
- elm.style.top = (position.y - position.height - elmRect.height) + 'px';
28196
+ const newTop = position.y - position.height - elmRect.height;
28197
+ const oldTop = position.y + 5 + position.height;
28198
+ //计算前后的高度的差距,然后判断新的值是否在父元素的范围内,如果不在则使用旧的值
28199
+ if (oldTop - newTop < elmRect.top - parentRect.top) {
28200
+ elm.style.top = (position.y - position.height - elmRect.height) + 'px';
28201
+ }
28202
+ //elm.style.top = (top - (elmRect.top + elmRect.height - (parentRect.top + parentRect.height))) + 'px';
28203
+ //elm.style.top = (position.y - position.height - elmRect.height) + 'px';
28187
28204
  }
28188
28205
  }
28189
28206
  }
@@ -28291,7 +28308,7 @@ class DocEditor {
28291
28308
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28292
28309
  }
28293
28310
  version() {
28294
- return "2.0.36";
28311
+ return "2.0.38";
28295
28312
  }
28296
28313
  }
28297
28314