@hufe921/canvas-editor 0.9.35 → 0.9.36

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.
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
23
23
  return value;
24
24
  };
25
25
  var index = "";
26
- const version = "0.9.35";
26
+ const version = "0.9.36";
27
27
  var MaxHeightRatio;
28
28
  (function(MaxHeightRatio2) {
29
29
  MaxHeightRatio2["HALF"] = "half";
@@ -37,6 +37,7 @@ var NumberType;
37
37
  })(NumberType || (NumberType = {}));
38
38
  const ZERO = "\u200B";
39
39
  const WRAP = "\n";
40
+ const NBSP = " ";
40
41
  const PUNCTUATION_LIST = ["\xB7", "\u3001", ":", "\uFF1A", ",", "\uFF0C", ".", "\u3002", ";", "\uFF1B", "?", "\uFF1F", "!", "\uFF01"];
41
42
  const maxHeightRadioMapping = {
42
43
  [MaxHeightRatio.HALF]: 1 / 2,
@@ -172,6 +173,17 @@ function convertNumberToChinese(num) {
172
173
  result = result.replace(/^一十/g, "\u5341");
173
174
  return result;
174
175
  }
176
+ function cloneProperty(properties, sourceElement, targetElement) {
177
+ for (let i = 0; i < properties.length; i++) {
178
+ const property = properties[i];
179
+ const value = sourceElement[property];
180
+ if (value !== void 0) {
181
+ targetElement[property] = value;
182
+ } else {
183
+ delete targetElement[property];
184
+ }
185
+ }
186
+ }
175
187
  const CURSOR_AGENT_HEIGHT = 12;
176
188
  const defaultCursorOption = {
177
189
  width: 1,
@@ -255,16 +267,25 @@ const EDITOR_ELEMENT_ZIP_ATTR = [
255
267
  "listStyle",
256
268
  "listWrap"
257
269
  ];
258
- const EDITOR_ELEMENT_CONTEXT_ATTR = [
270
+ const TABLE_CONTEXT_ATTR = [
259
271
  "tdId",
260
272
  "trId",
261
- "tableId",
273
+ "tableId"
274
+ ];
275
+ const TITLE_CONTEXT_ATTR = [
262
276
  "level",
263
- "titleId",
277
+ "titleId"
278
+ ];
279
+ const LIST_CONTEXT_ATTR = [
264
280
  "listId",
265
281
  "listType",
266
282
  "listStyle"
267
283
  ];
284
+ const EDITOR_ELEMENT_CONTEXT_ATTR = [
285
+ ...TABLE_CONTEXT_ATTR,
286
+ ...TITLE_CONTEXT_ATTR,
287
+ ...LIST_CONTEXT_ATTR
288
+ ];
268
289
  const TEXTLIKE_ELEMENT_TYPE = [
269
290
  ElementType.TEXT,
270
291
  ElementType.HYPERLINK,
@@ -3885,6 +3906,7 @@ function getAnchorElement(elementList, anchorIndex) {
3885
3906
  return !anchorElement.listId && anchorElement.value === ZERO && anchorNextElement && anchorNextElement.value !== ZERO ? anchorNextElement : anchorElement;
3886
3907
  }
3887
3908
  function formatElementContext(sourceElementList, formatElementList2, anchorIndex, options) {
3909
+ var _a, _b;
3888
3910
  const copyElement = getAnchorElement(sourceElementList, anchorIndex);
3889
3911
  if (!copyElement)
3890
3912
  return;
@@ -3893,20 +3915,16 @@ function formatElementContext(sourceElementList, formatElementList2, anchorIndex
3893
3915
  const targetElement = formatElementList2[e];
3894
3916
  if (isBreakWhenWrap && !copyElement.listId && /^\n/.test(targetElement.value))
3895
3917
  break;
3896
- if (!copyElement.listId && targetElement.type === ElementType.LIST)
3918
+ if (!copyElement.listId && targetElement.type === ElementType.LIST) {
3919
+ (_a = targetElement.valueList) == null ? void 0 : _a.forEach((valueItem) => {
3920
+ cloneProperty(TABLE_CONTEXT_ATTR, copyElement, valueItem);
3921
+ });
3897
3922
  continue;
3898
- if (targetElement.valueList && targetElement.valueList.length) {
3899
- formatElementContext(sourceElementList, targetElement.valueList, anchorIndex);
3900
3923
  }
3901
- for (let i = 0; i < EDITOR_ELEMENT_CONTEXT_ATTR.length; i++) {
3902
- const attr = EDITOR_ELEMENT_CONTEXT_ATTR[i];
3903
- const value = copyElement[attr];
3904
- if (value !== void 0) {
3905
- targetElement[attr] = value;
3906
- } else {
3907
- delete targetElement[attr];
3908
- }
3924
+ if ((_b = targetElement.valueList) == null ? void 0 : _b.length) {
3925
+ formatElementContext(sourceElementList, targetElement.valueList, anchorIndex);
3909
3926
  }
3927
+ cloneProperty(EDITOR_ELEMENT_CONTEXT_ATTR, copyElement, targetElement);
3910
3928
  }
3911
3929
  }
3912
3930
  function writeClipboardItem(text, html) {
@@ -4093,10 +4111,11 @@ function convertTextNodeToElement(textNode) {
4093
4111
  if (!textNode || textNode.nodeType !== 3)
4094
4112
  return null;
4095
4113
  const parentNode = textNode.parentNode;
4096
- const rowFlex = getElementRowFlex(parentNode);
4114
+ const anchorNode = parentNode.nodeName === "FONT" ? parentNode.parentNode : parentNode;
4115
+ const rowFlex = getElementRowFlex(anchorNode);
4097
4116
  const value = textNode.textContent;
4098
- const style = window.getComputedStyle(parentNode);
4099
- if (!value || parentNode.nodeName === "STYLE")
4117
+ const style = window.getComputedStyle(anchorNode);
4118
+ if (!value || anchorNode.nodeName === "STYLE")
4100
4119
  return null;
4101
4120
  const element = {
4102
4121
  value,
@@ -4105,9 +4124,9 @@ function convertTextNodeToElement(textNode) {
4105
4124
  italic: style.fontStyle.includes("italic"),
4106
4125
  size: Math.floor(parseFloat(style.fontSize))
4107
4126
  };
4108
- if (parentNode.nodeName === "SUB") {
4127
+ if (anchorNode.nodeName === "SUB" || style.verticalAlign === "sub") {
4109
4128
  element.type = ElementType.SUBSCRIPT;
4110
- } else if (parentNode.nodeName === "SUP") {
4129
+ } else if (anchorNode.nodeName === "SUP" || style.verticalAlign === "super") {
4111
4130
  element.type = ElementType.SUPERSCRIPT;
4112
4131
  }
4113
4132
  if (rowFlex !== RowFlex.LEFT) {
@@ -4433,6 +4452,9 @@ class Cursor {
4433
4452
  getAgentDom() {
4434
4453
  return this.cursorAgent.getAgentCursorDom();
4435
4454
  }
4455
+ getAgentIsActive() {
4456
+ return this.getAgentDom() === document.activeElement;
4457
+ }
4436
4458
  getAgentDomValue() {
4437
4459
  return this.getAgentDom().value;
4438
4460
  }
@@ -4463,7 +4485,7 @@ class Cursor {
4463
4485
  if (!cursorPosition)
4464
4486
  return;
4465
4487
  const { scale, cursor } = this.options;
4466
- const { color, width, isShow = true, isBlink = true } = __spreadValues(__spreadValues({}, cursor), payload);
4488
+ const { color, width, isShow = true, isBlink = true, isFocus = true } = __spreadValues(__spreadValues({}, cursor), payload);
4467
4489
  const height = this.draw.getHeight();
4468
4490
  const pageGap = this.draw.getPageGap();
4469
4491
  const { metrics, coordinate: { leftTop, rightTop }, ascent, pageNo } = cursorPosition;
@@ -4473,10 +4495,12 @@ class Cursor {
4473
4495
  const offsetHeight = metrics.height / 4;
4474
4496
  const cursorHeight = metrics.height + offsetHeight * 2;
4475
4497
  const agentCursorDom = this.cursorAgent.getAgentCursorDom();
4476
- setTimeout(() => {
4477
- agentCursorDom.focus();
4478
- agentCursorDom.setSelectionRange(0, 0);
4479
- });
4498
+ if (isFocus) {
4499
+ setTimeout(() => {
4500
+ agentCursorDom.focus();
4501
+ agentCursorDom.setSelectionRange(0, 0);
4502
+ });
4503
+ }
4480
4504
  const descent = metrics.boundingBoxDescent < 0 ? 0 : metrics.boundingBoxDescent;
4481
4505
  const cursorTop = leftTop[1] + ascent + descent - (cursorHeight - offsetHeight) + preY;
4482
4506
  const cursorLeft = rightTop[0];
@@ -5414,13 +5438,15 @@ const NUMBER_LIKE_REG = /[0-9.]/;
5414
5438
  function dblclick(host, evt) {
5415
5439
  const draw = host.getDraw();
5416
5440
  const position = draw.getPosition();
5417
- const positionContext = position.getPositionByXY({
5418
- x: evt.offsetX,
5419
- y: evt.offsetY
5420
- });
5421
- if (!~positionContext.index && positionContext.zone) {
5422
- draw.getZone().setZone(positionContext.zone);
5423
- return;
5441
+ if (draw.getIsPagingMode()) {
5442
+ const positionContext = position.getPositionByXY({
5443
+ x: evt.offsetX,
5444
+ y: evt.offsetY
5445
+ });
5446
+ if (!~positionContext.index && positionContext.zone) {
5447
+ draw.getZone().setZone(positionContext.zone);
5448
+ return;
5449
+ }
5424
5450
  }
5425
5451
  const cursorPosition = position.getCursorPosition();
5426
5452
  if (!cursorPosition)
@@ -5730,6 +5756,7 @@ class GlobalEvent {
5730
5756
  const outerEditorDom = findParent(evt.target, (node) => !!node && node.nodeType === 1 && !!node.getAttribute(EDITOR_COMPONENT), true);
5731
5757
  if (outerEditorDom) {
5732
5758
  this.setRangeStyle();
5759
+ this.watchCursorActive();
5733
5760
  return;
5734
5761
  }
5735
5762
  this.cursor.recoveryCursor();
@@ -5808,12 +5835,26 @@ class GlobalEvent {
5808
5835
  document.removeEventListener("visibilitychange", this._handleVisibilityChange);
5809
5836
  this.dprMediaQueryList.removeEventListener("change", this._handleDprChange);
5810
5837
  }
5838
+ watchCursorActive() {
5839
+ if (!this.range.getIsCollapsed())
5840
+ return;
5841
+ setTimeout(() => {
5842
+ var _a, _b;
5843
+ if (!((_a = this.cursor) == null ? void 0 : _a.getAgentIsActive())) {
5844
+ (_b = this.cursor) == null ? void 0 : _b.drawCursor({
5845
+ isFocus: false,
5846
+ isBlink: false
5847
+ });
5848
+ }
5849
+ });
5850
+ }
5811
5851
  }
5812
5852
  class HistoryManager {
5813
- constructor() {
5814
- __publicField(this, "MAX_RECORD_COUNT", 1e3);
5853
+ constructor(draw) {
5815
5854
  __publicField(this, "undoStack", []);
5816
5855
  __publicField(this, "redoStack", []);
5856
+ __publicField(this, "maxRecordCount");
5857
+ this.maxRecordCount = draw.getOptions().historyMaxRecordCount + 1;
5817
5858
  }
5818
5859
  undo() {
5819
5860
  if (this.undoStack.length > 1) {
@@ -5836,7 +5877,7 @@ class HistoryManager {
5836
5877
  if (this.redoStack.length) {
5837
5878
  this.redoStack = [];
5838
5879
  }
5839
- while (this.undoStack.length > this.MAX_RECORD_COUNT) {
5880
+ while (this.undoStack.length > this.maxRecordCount) {
5840
5881
  this.undoStack.shift();
5841
5882
  }
5842
5883
  }
@@ -6162,7 +6203,7 @@ class Position {
6162
6203
  const isHead = x < this.options.margins[3];
6163
6204
  if (isHead) {
6164
6205
  const headIndex = positionList.findIndex((p) => p.pageNo === positionNo && p.rowNo === lastLetterList[j].rowNo);
6165
- curPositionIndex = ~headIndex ? headIndex - 1 : index2;
6206
+ curPositionIndex = ~headIndex ? positionList[headIndex].value === ZERO ? headIndex : headIndex - 1 : index2;
6166
6207
  } else {
6167
6208
  curPositionIndex = index2;
6168
6209
  }
@@ -6266,6 +6307,10 @@ class RangeManager {
6266
6307
  clearRange() {
6267
6308
  this.setRange(-1, -1);
6268
6309
  }
6310
+ getIsCollapsed() {
6311
+ const { startIndex, endIndex } = this.range;
6312
+ return startIndex === endIndex;
6313
+ }
6269
6314
  getSelection() {
6270
6315
  const { startIndex, endIndex } = this.range;
6271
6316
  if (startIndex === endIndex)
@@ -6417,7 +6462,9 @@ class RangeManager {
6417
6462
  setRangeStyle() {
6418
6463
  if (!this.listener.rangeStyleChange)
6419
6464
  return;
6420
- const { endIndex, isCrossRowCol } = this.range;
6465
+ const { startIndex, endIndex, isCrossRowCol } = this.range;
6466
+ if (!~startIndex && !~endIndex)
6467
+ return;
6421
6468
  let curElement;
6422
6469
  if (isCrossRowCol) {
6423
6470
  const originalElementList = this.draw.getOriginalElementList();
@@ -7156,9 +7203,10 @@ var MoveDirection;
7156
7203
  MoveDirection2["RIGHT"] = "right";
7157
7204
  })(MoveDirection || (MoveDirection = {}));
7158
7205
  class SelectionObserver {
7159
- constructor() {
7206
+ constructor(draw) {
7160
7207
  __publicField(this, "step", 5);
7161
7208
  __publicField(this, "thresholdPoints", [70, 40, 10, 20]);
7209
+ __publicField(this, "rangeManager");
7162
7210
  __publicField(this, "requestAnimationFrameId");
7163
7211
  __publicField(this, "isMousedown");
7164
7212
  __publicField(this, "isMoving");
@@ -7170,7 +7218,7 @@ class SelectionObserver {
7170
7218
  this._stopMove();
7171
7219
  });
7172
7220
  __publicField(this, "_mousemove", (evt) => {
7173
- if (!this.isMousedown)
7221
+ if (!this.isMousedown || this.rangeManager.getIsCollapsed())
7174
7222
  return;
7175
7223
  const { x, y } = evt;
7176
7224
  const clientWidth = document.documentElement.clientWidth;
@@ -7190,6 +7238,7 @@ class SelectionObserver {
7190
7238
  this.requestAnimationFrameId = null;
7191
7239
  this.isMousedown = false;
7192
7240
  this.isMoving = false;
7241
+ this.rangeManager = draw.getRange();
7193
7242
  this._addEvent();
7194
7243
  }
7195
7244
  _addEvent() {
@@ -7869,11 +7918,11 @@ class Header {
7869
7918
  return this.positionList;
7870
7919
  }
7871
7920
  compute() {
7872
- this._recovery();
7921
+ this.recovery();
7873
7922
  this._computeRowList();
7874
7923
  this._computePositionList();
7875
7924
  }
7876
- _recovery() {
7925
+ recovery() {
7877
7926
  this.rowList = [];
7878
7927
  this.positionList = [];
7879
7928
  }
@@ -10073,11 +10122,11 @@ class Footer {
10073
10122
  return this.positionList;
10074
10123
  }
10075
10124
  compute() {
10076
- this._recovery();
10125
+ this.recovery();
10077
10126
  this._computeRowList();
10078
10127
  this._computePositionList();
10079
10128
  }
10080
- _recovery() {
10129
+ recovery() {
10081
10130
  this.rowList = [];
10082
10131
  this.positionList = [];
10083
10132
  }
@@ -10232,6 +10281,80 @@ class ListParticle {
10232
10281
  ctx.restore();
10233
10282
  }
10234
10283
  }
10284
+ class Placeholder {
10285
+ constructor(draw) {
10286
+ __publicField(this, "draw");
10287
+ __publicField(this, "position");
10288
+ __publicField(this, "options");
10289
+ __publicField(this, "elementList");
10290
+ __publicField(this, "rowList");
10291
+ __publicField(this, "positionList");
10292
+ this.draw = draw;
10293
+ this.position = draw.getPosition();
10294
+ this.options = draw.getOptions();
10295
+ this.elementList = [];
10296
+ this.rowList = [];
10297
+ this.positionList = [];
10298
+ }
10299
+ _recovery() {
10300
+ this.elementList = [];
10301
+ this.rowList = [];
10302
+ this.positionList = [];
10303
+ }
10304
+ _compute() {
10305
+ this._computeRowList();
10306
+ this._computePositionList();
10307
+ }
10308
+ _computeRowList() {
10309
+ const innerWidth = this.draw.getInnerWidth();
10310
+ this.rowList = this.draw.computeRowList(innerWidth, this.elementList);
10311
+ }
10312
+ _computePositionList() {
10313
+ const headerExtraHeight = this.draw.getHeader().getExtraHeight();
10314
+ const innerWidth = this.draw.getInnerWidth();
10315
+ const margins = this.draw.getMargins();
10316
+ const startX = margins[3];
10317
+ const startY = margins[0] + headerExtraHeight;
10318
+ this.position.computePageRowPosition({
10319
+ positionList: this.positionList,
10320
+ rowList: this.rowList,
10321
+ pageNo: 0,
10322
+ startRowIndex: 0,
10323
+ startIndex: 0,
10324
+ startX,
10325
+ startY,
10326
+ innerWidth
10327
+ });
10328
+ }
10329
+ render(ctx) {
10330
+ const { placeholder: { data: data2, font, size, color, opacity } } = this.options;
10331
+ if (!data2)
10332
+ return;
10333
+ this._recovery();
10334
+ this.elementList = [{
10335
+ value: data2,
10336
+ font,
10337
+ size,
10338
+ color
10339
+ }];
10340
+ formatElementList(this.elementList, {
10341
+ editorOptions: this.options
10342
+ });
10343
+ this._compute();
10344
+ const innerWidth = this.draw.getInnerWidth();
10345
+ ctx.save();
10346
+ ctx.globalAlpha = opacity;
10347
+ this.draw.drawRow(ctx, {
10348
+ elementList: this.elementList,
10349
+ positionList: this.positionList,
10350
+ rowList: this.rowList,
10351
+ pageNo: 0,
10352
+ startIndex: 0,
10353
+ innerWidth
10354
+ });
10355
+ ctx.restore();
10356
+ }
10357
+ }
10235
10358
  class Draw {
10236
10359
  constructor(rootContainer, options, data2, listener) {
10237
10360
  __publicField(this, "container");
@@ -10267,6 +10390,7 @@ class Draw {
10267
10390
  __publicField(this, "tableTool");
10268
10391
  __publicField(this, "pageNumber");
10269
10392
  __publicField(this, "waterMark");
10393
+ __publicField(this, "placeholder");
10270
10394
  __publicField(this, "header");
10271
10395
  __publicField(this, "footer");
10272
10396
  __publicField(this, "hyperlinkParticle");
@@ -10304,7 +10428,7 @@ class Draw {
10304
10428
  this.pageContainer = this._createPageContainer();
10305
10429
  this._createPage(0);
10306
10430
  this.i18n = new I18n();
10307
- this.historyManager = new HistoryManager();
10431
+ this.historyManager = new HistoryManager(this);
10308
10432
  this.position = new Position(this);
10309
10433
  this.zone = new Zone(this);
10310
10434
  this.range = new RangeManager(this);
@@ -10322,6 +10446,7 @@ class Draw {
10322
10446
  this.tableTool = new TableTool(this);
10323
10447
  this.pageNumber = new PageNumber(this);
10324
10448
  this.waterMark = new Watermark(this);
10449
+ this.placeholder = new Placeholder(this);
10325
10450
  this.header = new Header(this);
10326
10451
  this.footer = new Footer(this);
10327
10452
  this.hyperlinkParticle = new HyperlinkParticle(this);
@@ -10335,7 +10460,7 @@ class Draw {
10335
10460
  this.listParticle = new ListParticle(this);
10336
10461
  this.control = new Control(this);
10337
10462
  this.scrollObserver = new ScrollObserver(this);
10338
- this.selectionObserver = new SelectionObserver();
10463
+ this.selectionObserver = new SelectionObserver(this);
10339
10464
  this.imageObserver = new ImageObserver();
10340
10465
  this.canvasEvent = new CanvasEvent(this);
10341
10466
  this.cursor = new Cursor(this, this.canvasEvent);
@@ -10679,6 +10804,9 @@ class Draw {
10679
10804
  this.range.setRangeStyle();
10680
10805
  });
10681
10806
  }
10807
+ getIsPagingMode() {
10808
+ return this.options.pageMode === PageMode.PAGING;
10809
+ }
10682
10810
  setPageMode(payload) {
10683
10811
  if (!payload || this.options.pageMode === payload)
10684
10812
  return;
@@ -10690,6 +10818,11 @@ class Draw {
10690
10818
  canvas.style.height = `${height}px`;
10691
10819
  canvas.height = height * dpr;
10692
10820
  this._initPageContext(this.ctxList[0]);
10821
+ } else {
10822
+ this._disconnectLazyRender();
10823
+ this.header.recovery();
10824
+ this.footer.recovery();
10825
+ this.zone.setZone(EditorZone.MAIN);
10693
10826
  }
10694
10827
  this.render({
10695
10828
  isSubmitHistory: false,
@@ -11182,6 +11315,15 @@ class Draw {
11182
11315
  const element = curRow.elementList[j];
11183
11316
  const metrics = element.metrics;
11184
11317
  const { ascent: offsetY, coordinate: { leftTop: [x, y] } } = positionList[curRow.startIndex + j];
11318
+ const preElement = curRow.elementList[j - 1];
11319
+ if (element.highlight) {
11320
+ if (preElement && preElement.highlight && preElement.highlight !== element.highlight) {
11321
+ this.highlight.render(ctx);
11322
+ }
11323
+ this.highlight.recordFillInfo(ctx, x, y, metrics.width, curRow.height, element.highlight);
11324
+ } else if (preElement == null ? void 0 : preElement.highlight) {
11325
+ this.highlight.render(ctx);
11326
+ }
11185
11327
  if (element.type === ElementType.IMAGE) {
11186
11328
  this._drawRichText(ctx);
11187
11329
  this.imageParticle.render(ctx, element, x, y + offsetY);
@@ -11227,7 +11369,6 @@ class Draw {
11227
11369
  } else {
11228
11370
  this.textParticle.record(ctx, element, x, y + offsetY);
11229
11371
  }
11230
- const preElement = curRow.elementList[j - 1];
11231
11372
  if (element.underline) {
11232
11373
  this.underline.recordFillInfo(ctx, x, y + curRow.height, metrics.width, 0, element.color);
11233
11374
  } else if (preElement == null ? void 0 : preElement.underline) {
@@ -11238,14 +11379,6 @@ class Draw {
11238
11379
  } else if (preElement == null ? void 0 : preElement.strikeout) {
11239
11380
  this.strikeout.render(ctx);
11240
11381
  }
11241
- if (element.highlight) {
11242
- if (preElement && preElement.highlight && preElement.highlight !== element.highlight) {
11243
- this.highlight.render(ctx);
11244
- }
11245
- this.highlight.recordFillInfo(ctx, x, y, metrics.width, curRow.height, element.highlight);
11246
- } else if (preElement == null ? void 0 : preElement.highlight) {
11247
- this.highlight.render(ctx);
11248
- }
11249
11382
  const { zone: currentZone, startIndex: startIndex2, endIndex } = this.range.getRange();
11250
11383
  if (currentZone === zone && startIndex2 !== endIndex && startIndex2 <= index2 && index2 <= endIndex) {
11251
11384
  if (startIndex2 === index2) {
@@ -11331,14 +11464,16 @@ class Draw {
11331
11464
  innerWidth,
11332
11465
  zone: EditorZone.MAIN
11333
11466
  });
11334
- if (!header.disabled) {
11335
- this.header.render(ctx, pageNo);
11336
- }
11337
- if (!pageNumber.disabled) {
11338
- this.pageNumber.render(ctx, pageNo);
11339
- }
11340
- if (!footer.disabled) {
11341
- this.footer.render(ctx, pageNo);
11467
+ if (this.getIsPagingMode()) {
11468
+ if (!header.disabled) {
11469
+ this.header.render(ctx, pageNo);
11470
+ }
11471
+ if (!pageNumber.disabled) {
11472
+ this.pageNumber.render(ctx, pageNo);
11473
+ }
11474
+ if (!footer.disabled) {
11475
+ this.footer.render(ctx, pageNo);
11476
+ }
11342
11477
  }
11343
11478
  if (this.search.getSearchKeyword()) {
11344
11479
  this.search.render(ctx, pageNo);
@@ -11346,12 +11481,18 @@ class Draw {
11346
11481
  if (pageMode !== PageMode.CONTINUITY && this.options.watermark.data) {
11347
11482
  this.waterMark.render(ctx);
11348
11483
  }
11484
+ if (this.elementList.length <= 1) {
11485
+ this.placeholder.render(ctx);
11486
+ }
11349
11487
  }
11350
- _lazyRender() {
11488
+ _disconnectLazyRender() {
11351
11489
  var _a;
11490
+ (_a = this.lazyRenderIntersectionObserver) == null ? void 0 : _a.disconnect();
11491
+ }
11492
+ _lazyRender() {
11352
11493
  const positionList = this.position.getOriginalMainPositionList();
11353
11494
  const elementList = this.getOriginalMainElementList();
11354
- (_a = this.lazyRenderIntersectionObserver) == null ? void 0 : _a.disconnect();
11495
+ this._disconnectLazyRender();
11355
11496
  this.lazyRenderIntersectionObserver = new IntersectionObserver((entries) => {
11356
11497
  entries.forEach((entry) => {
11357
11498
  if (entry.isIntersecting) {
@@ -11383,16 +11524,19 @@ class Draw {
11383
11524
  }
11384
11525
  render(payload) {
11385
11526
  var _a;
11386
- const { pageMode, header, footer } = this.options;
11527
+ const { header, footer } = this.options;
11387
11528
  const { isSubmitHistory = true, isSetCursor = true, isCompute = true, isLazy = true } = payload || {};
11388
11529
  let { curIndex } = payload || {};
11389
11530
  const innerWidth = this.getInnerWidth();
11531
+ const isPagingMode = this.getIsPagingMode();
11390
11532
  if (isCompute) {
11391
- if (!header.disabled) {
11392
- this.header.compute();
11393
- }
11394
- if (!footer.disabled) {
11395
- this.footer.compute();
11533
+ if (isPagingMode) {
11534
+ if (!header.disabled) {
11535
+ this.header.compute();
11536
+ }
11537
+ if (!footer.disabled) {
11538
+ this.footer.compute();
11539
+ }
11396
11540
  }
11397
11541
  this.rowList = this.computeRowList(innerWidth, this.elementList);
11398
11542
  this.pageRowList = this._computePageList();
@@ -11416,7 +11560,7 @@ class Draw {
11416
11560
  this.ctxList.splice(curPageCount, deleteCount);
11417
11561
  this.pageList.splice(curPageCount, deleteCount).forEach((page) => page.remove());
11418
11562
  }
11419
- if (isLazy && pageMode === PageMode.PAGING) {
11563
+ if (isLazy && isPagingMode) {
11420
11564
  this._lazyRender();
11421
11565
  } else {
11422
11566
  this._immediateRender();
@@ -11480,406 +11624,164 @@ class Draw {
11480
11624
  this.selectionObserver.removeEvent();
11481
11625
  }
11482
11626
  }
11483
- const _Command = class {
11627
+ class Command {
11484
11628
  constructor(adapt) {
11485
- _Command.mode = adapt.mode.bind(adapt);
11486
- _Command.cut = adapt.cut.bind(adapt);
11487
- _Command.copy = adapt.copy.bind(adapt);
11488
- _Command.paste = adapt.paste.bind(adapt);
11489
- _Command.selectAll = adapt.selectAll.bind(adapt);
11490
- _Command.backspace = adapt.backspace.bind(adapt);
11491
- _Command.setRange = adapt.setRange.bind(adapt);
11492
- _Command.undo = adapt.undo.bind(adapt);
11493
- _Command.redo = adapt.redo.bind(adapt);
11494
- _Command.painter = adapt.painter.bind(adapt);
11495
- _Command.applyPainterStyle = adapt.applyPainterStyle.bind(adapt);
11496
- _Command.format = adapt.format.bind(adapt);
11497
- _Command.font = adapt.font.bind(adapt);
11498
- _Command.size = adapt.size.bind(adapt);
11499
- _Command.sizeAdd = adapt.sizeAdd.bind(adapt);
11500
- _Command.sizeMinus = adapt.sizeMinus.bind(adapt);
11501
- _Command.bold = adapt.bold.bind(adapt);
11502
- _Command.italic = adapt.italic.bind(adapt);
11503
- _Command.underline = adapt.underline.bind(adapt);
11504
- _Command.strikeout = adapt.strikeout.bind(adapt);
11505
- _Command.superscript = adapt.superscript.bind(adapt);
11506
- _Command.subscript = adapt.subscript.bind(adapt);
11507
- _Command.color = adapt.color.bind(adapt);
11508
- _Command.highlight = adapt.highlight.bind(adapt);
11509
- _Command.title = adapt.title.bind(adapt);
11510
- _Command.list = adapt.list.bind(adapt);
11511
- _Command.left = adapt.rowFlex.bind(adapt);
11512
- _Command.center = adapt.rowFlex.bind(adapt);
11513
- _Command.right = adapt.rowFlex.bind(adapt);
11514
- _Command.alignment = adapt.rowFlex.bind(adapt);
11515
- _Command.rowMargin = adapt.rowMargin.bind(adapt);
11516
- _Command.insertTable = adapt.insertTable.bind(adapt);
11517
- _Command.insertTableTopRow = adapt.insertTableTopRow.bind(adapt);
11518
- _Command.insertTableBottomRow = adapt.insertTableBottomRow.bind(adapt);
11519
- _Command.insertTableLeftCol = adapt.insertTableLeftCol.bind(adapt);
11520
- _Command.insertTableRightCol = adapt.insertTableRightCol.bind(adapt);
11521
- _Command.deleteTableRow = adapt.deleteTableRow.bind(adapt);
11522
- _Command.deleteTableCol = adapt.deleteTableCol.bind(adapt);
11523
- _Command.deleteTable = adapt.deleteTable.bind(adapt);
11524
- _Command.mergeTableCell = adapt.mergeTableCell.bind(adapt);
11525
- _Command.cancelMergeTableCell = adapt.cancelMergeTableCell.bind(adapt);
11526
- _Command.tableTdVerticalAlign = adapt.tableTdVerticalAlign.bind(adapt);
11527
- _Command.tableBorderType = adapt.tableBorderType.bind(adapt);
11528
- _Command.tableTdBackgroundColor = adapt.tableTdBackgroundColor.bind(adapt);
11529
- _Command.image = adapt.image.bind(adapt);
11530
- _Command.hyperlink = adapt.hyperlink.bind(adapt);
11531
- _Command.deleteHyperlink = adapt.deleteHyperlink.bind(adapt);
11532
- _Command.cancelHyperlink = adapt.cancelHyperlink.bind(adapt);
11533
- _Command.editHyperlink = adapt.editHyperlink.bind(adapt);
11534
- _Command.separator = adapt.separator.bind(adapt);
11535
- _Command.pageBreak = adapt.pageBreak.bind(adapt);
11536
- _Command.addWatermark = adapt.addWatermark.bind(adapt);
11537
- _Command.deleteWatermark = adapt.deleteWatermark.bind(adapt);
11538
- _Command.search = adapt.search.bind(adapt);
11539
- _Command.searchNavigatePre = adapt.searchNavigatePre.bind(adapt);
11540
- _Command.searchNavigateNext = adapt.searchNavigateNext.bind(adapt);
11541
- _Command.getSearchNavigateInfo = adapt.getSearchNavigateInfo.bind(adapt);
11542
- _Command.replace = adapt.replace.bind(adapt);
11543
- _Command.print = adapt.print.bind(adapt);
11544
- _Command.replaceImageElement = adapt.replaceImageElement.bind(adapt);
11545
- _Command.saveAsImageElement = adapt.saveAsImageElement.bind(adapt);
11546
- _Command.changeImageDisplay = adapt.changeImageDisplay.bind(adapt);
11547
- _Command.getImage = adapt.getImage.bind(adapt);
11548
- _Command.getValue = adapt.getValue.bind(adapt);
11549
- _Command.getWordCount = adapt.getWordCount.bind(adapt);
11550
- _Command.getRangeText = adapt.getRangeText.bind(adapt);
11551
- _Command.pageMode = adapt.pageMode.bind(adapt);
11552
- _Command.pageScaleRecovery = adapt.pageScaleRecovery.bind(adapt);
11553
- _Command.pageScaleMinus = adapt.pageScaleMinus.bind(adapt);
11554
- _Command.pageScaleAdd = adapt.pageScaleAdd.bind(adapt);
11555
- _Command.paperSize = adapt.paperSize.bind(adapt);
11556
- _Command.paperDirection = adapt.paperDirection.bind(adapt);
11557
- _Command.getPaperMargin = adapt.getPaperMargin.bind(adapt);
11558
- _Command.setPaperMargin = adapt.setPaperMargin.bind(adapt);
11559
- _Command.insertElementList = adapt.insertElementList.bind(adapt);
11560
- _Command.removeControl = adapt.removeControl.bind(adapt);
11561
- _Command.setLocale = adapt.setLocale.bind(adapt);
11562
- _Command.getCatalog = adapt.getCatalog.bind(adapt);
11563
- _Command.locationCatalog = adapt.locationCatalog.bind(adapt);
11564
- }
11565
- executeMode(payload) {
11566
- return _Command.mode(payload);
11567
- }
11568
- executeCut() {
11569
- return _Command.cut();
11570
- }
11571
- executeCopy() {
11572
- return _Command.copy();
11573
- }
11574
- executePaste() {
11575
- return _Command.paste();
11576
- }
11577
- executeSelectAll() {
11578
- return _Command.selectAll();
11579
- }
11580
- executeBackspace() {
11581
- return _Command.backspace();
11582
- }
11583
- executeSetRange(startIndex, endIndex) {
11584
- return _Command.setRange(startIndex, endIndex);
11585
- }
11586
- executeUndo() {
11587
- return _Command.undo();
11588
- }
11589
- executeRedo() {
11590
- return _Command.redo();
11591
- }
11592
- executePainter(options) {
11593
- return _Command.painter(options);
11594
- }
11595
- executeApplyPainterStyle() {
11596
- return _Command.applyPainterStyle();
11597
- }
11598
- executeFormat() {
11599
- return _Command.format();
11600
- }
11601
- executeFont(payload) {
11602
- return _Command.font(payload);
11603
- }
11604
- executeSize(payload) {
11605
- return _Command.size(payload);
11606
- }
11607
- executeSizeAdd() {
11608
- return _Command.sizeAdd();
11609
- }
11610
- executeSizeMinus() {
11611
- return _Command.sizeMinus();
11612
- }
11613
- executeBold() {
11614
- return _Command.bold();
11615
- }
11616
- executeItalic() {
11617
- return _Command.italic();
11618
- }
11619
- executeUnderline() {
11620
- return _Command.underline();
11621
- }
11622
- executeStrikeout() {
11623
- return _Command.strikeout();
11624
- }
11625
- executeSuperscript() {
11626
- return _Command.superscript();
11627
- }
11628
- executeSubscript() {
11629
- return _Command.subscript();
11630
- }
11631
- executeColor(payload) {
11632
- return _Command.color(payload);
11633
- }
11634
- executeHighlight(payload) {
11635
- return _Command.highlight(payload);
11636
- }
11637
- executeTitle(payload) {
11638
- return _Command.title(payload);
11639
- }
11640
- executeLeft() {
11641
- return _Command.left(RowFlex.LEFT);
11642
- }
11643
- executeCenter() {
11644
- return _Command.center(RowFlex.CENTER);
11645
- }
11646
- executeRight() {
11647
- return _Command.right(RowFlex.RIGHT);
11648
- }
11649
- executeAlignment() {
11650
- return _Command.alignment(RowFlex.ALIGNMENT);
11651
- }
11652
- executeRowMargin(payload) {
11653
- return _Command.rowMargin(payload);
11654
- }
11655
- executeList(listType, listStyle) {
11656
- return _Command.list(listType, listStyle);
11657
- }
11658
- executeInsertTable(row, col) {
11659
- return _Command.insertTable(row, col);
11660
- }
11661
- executeInsertTableTopRow() {
11662
- return _Command.insertTableTopRow();
11663
- }
11664
- executeInsertTableBottomRow() {
11665
- return _Command.insertTableBottomRow();
11666
- }
11667
- executeInsertTableLeftCol() {
11668
- return _Command.insertTableLeftCol();
11669
- }
11670
- executeInsertTableRightCol() {
11671
- return _Command.insertTableRightCol();
11672
- }
11673
- executeDeleteTableRow() {
11674
- return _Command.deleteTableRow();
11675
- }
11676
- executeDeleteTableCol() {
11677
- return _Command.deleteTableCol();
11678
- }
11679
- executeDeleteTable() {
11680
- return _Command.deleteTable();
11681
- }
11682
- executeMergeTableCell() {
11683
- return _Command.mergeTableCell();
11684
- }
11685
- executeCancelMergeTableCell() {
11686
- return _Command.cancelMergeTableCell();
11687
- }
11688
- executeTableTdVerticalAlign(payload) {
11689
- return _Command.tableTdVerticalAlign(payload);
11690
- }
11691
- executeTableBorderType(payload) {
11692
- return _Command.tableBorderType(payload);
11693
- }
11694
- executeTableTdBackgroundColor(payload) {
11695
- return _Command.tableTdBackgroundColor(payload);
11696
- }
11697
- executeHyperlink(payload) {
11698
- return _Command.hyperlink(payload);
11699
- }
11700
- executeDeleteHyperlink() {
11701
- return _Command.deleteHyperlink();
11702
- }
11703
- executeCancelHyperlink() {
11704
- return _Command.cancelHyperlink();
11629
+ __publicField(this, "executeMode");
11630
+ __publicField(this, "executeCut");
11631
+ __publicField(this, "executeCopy");
11632
+ __publicField(this, "executePaste");
11633
+ __publicField(this, "executeSelectAll");
11634
+ __publicField(this, "executeBackspace");
11635
+ __publicField(this, "executeSetRange");
11636
+ __publicField(this, "executeUndo");
11637
+ __publicField(this, "executeRedo");
11638
+ __publicField(this, "executePainter");
11639
+ __publicField(this, "executeApplyPainterStyle");
11640
+ __publicField(this, "executeFormat");
11641
+ __publicField(this, "executeFont");
11642
+ __publicField(this, "executeSize");
11643
+ __publicField(this, "executeSizeAdd");
11644
+ __publicField(this, "executeSizeMinus");
11645
+ __publicField(this, "executeBold");
11646
+ __publicField(this, "executeItalic");
11647
+ __publicField(this, "executeUnderline");
11648
+ __publicField(this, "executeStrikeout");
11649
+ __publicField(this, "executeSuperscript");
11650
+ __publicField(this, "executeSubscript");
11651
+ __publicField(this, "executeColor");
11652
+ __publicField(this, "executeHighlight");
11653
+ __publicField(this, "executeTitle");
11654
+ __publicField(this, "executeList");
11655
+ __publicField(this, "executeRowFlex");
11656
+ __publicField(this, "executeRowMargin");
11657
+ __publicField(this, "executeInsertTable");
11658
+ __publicField(this, "executeInsertTableTopRow");
11659
+ __publicField(this, "executeInsertTableBottomRow");
11660
+ __publicField(this, "executeInsertTableLeftCol");
11661
+ __publicField(this, "executeInsertTableRightCol");
11662
+ __publicField(this, "executeDeleteTableRow");
11663
+ __publicField(this, "executeDeleteTableCol");
11664
+ __publicField(this, "executeDeleteTable");
11665
+ __publicField(this, "executeMergeTableCell");
11666
+ __publicField(this, "executeCancelMergeTableCell");
11667
+ __publicField(this, "executeTableTdVerticalAlign");
11668
+ __publicField(this, "executeTableBorderType");
11669
+ __publicField(this, "executeTableTdBackgroundColor");
11670
+ __publicField(this, "executeImage");
11671
+ __publicField(this, "executeHyperlink");
11672
+ __publicField(this, "executeDeleteHyperlink");
11673
+ __publicField(this, "executeCancelHyperlink");
11674
+ __publicField(this, "executeEditHyperlink");
11675
+ __publicField(this, "executeSeparator");
11676
+ __publicField(this, "executePageBreak");
11677
+ __publicField(this, "executeAddWatermark");
11678
+ __publicField(this, "executeDeleteWatermark");
11679
+ __publicField(this, "executeSearch");
11680
+ __publicField(this, "executeSearchNavigatePre");
11681
+ __publicField(this, "executeSearchNavigateNext");
11682
+ __publicField(this, "executeReplace");
11683
+ __publicField(this, "executePrint");
11684
+ __publicField(this, "executeReplaceImageElement");
11685
+ __publicField(this, "executeSaveAsImageElement");
11686
+ __publicField(this, "executeChangeImageDisplay");
11687
+ __publicField(this, "executePageMode");
11688
+ __publicField(this, "executePageScaleRecovery");
11689
+ __publicField(this, "executePageScaleMinus");
11690
+ __publicField(this, "executePageScaleAdd");
11691
+ __publicField(this, "executePaperSize");
11692
+ __publicField(this, "executePaperDirection");
11693
+ __publicField(this, "executeSetPaperMargin");
11694
+ __publicField(this, "executeInsertElementList");
11695
+ __publicField(this, "executeRemoveControl");
11696
+ __publicField(this, "executeSetLocale");
11697
+ __publicField(this, "executeLocationCatalog");
11698
+ __publicField(this, "executeWordTool");
11699
+ __publicField(this, "getCatalog");
11700
+ __publicField(this, "getImage");
11701
+ __publicField(this, "getValue");
11702
+ __publicField(this, "getWordCount");
11703
+ __publicField(this, "getRangeText");
11704
+ __publicField(this, "getPaperMargin");
11705
+ __publicField(this, "getSearchNavigateInfo");
11706
+ this.executeMode = adapt.mode.bind(adapt);
11707
+ this.executeCut = adapt.cut.bind(adapt);
11708
+ this.executeCopy = adapt.copy.bind(adapt);
11709
+ this.executePaste = adapt.paste.bind(adapt);
11710
+ this.executeSelectAll = adapt.selectAll.bind(adapt);
11711
+ this.executeBackspace = adapt.backspace.bind(adapt);
11712
+ this.executeSetRange = adapt.setRange.bind(adapt);
11713
+ this.executeUndo = adapt.undo.bind(adapt);
11714
+ this.executeRedo = adapt.redo.bind(adapt);
11715
+ this.executePainter = adapt.painter.bind(adapt);
11716
+ this.executeApplyPainterStyle = adapt.applyPainterStyle.bind(adapt);
11717
+ this.executeFormat = adapt.format.bind(adapt);
11718
+ this.executeFont = adapt.font.bind(adapt);
11719
+ this.executeSize = adapt.size.bind(adapt);
11720
+ this.executeSizeAdd = adapt.sizeAdd.bind(adapt);
11721
+ this.executeSizeMinus = adapt.sizeMinus.bind(adapt);
11722
+ this.executeBold = adapt.bold.bind(adapt);
11723
+ this.executeItalic = adapt.italic.bind(adapt);
11724
+ this.executeUnderline = adapt.underline.bind(adapt);
11725
+ this.executeStrikeout = adapt.strikeout.bind(adapt);
11726
+ this.executeSuperscript = adapt.superscript.bind(adapt);
11727
+ this.executeSubscript = adapt.subscript.bind(adapt);
11728
+ this.executeColor = adapt.color.bind(adapt);
11729
+ this.executeHighlight = adapt.highlight.bind(adapt);
11730
+ this.executeTitle = adapt.title.bind(adapt);
11731
+ this.executeList = adapt.list.bind(adapt);
11732
+ this.executeRowFlex = adapt.rowFlex.bind(adapt);
11733
+ this.executeRowMargin = adapt.rowMargin.bind(adapt);
11734
+ this.executeInsertTable = adapt.insertTable.bind(adapt);
11735
+ this.executeInsertTableTopRow = adapt.insertTableTopRow.bind(adapt);
11736
+ this.executeInsertTableBottomRow = adapt.insertTableBottomRow.bind(adapt);
11737
+ this.executeInsertTableLeftCol = adapt.insertTableLeftCol.bind(adapt);
11738
+ this.executeInsertTableRightCol = adapt.insertTableRightCol.bind(adapt);
11739
+ this.executeDeleteTableRow = adapt.deleteTableRow.bind(adapt);
11740
+ this.executeDeleteTableCol = adapt.deleteTableCol.bind(adapt);
11741
+ this.executeDeleteTable = adapt.deleteTable.bind(adapt);
11742
+ this.executeMergeTableCell = adapt.mergeTableCell.bind(adapt);
11743
+ this.executeCancelMergeTableCell = adapt.cancelMergeTableCell.bind(adapt);
11744
+ this.executeTableTdVerticalAlign = adapt.tableTdVerticalAlign.bind(adapt);
11745
+ this.executeTableBorderType = adapt.tableBorderType.bind(adapt);
11746
+ this.executeTableTdBackgroundColor = adapt.tableTdBackgroundColor.bind(adapt);
11747
+ this.executeImage = adapt.image.bind(adapt);
11748
+ this.executeHyperlink = adapt.hyperlink.bind(adapt);
11749
+ this.executeDeleteHyperlink = adapt.deleteHyperlink.bind(adapt);
11750
+ this.executeCancelHyperlink = adapt.cancelHyperlink.bind(adapt);
11751
+ this.executeEditHyperlink = adapt.editHyperlink.bind(adapt);
11752
+ this.executeSeparator = adapt.separator.bind(adapt);
11753
+ this.executePageBreak = adapt.pageBreak.bind(adapt);
11754
+ this.executeAddWatermark = adapt.addWatermark.bind(adapt);
11755
+ this.executeDeleteWatermark = adapt.deleteWatermark.bind(adapt);
11756
+ this.executeSearch = adapt.search.bind(adapt);
11757
+ this.executeSearchNavigatePre = adapt.searchNavigatePre.bind(adapt);
11758
+ this.executeSearchNavigateNext = adapt.searchNavigateNext.bind(adapt);
11759
+ this.executeReplace = adapt.replace.bind(adapt);
11760
+ this.executePrint = adapt.print.bind(adapt);
11761
+ this.executeReplaceImageElement = adapt.replaceImageElement.bind(adapt);
11762
+ this.executeSaveAsImageElement = adapt.saveAsImageElement.bind(adapt);
11763
+ this.executeChangeImageDisplay = adapt.changeImageDisplay.bind(adapt);
11764
+ this.executePageMode = adapt.pageMode.bind(adapt);
11765
+ this.executePageScaleRecovery = adapt.pageScaleRecovery.bind(adapt);
11766
+ this.executePageScaleMinus = adapt.pageScaleMinus.bind(adapt);
11767
+ this.executePageScaleAdd = adapt.pageScaleAdd.bind(adapt);
11768
+ this.executePaperSize = adapt.paperSize.bind(adapt);
11769
+ this.executePaperDirection = adapt.paperDirection.bind(adapt);
11770
+ this.executeSetPaperMargin = adapt.setPaperMargin.bind(adapt);
11771
+ this.executeInsertElementList = adapt.insertElementList.bind(adapt);
11772
+ this.executeRemoveControl = adapt.removeControl.bind(adapt);
11773
+ this.executeSetLocale = adapt.setLocale.bind(adapt);
11774
+ this.executeLocationCatalog = adapt.locationCatalog.bind(adapt);
11775
+ this.executeWordTool = adapt.wordTool.bind(adapt);
11776
+ this.getImage = adapt.getImage.bind(adapt);
11777
+ this.getValue = adapt.getValue.bind(adapt);
11778
+ this.getWordCount = adapt.getWordCount.bind(adapt);
11779
+ this.getRangeText = adapt.getRangeText.bind(adapt);
11780
+ this.getCatalog = adapt.getCatalog.bind(adapt);
11781
+ this.getPaperMargin = adapt.getPaperMargin.bind(adapt);
11782
+ this.getSearchNavigateInfo = adapt.getSearchNavigateInfo.bind(adapt);
11705
11783
  }
11706
- executeEditHyperlink(payload) {
11707
- return _Command.editHyperlink(payload);
11708
- }
11709
- executeImage(payload) {
11710
- return _Command.image(payload);
11711
- }
11712
- executeSeparator(payload) {
11713
- return _Command.separator(payload);
11714
- }
11715
- executePageBreak() {
11716
- return _Command.pageBreak();
11717
- }
11718
- executeAddWatermark(payload) {
11719
- return _Command.addWatermark(payload);
11720
- }
11721
- executeDeleteWatermark() {
11722
- return _Command.deleteWatermark();
11723
- }
11724
- executeSearch(payload) {
11725
- return _Command.search(payload);
11726
- }
11727
- executeSearchNavigatePre() {
11728
- return _Command.searchNavigatePre();
11729
- }
11730
- executeSearchNavigateNext() {
11731
- return _Command.searchNavigateNext();
11732
- }
11733
- getSearchNavigateInfo() {
11734
- return _Command.getSearchNavigateInfo();
11735
- }
11736
- executeReplace(payload) {
11737
- return _Command.replace(payload);
11738
- }
11739
- executePrint() {
11740
- return _Command.print();
11741
- }
11742
- executeReplaceImageElement(payload) {
11743
- return _Command.replaceImageElement(payload);
11744
- }
11745
- executeSaveAsImageElement() {
11746
- return _Command.saveAsImageElement();
11747
- }
11748
- executeChangeImageDisplay(element, display) {
11749
- return _Command.changeImageDisplay(element, display);
11750
- }
11751
- getImage() {
11752
- return _Command.getImage();
11753
- }
11754
- getValue() {
11755
- return _Command.getValue();
11756
- }
11757
- getWordCount() {
11758
- return _Command.getWordCount();
11759
- }
11760
- getRangeText() {
11761
- return _Command.getRangeText();
11762
- }
11763
- executePageMode(payload) {
11764
- return _Command.pageMode(payload);
11765
- }
11766
- executePageScaleRecovery() {
11767
- return _Command.pageScaleRecovery();
11768
- }
11769
- executePageScaleMinus() {
11770
- return _Command.pageScaleMinus();
11771
- }
11772
- executePageScaleAdd() {
11773
- return _Command.pageScaleAdd();
11774
- }
11775
- executePaperSize(width, height) {
11776
- return _Command.paperSize(width, height);
11777
- }
11778
- executePaperDirection(payload) {
11779
- return _Command.paperDirection(payload);
11780
- }
11781
- getPaperMargin() {
11782
- return _Command.getPaperMargin();
11783
- }
11784
- executeSetPaperMargin(payload) {
11785
- return _Command.setPaperMargin(payload);
11786
- }
11787
- executeInsertElementList(payload) {
11788
- return _Command.insertElementList(payload);
11789
- }
11790
- executeRemoveControl() {
11791
- return _Command.removeControl();
11792
- }
11793
- executeSetLocale(payload) {
11794
- return _Command.setLocale(payload);
11795
- }
11796
- getCatalog() {
11797
- return _Command.getCatalog();
11798
- }
11799
- executeLocationCatalog(titleId) {
11800
- return _Command.locationCatalog(titleId);
11801
- }
11802
- };
11803
- let Command = _Command;
11804
- __publicField(Command, "mode");
11805
- __publicField(Command, "cut");
11806
- __publicField(Command, "copy");
11807
- __publicField(Command, "paste");
11808
- __publicField(Command, "selectAll");
11809
- __publicField(Command, "backspace");
11810
- __publicField(Command, "setRange");
11811
- __publicField(Command, "undo");
11812
- __publicField(Command, "redo");
11813
- __publicField(Command, "painter");
11814
- __publicField(Command, "applyPainterStyle");
11815
- __publicField(Command, "format");
11816
- __publicField(Command, "font");
11817
- __publicField(Command, "size");
11818
- __publicField(Command, "sizeAdd");
11819
- __publicField(Command, "sizeMinus");
11820
- __publicField(Command, "bold");
11821
- __publicField(Command, "italic");
11822
- __publicField(Command, "underline");
11823
- __publicField(Command, "strikeout");
11824
- __publicField(Command, "superscript");
11825
- __publicField(Command, "subscript");
11826
- __publicField(Command, "color");
11827
- __publicField(Command, "highlight");
11828
- __publicField(Command, "title");
11829
- __publicField(Command, "list");
11830
- __publicField(Command, "left");
11831
- __publicField(Command, "center");
11832
- __publicField(Command, "right");
11833
- __publicField(Command, "alignment");
11834
- __publicField(Command, "rowMargin");
11835
- __publicField(Command, "insertTable");
11836
- __publicField(Command, "insertTableTopRow");
11837
- __publicField(Command, "insertTableBottomRow");
11838
- __publicField(Command, "insertTableLeftCol");
11839
- __publicField(Command, "insertTableRightCol");
11840
- __publicField(Command, "deleteTableRow");
11841
- __publicField(Command, "deleteTableCol");
11842
- __publicField(Command, "deleteTable");
11843
- __publicField(Command, "mergeTableCell");
11844
- __publicField(Command, "cancelMergeTableCell");
11845
- __publicField(Command, "tableTdVerticalAlign");
11846
- __publicField(Command, "tableBorderType");
11847
- __publicField(Command, "tableTdBackgroundColor");
11848
- __publicField(Command, "image");
11849
- __publicField(Command, "hyperlink");
11850
- __publicField(Command, "deleteHyperlink");
11851
- __publicField(Command, "cancelHyperlink");
11852
- __publicField(Command, "editHyperlink");
11853
- __publicField(Command, "separator");
11854
- __publicField(Command, "pageBreak");
11855
- __publicField(Command, "addWatermark");
11856
- __publicField(Command, "deleteWatermark");
11857
- __publicField(Command, "search");
11858
- __publicField(Command, "searchNavigatePre");
11859
- __publicField(Command, "searchNavigateNext");
11860
- __publicField(Command, "getSearchNavigateInfo");
11861
- __publicField(Command, "replace");
11862
- __publicField(Command, "print");
11863
- __publicField(Command, "replaceImageElement");
11864
- __publicField(Command, "saveAsImageElement");
11865
- __publicField(Command, "changeImageDisplay");
11866
- __publicField(Command, "getImage");
11867
- __publicField(Command, "getValue");
11868
- __publicField(Command, "getWordCount");
11869
- __publicField(Command, "getRangeText");
11870
- __publicField(Command, "pageMode");
11871
- __publicField(Command, "pageScaleRecovery");
11872
- __publicField(Command, "pageScaleMinus");
11873
- __publicField(Command, "pageScaleAdd");
11874
- __publicField(Command, "paperSize");
11875
- __publicField(Command, "paperDirection");
11876
- __publicField(Command, "getPaperMargin");
11877
- __publicField(Command, "setPaperMargin");
11878
- __publicField(Command, "insertElementList");
11879
- __publicField(Command, "removeControl");
11880
- __publicField(Command, "setLocale");
11881
- __publicField(Command, "getCatalog");
11882
- __publicField(Command, "locationCatalog");
11784
+ }
11883
11785
  const defaultWatermarkOption = {
11884
11786
  data: "",
11885
11787
  color: "#AEB5C0",
@@ -13520,6 +13422,32 @@ class CommandAdapt {
13520
13422
  isSubmitHistory: false
13521
13423
  });
13522
13424
  }
13425
+ wordTool() {
13426
+ const elementList = this.draw.getMainElementList();
13427
+ let isApply = false;
13428
+ for (let i = 0; i < elementList.length; i++) {
13429
+ const element = elementList[i];
13430
+ if (element.value === ZERO) {
13431
+ while (i + 1 < elementList.length) {
13432
+ const nextElement = elementList[i + 1];
13433
+ if (nextElement.value !== ZERO && nextElement.value !== NBSP)
13434
+ break;
13435
+ elementList.splice(i + 1, 1);
13436
+ isApply = true;
13437
+ }
13438
+ }
13439
+ }
13440
+ if (!isApply) {
13441
+ const isCollapsed = this.range.getIsCollapsed();
13442
+ this.draw.getCursor().drawCursor({
13443
+ isShow: isCollapsed
13444
+ });
13445
+ } else {
13446
+ this.draw.render({
13447
+ isSetCursor: false
13448
+ });
13449
+ }
13450
+ }
13523
13451
  }
13524
13452
  class Listener {
13525
13453
  constructor() {
@@ -14176,28 +14104,28 @@ const richtextKeys = [
14176
14104
  key: KeyMap.L,
14177
14105
  mod: true,
14178
14106
  callback: (command) => {
14179
- command.executeLeft();
14107
+ command.executeRowFlex(RowFlex.LEFT);
14180
14108
  }
14181
14109
  },
14182
14110
  {
14183
14111
  key: KeyMap.E,
14184
14112
  mod: true,
14185
14113
  callback: (command) => {
14186
- command.executeCenter();
14114
+ command.executeRowFlex(RowFlex.CENTER);
14187
14115
  }
14188
14116
  },
14189
14117
  {
14190
14118
  key: KeyMap.R,
14191
14119
  mod: true,
14192
14120
  callback: (command) => {
14193
- command.executeRight();
14121
+ command.executeRowFlex(RowFlex.RIGHT);
14194
14122
  }
14195
14123
  },
14196
14124
  {
14197
14125
  key: KeyMap.J,
14198
14126
  mod: true,
14199
14127
  callback: (command) => {
14200
- command.executeAlignment();
14128
+ command.executeRowFlex(RowFlex.ALIGNMENT);
14201
14129
  }
14202
14130
  }
14203
14131
  ];
@@ -14339,6 +14267,13 @@ const defaultFooterOption = {
14339
14267
  maxHeightRadio: MaxHeightRatio.HALF,
14340
14268
  disabled: false
14341
14269
  };
14270
+ const defaultPlaceholderOption = {
14271
+ data: "",
14272
+ color: "#DCDFE6",
14273
+ opacity: 1,
14274
+ size: 16,
14275
+ font: "Yahei"
14276
+ };
14342
14277
  class Editor {
14343
14278
  constructor(container, data2, options = {}) {
14344
14279
  __publicField(this, "command");
@@ -14353,6 +14288,7 @@ class Editor {
14353
14288
  const checkboxOptions = __spreadValues(__spreadValues({}, defaultCheckboxOption), options.checkbox);
14354
14289
  const cursorOptions = __spreadValues(__spreadValues({}, defaultCursorOption), options.cursor);
14355
14290
  const titleOptions = __spreadValues(__spreadValues({}, defaultTitleOption), options.title);
14291
+ const placeholderOptions = __spreadValues(__spreadValues({}, defaultPlaceholderOption), options.placeholder);
14356
14292
  const editorOptions = __spreadProps(__spreadValues({
14357
14293
  mode: EditorMode.EDIT,
14358
14294
  defaultType: "TEXT",
@@ -14386,7 +14322,8 @@ class Editor {
14386
14322
  defaultTrMinHeight: 40,
14387
14323
  defaultHyperlinkColor: "#0000FF",
14388
14324
  paperDirection: PaperDirection.VERTICAL,
14389
- inactiveAlpha: 0.6
14325
+ inactiveAlpha: 0.6,
14326
+ historyMaxRecordCount: 100
14390
14327
  }, options), {
14391
14328
  header: headerOptions,
14392
14329
  footer: footerOptions,
@@ -14395,7 +14332,8 @@ class Editor {
14395
14332
  control: controlOptions,
14396
14333
  checkbox: checkboxOptions,
14397
14334
  cursor: cursorOptions,
14398
- title: titleOptions
14335
+ title: titleOptions,
14336
+ placeholder: placeholderOptions
14399
14337
  });
14400
14338
  let headerElementList = [];
14401
14339
  let mainElementList = [];