@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-cjs.js CHANGED
@@ -1752,8 +1752,8 @@ class TextProps extends INotifyPropertyChanged {
1752
1752
  super();
1753
1753
  }
1754
1754
  color;
1755
- fontName;
1756
- fontSize;
1755
+ fontName = '宋体';
1756
+ fontSize = 12;
1757
1757
  fontWeight = 'normal';
1758
1758
  fontStyle = 'normal';
1759
1759
  //textDecoration: 'none' | 'underline' | 'overline' | 'line-through' = 'none';
@@ -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)) {
@@ -14707,6 +14717,9 @@ class DocumentArrange {
14707
14717
  blockLine = children[++j];
14708
14718
  }
14709
14719
  }
14720
+ // if (cloneRender.length === 0 && sumHeight === 0) {
14721
+ // return null;
14722
+ // }
14710
14723
  ElementUtil.remeasure(cloneRender);
14711
14724
  ElementUtil.remeasure(render);
14712
14725
  if (cloneRender.length === 0) {
@@ -27255,13 +27268,16 @@ class DocEditor {
27255
27268
  * 设置光标
27256
27269
  */
27257
27270
  setCursor() {
27271
+ if (this.documentEvent.ismousedown) {
27272
+ return;
27273
+ }
27258
27274
  this.selectionState;
27259
27275
  if (!this.canSetCursor() || !this.selectionState.startHitInfo) {
27260
27276
  this.selectionState.editable = false;
27261
27277
  this.docCtx.selectionState.cursorPos = null;
27262
27278
  const cursorRect = this.getCursorRect();
27263
27279
  this.hiddenInput(false, cursorRect);
27264
- return false;
27280
+ return;
27265
27281
  }
27266
27282
  const cursorRect = this.getCursorRect();
27267
27283
  this.docCtx.cursorRect = ElementUtil.cloneRect(cursorRect);
@@ -27269,12 +27285,20 @@ class DocEditor {
27269
27285
  const abPos = ElementUtil.cloneRect(cursorRect);
27270
27286
  this.setCursorPosition(abPos);
27271
27287
  //this.documentEvent.invokeCursor(startControl);
27272
- return true;
27288
+ return;
27273
27289
  }
27274
27290
  getCursorRect() {
27275
27291
  try {
27276
27292
  const { startControl, startOffset } = this.selectionState;
27277
27293
  if (!this.documentEvent.startHitInfo || !startControl || (startControl && !startControl.parent)) {
27294
+ if (this.documentEvent.mousedownPos) {
27295
+ return {
27296
+ x: this.documentEvent.mousedownPos.x,
27297
+ y: this.documentEvent.mousedownPos.y,
27298
+ width: 0,
27299
+ height: 0
27300
+ };
27301
+ }
27278
27302
  return { x: 0, y: 0, width: 0, height: 0 };
27279
27303
  }
27280
27304
  const { startRegion, hitDocIndex } = this.documentEvent.startHitInfo;
@@ -28307,7 +28331,7 @@ class DocEditor {
28307
28331
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28308
28332
  }
28309
28333
  version() {
28310
- return "2.0.35";
28334
+ return "2.0.37";
28311
28335
  }
28312
28336
  }
28313
28337