@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 +48 -18
- package/index-cjs.js.map +1 -1
- package/index.js +48 -18
- package/index.js.map +1 -1
- package/med_editor/doc-editor.d.ts +4 -0
- package/med_editor/framework/document-event.d.ts +10 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -17899,6 +17899,23 @@ class DocumentEvent {
|
|
17899
17899
|
}
|
17900
17900
|
}
|
17901
17901
|
}
|
17902
|
+
/**
|
17903
|
+
* 移动光标到下一个数据元素上
|
17904
|
+
*/
|
17905
|
+
moveFocusToNextDataElement() {
|
17906
|
+
if (this.viewOptions.docMode !== DocMode.FormEdit) {
|
17907
|
+
return;
|
17908
|
+
}
|
17909
|
+
const currDataEle = this.getCurrentDataElement();
|
17910
|
+
if (currDataEle) {
|
17911
|
+
if (currDataEle instanceof DataElementLeaf) {
|
17912
|
+
this.moveCursorToRightHandle(currDataEle, 1);
|
17913
|
+
}
|
17914
|
+
else {
|
17915
|
+
this.moveCursorToRightHandle(currDataEle.endDecorate, 1);
|
17916
|
+
}
|
17917
|
+
}
|
17918
|
+
}
|
17902
17919
|
/**
|
17903
17920
|
* 向右移动光标
|
17904
17921
|
*/
|
@@ -18154,6 +18171,30 @@ class DocumentEvent {
|
|
18154
18171
|
this.clicks = 0;
|
18155
18172
|
}
|
18156
18173
|
}
|
18174
|
+
/**
|
18175
|
+
* 获取当前光标所在的数据元
|
18176
|
+
* @returns
|
18177
|
+
*/
|
18178
|
+
getCurrentDataElement() {
|
18179
|
+
const selectionState = this.selectionState;
|
18180
|
+
const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
|
18181
|
+
if (startControl && collapsed) {
|
18182
|
+
if (!ElementUtil.verifyHitable(startControl)) {
|
18183
|
+
return null;
|
18184
|
+
}
|
18185
|
+
const dataEle = ElementUtil.getParent(startControl, validateDataEle);
|
18186
|
+
if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
|
18187
|
+
return dataEle;
|
18188
|
+
}
|
18189
|
+
else {
|
18190
|
+
return null;
|
18191
|
+
}
|
18192
|
+
}
|
18193
|
+
else if (!collapsed && ancestorCommonControl) {
|
18194
|
+
return ElementUtil.getParent(ancestorCommonControl, validateDataEle);
|
18195
|
+
}
|
18196
|
+
return null;
|
18197
|
+
}
|
18157
18198
|
}
|
18158
18199
|
|
18159
18200
|
/**
|
@@ -27236,24 +27277,13 @@ class DocEditor {
|
|
27236
27277
|
* @returns
|
27237
27278
|
*/
|
27238
27279
|
getCurrentDataElement() {
|
27239
|
-
|
27240
|
-
|
27241
|
-
|
27242
|
-
|
27243
|
-
|
27244
|
-
|
27245
|
-
|
27246
|
-
if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
|
27247
|
-
return dataEle;
|
27248
|
-
}
|
27249
|
-
else {
|
27250
|
-
return null;
|
27251
|
-
}
|
27252
|
-
}
|
27253
|
-
else if (!collapsed && ancestorCommonControl) {
|
27254
|
-
return ElementUtil.getParent(ancestorCommonControl, validateDataEle);
|
27255
|
-
}
|
27256
|
-
return null;
|
27280
|
+
return this.documentEvent.getCurrentDataElement();
|
27281
|
+
}
|
27282
|
+
/**
|
27283
|
+
* 移动光标到下一个数据元素上
|
27284
|
+
*/
|
27285
|
+
moveFocusToNextDataElement() {
|
27286
|
+
this.documentEvent.moveFocusToNextDataElement();
|
27257
27287
|
}
|
27258
27288
|
/**
|
27259
27289
|
* 设置当前光标所在的数据元的值
|