@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.js CHANGED
@@ -18036,6 +18036,11 @@ class DocumentEvent {
18036
18036
  }
18037
18037
  }
18038
18038
  onKeydown(evt) {
18039
+ const keyEvent = new KeyboradElementEvent(this.docCtx);
18040
+ keyEvent.sourceEvent = evt;
18041
+ if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'All')) {
18042
+ return;
18043
+ }
18039
18044
  // const copy = () => {
18040
18045
  // const input = document.createElement('input');
18041
18046
  // document.body.appendChild(input);
@@ -18261,6 +18266,9 @@ class DocumentInput {
18261
18266
  if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'All')) {
18262
18267
  return;
18263
18268
  }
18269
+ if (!this.docCtx.selectionState.editable) {
18270
+ return;
18271
+ }
18264
18272
  if (evt.keyCode === 8) {
18265
18273
  this.onBackspaceEvent.next(evt);
18266
18274
  }
@@ -27161,7 +27169,7 @@ class DocEditor {
27161
27169
  if (!this.canSetCursor() || !this.documentEvent.startHitInfo) {
27162
27170
  this.selectionState.editable = false;
27163
27171
  this.docCtx.selectionState.cursorPos = null;
27164
- this.hiddenInput();
27172
+ this.hiddenInput(false);
27165
27173
  return false;
27166
27174
  }
27167
27175
  const cursorRect = this.getCursorRect();
@@ -27193,12 +27201,12 @@ class DocEditor {
27193
27201
  this.editInput.focus();
27194
27202
  }
27195
27203
  }
27196
- hiddenInput() {
27204
+ hiddenInput(reset = true) {
27197
27205
  //this.input.style.display = 'none';
27198
27206
  this.editInput.style.left = '-2px';
27199
27207
  this.editInput.style.top = '-2px';
27200
27208
  this.editInput.readOnly = true;
27201
- this.editInput.focus();
27209
+ !reset && this.editInput.focus();
27202
27210
  }
27203
27211
  /**
27204
27212
  * 设置光标位置