@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-cjs.js CHANGED
@@ -11914,7 +11914,7 @@ class ElementUtil {
11914
11914
  }
11915
11915
  const lastLeafElement = ElementUtil.getLastLeafElement(prevElement);
11916
11916
  //用于光标定位
11917
- if (forCursor && lastLeafElement && lastLeafElement.disableClick) {
11917
+ if (forCursor && lastLeafElement && !ElementUtil.canSetCursor(lastLeafElement, 0, true, viewOptions)) {
11918
11918
  return this.getRecursionPrevSiblingElement(lastLeafElement, inPara, forCursor, viewOptions);
11919
11919
  }
11920
11920
  if (lastLeafElement) {
@@ -11990,13 +11990,20 @@ class ElementUtil {
11990
11990
  */
11991
11991
  static getRecursionNextSiblingElement(currElement, inPara = false, forCursor = false, viewOptions) {
11992
11992
  const parent = currElement?.parent;
11993
- if (!currElement || !parent || !currElement.paintRenders.length) {
11993
+ if (!currElement || !parent) {
11994
11994
  return null;
11995
11995
  }
11996
+ // if (!currElement.paintRenders.length) {
11997
+ // return this.getRecursionNextSiblingElement(currElement, inPara, forCursor, viewOptions);
11998
+ // }
11996
11999
  //如果当前数据元不可编辑,则直接跳过
11997
12000
  if (parent instanceof DataElementInlineGroup && !parent.props.editable && viewOptions.docMode === exports.DocMode.FormEdit) {
11998
12001
  return this.getRecursionNextSiblingElement(parent, inPara, forCursor, viewOptions);
11999
12002
  }
12003
+ //如果当前为数据组,且数据组被隐藏,则直接跳过
12004
+ if (parent instanceof DataElementGroupElement && parent.props.hidden) {
12005
+ return this.getRecursionNextSiblingElement(parent, inPara, forCursor, viewOptions);
12006
+ }
12000
12007
  if (forCursor && parent.disableClick) {
12001
12008
  return this.getRecursionNextSiblingElement(parent, inPara, forCursor, viewOptions);
12002
12009
  }
@@ -12020,7 +12027,7 @@ class ElementUtil {
12020
12027
  }
12021
12028
  const lastLeafElement = ElementUtil.getFirstLeafElement(nextElement);
12022
12029
  //用于光标定位
12023
- if (forCursor && lastLeafElement && lastLeafElement.disableClick) {
12030
+ if (forCursor && lastLeafElement && !ElementUtil.canSetCursor(lastLeafElement, ElementUtil.getElementEndOffset(lastLeafElement), true, viewOptions)) {
12024
12031
  return this.getRecursionNextSiblingElement(lastLeafElement, inPara, forCursor, viewOptions);
12025
12032
  }
12026
12033
  if (lastLeafElement) {
@@ -12472,13 +12479,16 @@ class ElementUtil {
12472
12479
  if (!startControl || !editable) {
12473
12480
  return false;
12474
12481
  }
12475
- if (viewOptions.docMode === exports.DocMode.Design) {
12476
- return true;
12477
- }
12478
12482
  //浏览模式
12479
12483
  if (viewOptions.docMode === exports.DocMode.View) {
12480
12484
  return false;
12481
12485
  }
12486
+ if (startControl.paintRenders.length === 0) {
12487
+ return false;
12488
+ }
12489
+ if (viewOptions.docMode === exports.DocMode.Design) {
12490
+ return true;
12491
+ }
12482
12492
  //表单模式下,如果不在数据元素中,则不显示光标
12483
12493
  if (viewOptions.docMode === exports.DocMode.FormEdit) {
12484
12494
  if (!IsInSideDataElement(startControl, startOffset)) {
@@ -28213,7 +28223,14 @@ class DocEditor {
28213
28223
  elm.style.left = (position.x - elmRect.width + 10) + 'px';
28214
28224
  }
28215
28225
  if (elmRect.top + elmRect.height > parentRect.top + parentRect.height) {
28216
- elm.style.top = (position.y - position.height - elmRect.height) + 'px';
28226
+ const newTop = position.y - position.height - elmRect.height;
28227
+ const oldTop = position.y + 5 + position.height;
28228
+ //计算前后的高度的差距,然后判断新的值是否在父元素的范围内,如果不在则使用旧的值
28229
+ if (oldTop - newTop < elmRect.top - parentRect.top) {
28230
+ elm.style.top = (position.y - position.height - elmRect.height) + 'px';
28231
+ }
28232
+ //elm.style.top = (top - (elmRect.top + elmRect.height - (parentRect.top + parentRect.height))) + 'px';
28233
+ //elm.style.top = (position.y - position.height - elmRect.height) + 'px';
28217
28234
  }
28218
28235
  }
28219
28236
  }
@@ -28321,7 +28338,7 @@ class DocEditor {
28321
28338
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28322
28339
  }
28323
28340
  version() {
28324
- return "2.0.36";
28341
+ return "2.0.38";
28325
28342
  }
28326
28343
  }
28327
28344