@hailin-zheng/editor-core 2.0.24 → 2.0.26

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 CHANGED
@@ -18066,6 +18066,11 @@ class DocumentEvent {
18066
18066
  }
18067
18067
  }
18068
18068
  onKeydown(evt) {
18069
+ const keyEvent = new KeyboradElementEvent(this.docCtx);
18070
+ keyEvent.sourceEvent = evt;
18071
+ if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'All')) {
18072
+ return;
18073
+ }
18069
18074
  // const copy = () => {
18070
18075
  // const input = document.createElement('input');
18071
18076
  // document.body.appendChild(input);
@@ -18291,6 +18296,9 @@ class DocumentInput {
18291
18296
  if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'All')) {
18292
18297
  return;
18293
18298
  }
18299
+ if (!this.docCtx.selectionState.editable) {
18300
+ return;
18301
+ }
18294
18302
  if (evt.keyCode === 8) {
18295
18303
  this.onBackspaceEvent.next(evt);
18296
18304
  }
@@ -27191,7 +27199,7 @@ class DocEditor {
27191
27199
  if (!this.canSetCursor() || !this.documentEvent.startHitInfo) {
27192
27200
  this.selectionState.editable = false;
27193
27201
  this.docCtx.selectionState.cursorPos = null;
27194
- this.hiddenInput();
27202
+ this.hiddenInput(false);
27195
27203
  return false;
27196
27204
  }
27197
27205
  const cursorRect = this.getCursorRect();
@@ -27223,12 +27231,12 @@ class DocEditor {
27223
27231
  this.editInput.focus();
27224
27232
  }
27225
27233
  }
27226
- hiddenInput() {
27234
+ hiddenInput(reset = true) {
27227
27235
  //this.input.style.display = 'none';
27228
27236
  this.editInput.style.left = '-2px';
27229
27237
  this.editInput.style.top = '-2px';
27230
27238
  this.editInput.readOnly = true;
27231
- this.editInput.focus();
27239
+ !reset && this.editInput.focus();
27232
27240
  }
27233
27241
  /**
27234
27242
  * 设置光标位置