@hailin-zheng/editor-core 1.1.12 → 1.1.13

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
@@ -16943,6 +16943,9 @@ class ElementTrackManage {
16943
16943
  * 执行撤销
16944
16944
  */
16945
16945
  undo() {
16946
+ if (!this.canUndo) {
16947
+ return;
16948
+ }
16946
16949
  suppressTracking(() => {
16947
16950
  this.index--;
16948
16951
  this.executeCommand('undo');
@@ -16964,6 +16967,9 @@ class ElementTrackManage {
16964
16967
  * 执行重做
16965
16968
  */
16966
16969
  redo() {
16970
+ if (!this.canRedo) {
16971
+ return;
16972
+ }
16967
16973
  suppressTracking(() => {
16968
16974
  this.executeCommand('redo');
16969
16975
  this.index++;
@@ -18138,15 +18144,15 @@ class NodeEvent {
18138
18144
  canvas.addEventListener('wheel', evt => {
18139
18145
  this.setActiveAppContext(() => this.onWheelHandler(evt));
18140
18146
  });
18147
+ canvas.addEventListener('click', evt => {
18148
+ this.root.setInputFocus(true);
18149
+ });
18141
18150
  canvas.addEventListener('dblclick', evt => {
18142
18151
  this.setActiveAppContext(() => this.onDblClickHandler(evt));
18143
18152
  });
18144
18153
  canvas.addEventListener('contextmenu', evt => {
18145
18154
  this.setActiveAppContext(() => this.onContextMenuHandler(evt));
18146
18155
  });
18147
- canvas.addEventListener('keydown', evt => {
18148
- this.setActiveAppContext(() => this.onKeydownHandler(evt));
18149
- });
18150
18156
  this.root.addEventListener('preGotFocus', (evt) => {
18151
18157
  this.invokeNodeFocusedEvent(this.prevNode, this.prevFocusNodes, evt.source);
18152
18158
  }, true);
@@ -19016,6 +19022,7 @@ class SurfaceView extends NodeItems {
19016
19022
  this.invokeKeydown(evt);
19017
19023
  });
19018
19024
  this.input.addEventListener('copy', evt => {
19025
+ console.log('copy了');
19019
19026
  this.invokeClipboardEvent(evt, 'copy');
19020
19027
  });
19021
19028
  this.input.addEventListener('paste', evt => {
@@ -19074,6 +19081,7 @@ class SurfaceView extends NodeItems {
19074
19081
  return;
19075
19082
  }
19076
19083
  this.input.style.display = '';
19084
+ this.input.readOnly = false;
19077
19085
  const left = Math.floor(x) + 'px';
19078
19086
  const top = Math.floor(y) + 'px';
19079
19087
  if (left !== this.input.style.left || top !== this.input.style.top) {
@@ -19087,9 +19095,10 @@ class SurfaceView extends NodeItems {
19087
19095
  state ? this.input.focus() : this.input.blur();
19088
19096
  }
19089
19097
  hiddenInput() {
19090
- this.input.style.display = 'none';
19091
- this.input.style.left = '0';
19092
- this.input.style.top = '0';
19098
+ //this.input.style.display = 'none';
19099
+ this.input.style.left = '-2px';
19100
+ this.input.style.top = '-2px';
19101
+ this.input.readOnly = true;
19093
19102
  }
19094
19103
  endInput() {
19095
19104
  }
@@ -20453,7 +20462,7 @@ class CanvasTextEditor extends AbsolutePanel {
20453
20462
  */
20454
20463
  setCursor() {
20455
20464
  const { startControl, startOffset } = this.selectionState;
20456
- if (!this.canSetCursor()) {
20465
+ if (!this.canSetCursor() || !this.documentEvent.startHitInfo) {
20457
20466
  this.selectionState.editable = false;
20458
20467
  this.documentInput.setCursorVisibility(false);
20459
20468
  return false;