@hailin-zheng/editor-core 2.0.35 → 2.0.37

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
@@ -1722,8 +1722,8 @@ class TextProps extends INotifyPropertyChanged {
1722
1722
  super();
1723
1723
  }
1724
1724
  color;
1725
- fontName;
1726
- fontSize;
1725
+ fontName = '宋体';
1726
+ fontSize = 12;
1727
1727
  fontWeight = 'normal';
1728
1728
  fontStyle = 'normal';
1729
1729
  //textDecoration: 'none' | 'underline' | 'overline' | 'line-through' = 'none';
@@ -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)) {
@@ -14677,6 +14687,9 @@ class DocumentArrange {
14677
14687
  blockLine = children[++j];
14678
14688
  }
14679
14689
  }
14690
+ // if (cloneRender.length === 0 && sumHeight === 0) {
14691
+ // return null;
14692
+ // }
14680
14693
  ElementUtil.remeasure(cloneRender);
14681
14694
  ElementUtil.remeasure(render);
14682
14695
  if (cloneRender.length === 0) {
@@ -27225,13 +27238,16 @@ class DocEditor {
27225
27238
  * 设置光标
27226
27239
  */
27227
27240
  setCursor() {
27241
+ if (this.documentEvent.ismousedown) {
27242
+ return;
27243
+ }
27228
27244
  this.selectionState;
27229
27245
  if (!this.canSetCursor() || !this.selectionState.startHitInfo) {
27230
27246
  this.selectionState.editable = false;
27231
27247
  this.docCtx.selectionState.cursorPos = null;
27232
27248
  const cursorRect = this.getCursorRect();
27233
27249
  this.hiddenInput(false, cursorRect);
27234
- return false;
27250
+ return;
27235
27251
  }
27236
27252
  const cursorRect = this.getCursorRect();
27237
27253
  this.docCtx.cursorRect = ElementUtil.cloneRect(cursorRect);
@@ -27239,12 +27255,20 @@ class DocEditor {
27239
27255
  const abPos = ElementUtil.cloneRect(cursorRect);
27240
27256
  this.setCursorPosition(abPos);
27241
27257
  //this.documentEvent.invokeCursor(startControl);
27242
- return true;
27258
+ return;
27243
27259
  }
27244
27260
  getCursorRect() {
27245
27261
  try {
27246
27262
  const { startControl, startOffset } = this.selectionState;
27247
27263
  if (!this.documentEvent.startHitInfo || !startControl || (startControl && !startControl.parent)) {
27264
+ if (this.documentEvent.mousedownPos) {
27265
+ return {
27266
+ x: this.documentEvent.mousedownPos.x,
27267
+ y: this.documentEvent.mousedownPos.y,
27268
+ width: 0,
27269
+ height: 0
27270
+ };
27271
+ }
27248
27272
  return { x: 0, y: 0, width: 0, height: 0 };
27249
27273
  }
27250
27274
  const { startRegion, hitDocIndex } = this.documentEvent.startHitInfo;
@@ -28277,7 +28301,7 @@ class DocEditor {
28277
28301
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28278
28302
  }
28279
28303
  version() {
28280
- return "2.0.35";
28304
+ return "2.0.37";
28281
28305
  }
28282
28306
  }
28283
28307