@hailin-zheng/editor-core 1.1.10 → 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.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
  }
@@ -20387,8 +20387,6 @@ class CanvasTextEditor extends AbsolutePanel {
20387
20387
  const { startRegion, hitDocIndex } = this.documentEvent.startHitInfo;
20388
20388
  const cursorPos = DocumentCursor.getElementCursorPos(startControl, startOffset, startRegion, hitDocIndex);
20389
20389
  this.docCtx.cursorRect = ElementUtil.cloneRect(cursorPos.rect);
20390
- this.transToAbsolutePos(ElementUtil.cloneRect(cursorPos.rect));
20391
- //this.documentInput.setCursorPosition(abPos);
20392
20390
  const focusEvent = {
20393
20391
  target: this,
20394
20392
  source: this,
@@ -21145,11 +21143,12 @@ class CanvasTextEditor extends AbsolutePanel {
21145
21143
  drawCaret(e) {
21146
21144
  const appCtx = getCurrentActiveAppContext();
21147
21145
  if (appCtx) {
21148
- const caretPos = this.selectionState.cursorPos;
21146
+ let caretPos = this.selectionState.cursorPos;
21149
21147
  if (!caretPos) {
21150
21148
  appCtx.root.hiddenInput();
21151
21149
  return;
21152
21150
  }
21151
+ caretPos = ElementUtil.cloneRect(caretPos);
21153
21152
  caretPos.x += this.border + this.padding + e.renderPos.x;
21154
21153
  caretPos.y += this.border + this.padding + e.renderPos.y;
21155
21154
  appCtx.root.setInputPosition(caretPos);