@hailin-zheng/editor-core 2.0.22 → 2.0.23
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 +21 -14
- package/index-cjs.js.map +1 -1
- package/index.js +21 -14
- package/index.js.map +1 -1
- package/med_editor/doc-editor.d.ts +1 -0
- package/med_editor/framework/document-event.d.ts +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -17906,7 +17906,7 @@ class DocumentEvent {
|
|
17906
17906
|
if (this.viewOptions.docMode !== DocMode.FormEdit) {
|
17907
17907
|
return;
|
17908
17908
|
}
|
17909
|
-
const currDataEle = this.getCurrentDataElement();
|
17909
|
+
const currDataEle = this.getCurrentDataElement('free');
|
17910
17910
|
if (currDataEle) {
|
17911
17911
|
if (currDataEle instanceof DataElementLeaf) {
|
17912
17912
|
this.moveCursorToRightHandle(currDataEle, 1);
|
@@ -18175,15 +18175,15 @@ class DocumentEvent {
|
|
18175
18175
|
* 获取当前光标所在的数据元
|
18176
18176
|
* @returns
|
18177
18177
|
*/
|
18178
|
-
getCurrentDataElement() {
|
18178
|
+
getCurrentDataElement(mode = 'strict') {
|
18179
18179
|
const selectionState = this.selectionState;
|
18180
18180
|
const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
|
18181
18181
|
if (startControl && collapsed) {
|
18182
|
-
if (!ElementUtil.verifyHitable(startControl)) {
|
18183
|
-
|
18184
|
-
}
|
18182
|
+
// if (!ElementUtil.verifyHitable(startControl)) {
|
18183
|
+
// return null;
|
18184
|
+
// }
|
18185
18185
|
const dataEle = ElementUtil.getParent(startControl, validateDataEle);
|
18186
|
-
if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
|
18186
|
+
if (dataEle instanceof DataElementLeaf || (mode === 'free' || IsInSideDataElement(startControl, startOffset))) {
|
18187
18187
|
return dataEle;
|
18188
18188
|
}
|
18189
18189
|
else {
|
@@ -27198,6 +27198,7 @@ class DocEditor {
|
|
27198
27198
|
this.editInput.style.left = '-2px';
|
27199
27199
|
this.editInput.style.top = '-2px';
|
27200
27200
|
this.editInput.readOnly = true;
|
27201
|
+
this.editInput.focus();
|
27201
27202
|
}
|
27202
27203
|
/**
|
27203
27204
|
* 设置光标位置
|
@@ -27284,6 +27285,10 @@ class DocEditor {
|
|
27284
27285
|
*/
|
27285
27286
|
moveFocusToNextDataElement() {
|
27286
27287
|
this.documentEvent.moveFocusToNextDataElement();
|
27288
|
+
const startControl = this.selectionState.range?.startControl;
|
27289
|
+
if (startControl) {
|
27290
|
+
this.bringToView(startControl);
|
27291
|
+
}
|
27287
27292
|
}
|
27288
27293
|
/**
|
27289
27294
|
* 设置当前光标所在的数据元的值
|
@@ -27677,14 +27682,15 @@ class DocEditor {
|
|
27677
27682
|
const docRender = ElementUtil.getParentRender(renderObj, DocumentRenderObject);
|
27678
27683
|
const index = docRender.getIndex();
|
27679
27684
|
const cursorPos = DocumentCursor.getElementCursorPos(ele, 0, region, index);
|
27680
|
-
this.selectionState.resetRange(element, 0);
|
27681
|
-
|
27682
|
-
|
27683
|
-
|
27684
|
-
|
27685
|
-
|
27686
|
-
|
27685
|
+
//this.selectionState.resetRange(element, 0);
|
27686
|
+
this.scrollToPosition(cursorPos.rect);
|
27687
|
+
}
|
27688
|
+
}
|
27689
|
+
scrollToPosition(pos) {
|
27690
|
+
if (pos.y - this.viewOptions.pageOffset.y > 0 && pos.y - this.viewOptions.pageOffset.y < this.viewOptions.viewSettings.height) {
|
27691
|
+
return;
|
27687
27692
|
}
|
27693
|
+
this.scrollContainer.scrollTop = pos.y + 30;
|
27688
27694
|
}
|
27689
27695
|
/**
|
27690
27696
|
* 设置当前文档页边距
|
@@ -28104,7 +28110,8 @@ class DocEditor {
|
|
28104
28110
|
const dataEle = editor.getCurrentDataElement();
|
28105
28111
|
if (dataEle && dataEle instanceof DataElementDate) {
|
28106
28112
|
dataEle.setValue(value);
|
28107
|
-
editor.selectionState.
|
28113
|
+
editor.selectionState.resetRange(dataEle.endDecorate, 1);
|
28114
|
+
//editor.selectionState.clear();
|
28108
28115
|
}
|
28109
28116
|
});
|
28110
28117
|
return {
|