@hailin-zheng/editor-core 2.0.21 → 2.0.22

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
@@ -17929,6 +17929,23 @@ class DocumentEvent {
17929
17929
  }
17930
17930
  }
17931
17931
  }
17932
+ /**
17933
+ * 移动光标到下一个数据元素上
17934
+ */
17935
+ moveFocusToNextDataElement() {
17936
+ if (this.viewOptions.docMode !== exports.DocMode.FormEdit) {
17937
+ return;
17938
+ }
17939
+ const currDataEle = this.getCurrentDataElement();
17940
+ if (currDataEle) {
17941
+ if (currDataEle instanceof DataElementLeaf) {
17942
+ this.moveCursorToRightHandle(currDataEle, 1);
17943
+ }
17944
+ else {
17945
+ this.moveCursorToRightHandle(currDataEle.endDecorate, 1);
17946
+ }
17947
+ }
17948
+ }
17932
17949
  /**
17933
17950
  * 向右移动光标
17934
17951
  */
@@ -18184,6 +18201,30 @@ class DocumentEvent {
18184
18201
  this.clicks = 0;
18185
18202
  }
18186
18203
  }
18204
+ /**
18205
+ * 获取当前光标所在的数据元
18206
+ * @returns
18207
+ */
18208
+ getCurrentDataElement() {
18209
+ const selectionState = this.selectionState;
18210
+ const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
18211
+ if (startControl && collapsed) {
18212
+ if (!ElementUtil.verifyHitable(startControl)) {
18213
+ return null;
18214
+ }
18215
+ const dataEle = ElementUtil.getParent(startControl, validateDataEle);
18216
+ if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
18217
+ return dataEle;
18218
+ }
18219
+ else {
18220
+ return null;
18221
+ }
18222
+ }
18223
+ else if (!collapsed && ancestorCommonControl) {
18224
+ return ElementUtil.getParent(ancestorCommonControl, validateDataEle);
18225
+ }
18226
+ return null;
18227
+ }
18187
18228
  }
18188
18229
 
18189
18230
  /**
@@ -27266,24 +27307,13 @@ class DocEditor {
27266
27307
  * @returns
27267
27308
  */
27268
27309
  getCurrentDataElement() {
27269
- const selectionState = this.documentSelection.selectionState;
27270
- const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
27271
- if (startControl && collapsed) {
27272
- if (!ElementUtil.verifyHitable(startControl)) {
27273
- return null;
27274
- }
27275
- const dataEle = ElementUtil.getParent(startControl, validateDataEle);
27276
- if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
27277
- return dataEle;
27278
- }
27279
- else {
27280
- return null;
27281
- }
27282
- }
27283
- else if (!collapsed && ancestorCommonControl) {
27284
- return ElementUtil.getParent(ancestorCommonControl, validateDataEle);
27285
- }
27286
- return null;
27310
+ return this.documentEvent.getCurrentDataElement();
27311
+ }
27312
+ /**
27313
+ * 移动光标到下一个数据元素上
27314
+ */
27315
+ moveFocusToNextDataElement() {
27316
+ this.documentEvent.moveFocusToNextDataElement();
27287
27317
  }
27288
27318
  /**
27289
27319
  * 设置当前光标所在的数据元的值