@hufe921/canvas-editor 0.9.73 → 0.9.74

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,29 @@
1
+ ## [0.9.74](https://github.com/Hufe921/canvas-editor/compare/v0.9.73...v0.9.74) (2024-04-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * control component disabling segmenter ([868a791](https://github.com/Hufe921/canvas-editor/commit/868a79148d8e68ba1b34ddd8d37941e3e26988d7))
7
+ * delete default control color property #513 ([224ead0](https://github.com/Hufe921/canvas-editor/commit/224ead0dff28f333e04bfb7c7ba4068d32670e52)), closes [#513](https://github.com/Hufe921/canvas-editor/issues/513)
8
+ * disable control placeholder selection #511 ([2985d6b](https://github.com/Hufe921/canvas-editor/commit/2985d6b62ee5311a5f8350282f313e9faca95204)), closes [#511](https://github.com/Hufe921/canvas-editor/issues/511)
9
+
10
+
11
+ ### Features
12
+
13
+ * add control border #388 ([de06f6c](https://github.com/Hufe921/canvas-editor/commit/de06f6cc9b2d3f37033647cf159bb9c09a432c1b)), closes [#388](https://github.com/Hufe921/canvas-editor/issues/388)
14
+ * add extension property ([5027d73](https://github.com/Hufe921/canvas-editor/commit/5027d730c4522d496ef933830df026960077e660))
15
+ * add security rules to IFrameBlock element ([cdbd1ff](https://github.com/Hufe921/canvas-editor/commit/cdbd1ff4ded52a588d837c3b2cb04fe6168ed51f))
16
+ * add srcdoc property to IFrameBlock element #454 ([6696992](https://github.com/Hufe921/canvas-editor/commit/66969925ac5193b5a2b0e227df247052cf79364f)), closes [#454](https://github.com/Hufe921/canvas-editor/issues/454)
17
+ * control default style #340 ([eee2236](https://github.com/Hufe921/canvas-editor/commit/eee22363d3a0de8333a6b6f8815ef178fbfc3c8d)), closes [#340](https://github.com/Hufe921/canvas-editor/issues/340)
18
+ * record the first cursor position #517 ([0878506](https://github.com/Hufe921/canvas-editor/commit/087850606224290bc6e1992711416ac0acbfa45b)), closes [#517](https://github.com/Hufe921/canvas-editor/issues/517)
19
+
20
+
21
+ ### Tests
22
+
23
+ * update block test case ([6d358d1](https://github.com/Hufe921/canvas-editor/commit/6d358d16dc2eb1af309c554c369f30a805451acc))
24
+
25
+
26
+
1
27
  ## [0.9.73](https://github.com/Hufe921/canvas-editor/compare/v0.9.72...v0.9.73) (2024-04-12)
2
28
 
3
29
 
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
23
23
  return value;
24
24
  };
25
25
  var index = "";
26
- const version = "0.9.73";
26
+ const version = "0.9.74";
27
27
  var MaxHeightRatio;
28
28
  (function(MaxHeightRatio2) {
29
29
  MaxHeightRatio2["HALF"] = "half";
@@ -455,7 +455,8 @@ const EDITOR_ELEMENT_ZIP_ATTR = [
455
455
  "conceptId",
456
456
  "imgDisplay",
457
457
  "imgFloatPosition",
458
- "textDecoration"
458
+ "textDecoration",
459
+ "extension"
459
460
  ];
460
461
  const TABLE_TD_ZIP_ATTR = [
461
462
  "verticalAlign",
@@ -479,6 +480,14 @@ const CONTROL_CONTEXT_ATTR = [
479
480
  "controlId",
480
481
  "controlComponent"
481
482
  ];
483
+ const CONTROL_STYLE_ATTR = [
484
+ "font",
485
+ "size",
486
+ "bold",
487
+ "highlight",
488
+ "italic",
489
+ "strikeout"
490
+ ];
482
491
  const EDITOR_ELEMENT_CONTEXT_ATTR = [
483
492
  ...TABLE_CONTEXT_ATTR,
484
493
  ...TITLE_CONTEXT_ATTR,
@@ -3857,20 +3866,20 @@ function formatElementList(elementList, options) {
3857
3866
  const { editorOptions: { control: controlOption, checkbox: checkboxOption } } = options;
3858
3867
  const controlId = getUUID();
3859
3868
  elementList.splice(i, 1);
3860
- const thePrePostfixArgs = {};
3861
- if (editorOptions && editorOptions.control) {
3862
- thePrePostfixArgs.color = editorOptions.control.bracketColor;
3863
- }
3869
+ const controlDefaultStyle = pickObject(el.control, CONTROL_STYLE_ATTR);
3870
+ const thePrePostfixArg = __spreadProps(__spreadValues({}, controlDefaultStyle), {
3871
+ color: editorOptions.control.bracketColor
3872
+ });
3864
3873
  const prefixStrList = splitText(prefix || controlOption.prefix);
3865
3874
  for (let p = 0; p < prefixStrList.length; p++) {
3866
3875
  const value2 = prefixStrList[p];
3867
- elementList.splice(i, 0, __spreadValues({
3876
+ elementList.splice(i, 0, __spreadProps(__spreadValues({}, thePrePostfixArg), {
3868
3877
  controlId,
3869
3878
  value: value2,
3870
3879
  type: el.type,
3871
3880
  control: el.control,
3872
3881
  controlComponent: ControlComponent.PREFIX
3873
- }, thePrePostfixArgs));
3882
+ }));
3874
3883
  i++;
3875
3884
  }
3876
3885
  if (value && value.length || type === ControlType.CHECKBOX || type === ControlType.SELECT && code && (!value || !value.length)) {
@@ -3898,7 +3907,7 @@ function formatElementList(elementList, options) {
3898
3907
  for (let e = 0; e < valueStrList.length; e++) {
3899
3908
  const value2 = valueStrList[e];
3900
3909
  const isLastLetter = e === valueStrList.length - 1;
3901
- elementList.splice(i, 0, __spreadProps(__spreadValues({}, valueStyleList[valueStyleIndex]), {
3910
+ elementList.splice(i, 0, __spreadProps(__spreadValues(__spreadValues({}, controlDefaultStyle), valueStyleList[valueStyleIndex]), {
3902
3911
  controlId,
3903
3912
  value: value2 === "\n" ? ZERO : value2,
3904
3913
  letterSpacing: isLastLetter ? checkboxOption.gap : 0,
@@ -3929,7 +3938,7 @@ function formatElementList(elementList, options) {
3929
3938
  for (let v = 0; v < valueList.length; v++) {
3930
3939
  const element = valueList[v];
3931
3940
  const value2 = element.value;
3932
- elementList.splice(i, 0, __spreadProps(__spreadValues({}, element), {
3941
+ elementList.splice(i, 0, __spreadProps(__spreadValues(__spreadValues({}, controlDefaultStyle), element), {
3933
3942
  controlId,
3934
3943
  value: value2 === "\n" ? ZERO : value2,
3935
3944
  type: element.type || ElementType.TEXT,
@@ -3940,33 +3949,32 @@ function formatElementList(elementList, options) {
3940
3949
  }
3941
3950
  }
3942
3951
  } else if (placeholder) {
3943
- const thePlaceholderArgs = {};
3944
- if (editorOptions && editorOptions.control) {
3945
- thePlaceholderArgs.color = editorOptions.control.placeholderColor;
3946
- }
3952
+ const thePlaceholderArgs = __spreadProps(__spreadValues({}, controlDefaultStyle), {
3953
+ color: editorOptions.control.placeholderColor
3954
+ });
3947
3955
  const placeholderStrList = splitText(placeholder);
3948
3956
  for (let p = 0; p < placeholderStrList.length; p++) {
3949
3957
  const value2 = placeholderStrList[p];
3950
- elementList.splice(i, 0, __spreadValues({
3958
+ elementList.splice(i, 0, __spreadProps(__spreadValues({}, thePlaceholderArgs), {
3951
3959
  controlId,
3952
3960
  value: value2 === "\n" ? ZERO : value2,
3953
3961
  type: el.type,
3954
3962
  control: el.control,
3955
3963
  controlComponent: ControlComponent.PLACEHOLDER
3956
- }, thePlaceholderArgs));
3964
+ }));
3957
3965
  i++;
3958
3966
  }
3959
3967
  }
3960
3968
  const postfixStrList = splitText(postfix || controlOption.postfix);
3961
3969
  for (let p = 0; p < postfixStrList.length; p++) {
3962
3970
  const value2 = postfixStrList[p];
3963
- elementList.splice(i, 0, __spreadValues({
3971
+ elementList.splice(i, 0, __spreadProps(__spreadValues({}, thePrePostfixArg), {
3964
3972
  controlId,
3965
3973
  value: value2,
3966
3974
  type: el.type,
3967
3975
  control: el.control,
3968
3976
  controlComponent: ControlComponent.POSTFIX
3969
- }, thePrePostfixArgs));
3977
+ }));
3970
3978
  i++;
3971
3979
  }
3972
3980
  i--;
@@ -4172,7 +4180,8 @@ function zipElementList(payload) {
4172
4180
  } else if (element.controlId) {
4173
4181
  const controlId = element.controlId;
4174
4182
  if (controlId) {
4175
- const control = element.control;
4183
+ const controlDefaultStyle = pickObject(element, CONTROL_STYLE_ATTR);
4184
+ const control = __spreadValues(__spreadValues({}, element.control), controlDefaultStyle);
4176
4185
  const controlElement = {
4177
4186
  type: ElementType.CONTROL,
4178
4187
  value: "",
@@ -5724,6 +5733,12 @@ function mousemove(evt, host) {
5724
5733
  }
5725
5734
  if (start === end)
5726
5735
  return;
5736
+ const elementList = draw.getElementList();
5737
+ const startElement = elementList[start + 1];
5738
+ const endElement = elementList[end];
5739
+ if ((startElement == null ? void 0 : startElement.controlComponent) === ControlComponent.PLACEHOLDER && (endElement == null ? void 0 : endElement.controlComponent) === ControlComponent.PLACEHOLDER && startElement.controlId === endElement.controlId) {
5740
+ return;
5741
+ }
5727
5742
  rangeManager.setRange(start, end);
5728
5743
  }
5729
5744
  draw.render({
@@ -6723,7 +6738,7 @@ function getWordRangeBySegmenter(host) {
6723
6738
  const paragraphInfo = rangeManager.getRangeParagraphInfo();
6724
6739
  if (!paragraphInfo)
6725
6740
  return null;
6726
- const paragraphText = ((_a = paragraphInfo == null ? void 0 : paragraphInfo.elementList) == null ? void 0 : _a.map((e) => !e.type || TEXTLIKE_ELEMENT_TYPE.includes(e.type) && e.controlComponent !== ControlComponent.CHECKBOX ? e.value : ZERO).join("")) || "";
6741
+ const paragraphText = ((_a = paragraphInfo == null ? void 0 : paragraphInfo.elementList) == null ? void 0 : _a.map((e) => !e.type || e.type !== ElementType.CONTROL && TEXTLIKE_ELEMENT_TYPE.includes(e.type) ? e.value : ZERO).join("")) || "";
6727
6742
  if (!paragraphText)
6728
6743
  return null;
6729
6744
  const cursorStartIndex = cursorPosition.index;
@@ -7239,6 +7254,9 @@ class HistoryManager {
7239
7254
  isCanRedo() {
7240
7255
  return !!this.redoStack.length;
7241
7256
  }
7257
+ isStackEmpty() {
7258
+ return !this.undoStack.length && !this.redoStack.length;
7259
+ }
7242
7260
  recovery() {
7243
7261
  this.undoStack = [];
7244
7262
  this.redoStack = [];
@@ -8020,6 +8038,7 @@ class RangeManager {
8020
8038
  this.setRange(range.startIndex, range.endIndex, range.tableId, range.startTdIndex, range.endTdIndex, range.startTrIndex, range.endTrIndex);
8021
8039
  }
8022
8040
  setRangeStyle() {
8041
+ var _a;
8023
8042
  const rangeStyleChangeListener = this.listener.rangeStyleChange;
8024
8043
  const isSubscribeRangeStyleChange = this.eventBus.isSubscribe("rangeStyleChange");
8025
8044
  if (!rangeStyleChangeListener && !isSubscribeRangeStyleChange)
@@ -8046,8 +8065,8 @@ class RangeManager {
8046
8065
  const bold = !~curElementList.findIndex((el) => !el.bold);
8047
8066
  const italic = !~curElementList.findIndex((el) => !el.italic);
8048
8067
  const underline = !~curElementList.findIndex((el) => {
8049
- var _a;
8050
- return !el.underline && !((_a = el.control) == null ? void 0 : _a.underline);
8068
+ var _a2;
8069
+ return !el.underline && !((_a2 = el.control) == null ? void 0 : _a2.underline);
8051
8070
  });
8052
8071
  const strikeout = !~curElementList.findIndex((el) => !el.strikeout);
8053
8072
  const color = curElement.color || null;
@@ -8063,6 +8082,7 @@ class RangeManager {
8063
8082
  const undo = this.historyManager.isCanUndo();
8064
8083
  const redo = this.historyManager.isCanRedo();
8065
8084
  const groupIds = curElement.groupIds || null;
8085
+ const extension = (_a = curElement.extension) != null ? _a : null;
8066
8086
  const rangeStyle = {
8067
8087
  type,
8068
8088
  undo,
@@ -8083,7 +8103,8 @@ class RangeManager {
8083
8103
  listType,
8084
8104
  listStyle,
8085
8105
  groupIds,
8086
- textDecoration
8106
+ textDecoration,
8107
+ extension
8087
8108
  };
8088
8109
  if (rangeStyleChangeListener) {
8089
8110
  rangeStyleChangeListener(rangeStyle);
@@ -8123,7 +8144,8 @@ class RangeManager {
8123
8144
  listType: null,
8124
8145
  listStyle: null,
8125
8146
  groupIds: null,
8126
- textDecoration: null
8147
+ textDecoration: null,
8148
+ extension: null
8127
8149
  };
8128
8150
  if (rangeStyleChangeListener) {
8129
8151
  rangeStyleChangeListener(rangeStyle);
@@ -10085,6 +10107,47 @@ class ControlSearch {
10085
10107
  ctx.restore();
10086
10108
  }
10087
10109
  }
10110
+ class ControlBorder {
10111
+ constructor(draw) {
10112
+ __publicField(this, "borderRect");
10113
+ __publicField(this, "options");
10114
+ this.borderRect = this.clearBorderInfo();
10115
+ this.options = draw.getOptions();
10116
+ }
10117
+ clearBorderInfo() {
10118
+ this.borderRect = {
10119
+ x: 0,
10120
+ y: 0,
10121
+ width: 0,
10122
+ height: 0
10123
+ };
10124
+ return this.borderRect;
10125
+ }
10126
+ recordBorderInfo(x, y, width, height) {
10127
+ const isFirstRecord = !this.borderRect.width;
10128
+ if (isFirstRecord) {
10129
+ this.borderRect.x = x;
10130
+ this.borderRect.y = y;
10131
+ this.borderRect.height = height;
10132
+ }
10133
+ this.borderRect.width += width;
10134
+ }
10135
+ render(ctx) {
10136
+ if (!this.borderRect.width)
10137
+ return;
10138
+ const { scale, control: { borderWidth, borderColor } } = this.options;
10139
+ const { x, y, width, height } = this.borderRect;
10140
+ ctx.save();
10141
+ ctx.translate(0, 1 * scale);
10142
+ ctx.lineWidth = borderWidth * scale;
10143
+ ctx.strokeStyle = borderColor;
10144
+ ctx.beginPath();
10145
+ ctx.rect(x, y, width, height);
10146
+ ctx.stroke();
10147
+ ctx.restore();
10148
+ this.clearBorderInfo();
10149
+ }
10150
+ }
10088
10151
  class SelectControl {
10089
10152
  constructor(element, control) {
10090
10153
  __publicField(this, "element");
@@ -10227,7 +10290,9 @@ class SelectControl {
10227
10290
  if (!valueSet)
10228
10291
  return;
10229
10292
  const elementList = context.elementList || this.control.getElementList();
10230
- const styleElement = pickObject(this.getValue(context)[0], EDITOR_ELEMENT_STYLE_ATTR);
10293
+ const range = context.range || this.control.getRange();
10294
+ const valueElement = this.getValue(context)[0];
10295
+ const styleElement = valueElement ? pickObject(valueElement, EDITOR_ELEMENT_STYLE_ATTR) : pickObject(elementList[range.startIndex], CONTROL_STYLE_ATTR);
10231
10296
  const prefixIndex = this.clearSelect(context);
10232
10297
  if (!~prefixIndex)
10233
10298
  return;
@@ -10360,7 +10425,11 @@ class TextControl {
10360
10425
  this.control.removePlaceholder(startIndex, context);
10361
10426
  }
10362
10427
  const startElement = elementList[startIndex];
10363
- const anchorElement = startElement.type && !TEXTLIKE_ELEMENT_TYPE.includes(startElement.type) || startElement.controlComponent === ControlComponent.PREFIX ? pickObject(startElement, ["control", "controlId"]) : omitObject(startElement, ["type"]);
10428
+ const anchorElement = startElement.type && !TEXTLIKE_ELEMENT_TYPE.includes(startElement.type) || startElement.controlComponent === ControlComponent.PREFIX ? pickObject(startElement, [
10429
+ "control",
10430
+ "controlId",
10431
+ ...CONTROL_STYLE_ATTR
10432
+ ]) : omitObject(startElement, ["type"]);
10364
10433
  const start = range.startIndex + 1;
10365
10434
  for (let i = 0; i < data2.length; i++) {
10366
10435
  const newElement = __spreadProps(__spreadValues(__spreadValues({}, anchorElement), data2[i]), {
@@ -10461,6 +10530,7 @@ class TextControl {
10461
10530
  }
10462
10531
  class Control {
10463
10532
  constructor(draw) {
10533
+ __publicField(this, "controlBorder");
10464
10534
  __publicField(this, "draw");
10465
10535
  __publicField(this, "range");
10466
10536
  __publicField(this, "listener");
@@ -10469,6 +10539,7 @@ class Control {
10469
10539
  __publicField(this, "options");
10470
10540
  __publicField(this, "controlOptions");
10471
10541
  __publicField(this, "activeControl");
10542
+ this.controlBorder = new ControlBorder(draw);
10472
10543
  this.draw = draw;
10473
10544
  this.range = draw.getRange();
10474
10545
  this.listener = draw.getListener();
@@ -11091,6 +11162,12 @@ class Control {
11091
11162
  }
11092
11163
  return zipElementList(controlElementList);
11093
11164
  }
11165
+ recordBorderInfo(x, y, width, height) {
11166
+ this.controlBorder.recordBorderInfo(x, y, width, height);
11167
+ }
11168
+ drawBorder(ctx) {
11169
+ this.controlBorder.render(ctx);
11170
+ }
11094
11171
  }
11095
11172
  class CheckboxParticle {
11096
11173
  constructor(draw) {
@@ -12229,25 +12306,36 @@ const _IFrameBlock = class {
12229
12306
  __publicField(this, "element");
12230
12307
  this.element = element;
12231
12308
  }
12309
+ _defineIframeProperties(iframeWindow) {
12310
+ Object.defineProperties(iframeWindow, {
12311
+ parent: {
12312
+ get: () => null
12313
+ },
12314
+ __POWERED_BY_CANVAS_EDITOR__: {
12315
+ get: () => true
12316
+ }
12317
+ });
12318
+ }
12232
12319
  render(blockItemContainer) {
12233
- var _a;
12320
+ var _a, _b;
12234
12321
  const block = this.element.block;
12235
12322
  const iframe = document.createElement("iframe");
12323
+ iframe.setAttribute("data-id", this.element.id);
12236
12324
  iframe.sandbox.add(..._IFrameBlock.sandbox);
12237
12325
  iframe.style.border = "none";
12238
12326
  iframe.style.width = "100%";
12239
12327
  iframe.style.height = "100%";
12240
- iframe.src = ((_a = block.iframeBlock) == null ? void 0 : _a.src) || "";
12328
+ if ((_a = block.iframeBlock) == null ? void 0 : _a.src) {
12329
+ iframe.src = block.iframeBlock.src;
12330
+ } else if ((_b = block.iframeBlock) == null ? void 0 : _b.srcdoc) {
12331
+ iframe.srcdoc = block.iframeBlock.srcdoc;
12332
+ }
12241
12333
  blockItemContainer.append(iframe);
12334
+ this._defineIframeProperties(iframe.contentWindow);
12242
12335
  }
12243
12336
  };
12244
12337
  let IFrameBlock = _IFrameBlock;
12245
- __publicField(IFrameBlock, "sandbox", [
12246
- "allow-forms",
12247
- "allow-scripts",
12248
- "allow-same-origin",
12249
- "allow-popups"
12250
- ]);
12338
+ __publicField(IFrameBlock, "sandbox", ["allow-scripts", "allow-same-origin"]);
12251
12339
  class VideoBlock {
12252
12340
  constructor(element) {
12253
12341
  __publicField(this, "element");
@@ -13374,7 +13462,8 @@ class Draw {
13374
13462
  this.printModeData = null;
13375
13463
  this.render({
13376
13464
  isInit: true,
13377
- isSetCursor: false
13465
+ isSetCursor: false,
13466
+ isFirstRender: true
13378
13467
  });
13379
13468
  }
13380
13469
  getLetterReg() {
@@ -13991,7 +14080,8 @@ class Draw {
13991
14080
  });
13992
14081
  this.historyManager.recovery();
13993
14082
  this.render({
13994
- isSetCursor: false
14083
+ isSetCursor: false,
14084
+ isFirstRender: true
13995
14085
  });
13996
14086
  }
13997
14087
  setEditorData(payload) {
@@ -14058,6 +14148,10 @@ class Draw {
14058
14148
  getElementSize(el) {
14059
14149
  return el.actualSize || el.size || this.options.defaultSize;
14060
14150
  }
14151
+ getElementRowMargin(el) {
14152
+ const { defaultBasicRowMarginHeight, defaultRowMargin, scale } = this.options;
14153
+ return defaultBasicRowMarginHeight * (el.rowMargin || defaultRowMargin) * scale;
14154
+ }
14061
14155
  computeRowList(payload) {
14062
14156
  var _a, _b, _c, _d, _e, _f, _g, _h;
14063
14157
  const { innerWidth, elementList, isPagingMode = false } = payload;
@@ -14492,11 +14586,11 @@ class Draw {
14492
14586
  }
14493
14587
  }
14494
14588
  drawRow(ctx, payload) {
14495
- var _a, _b, _c;
14589
+ var _a, _b, _c, _d, _e, _f;
14496
14590
  this._drawHighlight(ctx, payload);
14497
14591
  const { rowList, pageNo, elementList, positionList, startIndex, zone: zone2 } = payload;
14498
14592
  const isPrintMode = this.mode === EditorMode.PRINT;
14499
- const { scale, tdPadding, defaultBasicRowMarginHeight, defaultRowMargin, group: group2 } = this.options;
14593
+ const { scale, tdPadding, group: group2 } = this.options;
14500
14594
  const { isCrossRowCol, tableId } = this.range.getRange();
14501
14595
  let index2 = startIndex;
14502
14596
  for (let i = 0; i < rowList.length; i++) {
@@ -14574,11 +14668,20 @@ class Draw {
14574
14668
  this.textParticle.complete();
14575
14669
  }
14576
14670
  }
14577
- if (element.underline || ((_a = element.control) == null ? void 0 : _a.underline)) {
14671
+ if ((_a = element.control) == null ? void 0 : _a.border) {
14672
+ if (((_b = preElement == null ? void 0 : preElement.control) == null ? void 0 : _b.border) && preElement.controlId !== element.controlId) {
14673
+ this.control.drawBorder(ctx);
14674
+ }
14675
+ const rowMargin = this.getElementRowMargin(element);
14676
+ this.control.recordBorderInfo(x, y + rowMargin, element.metrics.width, curRow.height - 2 * rowMargin);
14677
+ } else if ((_c = preElement == null ? void 0 : preElement.control) == null ? void 0 : _c.border) {
14678
+ this.control.drawBorder(ctx);
14679
+ }
14680
+ if (element.underline || ((_d = element.control) == null ? void 0 : _d.underline)) {
14578
14681
  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) {
14579
14682
  this.underline.render(ctx);
14580
14683
  }
14581
- const rowMargin = defaultBasicRowMarginHeight * (element.rowMargin || defaultRowMargin) * scale;
14684
+ const rowMargin = this.getElementRowMargin(element);
14582
14685
  const offsetX = element.left || 0;
14583
14686
  let offsetY2 = 0;
14584
14687
  if (element.type === ElementType.SUBSCRIPT) {
@@ -14587,8 +14690,8 @@ class Draw {
14587
14690
  offsetY2 = this.superscriptParticle.getOffsetY(element);
14588
14691
  }
14589
14692
  const color = element.controlComponent === ControlComponent.PLACEHOLDER ? void 0 : element.color;
14590
- this.underline.recordFillInfo(ctx, x - offsetX, y + curRow.height - rowMargin + offsetY2, metrics.width + offsetX, 0, color, (_b = element.textDecoration) == null ? void 0 : _b.style);
14591
- } else if ((preElement == null ? void 0 : preElement.underline) || ((_c = preElement == null ? void 0 : preElement.control) == null ? void 0 : _c.underline)) {
14693
+ this.underline.recordFillInfo(ctx, x - offsetX, y + curRow.height - rowMargin + offsetY2, metrics.width + offsetX, 0, color, (_e = element.textDecoration) == null ? void 0 : _e.style);
14694
+ } else if ((preElement == null ? void 0 : preElement.underline) || ((_f = preElement == null ? void 0 : preElement.control) == null ? void 0 : _f.underline)) {
14592
14695
  this.underline.render(ctx);
14593
14696
  }
14594
14697
  if (element.strikeout) {
@@ -14661,6 +14764,7 @@ class Draw {
14661
14764
  this.listParticle.drawListStyle(ctx, curRow, positionList[curRow.startIndex]);
14662
14765
  }
14663
14766
  this.textParticle.complete();
14767
+ this.control.drawBorder(ctx);
14664
14768
  this.underline.render(ctx);
14665
14769
  this.strikeout.render(ctx);
14666
14770
  this.group.render(ctx);
@@ -14786,7 +14890,7 @@ class Draw {
14786
14890
  render(payload) {
14787
14891
  var _a;
14788
14892
  const { header, footer } = this.options;
14789
- const { isSubmitHistory = true, isSetCursor = true, isCompute = true, isLazy = true, isInit = false, isSourceHistory = false } = payload || {};
14893
+ const { isSubmitHistory = true, isSetCursor = true, isCompute = true, isLazy = true, isInit = false, isSourceHistory = false, isFirstRender = false } = payload || {};
14790
14894
  let { curIndex } = payload || {};
14791
14895
  const innerWidth = this.getInnerWidth();
14792
14896
  const isPagingMode = this.getIsPagingMode();
@@ -14849,7 +14953,7 @@ class Draw {
14849
14953
  }
14850
14954
  this.cursor.drawCursor();
14851
14955
  }
14852
- if (isSubmitHistory) {
14956
+ if (isSubmitHistory && !isFirstRender || curIndex !== void 0 && this.historyManager.isStackEmpty()) {
14853
14957
  const oldElementList = getSlimCloneElementList(this.elementList);
14854
14958
  const oldHeaderElementList = getSlimCloneElementList(this.header.getElementList());
14855
14959
  const oldFooterElementList = getSlimCloneElementList(this.footer.getElementList());
@@ -18058,7 +18162,9 @@ const defaultControlOption = {
18058
18162
  placeholderColor: "#9c9b9b",
18059
18163
  bracketColor: "#000000",
18060
18164
  prefix: "{",
18061
- postfix: "}"
18165
+ postfix: "}",
18166
+ borderWidth: 1,
18167
+ borderColor: "#000000"
18062
18168
  };
18063
18169
  const defaultCheckboxOption = {
18064
18170
  width: 14,