@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.
package/index.js CHANGED
@@ -9016,7 +9016,7 @@ class ColumnPatchUtil {
9016
9016
  //要分割的列坐标
9017
9017
  const newLinePointMap = this.getLinePointMap(splitCols);
9018
9018
  const resArray = new Set();
9019
- const allPointMap = oldLinePointMap.concat(newLinePointMap);
9019
+ const allPointMap = oldLinePointMap.concat(newLinePointMap).sort((a, b) => a.index - b.index);
9020
9020
  for (let i = 0; i < allPointMap.length; i++) {
9021
9021
  const part = allPointMap[i];
9022
9022
  resArray.add(part.offset);
@@ -9341,6 +9341,8 @@ class TableSplitCell {
9341
9341
  const splitCols = this.getSplitCols(colsWidth, cols);
9342
9342
  const [otherPacks, currPacks] = ColumnPatchUtil.getPatchPacks(hMergeCols, splitCols);
9343
9343
  this.applyHorSplitColumnPatchPacks(tb, focusRowIndex, 1, otherPacks);
9344
+ //当前单元格执行补丁前,需要先还原单元格
9345
+ TableUtil.restoreCell(ss);
9344
9346
  this.applyHorSplitColumnCurrPatchPacks(tb, focusRowIndex, focusCellIndex, rows, currPacks);
9345
9347
  tb.pubOnChange('to-child');
9346
9348
  tb.refreshView();
@@ -9404,7 +9406,6 @@ class TableSplitCell {
9404
9406
  static applyHorSplitColumnCurrPatchPacks(tb, focusRowIndex, focusColInex, splitRows, packs) {
9405
9407
  //获取当前列的合并行数
9406
9408
  let vMergeRows = this.getVMergeRowsCount(tb, focusRowIndex, focusColInex);
9407
- vMergeRows = vMergeRows === 1 ? 0 : vMergeRows;
9408
9409
  const startRow = tb.getChild(focusRowIndex);
9409
9410
  const endRow = tb.getChild(focusRowIndex + vMergeRows - 1);
9410
9411
  for (let i = 0; i < packs.length; i++) {
@@ -16943,6 +16944,9 @@ class ElementTrackManage {
16943
16944
  * 执行撤销
16944
16945
  */
16945
16946
  undo() {
16947
+ if (!this.canUndo) {
16948
+ return;
16949
+ }
16946
16950
  suppressTracking(() => {
16947
16951
  this.index--;
16948
16952
  this.executeCommand('undo');
@@ -16964,6 +16968,9 @@ class ElementTrackManage {
16964
16968
  * 执行重做
16965
16969
  */
16966
16970
  redo() {
16971
+ if (!this.canRedo) {
16972
+ return;
16973
+ }
16967
16974
  suppressTracking(() => {
16968
16975
  this.executeCommand('redo');
16969
16976
  this.index++;
@@ -18138,15 +18145,15 @@ class NodeEvent {
18138
18145
  canvas.addEventListener('wheel', evt => {
18139
18146
  this.setActiveAppContext(() => this.onWheelHandler(evt));
18140
18147
  });
18148
+ canvas.addEventListener('click', evt => {
18149
+ this.root.setInputFocus(true);
18150
+ });
18141
18151
  canvas.addEventListener('dblclick', evt => {
18142
18152
  this.setActiveAppContext(() => this.onDblClickHandler(evt));
18143
18153
  });
18144
18154
  canvas.addEventListener('contextmenu', evt => {
18145
18155
  this.setActiveAppContext(() => this.onContextMenuHandler(evt));
18146
18156
  });
18147
- canvas.addEventListener('keydown', evt => {
18148
- this.setActiveAppContext(() => this.onKeydownHandler(evt));
18149
- });
18150
18157
  this.root.addEventListener('preGotFocus', (evt) => {
18151
18158
  this.invokeNodeFocusedEvent(this.prevNode, this.prevFocusNodes, evt.source);
18152
18159
  }, true);
@@ -19016,6 +19023,7 @@ class SurfaceView extends NodeItems {
19016
19023
  this.invokeKeydown(evt);
19017
19024
  });
19018
19025
  this.input.addEventListener('copy', evt => {
19026
+ console.log('copy了');
19019
19027
  this.invokeClipboardEvent(evt, 'copy');
19020
19028
  });
19021
19029
  this.input.addEventListener('paste', evt => {
@@ -19074,6 +19082,7 @@ class SurfaceView extends NodeItems {
19074
19082
  return;
19075
19083
  }
19076
19084
  this.input.style.display = '';
19085
+ this.input.readOnly = false;
19077
19086
  const left = Math.floor(x) + 'px';
19078
19087
  const top = Math.floor(y) + 'px';
19079
19088
  if (left !== this.input.style.left || top !== this.input.style.top) {
@@ -19087,9 +19096,10 @@ class SurfaceView extends NodeItems {
19087
19096
  state ? this.input.focus() : this.input.blur();
19088
19097
  }
19089
19098
  hiddenInput() {
19090
- this.input.style.display = 'none';
19091
- this.input.style.left = '0';
19092
- this.input.style.top = '0';
19099
+ //this.input.style.display = 'none';
19100
+ this.input.style.left = '-2px';
19101
+ this.input.style.top = '-2px';
19102
+ this.input.readOnly = true;
19093
19103
  }
19094
19104
  endInput() {
19095
19105
  }
@@ -20453,7 +20463,7 @@ class CanvasTextEditor extends AbsolutePanel {
20453
20463
  */
20454
20464
  setCursor() {
20455
20465
  const { startControl, startOffset } = this.selectionState;
20456
- if (!this.canSetCursor()) {
20466
+ if (!this.canSetCursor() || !this.documentEvent.startHitInfo) {
20457
20467
  this.selectionState.editable = false;
20458
20468
  this.documentInput.setCursorVisibility(false);
20459
20469
  return false;