@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-cjs.js
CHANGED
@@ -9741,6 +9741,7 @@ class SelectionState {
|
|
9741
9741
|
selectedRange;
|
9742
9742
|
editable = true;
|
9743
9743
|
renderContainer;
|
9744
|
+
//光标所在的位置,当前位置时相对文档的位置,而非DOM页面中的位置
|
9744
9745
|
cursorPos;
|
9745
9746
|
//当前选区的上下文是否支持留痕修改
|
9746
9747
|
enableTrackChanges = false;
|
@@ -14737,7 +14738,7 @@ class DocumentEvent {
|
|
14737
14738
|
return;
|
14738
14739
|
}
|
14739
14740
|
let { x, y } = this.selectionState.cursorPos;
|
14740
|
-
y -= this.viewOptions.pageOffset.y;
|
14741
|
+
//y -= this.viewOptions.pageOffset.y;
|
14741
14742
|
for (let i = 0; i < 50; i++) {
|
14742
14743
|
const docEvent = new MouseElementEvent(this.docCtx);
|
14743
14744
|
docEvent.globalX = x;
|
@@ -14922,7 +14923,6 @@ class DocumentInput {
|
|
14922
14923
|
* @param visibility
|
14923
14924
|
*/
|
14924
14925
|
setCursorVisibility(visibility) {
|
14925
|
-
//this.cursorWrapper.style.display = visibility ? 'block' : 'none';
|
14926
14926
|
if (visibility) {
|
14927
14927
|
this.setInputFocus(true);
|
14928
14928
|
}
|
@@ -19043,6 +19043,8 @@ class SurfaceView extends NodeItems {
|
|
19043
19043
|
}
|
19044
19044
|
hiddenInput() {
|
19045
19045
|
this.input.style.display = 'none';
|
19046
|
+
this.input.style.left = '0';
|
19047
|
+
this.input.style.top = '0';
|
19046
19048
|
}
|
19047
19049
|
endInput() {
|
19048
19050
|
}
|
@@ -20414,8 +20416,6 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
20414
20416
|
const { startRegion, hitDocIndex } = this.documentEvent.startHitInfo;
|
20415
20417
|
const cursorPos = DocumentCursor.getElementCursorPos(startControl, startOffset, startRegion, hitDocIndex);
|
20416
20418
|
this.docCtx.cursorRect = ElementUtil.cloneRect(cursorPos.rect);
|
20417
|
-
this.transToAbsolutePos(ElementUtil.cloneRect(cursorPos.rect));
|
20418
|
-
//this.documentInput.setCursorPosition(abPos);
|
20419
20419
|
const focusEvent = {
|
20420
20420
|
target: this,
|
20421
20421
|
source: this,
|
@@ -20490,6 +20490,10 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
20490
20490
|
* 文档点击事件
|
20491
20491
|
*/
|
20492
20492
|
docClickHandle(evt) {
|
20493
|
+
const appCtx = getCurrentActiveAppContext();
|
20494
|
+
if (appCtx) {
|
20495
|
+
appCtx.root.hiddenInput();
|
20496
|
+
}
|
20493
20497
|
this.setCursor();
|
20494
20498
|
this.updateSelection();
|
20495
20499
|
this.onClickEvent.next(evt);
|
@@ -21168,11 +21172,12 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
21168
21172
|
drawCaret(e) {
|
21169
21173
|
const appCtx = getCurrentActiveAppContext();
|
21170
21174
|
if (appCtx) {
|
21171
|
-
|
21175
|
+
let caretPos = this.selectionState.cursorPos;
|
21172
21176
|
if (!caretPos) {
|
21173
21177
|
appCtx.root.hiddenInput();
|
21174
21178
|
return;
|
21175
21179
|
}
|
21180
|
+
caretPos = ElementUtil.cloneRect(caretPos);
|
21176
21181
|
caretPos.x += this.border + this.padding + e.renderPos.x;
|
21177
21182
|
caretPos.y += this.border + this.padding + e.renderPos.y;
|
21178
21183
|
appCtx.root.setInputPosition(caretPos);
|
@@ -21207,7 +21212,8 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
21207
21212
|
/**
|
21208
21213
|
* 注册编辑器格式读取器
|
21209
21214
|
*/
|
21210
|
-
registerReaderFactory(handler) {
|
21215
|
+
registerReaderFactory(handler) {
|
21216
|
+
}
|
21211
21217
|
}
|
21212
21218
|
|
21213
21219
|
/**
|