@hufe921/canvas-editor 0.9.76 → 0.9.77

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/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## [0.9.77](https://github.com/Hufe921/canvas-editor/compare/v0.9.76...v0.9.77) (2024-05-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * delete control placeholder boundary error #553 ([73e47f5](https://github.com/Hufe921/canvas-editor/commit/73e47f56b54dfc2e8dbbe1e167b1cf868684b38c)), closes [#553](https://github.com/Hufe921/canvas-editor/issues/553)
7
+ * image resizer position boundary error #538 ([9f37995](https://github.com/Hufe921/canvas-editor/commit/9f37995a23e5655ee9011e19ce7b7aed1f9298eb)), closes [#538](https://github.com/Hufe921/canvas-editor/issues/538)
8
+ * move cursor boundary error with up and down keys #556 ([d58b28c](https://github.com/Hufe921/canvas-editor/commit/d58b28c1dbe47a7a4970b4333c0846fafbf511db)), closes [#556](https://github.com/Hufe921/canvas-editor/issues/556)
9
+ * subscript and superscript strikeout rendering ([62c94fc](https://github.com/Hufe921/canvas-editor/commit/62c94fce59c206b87dc68d0ed9d74f036cde956f))
10
+ * subscript underline rendering position #537 ([745a098](https://github.com/Hufe921/canvas-editor/commit/745a098a707893cc7ae8ba812ab11f826b961d55)), closes [#537](https://github.com/Hufe921/canvas-editor/issues/537)
11
+
12
+
13
+ ### Features
14
+
15
+ * table header appears repeatedly when paging #541 ([c86e546](https://github.com/Hufe921/canvas-editor/commit/c86e5468e666c64c087a430af8a9a8307b837f0f)), closes [#541](https://github.com/Hufe921/canvas-editor/issues/541)
16
+
17
+
18
+ ### Performance Improvements
19
+
20
+ * control operation history boundary #540 ([24c5b74](https://github.com/Hufe921/canvas-editor/commit/24c5b74bf2196ce3a1c76d0cf5626cd249a2a5fd)), closes [#540](https://github.com/Hufe921/canvas-editor/issues/540)
21
+
22
+
23
+
1
24
  ## [0.9.76](https://github.com/Hufe921/canvas-editor/compare/v0.9.75...v0.9.76) (2024-05-04)
2
25
 
3
26
 
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
23
23
  return value;
24
24
  };
25
25
  var index = "";
26
- const version = "0.9.76";
26
+ const version = "0.9.77";
27
27
  var MaxHeightRatio;
28
28
  (function(MaxHeightRatio2) {
29
29
  MaxHeightRatio2["HALF"] = "half";
@@ -509,6 +509,10 @@ const TEXTLIKE_ELEMENT_TYPE = [
509
509
  ElementType.CONTROL,
510
510
  ElementType.DATE
511
511
  ];
512
+ const IMAGE_ELEMENT_TYPE = [
513
+ ElementType.IMAGE,
514
+ ElementType.LATEX
515
+ ];
512
516
  const INLINE_ELEMENT_TYPE = [
513
517
  ElementType.BLOCK,
514
518
  ElementType.PAGE_BREAK,
@@ -3812,12 +3816,13 @@ function formatElementList(elementList, options) {
3812
3816
  const tableId = getUUID();
3813
3817
  el.id = tableId;
3814
3818
  if (el.trList) {
3819
+ const { defaultTrMinHeight } = editorOptions.table;
3815
3820
  for (let t = 0; t < el.trList.length; t++) {
3816
3821
  const tr = el.trList[t];
3817
3822
  const trId = getUUID();
3818
3823
  tr.id = trId;
3819
- if (!tr.minHeight || tr.minHeight < editorOptions.defaultTrMinHeight) {
3820
- tr.minHeight = editorOptions.defaultTrMinHeight;
3824
+ if (!tr.minHeight || tr.minHeight < defaultTrMinHeight) {
3825
+ tr.minHeight = defaultTrMinHeight;
3821
3826
  }
3822
3827
  if (tr.height < tr.minHeight) {
3823
3828
  tr.height = tr.minHeight;
@@ -6354,11 +6359,11 @@ function tab(evt, host) {
6354
6359
  }
6355
6360
  function getNextPositionIndex(payload) {
6356
6361
  const { positionList, index: index2, isUp, rowNo, cursorX } = payload;
6357
- let nextIndex = 0;
6362
+ let nextIndex = -1;
6358
6363
  const probablePosition = [];
6359
6364
  if (isUp) {
6360
6365
  let p = index2 - 1;
6361
- while (p > 0) {
6366
+ while (p >= 0) {
6362
6367
  const position = positionList[p];
6363
6368
  p--;
6364
6369
  if (position.rowNo === rowNo)
@@ -6521,7 +6526,7 @@ function updown(evt, host) {
6521
6526
  isUp,
6522
6527
  cursorX: curRightX
6523
6528
  });
6524
- if (!nextIndex)
6529
+ if (nextIndex < 0)
6525
6530
  return;
6526
6531
  anchorStartIndex = nextIndex;
6527
6532
  anchorEndIndex = nextIndex;
@@ -7392,6 +7397,9 @@ class HistoryManager {
7392
7397
  this.undoStack = [];
7393
7398
  this.redoStack = [];
7394
7399
  }
7400
+ popUndo() {
7401
+ return this.undoStack.pop();
7402
+ }
7395
7403
  }
7396
7404
  class Position {
7397
7405
  constructor(draw) {
@@ -7454,7 +7462,7 @@ class Position {
7454
7462
  }
7455
7463
  computePageRowPosition(payload) {
7456
7464
  const { positionList, rowList, pageNo, startX, startY, startRowIndex, startIndex, innerWidth, zone: zone2 } = payload;
7457
- const { scale, tdPadding } = this.options;
7465
+ const { scale, table: { tdPadding } } = this.options;
7458
7466
  let x = startX;
7459
7467
  let y = startY;
7460
7468
  let index2 = startIndex;
@@ -7876,12 +7884,14 @@ class Position {
7876
7884
  positionResult.index = newIndex;
7877
7885
  }
7878
7886
  }
7879
- const { index: index2, isCheckbox, isRadio, isControl, isTable, trIndex, tdIndex, tdId, trId, tableId } = positionResult;
7887
+ const { index: index2, isCheckbox, isRadio, isControl, isImage, isDirectHit, isTable, trIndex, tdIndex, tdId, trId, tableId } = positionResult;
7880
7888
  this.setPositionContext({
7881
7889
  isTable: isTable || false,
7882
7890
  isCheckbox: isCheckbox || false,
7883
7891
  isRadio: isRadio || false,
7884
7892
  isControl: isControl || false,
7893
+ isImage: isImage || false,
7894
+ isDirectHit: isDirectHit || false,
7885
7895
  index: index2,
7886
7896
  trIndex,
7887
7897
  tdIndex,
@@ -9787,7 +9797,7 @@ class TableTool {
9787
9797
  if (order === TableOrder.ROW) {
9788
9798
  const trList = element.trList;
9789
9799
  const tr = trList[index2] || trList[index2 - 1];
9790
- const { defaultTrMinHeight } = this.options;
9800
+ const { defaultTrMinHeight } = this.options.table;
9791
9801
  if (dy < 0 && tr.height + dy < defaultTrMinHeight) {
9792
9802
  dy = defaultTrMinHeight - tr.height;
9793
9803
  }
@@ -10980,13 +10990,19 @@ class Control {
10980
10990
  const startElement = elementList[startIndex];
10981
10991
  const nextElement = elementList[startIndex + 1];
10982
10992
  if (startElement.controlComponent === ControlComponent.PLACEHOLDER || nextElement.controlComponent === ControlComponent.PLACEHOLDER) {
10993
+ let isHasSubmitHistory = false;
10983
10994
  let index2 = startIndex;
10984
10995
  while (index2 < elementList.length) {
10985
10996
  const curElement = elementList[index2];
10986
10997
  if (curElement.controlId !== startElement.controlId)
10987
10998
  break;
10988
10999
  if (curElement.controlComponent === ControlComponent.PLACEHOLDER) {
10989
- this.draw.spliceElementList(elementList, index2, 1);
11000
+ if (!isHasSubmitHistory) {
11001
+ isHasSubmitHistory = true;
11002
+ this.draw.getHistoryManager().popUndo();
11003
+ this.draw.submitHistory(startIndex);
11004
+ }
11005
+ elementList.splice(index2, 1);
10990
11006
  } else {
10991
11007
  index2++;
10992
11008
  }
@@ -11833,6 +11849,11 @@ class Previewer {
11833
11849
  }
11834
11850
  drawResizer(element, position = null, options = {}) {
11835
11851
  this.previewerDrawOption = options;
11852
+ this.curElementSrc = element[options.srcKey || "value"] || "";
11853
+ this.updateResizer(element, position);
11854
+ document.addEventListener("keydown", this._keydown);
11855
+ }
11856
+ updateResizer(element, position = null) {
11836
11857
  const { scale } = this.options;
11837
11858
  const elementWidth = element.width * scale;
11838
11859
  const elementHeight = element.height * scale;
@@ -11843,11 +11864,9 @@ class Previewer {
11843
11864
  this._updateResizerRect(elementWidth, elementHeight);
11844
11865
  this.resizerSelection.style.display = "block";
11845
11866
  this.curElement = element;
11846
- this.curElementSrc = element[options.srcKey || "value"] || "";
11847
11867
  this.curPosition = position;
11848
- this.width = this.curElement.width * scale;
11849
- this.height = this.curElement.height * scale;
11850
- document.addEventListener("keydown", this._keydown);
11868
+ this.width = elementWidth;
11869
+ this.height = elementHeight;
11851
11870
  }
11852
11871
  clearResizer() {
11853
11872
  this.resizerSelection.style.display = "none";
@@ -13814,7 +13833,7 @@ class Draw {
13814
13833
  return this.options.defaultBasicRowMarginHeight * this.options.scale;
13815
13834
  }
13816
13835
  getTdPadding() {
13817
- const { tdPadding, scale } = this.options;
13836
+ const { table: { tdPadding }, scale } = this.options;
13818
13837
  return tdPadding.map((m) => m * scale);
13819
13838
  }
13820
13839
  getContainer() {
@@ -14398,9 +14417,9 @@ class Draw {
14398
14417
  return defaultBasicRowMarginHeight * (el.rowMargin || defaultRowMargin) * scale;
14399
14418
  }
14400
14419
  computeRowList(payload) {
14401
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
14420
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
14402
14421
  const { innerWidth, elementList, isPagingMode = false } = payload;
14403
- const { defaultSize, defaultRowMargin, scale, tdPadding, defaultTabWidth } = this.options;
14422
+ const { defaultSize, defaultRowMargin, scale, table: { tdPadding }, defaultTabWidth } = this.options;
14404
14423
  const defaultBasicRowMarginHeight = this.getDefaultBasicRowMarginHeight();
14405
14424
  const canvas = document.createElement("canvas");
14406
14425
  const ctx = canvas.getContext("2d");
@@ -14465,7 +14484,8 @@ class Draw {
14465
14484
  while (tableIndex < elementList.length) {
14466
14485
  const nextElement2 = elementList[tableIndex];
14467
14486
  if (nextElement2.pagingId === element.pagingId) {
14468
- element.trList.push(...nextElement2.trList);
14487
+ const nexTrList = nextElement2.trList.filter((tr) => !tr.pagingRepeat);
14488
+ element.trList.push(...nexTrList);
14469
14489
  element.height += nextElement2.height;
14470
14490
  tableIndex++;
14471
14491
  combineCount++;
@@ -14477,6 +14497,7 @@ class Draw {
14477
14497
  elementList.splice(i + 1, combineCount);
14478
14498
  }
14479
14499
  }
14500
+ element.pagingIndex = (_c = element.pagingIndex) != null ? _c : 0;
14480
14501
  this.tableParticle.computeRowColInfo(element);
14481
14502
  const trList = element.trList;
14482
14503
  for (let t = 0; t < trList.length; t++) {
@@ -14552,14 +14573,14 @@ class Draw {
14552
14573
  let curPagePreHeight = marginHeight;
14553
14574
  for (let r = 0; r < rowList.length; r++) {
14554
14575
  const row = rowList[r];
14555
- if (row.height + curPagePreHeight > height2 || ((_c = rowList[r - 1]) == null ? void 0 : _c.isPageBreak)) {
14576
+ if (row.height + curPagePreHeight > height2 || ((_d = rowList[r - 1]) == null ? void 0 : _d.isPageBreak)) {
14556
14577
  curPagePreHeight = marginHeight + row.height;
14557
14578
  } else {
14558
14579
  curPagePreHeight += row.height;
14559
14580
  }
14560
14581
  }
14561
14582
  const rowMarginHeight = rowMargin * 2 * scale;
14562
- if (curPagePreHeight + element.trList[0].height + rowMarginHeight > height2) {
14583
+ if (curPagePreHeight + element.trList[0].height + rowMarginHeight > height2 || element.pagingIndex !== 0 && element.trList[0].pagingRepeat) {
14563
14584
  curPagePreHeight = marginHeight;
14564
14585
  }
14565
14586
  if (curPagePreHeight + rowMarginHeight + elementHeight > height2) {
@@ -14573,7 +14594,7 @@ class Draw {
14573
14594
  const trHeight = tr.height * scale;
14574
14595
  if (curPagePreHeight + rowMarginHeight + preTrHeight + trHeight > height2) {
14575
14596
  const rowColCount = tr.tdList.reduce((pre, cur) => pre + cur.colspan, 0);
14576
- if (((_d = element.colgroup) == null ? void 0 : _d.length) !== rowColCount) {
14597
+ if (((_e = element.colgroup) == null ? void 0 : _e.length) !== rowColCount) {
14577
14598
  deleteCount = 0;
14578
14599
  }
14579
14600
  break;
@@ -14594,6 +14615,13 @@ class Draw {
14594
14615
  metrics.boundingBoxDescent -= cloneTrHeight;
14595
14616
  const cloneElement = deepClone(element);
14596
14617
  cloneElement.pagingId = pagingId;
14618
+ cloneElement.pagingIndex = element.pagingIndex + 1;
14619
+ const repeatTrList = trList2.filter((tr) => tr.pagingRepeat);
14620
+ if (repeatTrList.length) {
14621
+ const cloneRepeatTrList = deepClone(repeatTrList);
14622
+ cloneRepeatTrList.forEach((tr) => tr.id = getUUID());
14623
+ cloneTrList.unshift(...cloneRepeatTrList);
14624
+ }
14597
14625
  cloneElement.trList = cloneTrList;
14598
14626
  cloneElement.id = getUUID();
14599
14627
  this.spliceElementList(elementList, i + 1, 0, cloneElement);
@@ -14689,7 +14717,7 @@ class Draw {
14689
14717
  metrics,
14690
14718
  style: this.getElementFont(element, scale)
14691
14719
  });
14692
- if ((_e = rowElement.control) == null ? void 0 : _e.minWidth) {
14720
+ if ((_f = rowElement.control) == null ? void 0 : _f.minWidth) {
14693
14721
  if (rowElement.controlComponent) {
14694
14722
  controlRealWidth += metrics.width;
14695
14723
  }
@@ -14738,7 +14766,7 @@ class Draw {
14738
14766
  curRow.height = defaultBasicRowMarginHeight;
14739
14767
  }
14740
14768
  if ((preElement == null ? void 0 : preElement.rowFlex) === RowFlex.JUSTIFY || (preElement == null ? void 0 : preElement.rowFlex) === RowFlex.ALIGNMENT && isWidthNotEnough) {
14741
- const rowElementList = ((_f = curRow.elementList[0]) == null ? void 0 : _f.value) === ZERO ? curRow.elementList.slice(1) : curRow.elementList;
14769
+ const rowElementList = ((_g = curRow.elementList[0]) == null ? void 0 : _g.value) === ZERO ? curRow.elementList.slice(1) : curRow.elementList;
14742
14770
  const gap = (availableWidth - curRow.width) / (rowElementList.length - 1);
14743
14771
  for (let e = 0; e < rowElementList.length - 1; e++) {
14744
14772
  const el = rowElementList[e];
@@ -14752,10 +14780,10 @@ class Draw {
14752
14780
  startIndex: i,
14753
14781
  elementList: [rowElement],
14754
14782
  ascent,
14755
- rowFlex: ((_g = elementList[i]) == null ? void 0 : _g.rowFlex) || ((_h = elementList[i + 1]) == null ? void 0 : _h.rowFlex),
14783
+ rowFlex: ((_h = elementList[i]) == null ? void 0 : _h.rowFlex) || ((_i = elementList[i + 1]) == null ? void 0 : _i.rowFlex),
14756
14784
  isPageBreak: element.type === ElementType.PAGE_BREAK
14757
14785
  };
14758
- if (rowElement.controlComponent !== ControlComponent.PREFIX && ((_i = rowElement.control) == null ? void 0 : _i.indentation) === ControlIndentation.VALUE_START) {
14786
+ if (rowElement.controlComponent !== ControlComponent.PREFIX && ((_j = rowElement.control) == null ? void 0 : _j.indentation) === ControlIndentation.VALUE_START) {
14759
14787
  const preStartIndex = curRow.elementList.findIndex((el) => el.controlId === rowElement.controlId && el.controlComponent !== ControlComponent.PREFIX);
14760
14788
  if (~preStartIndex) {
14761
14789
  const preRowPositionList = this.position.computeRowPosition({
@@ -14846,7 +14874,7 @@ class Draw {
14846
14874
  drawRow(ctx, payload) {
14847
14875
  var _a, _b, _c, _d, _e, _f;
14848
14876
  this._drawHighlight(ctx, payload);
14849
- const { scale, tdPadding, group: group2, lineBreak } = this.options;
14877
+ const { scale, table: { tdPadding }, group: group2, lineBreak } = this.options;
14850
14878
  const { rowList, pageNo, elementList, positionList, startIndex, zone: zone2, isDrawLineBreak = !lineBreak.disabled } = payload;
14851
14879
  const isPrintMode = this.mode === EditorMode.PRINT;
14852
14880
  const { isCrossRowCol, tableId } = this.range.getRange();
@@ -14893,7 +14921,6 @@ class Draw {
14893
14921
  this.textParticle.complete();
14894
14922
  }
14895
14923
  } else if (element.type === ElementType.SUPERSCRIPT) {
14896
- this.underline.render(ctx);
14897
14924
  this.textParticle.complete();
14898
14925
  this.superscriptParticle.render(ctx, element, x, y + offsetY);
14899
14926
  } else if (element.type === ElementType.SUBSCRIPT) {
@@ -14942,7 +14969,7 @@ class Draw {
14942
14969
  this.control.drawBorder(ctx);
14943
14970
  }
14944
14971
  if (element.underline || ((_d = element.control) == null ? void 0 : _d.underline)) {
14945
- if ((preElement == null ? void 0 : preElement.type) === ElementType.SUPERSCRIPT && element.type !== ElementType.SUPERSCRIPT || (preElement == null ? void 0 : preElement.type) === ElementType.SUBSCRIPT && element.type !== ElementType.SUBSCRIPT) {
14972
+ if ((preElement == null ? void 0 : preElement.type) === ElementType.SUBSCRIPT && element.type !== ElementType.SUBSCRIPT) {
14946
14973
  this.underline.render(ctx);
14947
14974
  }
14948
14975
  const rowMargin = this.getElementRowMargin(element);
@@ -14950,8 +14977,6 @@ class Draw {
14950
14977
  let offsetY2 = 0;
14951
14978
  if (element.type === ElementType.SUBSCRIPT) {
14952
14979
  offsetY2 = this.subscriptParticle.getOffsetY(element);
14953
- } else if (element.type === ElementType.SUPERSCRIPT) {
14954
- offsetY2 = this.superscriptParticle.getOffsetY(element);
14955
14980
  }
14956
14981
  const color = element.controlComponent === ControlComponent.PLACEHOLDER ? void 0 : element.color;
14957
14982
  this.underline.recordFillInfo(ctx, x - offsetX, y + curRow.height - rowMargin + offsetY2, metrics.width + offsetX, 0, color, (_e = element.textDecoration) == null ? void 0 : _e.style);
@@ -14960,7 +14985,7 @@ class Draw {
14960
14985
  }
14961
14986
  if (element.strikeout) {
14962
14987
  if (!element.type || TEXTLIKE_ELEMENT_TYPE.includes(element.type)) {
14963
- if (preElement && this.getElementSize(preElement) !== this.getElementSize(element)) {
14988
+ if (preElement && (preElement.type === ElementType.SUBSCRIPT && element.type !== ElementType.SUBSCRIPT || preElement.type === ElementType.SUPERSCRIPT && element.type !== ElementType.SUPERSCRIPT || this.getElementSize(preElement) !== this.getElementSize(element))) {
14964
14989
  this.strikeout.render(ctx);
14965
14990
  }
14966
14991
  const standardMetrics = this.textParticle.measureBasisWord(ctx, this.getElementFont(element));
@@ -15153,7 +15178,6 @@ class Draw {
15153
15178
  }
15154
15179
  }
15155
15180
  render(payload) {
15156
- var _a;
15157
15181
  const { header, footer } = this.options;
15158
15182
  const { isSubmitHistory = true, isSetCursor = true, isCompute = true, isLazy = true, isInit = false, isSourceHistory = false, isFirstRender = false } = payload || {};
15159
15183
  let { curIndex } = payload || {};
@@ -15201,48 +15225,14 @@ class Draw {
15201
15225
  } else {
15202
15226
  this._immediateRender();
15203
15227
  }
15204
- const positionContext = this.position.getPositionContext();
15205
15228
  if (isSetCursor) {
15206
- const positionList = this.position.getPositionList();
15207
- if (positionContext.isTable) {
15208
- const { index: index2, trIndex, tdIndex } = positionContext;
15209
- const elementList = this.getOriginalElementList();
15210
- const tablePositionList = (_a = elementList[index2].trList) == null ? void 0 : _a[trIndex].tdList[tdIndex].positionList;
15211
- if (curIndex === void 0 && tablePositionList) {
15212
- curIndex = tablePositionList.length - 1;
15213
- }
15214
- const tablePosition = tablePositionList == null ? void 0 : tablePositionList[curIndex];
15215
- this.position.setCursorPosition(tablePosition || null);
15216
- } else {
15217
- this.position.setCursorPosition(curIndex !== void 0 ? positionList[curIndex] : null);
15218
- }
15219
- this.cursor.drawCursor();
15229
+ curIndex = this.setCursor(curIndex);
15220
15230
  }
15221
15231
  if (isSubmitHistory && !isFirstRender || curIndex !== void 0 && this.historyManager.isStackEmpty()) {
15222
- const oldElementList = getSlimCloneElementList(this.elementList);
15223
- const oldHeaderElementList = getSlimCloneElementList(this.header.getElementList());
15224
- const oldFooterElementList = getSlimCloneElementList(this.footer.getElementList());
15225
- const oldRange = deepClone(this.range.getRange());
15226
- const pageNo = this.pageNo;
15227
- const oldPositionContext = deepClone(positionContext);
15228
- const zone2 = this.zone.getZone();
15229
- this.historyManager.execute(() => {
15230
- this.zone.setZone(zone2);
15231
- this.setPageNo(pageNo);
15232
- this.position.setPositionContext(deepClone(oldPositionContext));
15233
- this.header.setElementList(deepClone(oldHeaderElementList));
15234
- this.footer.setElementList(deepClone(oldFooterElementList));
15235
- this.elementList = deepClone(oldElementList);
15236
- this.range.replaceRange(deepClone(oldRange));
15237
- this.render({
15238
- curIndex,
15239
- isSubmitHistory: false,
15240
- isSourceHistory: true
15241
- });
15242
- });
15232
+ this.submitHistory(curIndex);
15243
15233
  }
15244
15234
  nextTick(() => {
15245
- if (isCompute && !this.isReadonly() && positionContext.isTable) {
15235
+ if (isCompute && !this.isReadonly() && this.position.getPositionContext().isTable) {
15246
15236
  this.tableTool.render();
15247
15237
  }
15248
15238
  if (isCompute && !this.zone.isMainActive()) {
@@ -15264,6 +15254,61 @@ class Draw {
15264
15254
  }
15265
15255
  });
15266
15256
  }
15257
+ setCursor(curIndex) {
15258
+ var _a;
15259
+ const positionContext = this.position.getPositionContext();
15260
+ const positionList = this.position.getPositionList();
15261
+ if (positionContext.isTable) {
15262
+ const { index: index2, trIndex, tdIndex } = positionContext;
15263
+ const elementList = this.getOriginalElementList();
15264
+ const tablePositionList = (_a = elementList[index2].trList) == null ? void 0 : _a[trIndex].tdList[tdIndex].positionList;
15265
+ if (curIndex === void 0 && tablePositionList) {
15266
+ curIndex = tablePositionList.length - 1;
15267
+ }
15268
+ const tablePosition = tablePositionList == null ? void 0 : tablePositionList[curIndex];
15269
+ this.position.setCursorPosition(tablePosition || null);
15270
+ } else {
15271
+ this.position.setCursorPosition(curIndex !== void 0 ? positionList[curIndex] : null);
15272
+ }
15273
+ let isShowCursor = true;
15274
+ if (curIndex !== void 0 && positionContext.isImage && positionContext.isDirectHit) {
15275
+ const elementList = this.getElementList();
15276
+ const element = elementList[curIndex];
15277
+ if (IMAGE_ELEMENT_TYPE.includes(element.type)) {
15278
+ isShowCursor = false;
15279
+ const position = this.position.getCursorPosition();
15280
+ this.previewer.updateResizer(element, position);
15281
+ }
15282
+ }
15283
+ this.cursor.drawCursor({
15284
+ isShow: isShowCursor
15285
+ });
15286
+ return curIndex;
15287
+ }
15288
+ submitHistory(curIndex) {
15289
+ const positionContext = this.position.getPositionContext();
15290
+ const oldElementList = getSlimCloneElementList(this.elementList);
15291
+ const oldHeaderElementList = getSlimCloneElementList(this.header.getElementList());
15292
+ const oldFooterElementList = getSlimCloneElementList(this.footer.getElementList());
15293
+ const oldRange = deepClone(this.range.getRange());
15294
+ const pageNo = this.pageNo;
15295
+ const oldPositionContext = deepClone(positionContext);
15296
+ const zone2 = this.zone.getZone();
15297
+ this.historyManager.execute(() => {
15298
+ this.zone.setZone(zone2);
15299
+ this.setPageNo(pageNo);
15300
+ this.position.setPositionContext(deepClone(oldPositionContext));
15301
+ this.header.setElementList(deepClone(oldHeaderElementList));
15302
+ this.footer.setElementList(deepClone(oldFooterElementList));
15303
+ this.elementList = deepClone(oldElementList);
15304
+ this.range.replaceRange(deepClone(oldRange));
15305
+ this.render({
15306
+ curIndex,
15307
+ isSubmitHistory: false,
15308
+ isSourceHistory: true
15309
+ });
15310
+ });
15311
+ }
15267
15312
  destroy() {
15268
15313
  this.container.remove();
15269
15314
  this.globalEvent.removeEvent();
@@ -16167,6 +16212,7 @@ class CommandAdapt {
16167
16212
  const { startIndex, endIndex } = this.range.getRange();
16168
16213
  if (!~startIndex && !~endIndex)
16169
16214
  return;
16215
+ const { defaultTrMinHeight } = this.options.table;
16170
16216
  const elementList = this.draw.getElementList();
16171
16217
  let offsetX = 0;
16172
16218
  if ((_a = elementList[startIndex]) == null ? void 0 : _a.listId) {
@@ -16188,7 +16234,7 @@ class CommandAdapt {
16188
16234
  for (let r = 0; r < row; r++) {
16189
16235
  const tdList = [];
16190
16236
  const tr = {
16191
- height: this.options.defaultTrMinHeight,
16237
+ height: defaultTrMinHeight,
16192
16238
  tdList
16193
16239
  };
16194
16240
  for (let c = 0; c < col; c++) {
@@ -16372,7 +16418,7 @@ class CommandAdapt {
16372
16418
  }
16373
16419
  const colgroup = element.colgroup;
16374
16420
  colgroup.splice(curTdIndex, 0, {
16375
- width: this.options.defaultColMinWidth
16421
+ width: this.options.table.defaultColMinWidth
16376
16422
  });
16377
16423
  const colgroupWidth = colgroup.reduce((pre, cur) => pre + cur.width, 0);
16378
16424
  const width = this.draw.getOriginalInnerWidth();
@@ -16428,7 +16474,7 @@ class CommandAdapt {
16428
16474
  }
16429
16475
  const colgroup = element.colgroup;
16430
16476
  colgroup.splice(curTdIndex, 0, {
16431
- width: this.options.defaultColMinWidth
16477
+ width: this.options.table.defaultColMinWidth
16432
16478
  });
16433
16479
  const colgroupWidth = colgroup.reduce((pre, cur) => pre + cur.width, 0);
16434
16480
  const width = this.draw.getOriginalInnerWidth();
@@ -18832,6 +18878,11 @@ const defaultSeparatorOption = {
18832
18878
  lineWidth: 1,
18833
18879
  strokeStyle: "#000000"
18834
18880
  };
18881
+ const defaultTableOption = {
18882
+ tdPadding: [0, 5, 5, 5],
18883
+ defaultTrMinHeight: 42,
18884
+ defaultColMinWidth: 40
18885
+ };
18835
18886
  class Editor {
18836
18887
  constructor(container, data2, options = {}) {
18837
18888
  __publicField(this, "command");
@@ -18841,6 +18892,7 @@ class Editor {
18841
18892
  __publicField(this, "register");
18842
18893
  __publicField(this, "destroy");
18843
18894
  __publicField(this, "use");
18895
+ const tableOptions = __spreadValues(__spreadValues({}, defaultTableOption), options.table);
18844
18896
  const headerOptions = __spreadValues(__spreadValues({}, defaultHeaderOption), options.header);
18845
18897
  const footerOptions = __spreadValues(__spreadValues({}, defaultFooterOption), options.footer);
18846
18898
  const pageNumberOptions = __spreadValues(__spreadValues({}, defaultPageNumberOption), options.pageNumber);
@@ -18887,9 +18939,6 @@ class Editor {
18887
18939
  marginIndicatorColor: "#BABABA",
18888
18940
  margins: [100, 120, 100, 120],
18889
18941
  pageMode: PageMode.PAGING,
18890
- tdPadding: [0, 5, 5, 5],
18891
- defaultTrMinHeight: 42,
18892
- defaultColMinWidth: 40,
18893
18942
  defaultHyperlinkColor: "#0000FF",
18894
18943
  paperDirection: PaperDirection.VERTICAL,
18895
18944
  inactiveAlpha: 0.6,
@@ -18901,6 +18950,7 @@ class Editor {
18901
18950
  contextMenuDisableKeys: [],
18902
18951
  scrollContainerSelector: ""
18903
18952
  }, options), {
18953
+ table: tableOptions,
18904
18954
  header: headerOptions,
18905
18955
  footer: footerOptions,
18906
18956
  pageNumber: pageNumberOptions,