@hailin-zheng/editor-core 1.1.9 → 1.1.11
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 +12 -6
- package/index-cjs.js.map +1 -1
- package/index.js +12 -6
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -9712,6 +9712,7 @@ class SelectionState {
|
|
9712
9712
|
selectedRange;
|
9713
9713
|
editable = true;
|
9714
9714
|
renderContainer;
|
9715
|
+
//光标所在的位置,当前位置时相对文档的位置,而非DOM页面中的位置
|
9715
9716
|
cursorPos;
|
9716
9717
|
//当前选区的上下文是否支持留痕修改
|
9717
9718
|
enableTrackChanges = false;
|
@@ -14708,7 +14709,7 @@ class DocumentEvent {
|
|
14708
14709
|
return;
|
14709
14710
|
}
|
14710
14711
|
let { x, y } = this.selectionState.cursorPos;
|
14711
|
-
y -= this.viewOptions.pageOffset.y;
|
14712
|
+
//y -= this.viewOptions.pageOffset.y;
|
14712
14713
|
for (let i = 0; i < 50; i++) {
|
14713
14714
|
const docEvent = new MouseElementEvent(this.docCtx);
|
14714
14715
|
docEvent.globalX = x;
|
@@ -14893,7 +14894,6 @@ class DocumentInput {
|
|
14893
14894
|
* @param visibility
|
14894
14895
|
*/
|
14895
14896
|
setCursorVisibility(visibility) {
|
14896
|
-
//this.cursorWrapper.style.display = visibility ? 'block' : 'none';
|
14897
14897
|
if (visibility) {
|
14898
14898
|
this.setInputFocus(true);
|
14899
14899
|
}
|
@@ -19014,6 +19014,8 @@ class SurfaceView extends NodeItems {
|
|
19014
19014
|
}
|
19015
19015
|
hiddenInput() {
|
19016
19016
|
this.input.style.display = 'none';
|
19017
|
+
this.input.style.left = '0';
|
19018
|
+
this.input.style.top = '0';
|
19017
19019
|
}
|
19018
19020
|
endInput() {
|
19019
19021
|
}
|
@@ -20385,8 +20387,6 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
20385
20387
|
const { startRegion, hitDocIndex } = this.documentEvent.startHitInfo;
|
20386
20388
|
const cursorPos = DocumentCursor.getElementCursorPos(startControl, startOffset, startRegion, hitDocIndex);
|
20387
20389
|
this.docCtx.cursorRect = ElementUtil.cloneRect(cursorPos.rect);
|
20388
|
-
this.transToAbsolutePos(ElementUtil.cloneRect(cursorPos.rect));
|
20389
|
-
//this.documentInput.setCursorPosition(abPos);
|
20390
20390
|
const focusEvent = {
|
20391
20391
|
target: this,
|
20392
20392
|
source: this,
|
@@ -20461,6 +20461,10 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
20461
20461
|
* 文档点击事件
|
20462
20462
|
*/
|
20463
20463
|
docClickHandle(evt) {
|
20464
|
+
const appCtx = getCurrentActiveAppContext();
|
20465
|
+
if (appCtx) {
|
20466
|
+
appCtx.root.hiddenInput();
|
20467
|
+
}
|
20464
20468
|
this.setCursor();
|
20465
20469
|
this.updateSelection();
|
20466
20470
|
this.onClickEvent.next(evt);
|
@@ -21139,11 +21143,12 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
21139
21143
|
drawCaret(e) {
|
21140
21144
|
const appCtx = getCurrentActiveAppContext();
|
21141
21145
|
if (appCtx) {
|
21142
|
-
|
21146
|
+
let caretPos = this.selectionState.cursorPos;
|
21143
21147
|
if (!caretPos) {
|
21144
21148
|
appCtx.root.hiddenInput();
|
21145
21149
|
return;
|
21146
21150
|
}
|
21151
|
+
caretPos = ElementUtil.cloneRect(caretPos);
|
21147
21152
|
caretPos.x += this.border + this.padding + e.renderPos.x;
|
21148
21153
|
caretPos.y += this.border + this.padding + e.renderPos.y;
|
21149
21154
|
appCtx.root.setInputPosition(caretPos);
|
@@ -21178,7 +21183,8 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
21178
21183
|
/**
|
21179
21184
|
* 注册编辑器格式读取器
|
21180
21185
|
*/
|
21181
|
-
registerReaderFactory(handler) {
|
21186
|
+
registerReaderFactory(handler) {
|
21187
|
+
}
|
21182
21188
|
}
|
21183
21189
|
|
21184
21190
|
/**
|