@windoc/core 0.3.2 → 0.3.4

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/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var version = "0.9.47";
2
+ var version = "0.3.4";
3
3
 
4
4
  // src/dataset/enum/Common.ts
5
5
  var MaxHeightRatio = /* @__PURE__ */ ((MaxHeightRatio2) => {
@@ -39,14 +39,7 @@ var ZERO = "\u200B";
39
39
  var WRAP = "\n";
40
40
  var NBSP = " ";
41
41
  var NON_BREAKING_SPACE = " ";
42
- var PUNCTUATION_LIST = [
43
- ":",
44
- ",",
45
- ".",
46
- ";",
47
- "?",
48
- "!"
49
- ];
42
+ var PUNCTUATION_LIST = [":", ",", ".", ";", "?", "!"];
50
43
  var maxHeightRadioMapping = {
51
44
  ["half" /* HALF */]: 1 / 2,
52
45
  ["one-third" /* ONE_THIRD */]: 1 / 3,
@@ -3879,7 +3872,11 @@ var listStyleCSSMapping = {
3879
3872
  };
3880
3873
  var olPresetCycles = {
3881
3874
  ["olDefault" /* DEFAULT */]: ["decimal", "lowerAlpha", "lowerRoman"],
3882
- ["olParen" /* PARENTHESIS */]: ["decimalParen", "lowerAlphaParen", "lowerRomanParen"],
3875
+ ["olParen" /* PARENTHESIS */]: [
3876
+ "decimalParen",
3877
+ "lowerAlphaParen",
3878
+ "lowerRomanParen"
3879
+ ],
3883
3880
  ["olOutline" /* OUTLINE */]: ["outline", "outline", "outline"],
3884
3881
  ["olUpperA" /* UPPER_ALPHA */]: ["upperAlpha", "lowerAlpha", "lowerRoman"],
3885
3882
  ["olRoman" /* ROMAN */]: ["upperRoman", "upperAlpha", "decimal"],
@@ -4403,7 +4400,7 @@ function mergeOption(options = {}) {
4403
4400
  };
4404
4401
  return {
4405
4402
  mode: "edit" /* EDIT */,
4406
- locale: "zhCN",
4403
+ locale: "en",
4407
4404
  defaultType: "TEXT",
4408
4405
  defaultColor: "#000000",
4409
4406
  defaultFont: "Arial",
@@ -4496,6 +4493,7 @@ function formatElementList(elementList, options) {
4496
4493
  const startElement = elementList[0];
4497
4494
  if (isForceCompensation || isHandleFirstElement && startElement?.type !== "list" /* LIST */ && (startElement?.type && startElement.type !== "text" /* TEXT */ || !START_LINE_BREAK_REG.test(startElement?.value))) {
4498
4495
  elementList.unshift({
4496
+ type: "text" /* TEXT */,
4499
4497
  value: ZERO
4500
4498
  });
4501
4499
  }
@@ -7112,7 +7110,12 @@ function mouseup(evt, host) {
7112
7110
  rangeEnd = activeControl.setValue(replaceElementList);
7113
7111
  rangeStart = rangeEnd - replaceLength;
7114
7112
  } else {
7115
- draw.spliceElementList(elementList, rangeStart + 1, 0, replaceElementList);
7113
+ draw.spliceElementList(
7114
+ elementList,
7115
+ rangeStart + 1,
7116
+ 0,
7117
+ replaceElementList
7118
+ );
7116
7119
  }
7117
7120
  if (!~rangeEnd) {
7118
7121
  draw.render({
@@ -7431,7 +7434,11 @@ function backspace(evt, host) {
7431
7434
  }
7432
7435
  }
7433
7436
  if (!isCollapsed) {
7434
- draw.spliceElementList(elementList, startIndex + 1, endIndex - startIndex);
7437
+ draw.spliceElementList(
7438
+ elementList,
7439
+ startIndex + 1,
7440
+ endIndex - startIndex
7441
+ );
7435
7442
  curIndex = startIndex;
7436
7443
  } else if (evt.altKey) {
7437
7444
  const LETTER_REG = draw.getLetterReg();
@@ -7446,7 +7453,11 @@ function backspace(evt, host) {
7446
7453
  i--;
7447
7454
  }
7448
7455
  if (deleteCount > 0) {
7449
- draw.spliceElementList(elementList, index - deleteCount + 1, deleteCount);
7456
+ draw.spliceElementList(
7457
+ elementList,
7458
+ index - deleteCount + 1,
7459
+ deleteCount
7460
+ );
7450
7461
  }
7451
7462
  curIndex = index - deleteCount;
7452
7463
  evt.preventDefault();
@@ -7725,7 +7736,12 @@ function left(evt, host) {
7725
7736
  }
7726
7737
  if (!isCollapsed && !evt.shiftKey) {
7727
7738
  rangeManager.setRange(startIndex, startIndex);
7728
- draw.render({ curIndex: startIndex, isSetCursor: true, isSubmitHistory: false, isCompute: false });
7739
+ draw.render({
7740
+ curIndex: startIndex,
7741
+ isSetCursor: true,
7742
+ isSubmitHistory: false,
7743
+ isCompute: false
7744
+ });
7729
7745
  evt.preventDefault();
7730
7746
  return;
7731
7747
  }
@@ -7867,7 +7883,12 @@ function right(evt, host) {
7867
7883
  }
7868
7884
  if (!isCollapsed && !evt.shiftKey) {
7869
7885
  rangeManager.setRange(endIndex, endIndex);
7870
- draw.render({ curIndex: endIndex, isSetCursor: true, isSubmitHistory: false, isCompute: false });
7886
+ draw.render({
7887
+ curIndex: endIndex,
7888
+ isSetCursor: true,
7889
+ isSubmitHistory: false,
7890
+ isCompute: false
7891
+ });
7871
7892
  evt.preventDefault();
7872
7893
  return;
7873
7894
  }
@@ -8437,9 +8458,11 @@ function input(data2, host) {
8437
8458
  }
8438
8459
  if (~curIndex) {
8439
8460
  rangeManager.setRange(curIndex, curIndex);
8461
+ const isWordBoundary = !isComposing && /[\s\p{P}]/u.test(data2);
8440
8462
  draw.render({
8441
8463
  curIndex,
8442
- isSubmitHistory: !isComposing
8464
+ isSubmitHistory: !isComposing,
8465
+ isInputHistory: !isComposing && !isWordBoundary
8443
8466
  });
8444
8467
  }
8445
8468
  if (isComposing && ~curIndex) {
@@ -9110,10 +9133,12 @@ var GlobalEvent = class {
9110
9133
  };
9111
9134
 
9112
9135
  // src/core/history/HistoryManager.ts
9136
+ var INPUT_GROUP_INTERVAL = 1e3;
9113
9137
  var HistoryManager = class {
9114
9138
  constructor(draw) {
9115
9139
  this.undoStack = [];
9116
9140
  this.redoStack = [];
9141
+ this.lastInputTime = 0;
9117
9142
  this.maxRecordCount = draw.getOptions().historyMaxRecordCount + 1;
9118
9143
  }
9119
9144
  undo() {
@@ -9141,6 +9166,25 @@ var HistoryManager = class {
9141
9166
  this.undoStack.shift();
9142
9167
  }
9143
9168
  }
9169
+ replaceLatest(fn) {
9170
+ if (this.undoStack.length > 0) {
9171
+ this.undoStack[this.undoStack.length - 1] = fn;
9172
+ } else {
9173
+ this.execute(fn);
9174
+ }
9175
+ if (this.redoStack.length) {
9176
+ this.redoStack = [];
9177
+ }
9178
+ }
9179
+ isInputGroupable() {
9180
+ return Date.now() - this.lastInputTime < INPUT_GROUP_INTERVAL;
9181
+ }
9182
+ recordInputTime() {
9183
+ this.lastInputTime = Date.now();
9184
+ }
9185
+ resetInputTime() {
9186
+ this.lastInputTime = 0;
9187
+ }
9144
9188
  isCanUndo() {
9145
9189
  return this.undoStack.length > 1;
9146
9190
  }
@@ -9391,7 +9435,10 @@ var Position = class {
9391
9435
  startRowIndex += rowList.length;
9392
9436
  }
9393
9437
  } else {
9394
- const { column: { gap }, scale } = this.options;
9438
+ const {
9439
+ column: { gap },
9440
+ scale
9441
+ } = this.options;
9395
9442
  for (let i = 0; i < pageRowList.length; i++) {
9396
9443
  const rowList = pageRowList[i];
9397
9444
  if (!rowList?.length) continue;
@@ -10462,7 +10509,13 @@ var Background = class {
10462
10509
  const repeatYCount = background.repeat === "repeat" /* REPEAT */ || background.repeat === "repeat-y" /* REPEAT_Y */ ? Math.ceil(height * scale / imageHeight) : 1;
10463
10510
  for (let x = 0; x < repeatXCount; x++) {
10464
10511
  for (let y = 0; y < repeatYCount; y++) {
10465
- ctx.drawImage(imageElement, startX, startY, imageWidth, imageHeight);
10512
+ ctx.drawImage(
10513
+ imageElement,
10514
+ startX,
10515
+ startY,
10516
+ imageWidth,
10517
+ imageHeight
10518
+ );
10466
10519
  startY += imageHeight;
10467
10520
  }
10468
10521
  startY = 0;
@@ -11323,7 +11376,10 @@ var ScrollObserver = class {
11323
11376
  let bottomBound;
11324
11377
  if (this.scrollContainer === document) {
11325
11378
  topBound = 0;
11326
- bottomBound = Math.max(document.documentElement.clientHeight, window.innerHeight);
11379
+ bottomBound = Math.max(
11380
+ document.documentElement.clientHeight,
11381
+ window.innerHeight
11382
+ );
11327
11383
  } else {
11328
11384
  const containerRect = this.scrollContainer.getBoundingClientRect();
11329
11385
  topBound = containerRect.top;
@@ -12716,7 +12772,17 @@ var Watermark = class {
12716
12772
  }
12717
12773
  renderText(ctx, pageNo) {
12718
12774
  const {
12719
- watermark: { data: data2, opacity, font, size, color, repeat, gap, numberType, rotation },
12775
+ watermark: {
12776
+ data: data2,
12777
+ opacity,
12778
+ font,
12779
+ size,
12780
+ color,
12781
+ repeat,
12782
+ gap,
12783
+ numberType,
12784
+ rotation
12785
+ },
12720
12786
  scale
12721
12787
  } = this.options;
12722
12788
  const width = this.draw.getWidth();
@@ -13130,7 +13196,11 @@ var SelectControl = class {
13130
13196
  const { startIndex, endIndex } = range;
13131
13197
  const draw = this.control.getDraw();
13132
13198
  if (startIndex !== endIndex) {
13133
- draw.spliceElementList(elementList, startIndex + 1, endIndex - startIndex);
13199
+ draw.spliceElementList(
13200
+ elementList,
13201
+ startIndex + 1,
13202
+ endIndex - startIndex
13203
+ );
13134
13204
  } else {
13135
13205
  this.control.removePlaceholder(startIndex, context);
13136
13206
  }
@@ -14149,7 +14219,11 @@ var DateControl = class {
14149
14219
  const { startIndex, endIndex } = range;
14150
14220
  const draw = this.control.getDraw();
14151
14221
  if (startIndex !== endIndex) {
14152
- draw.spliceElementList(elementList, startIndex + 1, endIndex - startIndex);
14222
+ draw.spliceElementList(
14223
+ elementList,
14224
+ startIndex + 1,
14225
+ endIndex - startIndex
14226
+ );
14153
14227
  } else {
14154
14228
  this.control.removePlaceholder(startIndex, context);
14155
14229
  }
@@ -16247,7 +16321,11 @@ function computeCatalog(elementList, positionList) {
16247
16321
  return { position, titleElement };
16248
16322
  };
16249
16323
  if (element.titleId) {
16250
- const { position, titleElement } = getElementInfo(element, elementList, t);
16324
+ const { position, titleElement } = getElementInfo(
16325
+ element,
16326
+ elementList,
16327
+ t
16328
+ );
16251
16329
  t = position;
16252
16330
  titleElementList.push(titleElement);
16253
16331
  }
@@ -17248,100 +17326,6 @@ var BlockParticle = class {
17248
17326
  }
17249
17327
  };
17250
17328
 
17251
- // src/core/i18n/lang/zh-CN.json
17252
- var zh_CN_default = {
17253
- contextmenu: {
17254
- global: {
17255
- cut: "Cut",
17256
- copy: "Copy",
17257
- paste: "Paste",
17258
- selectAll: "Select All",
17259
- print: "Print"
17260
- },
17261
- control: {
17262
- delete: "Delete Control"
17263
- },
17264
- hyperlink: {
17265
- delete: "Delete Hyperlink",
17266
- cancel: "Cancel Hyperlink",
17267
- edit: "Edit Hyperlink"
17268
- },
17269
- image: {
17270
- change: "Change Image",
17271
- saveAs: "Save As Image",
17272
- textWrap: "Text Wrapping",
17273
- textWrapType: {
17274
- embed: "Inline",
17275
- upDown: "Top and Bottom",
17276
- surround: "Square",
17277
- floatTop: "Float Over Text",
17278
- floatBottom: "Float Below Text"
17279
- }
17280
- },
17281
- table: {
17282
- insertRowCol: "Insert Row/Column",
17283
- insertTopRow: "Insert Row Above",
17284
- insertBottomRow: "Insert Row Below",
17285
- insertLeftCol: "Insert Column Left",
17286
- insertRightCol: "Insert Column Right",
17287
- deleteRowCol: "Delete Row/Column",
17288
- deleteRow: "Delete Row",
17289
- deleteCol: "Delete Column",
17290
- deleteTable: "Delete Table",
17291
- mergeCell: "Merge Cells",
17292
- mergeCancelCell: "Cancel Merge",
17293
- verticalAlign: "Vertical Alignment",
17294
- verticalAlignTop: "Align Top",
17295
- verticalAlignMiddle: "Align Middle",
17296
- verticalAlignBottom: "Align Bottom",
17297
- border: "Table Border",
17298
- borderAll: "All Borders",
17299
- borderEmpty: "No Border",
17300
- borderDash: "Dashed Border",
17301
- borderExternal: "Outer Border",
17302
- borderInternal: "Inner Border",
17303
- borderTd: "Cell Border",
17304
- borderTdTop: "Top Border",
17305
- borderTdRight: "Right Border",
17306
- borderTdBottom: "Bottom Border",
17307
- borderTdLeft: "Left Border",
17308
- borderTdForward: "Forward Slash",
17309
- borderTdBack: "Back Slash"
17310
- }
17311
- },
17312
- datePicker: {
17313
- now: "Now",
17314
- confirm: "Confirm",
17315
- return: "Return Date",
17316
- timeSelect: "Time Select",
17317
- weeks: {
17318
- sun: "Sun",
17319
- mon: "Mon",
17320
- tue: "Tue",
17321
- wed: "Wed",
17322
- thu: "Thu",
17323
- fri: "Fri",
17324
- sat: "Sat"
17325
- },
17326
- year: "Year",
17327
- month: "Month",
17328
- hour: "Hour",
17329
- minute: "Minute",
17330
- second: "Second"
17331
- },
17332
- frame: {
17333
- header: "Header",
17334
- footer: "Footer"
17335
- },
17336
- pageBreak: {
17337
- displayName: "Page Break"
17338
- },
17339
- zone: {
17340
- headerTip: "Double-click to edit header",
17341
- footerTip: "Double-click to edit footer"
17342
- }
17343
- };
17344
-
17345
17329
  // src/core/i18n/lang/en.json
17346
17330
  var en_default = {
17347
17331
  contextmenu: {
@@ -17436,18 +17420,115 @@ var en_default = {
17436
17420
  }
17437
17421
  };
17438
17422
 
17423
+ // src/core/i18n/lang/id.json
17424
+ var id_default = {
17425
+ contextmenu: {
17426
+ global: {
17427
+ cut: "Potong",
17428
+ copy: "Salin",
17429
+ paste: "Tempel",
17430
+ selectAll: "Pilih semua",
17431
+ print: "Cetak"
17432
+ },
17433
+ control: {
17434
+ delete: "Hapus kontrol"
17435
+ },
17436
+ hyperlink: {
17437
+ delete: "Hapus tautan",
17438
+ cancel: "Batal tautan",
17439
+ edit: "Edit tautan"
17440
+ },
17441
+ image: {
17442
+ change: "Ubah gambar",
17443
+ saveAs: "Simpan sebagai gambar",
17444
+ textWrap: "Pembungkus teks",
17445
+ textWrapType: {
17446
+ embed: "Sematkan",
17447
+ upDown: "Atas bawah",
17448
+ surround: "Mengelilingi",
17449
+ floatTop: "Mengapung di atas teks",
17450
+ floatBottom: "Mengapung di bawah teks"
17451
+ }
17452
+ },
17453
+ table: {
17454
+ insertRowCol: "Sisipkan baris/kolom",
17455
+ insertTopRow: "Sisipkan 1 baris atas",
17456
+ insertBottomRow: "Sisipkan 1 baris bawah",
17457
+ insertLeftCol: "Sisipkan 1 kolom kiri",
17458
+ insertRightCol: "Sisipkan 1 kolom kanan",
17459
+ deleteRowCol: "Hapus baris/kolom",
17460
+ deleteRow: "Hapus 1 baris",
17461
+ deleteCol: "Hapus 1 kolom",
17462
+ deleteTable: "Hapus tabel",
17463
+ mergeCell: "Gabung sel",
17464
+ mergeCancelCell: "Batal gabung sel",
17465
+ verticalAlign: "Perataan vertikal",
17466
+ verticalAlignTop: "Atas",
17467
+ verticalAlignMiddle: "Tengah",
17468
+ verticalAlignBottom: "Bawah",
17469
+ border: "Batas tabel",
17470
+ borderAll: "Semua",
17471
+ borderEmpty: "Kosong",
17472
+ borderDash: "Putus-putus",
17473
+ borderExternal: "Eksternal",
17474
+ borderInternal: "Internal",
17475
+ borderTd: "Batas sel tabel",
17476
+ borderTdTop: "Atas",
17477
+ borderTdRight: "Kanan",
17478
+ borderTdBottom: "Bawah",
17479
+ borderTdLeft: "Kiri",
17480
+ borderTdForward: "Maju",
17481
+ borderTdBack: "Mundur"
17482
+ }
17483
+ },
17484
+ datePicker: {
17485
+ now: "Sekarang",
17486
+ confirm: "Konfirmasi",
17487
+ return: "Kembali",
17488
+ timeSelect: "Pilih waktu",
17489
+ weeks: {
17490
+ sun: "Min",
17491
+ mon: "Sen",
17492
+ tue: "Sel",
17493
+ wed: "Rab",
17494
+ thu: "Kam",
17495
+ fri: "Jum",
17496
+ sat: "Sab"
17497
+ },
17498
+ year: " ",
17499
+ month: " ",
17500
+ hour: "Jam",
17501
+ minute: "Menit",
17502
+ second: "Detik"
17503
+ },
17504
+ frame: {
17505
+ header: "Header",
17506
+ footer: "Footer"
17507
+ },
17508
+ pageBreak: {
17509
+ displayName: "Henti Halaman"
17510
+ },
17511
+ zone: {
17512
+ headerTip: "Klik dua kali untuk edit header",
17513
+ footerTip: "Klik dua kali untuk edit footer"
17514
+ }
17515
+ };
17516
+
17439
17517
  // src/core/i18n/I18n.ts
17440
17518
  var I18n = class {
17441
17519
  constructor(locale) {
17442
17520
  this.langMap = /* @__PURE__ */ new Map([
17443
- ["zhCN", zh_CN_default],
17444
- ["en", en_default]
17521
+ ["en", en_default],
17522
+ ["id", id_default]
17445
17523
  ]);
17446
17524
  this.currentLocale = locale;
17447
17525
  }
17448
17526
  registerLangMap(locale, lang) {
17449
17527
  const sourceLang = this.langMap.get(locale);
17450
- this.langMap.set(locale, mergeObject(sourceLang || zh_CN_default, lang));
17528
+ this.langMap.set(
17529
+ locale,
17530
+ mergeObject(sourceLang || this.langMap.get("en"), lang)
17531
+ );
17451
17532
  }
17452
17533
  getLocale() {
17453
17534
  return this.currentLocale;
@@ -17456,7 +17537,7 @@ var I18n = class {
17456
17537
  this.currentLocale = locale;
17457
17538
  }
17458
17539
  getLang() {
17459
- return this.langMap.get(this.currentLocale) || zh_CN_default;
17540
+ return this.langMap.get(this.currentLocale) || this.langMap.get("en");
17460
17541
  }
17461
17542
  t(path) {
17462
17543
  const keyList = path.split(".");
@@ -17894,7 +17975,9 @@ var Zone = class {
17894
17975
  dropdown.append(addItem);
17895
17976
  } else {
17896
17977
  const formatItem = document.createElement("div");
17897
- formatItem.classList.add(`${EDITOR_PREFIX}-zone-indicator-dropdown__item`);
17978
+ formatItem.classList.add(
17979
+ `${EDITOR_PREFIX}-zone-indicator-dropdown__item`
17980
+ );
17898
17981
  formatItem.textContent = isHeaderActive ? "Header Format" : "Footer Format";
17899
17982
  formatItem.onclick = (e) => {
17900
17983
  e.stopPropagation();
@@ -17908,7 +17991,9 @@ var Zone = class {
17908
17991
  );
17909
17992
  dropdown.append(separator);
17910
17993
  const removeItem = document.createElement("div");
17911
- removeItem.classList.add(`${EDITOR_PREFIX}-zone-indicator-dropdown__item`);
17994
+ removeItem.classList.add(
17995
+ `${EDITOR_PREFIX}-zone-indicator-dropdown__item`
17996
+ );
17912
17997
  removeItem.textContent = isHeaderActive ? "Remove Header" : "Remove Footer";
17913
17998
  removeItem.onclick = (e) => {
17914
17999
  e.stopPropagation();
@@ -18796,7 +18881,10 @@ var MouseObserver = class {
18796
18881
  this.draw = draw;
18797
18882
  this.eventBus = this.draw.getEventBus();
18798
18883
  this.pageContainer = this.draw.getPageContainer();
18799
- this.pageContainer.addEventListener("mousemove", this._mousemove.bind(this));
18884
+ this.pageContainer.addEventListener(
18885
+ "mousemove",
18886
+ this._mousemove.bind(this)
18887
+ );
18800
18888
  this.pageContainer.addEventListener(
18801
18889
  "mouseenter",
18802
18890
  this._mouseenter.bind(this)
@@ -18805,7 +18893,10 @@ var MouseObserver = class {
18805
18893
  "mouseleave",
18806
18894
  this._mouseleave.bind(this)
18807
18895
  );
18808
- this.pageContainer.addEventListener("mousedown", this._mousedown.bind(this));
18896
+ this.pageContainer.addEventListener(
18897
+ "mousedown",
18898
+ this._mousedown.bind(this)
18899
+ );
18809
18900
  this.pageContainer.addEventListener("mouseup", this._mouseup.bind(this));
18810
18901
  this.pageContainer.addEventListener("click", this._click.bind(this));
18811
18902
  }
@@ -19670,7 +19761,9 @@ var TableOperate = class {
19670
19761
  if (!td.borderTypes) {
19671
19762
  td.borderTypes = [];
19672
19763
  }
19673
- const borderTypeIndex = td.borderTypes.findIndex((type) => type === payload);
19764
+ const borderTypeIndex = td.borderTypes.findIndex(
19765
+ (type) => type === payload
19766
+ );
19674
19767
  if (isSetBorderType) {
19675
19768
  if (!~borderTypeIndex) {
19676
19769
  td.borderTypes.push(payload);
@@ -20337,7 +20430,10 @@ var Draw = class {
20337
20430
  const nextElement = elementList[startIndex + 1];
20338
20431
  return !!(startElement?.title?.disabled && nextElement?.title?.disabled && startElement.titleId === nextElement.titleId || startElement?.control?.disabled && nextElement?.control?.disabled && startElement.controlId === nextElement.controlId);
20339
20432
  }
20340
- const selectionElementList = elementList.slice(startIndex + 1, endIndex + 1);
20433
+ const selectionElementList = elementList.slice(
20434
+ startIndex + 1,
20435
+ endIndex + 1
20436
+ );
20341
20437
  return selectionElementList.some(
20342
20438
  (element) => element.title?.disabled || element.control?.disabled
20343
20439
  );
@@ -21334,7 +21430,10 @@ var Draw = class {
21334
21430
  isFromTable: true,
21335
21431
  isPagingMode
21336
21432
  });
21337
- const rowHeight = tdRowList.reduce((pre, cur) => pre + cur.height, 0);
21433
+ const rowHeight = tdRowList.reduce(
21434
+ (pre, cur) => pre + cur.height,
21435
+ 0
21436
+ );
21338
21437
  td.rowList = tdRowList;
21339
21438
  const curTdHeight = rowHeight / scale + tdPaddingHeight;
21340
21439
  if (td.height < curTdHeight) {
@@ -21619,10 +21718,16 @@ var Draw = class {
21619
21718
  listLevelIndex.delete(lvl);
21620
21719
  }
21621
21720
  }
21622
- listLevelIndex.set(curLevel, (listLevelIndex.get(curLevel) ?? -1) + 1);
21721
+ listLevelIndex.set(
21722
+ curLevel,
21723
+ (listLevelIndex.get(curLevel) ?? -1) + 1
21724
+ );
21623
21725
  }
21624
21726
  } else {
21625
- listLevelIndex.set(curLevel, (listLevelIndex.get(curLevel) ?? -1) + 1);
21727
+ listLevelIndex.set(
21728
+ curLevel,
21729
+ (listLevelIndex.get(curLevel) ?? -1) + 1
21730
+ );
21626
21731
  }
21627
21732
  listIndex = listLevelIndex.get(curLevel) ?? 0;
21628
21733
  prevListLevel = curLevel;
@@ -22003,7 +22108,12 @@ var Draw = class {
22003
22108
  this.lineBreakParticle.render(ctx, element, x, y + curRow.height / 2);
22004
22109
  }
22005
22110
  if (isDrawWhiteSpace && WHITE_SPACE_REG.test(element.value)) {
22006
- this.whiteSpaceParticle.render(ctx, element, x, y + curRow.height / 2);
22111
+ this.whiteSpaceParticle.render(
22112
+ ctx,
22113
+ element,
22114
+ x,
22115
+ y + curRow.height / 2
22116
+ );
22007
22117
  }
22008
22118
  if (element.control?.border) {
22009
22119
  if (preElement?.control?.border && preElement.controlId !== element.controlId) {
@@ -22057,7 +22167,14 @@ var Draw = class {
22057
22167
  } else if (element.type === "superscript" /* SUPERSCRIPT */) {
22058
22168
  adjustY += this.superscriptParticle.getOffsetY(element);
22059
22169
  }
22060
- this.strikeout.recordFillInfo(ctx, x, adjustY, metrics.width, 0, element.color);
22170
+ this.strikeout.recordFillInfo(
22171
+ ctx,
22172
+ x,
22173
+ adjustY,
22174
+ metrics.width,
22175
+ 0,
22176
+ element.color
22177
+ );
22061
22178
  }
22062
22179
  } else if (preElement?.strikeout) {
22063
22180
  this.strikeout.render(ctx);
@@ -22093,7 +22210,13 @@ var Draw = class {
22093
22210
  }
22094
22211
  }
22095
22212
  if (!group2.disabled && element.groupIds) {
22096
- this.group.recordFillInfo(element, x, y, metrics.width, curRow.height);
22213
+ this.group.recordFillInfo(
22214
+ element,
22215
+ x,
22216
+ y,
22217
+ metrics.width,
22218
+ curRow.height
22219
+ );
22097
22220
  }
22098
22221
  index++;
22099
22222
  if (element.type === "table" /* TABLE */ && !element.hide) {
@@ -22321,6 +22444,7 @@ var Draw = class {
22321
22444
  const { header, footer } = this.options;
22322
22445
  const {
22323
22446
  isSubmitHistory = true,
22447
+ isInputHistory = false,
22324
22448
  isSetCursor = true,
22325
22449
  isCompute = true,
22326
22450
  isLazy = true,
@@ -22400,7 +22524,7 @@ var Draw = class {
22400
22524
  this.cursor.focus();
22401
22525
  }
22402
22526
  if (isSubmitHistory && !isFirstRender || curIndex !== void 0 && this.historyManager.isStackEmpty()) {
22403
- this.submitHistory(curIndex);
22527
+ this.submitHistory(curIndex, isInputHistory);
22404
22528
  }
22405
22529
  nextTick(() => {
22406
22530
  this.range.setRangeStyle();
@@ -22463,7 +22587,7 @@ var Draw = class {
22463
22587
  });
22464
22588
  return curIndex;
22465
22589
  }
22466
- submitHistory(curIndex) {
22590
+ submitHistory(curIndex, isInput = false) {
22467
22591
  const positionContext = this.position.getPositionContext();
22468
22592
  const oldElementList = getSlimCloneElementList(this.elementList);
22469
22593
  const oldHeaderElementList = getSlimCloneElementList(
@@ -22476,7 +22600,7 @@ var Draw = class {
22476
22600
  const pageNo = this.pageNo;
22477
22601
  const oldPositionContext = deepClone(positionContext);
22478
22602
  const zone = this.zone.getZone();
22479
- this.historyManager.execute(() => {
22603
+ const fn = () => {
22480
22604
  this.zone.setZone(zone);
22481
22605
  this.setPageNo(pageNo);
22482
22606
  this.position.setPositionContext(deepClone(oldPositionContext));
@@ -22489,7 +22613,17 @@ var Draw = class {
22489
22613
  isSubmitHistory: false,
22490
22614
  isSourceHistory: true
22491
22615
  });
22492
- });
22616
+ };
22617
+ if (isInput && this.historyManager.isInputGroupable()) {
22618
+ this.historyManager.replaceLatest(fn);
22619
+ } else {
22620
+ this.historyManager.execute(fn);
22621
+ }
22622
+ if (isInput) {
22623
+ this.historyManager.recordInputTime();
22624
+ } else {
22625
+ this.historyManager.resetInputTime();
22626
+ }
22493
22627
  }
22494
22628
  destroy() {
22495
22629
  this.container.remove();
@@ -25672,7 +25806,9 @@ var ContextMenu = class {
25672
25806
  }
25673
25807
  _createContextMenuContainer() {
25674
25808
  const contextMenuContainer = document.createElement("div");
25675
- contextMenuContainer.classList.add(`${EDITOR_PREFIX}-contextmenu-container`);
25809
+ contextMenuContainer.classList.add(
25810
+ `${EDITOR_PREFIX}-contextmenu-container`
25811
+ );
25676
25812
  contextMenuContainer.setAttribute(
25677
25813
  EDITOR_COMPONENT,
25678
25814
  "contextmenu" /* CONTEXTMENU */
@@ -25705,7 +25841,9 @@ var ContextMenu = class {
25705
25841
  menuItem.classList.add(`${EDITOR_PREFIX}-contextmenu-item`);
25706
25842
  if (menu.childMenus) {
25707
25843
  const childMenus = this._filterMenuList(menu.childMenus);
25708
- const isRegisterContextMenu = childMenus.some((menu2) => !menu2.isDivider);
25844
+ const isRegisterContextMenu = childMenus.some(
25845
+ (menu2) => !menu2.isDivider
25846
+ );
25709
25847
  if (isRegisterContextMenu) {
25710
25848
  menuItem.classList.add(`${EDITOR_PREFIX}-contextmenu-sub-item`);
25711
25849
  menuItem.onmouseenter = () => {