@hufe921/canvas-editor 0.9.102 → 0.9.103

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,32 @@
1
+ ## [0.9.103](https://github.com/Hufe921/canvas-editor/compare/v0.9.102...v0.9.103) (2025-02-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * checkbox list select error in paper horizontal mode #997 ([5442f5e](https://github.com/Hufe921/canvas-editor/commit/5442f5ea1795cd54869912e887aacb60a3160cc9)), closes [#997](https://github.com/Hufe921/canvas-editor/issues/997)
7
+ * control content change event boundary error #996 ([e6c681d](https://github.com/Hufe921/canvas-editor/commit/e6c681d2867c7894491b42842ac180503f0702a3)), closes [#996](https://github.com/Hufe921/canvas-editor/issues/996)
8
+ * format error when update element by id #1006 ([15728e8](https://github.com/Hufe921/canvas-editor/commit/15728e8d799cf334bcc355cc7198ebcfc0345843)), closes [#1006](https://github.com/Hufe921/canvas-editor/issues/1006)
9
+
10
+
11
+ ### Chores
12
+
13
+ * update issue template ([fd34310](https://github.com/Hufe921/canvas-editor/commit/fd343106fbd613f395a78d768dbca306d9461338))
14
+ * update README.md ([e355de8](https://github.com/Hufe921/canvas-editor/commit/e355de8a597b58b9b79aba1bfec2ae31e0db4589))
15
+
16
+
17
+ ### Features
18
+
19
+ * add executeDeleteElementById api #1003 ([089d684](https://github.com/Hufe921/canvas-editor/commit/089d6841988d20efb84efd6556469455207d5a2e)), closes [#1003](https://github.com/Hufe921/canvas-editor/issues/1003)
20
+ * convert block elements to html #984 ([b77fd96](https://github.com/Hufe921/canvas-editor/commit/b77fd96dfadc012c6a2a9a4957d59fb8af0abc55)), closes [#984](https://github.com/Hufe921/canvas-editor/issues/984)
21
+
22
+
23
+ ### Performance Improvements
24
+
25
+ * mouse event listener option #1010 ([56f9604](https://github.com/Hufe921/canvas-editor/commit/56f9604e9c8c11e31c7c86f5246373412bcc6625)), closes [#1010](https://github.com/Hufe921/canvas-editor/issues/1010)
26
+ * timing of updating range style #985 ([cfb09ce](https://github.com/Hufe921/canvas-editor/commit/cfb09cef78c9e661540b87834495dc5a19839ef8)), closes [#985](https://github.com/Hufe921/canvas-editor/issues/985)
27
+
28
+
29
+
1
30
  ## [0.9.102](https://github.com/Hufe921/canvas-editor/compare/v0.9.101...v0.9.102) (2025-02-07)
2
31
 
3
32
 
package/README.md CHANGED
@@ -33,6 +33,7 @@
33
33
  1. Official plugin: [canvas-editor-plugin](https://github.com/Hufe921/canvas-editor-plugin)
34
34
  2. The render layer by svg is under development, see [feature/svg](https://github.com/Hufe921/canvas-editor/tree/feature/svg)
35
35
  3. The export pdf feature is available now, see [feature/pdf](https://github.com/Hufe921/canvas-editor/tree/feature/pdf)
36
+ 4. The AI-powered text processing demo, see [feature/ai](https://github.com/Hufe921/canvas-editor/tree/feature/ai)
36
37
 
37
38
  ## Basic usage
38
39
 
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
23
23
  return value;
24
24
  };
25
25
  var index = "";
26
- const version = "0.9.102";
26
+ const version = "0.9.103";
27
27
  var MaxHeightRatio;
28
28
  (function(MaxHeightRatio2) {
29
29
  MaxHeightRatio2["HALF"] = "half";
@@ -582,6 +582,41 @@ const VIRTUAL_ELEMENT_TYPE = [
582
582
  ElementType.TITLE,
583
583
  ElementType.LIST
584
584
  ];
585
+ const _IFrameBlock = class {
586
+ constructor(element) {
587
+ __publicField(this, "element");
588
+ this.element = element;
589
+ }
590
+ _defineIframeProperties(iframeWindow) {
591
+ Object.defineProperties(iframeWindow, {
592
+ parent: {
593
+ get: () => null
594
+ },
595
+ __POWERED_BY_CANVAS_EDITOR__: {
596
+ get: () => true
597
+ }
598
+ });
599
+ }
600
+ render(blockItemContainer) {
601
+ var _a, _b;
602
+ const block = this.element.block;
603
+ const iframe = document.createElement("iframe");
604
+ iframe.setAttribute("data-id", this.element.id);
605
+ iframe.sandbox.add(..._IFrameBlock.sandbox);
606
+ iframe.style.border = "none";
607
+ iframe.style.width = "100%";
608
+ iframe.style.height = "100%";
609
+ if ((_a = block.iframeBlock) == null ? void 0 : _a.src) {
610
+ iframe.src = block.iframeBlock.src;
611
+ } else if ((_b = block.iframeBlock) == null ? void 0 : _b.srcdoc) {
612
+ iframe.srcdoc = block.iframeBlock.srcdoc;
613
+ }
614
+ blockItemContainer.append(iframe);
615
+ this._defineIframeProperties(iframe.contentWindow);
616
+ }
617
+ };
618
+ let IFrameBlock = _IFrameBlock;
619
+ __publicField(IFrameBlock, "sandbox", ["allow-scripts", "allow-same-origin"]);
585
620
  class ImageParticle {
586
621
  constructor(draw) {
587
622
  __publicField(this, "draw");
@@ -4937,7 +4972,7 @@ function groupElementListByRowFlex(elementList) {
4937
4972
  function createDomFromElementList(elementList, options) {
4938
4973
  const editorOptions = mergeOption(options);
4939
4974
  function buildDom(payload) {
4940
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4975
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
4941
4976
  const clipboardDom2 = document.createElement("div");
4942
4977
  for (let e = 0; e < payload.length; e++) {
4943
4978
  const element = payload[e];
@@ -5032,20 +5067,49 @@ function createDomFromElementList(elementList, options) {
5032
5067
  img.height = element.height;
5033
5068
  }
5034
5069
  clipboardDom2.append(img);
5070
+ } else if (element.type === ElementType.BLOCK) {
5071
+ if (((_e = element.block) == null ? void 0 : _e.type) === BlockType.VIDEO) {
5072
+ const src = (_f = element.block.videoBlock) == null ? void 0 : _f.src;
5073
+ if (src) {
5074
+ const video = document.createElement("video");
5075
+ video.style.display = "block";
5076
+ video.controls = true;
5077
+ video.src = src;
5078
+ video.width = element.width || (options == null ? void 0 : options.width) || window.innerWidth;
5079
+ video.height = element.height;
5080
+ clipboardDom2.append(video);
5081
+ }
5082
+ } else if (((_g = element.block) == null ? void 0 : _g.type) === BlockType.IFRAME) {
5083
+ const { src, srcdoc } = element.block.iframeBlock || {};
5084
+ if (src || srcdoc) {
5085
+ const iframe = document.createElement("iframe");
5086
+ iframe.sandbox.add(...IFrameBlock.sandbox);
5087
+ iframe.style.display = "block";
5088
+ iframe.style.border = "none";
5089
+ if (src) {
5090
+ iframe.src = src;
5091
+ } else if (srcdoc) {
5092
+ iframe.srcdoc = srcdoc;
5093
+ }
5094
+ iframe.width = `${element.width || (options == null ? void 0 : options.width) || window.innerWidth}`;
5095
+ iframe.height = `${element.height}`;
5096
+ clipboardDom2.append(iframe);
5097
+ }
5098
+ }
5035
5099
  } else if (element.type === ElementType.SEPARATOR) {
5036
5100
  const hr = document.createElement("hr");
5037
5101
  clipboardDom2.append(hr);
5038
5102
  } else if (element.type === ElementType.CHECKBOX) {
5039
5103
  const checkbox = document.createElement("input");
5040
5104
  checkbox.type = "checkbox";
5041
- if ((_e = element.checkbox) == null ? void 0 : _e.value) {
5105
+ if ((_h = element.checkbox) == null ? void 0 : _h.value) {
5042
5106
  checkbox.setAttribute("checked", "true");
5043
5107
  }
5044
5108
  clipboardDom2.append(checkbox);
5045
5109
  } else if (element.type === ElementType.RADIO) {
5046
5110
  const radio = document.createElement("input");
5047
5111
  radio.type = "radio";
5048
- if ((_f = element.radio) == null ? void 0 : _f.value) {
5112
+ if ((_i = element.radio) == null ? void 0 : _i.value) {
5049
5113
  radio.setAttribute("checked", "true");
5050
5114
  }
5051
5115
  clipboardDom2.append(radio);
@@ -5055,20 +5119,20 @@ function createDomFromElementList(elementList, options) {
5055
5119
  clipboardDom2.append(tab2);
5056
5120
  } else if (element.type === ElementType.CONTROL) {
5057
5121
  const controlElement = document.createElement("span");
5058
- const childDom = buildDom(((_g = element.control) == null ? void 0 : _g.value) || []);
5122
+ const childDom = buildDom(((_j = element.control) == null ? void 0 : _j.value) || []);
5059
5123
  controlElement.innerHTML = childDom.innerHTML;
5060
5124
  clipboardDom2.append(controlElement);
5061
5125
  } else if (!element.type || element.type === ElementType.LATEX || TEXTLIKE_ELEMENT_TYPE.includes(element.type)) {
5062
5126
  let text = "";
5063
5127
  if (element.type === ElementType.DATE) {
5064
- text = ((_h = element.valueList) == null ? void 0 : _h.map((v) => v.value).join("")) || "";
5128
+ text = ((_k = element.valueList) == null ? void 0 : _k.map((v) => v.value).join("")) || "";
5065
5129
  } else {
5066
5130
  text = element.value;
5067
5131
  }
5068
5132
  if (!text)
5069
5133
  continue;
5070
5134
  const dom = convertElementToDom(element, editorOptions);
5071
- if (((_i = payload[e - 1]) == null ? void 0 : _i.type) === ElementType.TITLE) {
5135
+ if (((_l = payload[e - 1]) == null ? void 0 : _l.type) === ElementType.TITLE) {
5072
5136
  text = text.replace(/^\n/, "");
5073
5137
  }
5074
5138
  dom.innerText = text.replace(new RegExp(`${ZERO}`, "g"), "\n");
@@ -5225,6 +5289,39 @@ function getElementListByHTML(htmlText, options) {
5225
5289
  type: ElementType.IMAGE
5226
5290
  });
5227
5291
  }
5292
+ } else if (node.nodeName === "VIDEO") {
5293
+ const { src, width, height } = node;
5294
+ if (src && width && height) {
5295
+ elementList.push({
5296
+ value: "",
5297
+ type: ElementType.BLOCK,
5298
+ block: {
5299
+ type: BlockType.VIDEO,
5300
+ videoBlock: {
5301
+ src
5302
+ }
5303
+ },
5304
+ width,
5305
+ height
5306
+ });
5307
+ }
5308
+ } else if (node.nodeName === "IFRAME") {
5309
+ const { src, srcdoc, width, height } = node;
5310
+ if ((src || srcdoc) && width && height) {
5311
+ elementList.push({
5312
+ value: "",
5313
+ type: ElementType.BLOCK,
5314
+ block: {
5315
+ type: BlockType.IFRAME,
5316
+ iframeBlock: {
5317
+ src,
5318
+ srcdoc
5319
+ }
5320
+ },
5321
+ width: parseInt(width),
5322
+ height: parseInt(height)
5323
+ });
5324
+ }
5228
5325
  } else if (node.nodeName === "TABLE") {
5229
5326
  const tableElement = node;
5230
5327
  const element = {
@@ -8113,13 +8210,10 @@ class GlobalEvent {
8113
8210
  const target = (evt == null ? void 0 : evt.composedPath()[0]) || evt.target;
8114
8211
  const pageList = this.draw.getPageList();
8115
8212
  const innerEditorDom = findParent(target, (node) => pageList.includes(node), true);
8116
- if (innerEditorDom) {
8117
- this.setRangeStyle();
8213
+ if (innerEditorDom)
8118
8214
  return;
8119
- }
8120
8215
  const outerEditorDom = findParent(target, (node) => !!node && node.nodeType === 1 && !!node.getAttribute(EDITOR_COMPONENT), true);
8121
8216
  if (outerEditorDom) {
8122
- this.setRangeStyle();
8123
8217
  this.watchCursorActive();
8124
8218
  return;
8125
8219
  }
@@ -8136,9 +8230,6 @@ class GlobalEvent {
8136
8230
  this.canvasEvent.setIsAllowDrag(false);
8137
8231
  this.canvasEvent.setIsAllowSelection(false);
8138
8232
  });
8139
- __publicField(this, "setRangeStyle", () => {
8140
- this.range.setRangeStyle();
8141
- });
8142
8233
  __publicField(this, "setPageScale", (evt) => {
8143
8234
  if (!evt.ctrlKey)
8144
8235
  return;
@@ -8191,8 +8282,7 @@ class GlobalEvent {
8191
8282
  }
8192
8283
  addEvent() {
8193
8284
  window.addEventListener("blur", this.clearSideEffect);
8194
- document.addEventListener("keyup", this.setRangeStyle);
8195
- document.addEventListener("click", this.clearSideEffect);
8285
+ document.addEventListener("mousedown", this.clearSideEffect);
8196
8286
  document.addEventListener("mouseup", this.setCanvasEventAbility);
8197
8287
  document.addEventListener("wheel", this.setPageScale, { passive: false });
8198
8288
  document.addEventListener("visibilitychange", this._handleVisibilityChange);
@@ -8200,8 +8290,7 @@ class GlobalEvent {
8200
8290
  }
8201
8291
  removeEvent() {
8202
8292
  window.removeEventListener("blur", this.clearSideEffect);
8203
- document.removeEventListener("keyup", this.setRangeStyle);
8204
- document.removeEventListener("click", this.clearSideEffect);
8293
+ document.removeEventListener("mousedown", this.clearSideEffect);
8205
8294
  document.removeEventListener("mouseup", this.setCanvasEventAbility);
8206
8295
  document.removeEventListener("wheel", this.setPageScale);
8207
8296
  document.removeEventListener("visibilitychange", this._handleVisibilityChange);
@@ -8654,7 +8743,7 @@ class Position {
8654
8743
  const headIndex = positionList.findIndex((p) => p.pageNo === positionNo && p.rowNo === rowNo);
8655
8744
  const headElement = elementList[headIndex];
8656
8745
  const headPosition = positionList[headIndex];
8657
- const headStartX = headElement.listStyle === ListStyle.CHECKBOX ? this.options.margins[3] : headPosition.coordinate.leftTop[0];
8746
+ const headStartX = headElement.listStyle === ListStyle.CHECKBOX ? this.draw.getMargins()[3] : headPosition.coordinate.leftTop[0];
8658
8747
  if (x < headStartX) {
8659
8748
  if (~headIndex) {
8660
8749
  if (headPosition.value === ZERO) {
@@ -13057,6 +13146,8 @@ class Control {
13057
13146
  const elementList = context.elementList || this.getElementList();
13058
13147
  const { startIndex } = context.range || this.getRange();
13059
13148
  const startElement = elementList[startIndex];
13149
+ if (!(startElement == null ? void 0 : startElement.controlId))
13150
+ return [];
13060
13151
  const data2 = [];
13061
13152
  let preIndex = startIndex;
13062
13153
  while (preIndex > 0) {
@@ -13198,7 +13289,7 @@ class Control {
13198
13289
  }
13199
13290
  }
13200
13291
  emitControlContentChange(options) {
13201
- var _a, _b, _c;
13292
+ var _a, _b, _c, _d, _e, _f;
13202
13293
  const isSubscribeControlContentChange = this.eventBus.isSubscribe("controlContentChange");
13203
13294
  if (!isSubscribeControlContentChange && !this.listener.controlContentChange) {
13204
13295
  return;
@@ -13206,6 +13297,10 @@ class Control {
13206
13297
  const controlElement = (options == null ? void 0 : options.controlElement) || ((_a = this.activeControl) == null ? void 0 : _a.getElement());
13207
13298
  if (!controlElement)
13208
13299
  return;
13300
+ const elementList = ((_b = options == null ? void 0 : options.context) == null ? void 0 : _b.elementList) || this.getElementList();
13301
+ const { startIndex } = ((_c = options == null ? void 0 : options.context) == null ? void 0 : _c.range) || this.getRange();
13302
+ if (!((_d = elementList[startIndex]) == null ? void 0 : _d.controlId))
13303
+ return;
13209
13304
  const controlValue = (options == null ? void 0 : options.controlValue) || this.getControlElementList(options == null ? void 0 : options.context);
13210
13305
  let control;
13211
13306
  if (controlValue == null ? void 0 : controlValue.length) {
@@ -13220,7 +13315,7 @@ class Control {
13220
13315
  control,
13221
13316
  controlId: controlElement.controlId
13222
13317
  };
13223
- (_c = (_b = this.listener).controlContentChange) == null ? void 0 : _c.call(_b, payload);
13318
+ (_f = (_e = this.listener).controlContentChange) == null ? void 0 : _f.call(_e, payload);
13224
13319
  if (isSubscribeControlContentChange) {
13225
13320
  this.eventBus.emit("controlContentChange", payload);
13226
13321
  }
@@ -14782,41 +14877,6 @@ var BlockType;
14782
14877
  BlockType2["IFRAME"] = "iframe";
14783
14878
  BlockType2["VIDEO"] = "video";
14784
14879
  })(BlockType || (BlockType = {}));
14785
- const _IFrameBlock = class {
14786
- constructor(element) {
14787
- __publicField(this, "element");
14788
- this.element = element;
14789
- }
14790
- _defineIframeProperties(iframeWindow) {
14791
- Object.defineProperties(iframeWindow, {
14792
- parent: {
14793
- get: () => null
14794
- },
14795
- __POWERED_BY_CANVAS_EDITOR__: {
14796
- get: () => true
14797
- }
14798
- });
14799
- }
14800
- render(blockItemContainer) {
14801
- var _a, _b;
14802
- const block = this.element.block;
14803
- const iframe = document.createElement("iframe");
14804
- iframe.setAttribute("data-id", this.element.id);
14805
- iframe.sandbox.add(..._IFrameBlock.sandbox);
14806
- iframe.style.border = "none";
14807
- iframe.style.width = "100%";
14808
- iframe.style.height = "100%";
14809
- if ((_a = block.iframeBlock) == null ? void 0 : _a.src) {
14810
- iframe.src = block.iframeBlock.src;
14811
- } else if ((_b = block.iframeBlock) == null ? void 0 : _b.srcdoc) {
14812
- iframe.srcdoc = block.iframeBlock.srcdoc;
14813
- }
14814
- blockItemContainer.append(iframe);
14815
- this._defineIframeProperties(iframe.contentWindow);
14816
- }
14817
- };
14818
- let IFrameBlock = _IFrameBlock;
14819
- __publicField(IFrameBlock, "sandbox", ["allow-scripts", "allow-same-origin"]);
14820
14880
  class VideoBlock {
14821
14881
  constructor(element) {
14822
14882
  __publicField(this, "element");
@@ -14831,7 +14891,6 @@ class VideoBlock {
14831
14891
  video.style.objectFit = "contain";
14832
14892
  video.src = ((_a = block.videoBlock) == null ? void 0 : _a.src) || "";
14833
14893
  video.controls = true;
14834
- video.crossOrigin = "anonymous";
14835
14894
  blockItemContainer.append(video);
14836
14895
  }
14837
14896
  }
@@ -15979,6 +16038,9 @@ class MouseObserver {
15979
16038
  this.pageContainer.addEventListener("mousemove", this._mousemove.bind(this));
15980
16039
  this.pageContainer.addEventListener("mouseenter", this._mouseenter.bind(this));
15981
16040
  this.pageContainer.addEventListener("mouseleave", this._mouseleave.bind(this));
16041
+ this.pageContainer.addEventListener("mousedown", this._mousedown.bind(this));
16042
+ this.pageContainer.addEventListener("mouseup", this._mouseup.bind(this));
16043
+ this.pageContainer.addEventListener("click", this._click.bind(this));
15982
16044
  }
15983
16045
  _mousemove(evt) {
15984
16046
  if (!this.eventBus.isSubscribe("mousemove"))
@@ -15995,6 +16057,21 @@ class MouseObserver {
15995
16057
  return;
15996
16058
  this.eventBus.emit("mouseleave", evt);
15997
16059
  }
16060
+ _mousedown(evt) {
16061
+ if (!this.eventBus.isSubscribe("mousedown"))
16062
+ return;
16063
+ this.eventBus.emit("mousedown", evt);
16064
+ }
16065
+ _mouseup(evt) {
16066
+ if (!this.eventBus.isSubscribe("mouseup"))
16067
+ return;
16068
+ this.eventBus.emit("mouseup", evt);
16069
+ }
16070
+ _click(evt) {
16071
+ if (!this.eventBus.isSubscribe("click"))
16072
+ return;
16073
+ this.eventBus.emit("click", evt);
16074
+ }
15998
16075
  }
15999
16076
  class LineNumber {
16000
16077
  constructor(draw) {
@@ -19050,6 +19127,7 @@ class Draw {
19050
19127
  this.submitHistory(curIndex);
19051
19128
  }
19052
19129
  nextTick(() => {
19130
+ this.range.setRangeStyle();
19053
19131
  if (isCompute && this.control.getActiveControl()) {
19054
19132
  this.control.reAwakeControl();
19055
19133
  }
@@ -19231,6 +19309,7 @@ class Command {
19231
19309
  __publicField(this, "executeLocationArea");
19232
19310
  __publicField(this, "executeAppendElementList");
19233
19311
  __publicField(this, "executeUpdateElementById");
19312
+ __publicField(this, "executeDeleteElementById");
19234
19313
  __publicField(this, "executeSetValue");
19235
19314
  __publicField(this, "executeRemoveControl");
19236
19315
  __publicField(this, "executeSetLocale");
@@ -19361,6 +19440,7 @@ class Command {
19361
19440
  this.executeInsertElementList = adapt.insertElementList.bind(adapt);
19362
19441
  this.executeAppendElementList = adapt.appendElementList.bind(adapt);
19363
19442
  this.executeUpdateElementById = adapt.updateElementById.bind(adapt);
19443
+ this.executeDeleteElementById = adapt.deleteElementById.bind(adapt);
19364
19444
  this.executeSetValue = adapt.setValue.bind(adapt);
19365
19445
  this.executeRemoveControl = adapt.removeControl.bind(adapt);
19366
19446
  this.executeSetLocale = adapt.setLocale.bind(adapt);
@@ -20904,7 +20984,7 @@ class CommandAdapt {
20904
20984
  }
20905
20985
  }
20906
20986
  }
20907
- if (id && (element.id === id || element.controlId === id) || conceptId && element.conceptId === conceptId) {
20987
+ if (id && element.id === id || conceptId && element.conceptId === conceptId) {
20908
20988
  updateElementInfoList.push({
20909
20989
  elementList,
20910
20990
  index: i - 1
@@ -20924,16 +21004,60 @@ class CommandAdapt {
20924
21004
  return;
20925
21005
  for (let i = 0; i < updateElementInfoList.length; i++) {
20926
21006
  const { elementList, index: index2 } = updateElementInfoList[i];
20927
- elementList[index2] = __spreadValues(__spreadValues({}, elementList[index2]), payload.properties);
20928
- formatElementList(zipElementList([elementList[index2]]), {
21007
+ const newElement = zipElementList([
21008
+ __spreadValues(__spreadValues({}, elementList[index2]), payload.properties)
21009
+ ]);
21010
+ formatElementList(newElement, {
20929
21011
  isHandleFirstElement: false,
20930
21012
  editorOptions: this.options
20931
21013
  });
21014
+ elementList[index2] = newElement[0];
20932
21015
  }
20933
21016
  this.draw.render({
20934
21017
  isSetCursor: false
20935
21018
  });
20936
21019
  }
21020
+ deleteElementById(payload) {
21021
+ const { id, conceptId } = payload;
21022
+ if (!id && !conceptId)
21023
+ return;
21024
+ let isExistDelete = false;
21025
+ function deleteElement(elementList) {
21026
+ let i = 0;
21027
+ while (i < elementList.length) {
21028
+ const element = elementList[i];
21029
+ if (element.type === ElementType.TABLE) {
21030
+ const trList = element.trList;
21031
+ for (let r = 0; r < trList.length; r++) {
21032
+ const tr = trList[r];
21033
+ for (let d = 0; d < tr.tdList.length; d++) {
21034
+ const td = tr.tdList[d];
21035
+ deleteElement(td.value);
21036
+ }
21037
+ }
21038
+ }
21039
+ if (id && element.id === id || conceptId && element.conceptId === conceptId) {
21040
+ isExistDelete = true;
21041
+ elementList.splice(i, 1);
21042
+ i--;
21043
+ }
21044
+ i++;
21045
+ }
21046
+ }
21047
+ const data2 = [
21048
+ this.draw.getOriginalMainElementList(),
21049
+ this.draw.getHeaderElementList(),
21050
+ this.draw.getFooterElementList()
21051
+ ];
21052
+ for (const elementList of data2) {
21053
+ deleteElement(elementList);
21054
+ }
21055
+ if (!isExistDelete)
21056
+ return;
21057
+ this.draw.render({
21058
+ isSetCursor: false
21059
+ });
21060
+ }
20937
21061
  getElementById(payload) {
20938
21062
  const { id, conceptId } = payload;
20939
21063
  const result = [];
@@ -20954,7 +21078,7 @@ class CommandAdapt {
20954
21078
  }
20955
21079
  }
20956
21080
  }
20957
- if (id && element.controlId !== id && element.id !== id || conceptId && element.conceptId !== conceptId) {
21081
+ if (id && element.id !== id || conceptId && element.conceptId !== conceptId) {
20958
21082
  continue;
20959
21083
  }
20960
21084
  result.push(element);
@@ -21338,11 +21462,12 @@ class CommandAdapt {
21338
21462
  }
21339
21463
  return result;
21340
21464
  }
21341
- getPositionContextByEvent(evt) {
21465
+ getPositionContextByEvent(evt, options = {}) {
21342
21466
  var _a, _b, _c;
21343
21467
  const pageIndex = (_a = evt.target) == null ? void 0 : _a.dataset.index;
21344
21468
  if (!pageIndex)
21345
21469
  return null;
21470
+ const { isMustDirectHit = true } = options;
21346
21471
  const pageNo = Number(pageIndex);
21347
21472
  const positionContext = this.position.getPositionByXY({
21348
21473
  x: evt.offsetX,
@@ -21350,8 +21475,10 @@ class CommandAdapt {
21350
21475
  pageNo
21351
21476
  });
21352
21477
  const { isDirectHit, isTable, index: index2, trIndex, tdIndex, tdValueIndex, zone: zone2 } = positionContext;
21353
- if (!isDirectHit || zone2 && zone2 !== this.zone.getZone())
21478
+ if (isMustDirectHit && !isDirectHit || zone2 && zone2 !== this.zone.getZone()) {
21354
21479
  return null;
21480
+ }
21481
+ let tableInfo = null;
21355
21482
  let element = null;
21356
21483
  const elementList = this.draw.getOriginalElementList();
21357
21484
  let position = null;
@@ -21360,6 +21487,11 @@ class CommandAdapt {
21360
21487
  const td = (_b = elementList[index2].trList) == null ? void 0 : _b[trIndex].tdList[tdIndex];
21361
21488
  element = (td == null ? void 0 : td.value[tdValueIndex]) || null;
21362
21489
  position = ((_c = td == null ? void 0 : td.positionList) == null ? void 0 : _c[tdValueIndex]) || null;
21490
+ tableInfo = {
21491
+ element: elementList[index2],
21492
+ trIndex,
21493
+ tdIndex
21494
+ };
21363
21495
  } else {
21364
21496
  element = elementList[index2] || null;
21365
21497
  position = positionList[index2] || null;
@@ -21379,7 +21511,8 @@ class CommandAdapt {
21379
21511
  return {
21380
21512
  pageNo,
21381
21513
  element,
21382
- rangeRect
21514
+ rangeRect,
21515
+ tableInfo
21383
21516
  };
21384
21517
  }
21385
21518
  insertTitle(payload) {