@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-cjs.js
CHANGED
@@ -17936,7 +17936,7 @@ class DocumentEvent {
|
|
17936
17936
|
if (this.viewOptions.docMode !== exports.DocMode.FormEdit) {
|
17937
17937
|
return;
|
17938
17938
|
}
|
17939
|
-
const currDataEle = this.getCurrentDataElement();
|
17939
|
+
const currDataEle = this.getCurrentDataElement('free');
|
17940
17940
|
if (currDataEle) {
|
17941
17941
|
if (currDataEle instanceof DataElementLeaf) {
|
17942
17942
|
this.moveCursorToRightHandle(currDataEle, 1);
|
@@ -18205,15 +18205,15 @@ class DocumentEvent {
|
|
18205
18205
|
* 获取当前光标所在的数据元
|
18206
18206
|
* @returns
|
18207
18207
|
*/
|
18208
|
-
getCurrentDataElement() {
|
18208
|
+
getCurrentDataElement(mode = 'strict') {
|
18209
18209
|
const selectionState = this.selectionState;
|
18210
18210
|
const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
|
18211
18211
|
if (startControl && collapsed) {
|
18212
|
-
if (!ElementUtil.verifyHitable(startControl)) {
|
18213
|
-
|
18214
|
-
}
|
18212
|
+
// if (!ElementUtil.verifyHitable(startControl)) {
|
18213
|
+
// return null;
|
18214
|
+
// }
|
18215
18215
|
const dataEle = ElementUtil.getParent(startControl, validateDataEle);
|
18216
|
-
if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
|
18216
|
+
if (dataEle instanceof DataElementLeaf || (mode === 'free' || IsInSideDataElement(startControl, startOffset))) {
|
18217
18217
|
return dataEle;
|
18218
18218
|
}
|
18219
18219
|
else {
|
@@ -27228,6 +27228,7 @@ class DocEditor {
|
|
27228
27228
|
this.editInput.style.left = '-2px';
|
27229
27229
|
this.editInput.style.top = '-2px';
|
27230
27230
|
this.editInput.readOnly = true;
|
27231
|
+
this.editInput.focus();
|
27231
27232
|
}
|
27232
27233
|
/**
|
27233
27234
|
* 设置光标位置
|
@@ -27314,6 +27315,10 @@ class DocEditor {
|
|
27314
27315
|
*/
|
27315
27316
|
moveFocusToNextDataElement() {
|
27316
27317
|
this.documentEvent.moveFocusToNextDataElement();
|
27318
|
+
const startControl = this.selectionState.range?.startControl;
|
27319
|
+
if (startControl) {
|
27320
|
+
this.bringToView(startControl);
|
27321
|
+
}
|
27317
27322
|
}
|
27318
27323
|
/**
|
27319
27324
|
* 设置当前光标所在的数据元的值
|
@@ -27707,14 +27712,15 @@ class DocEditor {
|
|
27707
27712
|
const docRender = ElementUtil.getParentRender(renderObj, DocumentRenderObject);
|
27708
27713
|
const index = docRender.getIndex();
|
27709
27714
|
const cursorPos = DocumentCursor.getElementCursorPos(ele, 0, region, index);
|
27710
|
-
this.selectionState.resetRange(element, 0);
|
27711
|
-
|
27712
|
-
|
27713
|
-
|
27714
|
-
|
27715
|
-
|
27716
|
-
|
27715
|
+
//this.selectionState.resetRange(element, 0);
|
27716
|
+
this.scrollToPosition(cursorPos.rect);
|
27717
|
+
}
|
27718
|
+
}
|
27719
|
+
scrollToPosition(pos) {
|
27720
|
+
if (pos.y - this.viewOptions.pageOffset.y > 0 && pos.y - this.viewOptions.pageOffset.y < this.viewOptions.viewSettings.height) {
|
27721
|
+
return;
|
27717
27722
|
}
|
27723
|
+
this.scrollContainer.scrollTop = pos.y + 30;
|
27718
27724
|
}
|
27719
27725
|
/**
|
27720
27726
|
* 设置当前文档页边距
|
@@ -28134,7 +28140,8 @@ class DocEditor {
|
|
28134
28140
|
const dataEle = editor.getCurrentDataElement();
|
28135
28141
|
if (dataEle && dataEle instanceof DataElementDate) {
|
28136
28142
|
dataEle.setValue(value);
|
28137
|
-
editor.selectionState.
|
28143
|
+
editor.selectionState.resetRange(dataEle.endDecorate, 1);
|
28144
|
+
//editor.selectionState.clear();
|
28138
28145
|
}
|
28139
28146
|
});
|
28140
28147
|
return {
|