@hailin-zheng/editor-core 1.1.12 → 1.1.14

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.
@@ -36,7 +36,7 @@ export declare class SurfaceView extends NodeItems {
36
36
  invokeInput(data: string): void;
37
37
  invokeKeydown(evt: KeyboardEvent): void;
38
38
  setInputPosition({ x, y, height }: Omit<Rect, 'width'>): void;
39
- private setInputFocus;
39
+ setInputFocus(state?: boolean): void;
40
40
  hiddenInput(): void;
41
41
  endInput(): void;
42
42
  }
package/index-cjs.js CHANGED
@@ -9045,7 +9045,7 @@ class ColumnPatchUtil {
9045
9045
  //要分割的列坐标
9046
9046
  const newLinePointMap = this.getLinePointMap(splitCols);
9047
9047
  const resArray = new Set();
9048
- const allPointMap = oldLinePointMap.concat(newLinePointMap);
9048
+ const allPointMap = oldLinePointMap.concat(newLinePointMap).sort((a, b) => a.index - b.index);
9049
9049
  for (let i = 0; i < allPointMap.length; i++) {
9050
9050
  const part = allPointMap[i];
9051
9051
  resArray.add(part.offset);
@@ -9370,6 +9370,8 @@ class TableSplitCell {
9370
9370
  const splitCols = this.getSplitCols(colsWidth, cols);
9371
9371
  const [otherPacks, currPacks] = ColumnPatchUtil.getPatchPacks(hMergeCols, splitCols);
9372
9372
  this.applyHorSplitColumnPatchPacks(tb, focusRowIndex, 1, otherPacks);
9373
+ //当前单元格执行补丁前,需要先还原单元格
9374
+ TableUtil.restoreCell(ss);
9373
9375
  this.applyHorSplitColumnCurrPatchPacks(tb, focusRowIndex, focusCellIndex, rows, currPacks);
9374
9376
  tb.pubOnChange('to-child');
9375
9377
  tb.refreshView();
@@ -9433,7 +9435,6 @@ class TableSplitCell {
9433
9435
  static applyHorSplitColumnCurrPatchPacks(tb, focusRowIndex, focusColInex, splitRows, packs) {
9434
9436
  //获取当前列的合并行数
9435
9437
  let vMergeRows = this.getVMergeRowsCount(tb, focusRowIndex, focusColInex);
9436
- vMergeRows = vMergeRows === 1 ? 0 : vMergeRows;
9437
9438
  const startRow = tb.getChild(focusRowIndex);
9438
9439
  const endRow = tb.getChild(focusRowIndex + vMergeRows - 1);
9439
9440
  for (let i = 0; i < packs.length; i++) {
@@ -16972,6 +16973,9 @@ class ElementTrackManage {
16972
16973
  * 执行撤销
16973
16974
  */
16974
16975
  undo() {
16976
+ if (!this.canUndo) {
16977
+ return;
16978
+ }
16975
16979
  suppressTracking(() => {
16976
16980
  this.index--;
16977
16981
  this.executeCommand('undo');
@@ -16993,6 +16997,9 @@ class ElementTrackManage {
16993
16997
  * 执行重做
16994
16998
  */
16995
16999
  redo() {
17000
+ if (!this.canRedo) {
17001
+ return;
17002
+ }
16996
17003
  suppressTracking(() => {
16997
17004
  this.executeCommand('redo');
16998
17005
  this.index++;
@@ -18167,15 +18174,15 @@ class NodeEvent {
18167
18174
  canvas.addEventListener('wheel', evt => {
18168
18175
  this.setActiveAppContext(() => this.onWheelHandler(evt));
18169
18176
  });
18177
+ canvas.addEventListener('click', evt => {
18178
+ this.root.setInputFocus(true);
18179
+ });
18170
18180
  canvas.addEventListener('dblclick', evt => {
18171
18181
  this.setActiveAppContext(() => this.onDblClickHandler(evt));
18172
18182
  });
18173
18183
  canvas.addEventListener('contextmenu', evt => {
18174
18184
  this.setActiveAppContext(() => this.onContextMenuHandler(evt));
18175
18185
  });
18176
- canvas.addEventListener('keydown', evt => {
18177
- this.setActiveAppContext(() => this.onKeydownHandler(evt));
18178
- });
18179
18186
  this.root.addEventListener('preGotFocus', (evt) => {
18180
18187
  this.invokeNodeFocusedEvent(this.prevNode, this.prevFocusNodes, evt.source);
18181
18188
  }, true);
@@ -19045,6 +19052,7 @@ class SurfaceView extends NodeItems {
19045
19052
  this.invokeKeydown(evt);
19046
19053
  });
19047
19054
  this.input.addEventListener('copy', evt => {
19055
+ console.log('copy了');
19048
19056
  this.invokeClipboardEvent(evt, 'copy');
19049
19057
  });
19050
19058
  this.input.addEventListener('paste', evt => {
@@ -19103,6 +19111,7 @@ class SurfaceView extends NodeItems {
19103
19111
  return;
19104
19112
  }
19105
19113
  this.input.style.display = '';
19114
+ this.input.readOnly = false;
19106
19115
  const left = Math.floor(x) + 'px';
19107
19116
  const top = Math.floor(y) + 'px';
19108
19117
  if (left !== this.input.style.left || top !== this.input.style.top) {
@@ -19116,9 +19125,10 @@ class SurfaceView extends NodeItems {
19116
19125
  state ? this.input.focus() : this.input.blur();
19117
19126
  }
19118
19127
  hiddenInput() {
19119
- this.input.style.display = 'none';
19120
- this.input.style.left = '0';
19121
- this.input.style.top = '0';
19128
+ //this.input.style.display = 'none';
19129
+ this.input.style.left = '-2px';
19130
+ this.input.style.top = '-2px';
19131
+ this.input.readOnly = true;
19122
19132
  }
19123
19133
  endInput() {
19124
19134
  }
@@ -20482,7 +20492,7 @@ class CanvasTextEditor extends AbsolutePanel {
20482
20492
  */
20483
20493
  setCursor() {
20484
20494
  const { startControl, startOffset } = this.selectionState;
20485
- if (!this.canSetCursor()) {
20495
+ if (!this.canSetCursor() || !this.documentEvent.startHitInfo) {
20486
20496
  this.selectionState.editable = false;
20487
20497
  this.documentInput.setCursorVisibility(false);
20488
20498
  return false;