@hufe921/canvas-editor 0.9.81 → 0.9.83

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,36 @@
1
+ ## [0.9.83](https://github.com/Hufe921/canvas-editor/compare/v0.9.82...v0.9.83) (2024-06-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * executeSetControlProperties api invalid in table #653 ([fdcf639](https://github.com/Hufe921/canvas-editor/commit/fdcf6397e1ce62ef1ed18a526a0642c3f120df3b)), closes [#653](https://github.com/Hufe921/canvas-editor/issues/653)
7
+
8
+
9
+ ### Features
10
+
11
+ * add clear format attributes ([e21533a](https://github.com/Hufe921/canvas-editor/commit/e21533a3d1cfeecde562aaa6c52ee306e5063a01))
12
+ * add conceptId attribute to table td #654 ([959a062](https://github.com/Hufe921/canvas-editor/commit/959a062f830042b78af498e2d6cbc4e5f82fa3d4)), closes [#654](https://github.com/Hufe921/canvas-editor/issues/654)
13
+ * add mouse event listener #603 ([a2978bd](https://github.com/Hufe921/canvas-editor/commit/a2978bd1f507e9417b995bbb0b7ff756dbe5d2c4)), closes [#603](https://github.com/Hufe921/canvas-editor/issues/603)
14
+ * copy table structure and data #516 ([76c20a6](https://github.com/Hufe921/canvas-editor/commit/76c20a6b44914396ae7dd69a7c97db1b179937c2)), closes [#516](https://github.com/Hufe921/canvas-editor/issues/516)
15
+
16
+
17
+
18
+ ## [0.9.82](https://github.com/Hufe921/canvas-editor/compare/v0.9.81...v0.9.82) (2024-06-14)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * table cell merge boundary error #645 ([f7da332](https://github.com/Hufe921/canvas-editor/commit/f7da33235419aadb2aea024d3cba4444d6d719fd)), closes [#645](https://github.com/Hufe921/canvas-editor/issues/645)
24
+
25
+
26
+ ### Features
27
+
28
+ * add executeUpdateElementById api #648 ([5c896bf](https://github.com/Hufe921/canvas-editor/commit/5c896bf95814c6ef2956221763e7df560b3fe98a)), closes [#648](https://github.com/Hufe921/canvas-editor/issues/648)
29
+ * add override internal drop function api #643 ([ec7e076](https://github.com/Hufe921/canvas-editor/commit/ec7e0760c113711fdafc13374ea521605308f867)), closes [#643](https://github.com/Hufe921/canvas-editor/issues/643)
30
+ * move control position by dragging #456 ([cdb0788](https://github.com/Hufe921/canvas-editor/commit/cdb0788dfcecadb70e680eb40a31551e0e096401)), closes [#456](https://github.com/Hufe921/canvas-editor/issues/456)
31
+
32
+
33
+
1
34
  ## [0.9.81](https://github.com/Hufe921/canvas-editor/compare/v0.9.80...v0.9.81) (2024-06-07)
2
35
 
3
36
 
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
23
23
  return value;
24
24
  };
25
25
  var index = "";
26
- const version = "0.9.81";
26
+ const version = "0.9.83";
27
27
  var MaxHeightRatio;
28
28
  (function(MaxHeightRatio2) {
29
29
  MaxHeightRatio2["HALF"] = "half";
@@ -471,6 +471,7 @@ const EDITOR_ELEMENT_ZIP_ATTR = [
471
471
  "externalId"
472
472
  ];
473
473
  const TABLE_TD_ZIP_ATTR = [
474
+ "conceptId",
474
475
  "verticalAlign",
475
476
  "backgroundColor",
476
477
  "borderTypes",
@@ -4779,9 +4780,7 @@ function getElementListByHTML(htmlText, options) {
4779
4780
  }
4780
4781
  tr.tdList.push(td);
4781
4782
  });
4782
- if (tr.tdList.length) {
4783
- element.trList.push(tr);
4784
- }
4783
+ element.trList.push(tr);
4785
4784
  });
4786
4785
  if (element.trList.length) {
4787
4786
  const tdCount = element.trList[0].tdList.reduce((pre, cur) => pre + cur.colspan, 0);
@@ -5191,9 +5190,10 @@ class CursorAgent {
5191
5190
  this.canvasEvent.keydown(evt);
5192
5191
  }
5193
5192
  _input(evt) {
5194
- if (!evt.data)
5193
+ const data2 = evt.data;
5194
+ if (!data2)
5195
5195
  return;
5196
- this.canvasEvent.input(evt.data);
5196
+ this.canvasEvent.input(data2);
5197
5197
  }
5198
5198
  _paste(evt) {
5199
5199
  const isReadonly = this.draw.isReadonly();
@@ -5799,14 +5799,20 @@ function mouseup(evt, host) {
5799
5799
  return;
5800
5800
  }
5801
5801
  }
5802
- const editorOptions = draw.getOptions();
5802
+ const control = draw.getControl();
5803
5803
  const elementList = draw.getElementList();
5804
+ const isOmitControlAttr = !isContainControl || !!elementList[range.startIndex].controlId || !control.getIsElementListContainFullControl(dragElementList);
5805
+ const editorOptions = draw.getOptions();
5804
5806
  const replaceElementList = dragElementList.map((el) => {
5805
5807
  if (!el.type || el.type === ElementType.TEXT) {
5806
5808
  const newElement = {
5807
5809
  value: el.value
5808
5810
  };
5809
- EDITOR_ELEMENT_STYLE_ATTR.forEach((attr) => {
5811
+ const copyAttr = EDITOR_ELEMENT_STYLE_ATTR;
5812
+ if (!isOmitControlAttr) {
5813
+ copyAttr.push(...CONTROL_CONTEXT_ATTR);
5814
+ }
5815
+ copyAttr.forEach((attr) => {
5810
5816
  const value = el[attr];
5811
5817
  if (value !== void 0) {
5812
5818
  newElement[attr] = value;
@@ -5814,7 +5820,10 @@ function mouseup(evt, host) {
5814
5820
  });
5815
5821
  return newElement;
5816
5822
  } else {
5817
- const newElement = omitObject(deepClone(el), CONTROL_CONTEXT_ATTR);
5823
+ let newElement = deepClone(el);
5824
+ if (isOmitControlAttr) {
5825
+ newElement = omitObject(newElement, CONTROL_CONTEXT_ATTR);
5826
+ }
5818
5827
  formatElementList([newElement], {
5819
5828
  isHandleFirstElement: false,
5820
5829
  editorOptions
@@ -5830,7 +5839,6 @@ function mouseup(evt, host) {
5830
5839
  const replaceLength = replaceElementList.length;
5831
5840
  let rangeStart = range.startIndex;
5832
5841
  let rangeEnd = rangeStart + replaceLength;
5833
- const control = draw.getControl();
5834
5842
  const activeControl = control.getActiveControl();
5835
5843
  if (activeControl && cacheElementList[rangeStart].controlComponent !== ControlComponent.POSTFIX) {
5836
5844
  rangeEnd = activeControl.setValue(replaceElementList);
@@ -6972,13 +6980,57 @@ function copy(host) {
6972
6980
  return;
6973
6981
  }
6974
6982
  const rangeManager = draw.getRange();
6975
- const copyElementList = rangeManager.getIsCollapsed() ? rangeManager.getRangeRowElementList() : rangeManager.getSelectionElementList();
6983
+ let copyElementList = null;
6984
+ const range = rangeManager.getRange();
6985
+ if (range.isCrossRowCol) {
6986
+ const tableElement = rangeManager.getRangeTableElement();
6987
+ if (!tableElement)
6988
+ return;
6989
+ const rowCol = draw.getTableParticle().getRangeRowCol();
6990
+ if (!rowCol)
6991
+ return;
6992
+ const copyTableElement = {
6993
+ type: ElementType.TABLE,
6994
+ value: "",
6995
+ colgroup: [],
6996
+ trList: []
6997
+ };
6998
+ const firstRow = rowCol[0];
6999
+ const colStartIndex = firstRow[0].colIndex;
7000
+ const lastCol = firstRow[firstRow.length - 1];
7001
+ const colEndIndex = lastCol.colIndex + lastCol.colspan - 1;
7002
+ for (let c = colStartIndex; c <= colEndIndex; c++) {
7003
+ copyTableElement.colgroup.push(tableElement.colgroup[c]);
7004
+ }
7005
+ for (let r = 0; r < rowCol.length; r++) {
7006
+ const row = rowCol[r];
7007
+ const tr = tableElement.trList[row[0].rowIndex];
7008
+ const coptTr = {
7009
+ tdList: [],
7010
+ height: tr.height,
7011
+ minHeight: tr.minHeight
7012
+ };
7013
+ for (let c = 0; c < row.length; c++) {
7014
+ coptTr.tdList.push(row[c]);
7015
+ }
7016
+ copyTableElement.trList.push(coptTr);
7017
+ }
7018
+ copyElementList = zipElementList([copyTableElement]);
7019
+ } else {
7020
+ copyElementList = rangeManager.getIsCollapsed() ? rangeManager.getRangeRowElementList() : rangeManager.getSelectionElementList();
7021
+ }
6976
7022
  if (!(copyElementList == null ? void 0 : copyElementList.length))
6977
7023
  return;
6978
7024
  writeElementList(copyElementList, draw.getOptions());
6979
7025
  }
6980
7026
  function drop(evt, host) {
6981
7027
  var _a, _b;
7028
+ const draw = host.getDraw();
7029
+ const { drop: drop2 } = draw.getOverride();
7030
+ if (drop2) {
7031
+ drop2(evt);
7032
+ return;
7033
+ }
6982
7034
  evt.preventDefault();
6983
7035
  const data2 = (_a = evt.dataTransfer) == null ? void 0 : _a.getData("text");
6984
7036
  if (data2) {
@@ -7812,6 +7864,7 @@ class Position {
7812
7864
  x,
7813
7865
  y,
7814
7866
  td,
7867
+ pageNo: curPageNo,
7815
7868
  tablePosition: positionList[j],
7816
7869
  isTable: true,
7817
7870
  elementList: td.value,
@@ -7872,6 +7925,7 @@ class Position {
7872
7925
  }
7873
7926
  }
7874
7927
  return {
7928
+ isDirectHit: true,
7875
7929
  hitLineStartIndex: hitLineStartIndex2,
7876
7930
  index: curPositionIndex2,
7877
7931
  isControl: !!element.controlId
@@ -8275,6 +8329,13 @@ class RangeManager {
8275
8329
  var _a;
8276
8330
  return ((_a = this.getRangeParagraphInfo()) == null ? void 0 : _a.elementList) || null;
8277
8331
  }
8332
+ getRangeTableElement() {
8333
+ const positionContext = this.position.getPositionContext();
8334
+ if (!positionContext.isTable)
8335
+ return null;
8336
+ const originalElementList = this.draw.getOriginalElementList();
8337
+ return originalElementList[positionContext.index];
8338
+ }
8278
8339
  getIsSelectAll() {
8279
8340
  const elementList = this.draw.getElementList();
8280
8341
  const { startIndex, endIndex } = this.range;
@@ -9641,12 +9702,10 @@ class TableParticle {
9641
9702
  const { colgroup, trList } = element;
9642
9703
  if (!colgroup || !trList)
9643
9704
  return;
9644
- let x = 0;
9645
- let y = 0;
9705
+ let preX = 0;
9646
9706
  for (let t = 0; t < trList.length; t++) {
9647
9707
  const tr = trList[t];
9648
9708
  const isLastTr = trList.length - 1 === t;
9649
- let rowMinHeight = 0;
9650
9709
  for (let d = 0; d < tr.tdList.length; d++) {
9651
9710
  const td = tr.tdList[d];
9652
9711
  let colIndex = 0;
@@ -9661,7 +9720,7 @@ class TableParticle {
9661
9720
  for (let preC = 0; preC < c; preC++) {
9662
9721
  preColWidth += colgroup[preC].width;
9663
9722
  }
9664
- x = preColWidth;
9723
+ preX = preColWidth;
9665
9724
  break;
9666
9725
  }
9667
9726
  }
@@ -9680,9 +9739,6 @@ class TableParticle {
9680
9739
  const curTr = trList[row + t] || trList[t];
9681
9740
  height += curTr.height;
9682
9741
  }
9683
- if (rowMinHeight === 0 || rowMinHeight > height) {
9684
- rowMinHeight = height;
9685
- }
9686
9742
  const isLastRowTd = tr.tdList.length - 1 === d;
9687
9743
  let isLastColTd = isLastTr;
9688
9744
  if (!isLastColTd) {
@@ -9695,16 +9751,26 @@ class TableParticle {
9695
9751
  td.isLastRowTd = isLastRowTd;
9696
9752
  td.isLastColTd = isLastColTd;
9697
9753
  td.isLastTd = isLastTd;
9698
- td.x = x;
9699
- td.y = y;
9754
+ td.x = preX;
9755
+ let preY = 0;
9756
+ for (let preR = 0; preR < t; preR++) {
9757
+ const preTdList = trList[preR].tdList;
9758
+ for (let preD = 0; preD < preTdList.length; preD++) {
9759
+ const td2 = preTdList[preD];
9760
+ if (colIndex >= td2.colIndex && colIndex < td2.colIndex + td2.colspan) {
9761
+ preY += td2.height;
9762
+ break;
9763
+ }
9764
+ }
9765
+ }
9766
+ td.y = preY;
9700
9767
  td.width = width;
9701
9768
  td.height = height;
9702
9769
  td.rowIndex = t;
9703
9770
  td.colIndex = colIndex;
9704
- x += width;
9771
+ preX += width;
9705
9772
  if (isLastRowTd && !isLastTd) {
9706
- x = 0;
9707
- y += rowMinHeight;
9773
+ preX = 0;
9708
9774
  }
9709
9775
  }
9710
9776
  }
@@ -11697,6 +11763,23 @@ class Control {
11697
11763
  }
11698
11764
  return false;
11699
11765
  }
11766
+ getIsElementListContainFullControl(elementList) {
11767
+ if (!elementList.some((element) => element.controlId))
11768
+ return false;
11769
+ let prefixCount = 0;
11770
+ let postfixCount = 0;
11771
+ for (let e = 0; e < elementList.length; e++) {
11772
+ const element = elementList[e];
11773
+ if (element.controlComponent === ControlComponent.PREFIX) {
11774
+ prefixCount++;
11775
+ } else if (element.controlComponent === ControlComponent.POSTFIX) {
11776
+ postfixCount++;
11777
+ }
11778
+ }
11779
+ if (!prefixCount || !postfixCount)
11780
+ return false;
11781
+ return prefixCount === postfixCount;
11782
+ }
11700
11783
  getIsDisabledControl() {
11701
11784
  var _a, _b;
11702
11785
  return !!((_b = (_a = this.activeControl) == null ? void 0 : _a.getElement().control) == null ? void 0 : _b.disabled);
@@ -12217,23 +12300,27 @@ class Control {
12217
12300
  }
12218
12301
  }
12219
12302
  setPropertiesByConceptId(payload) {
12220
- var _a;
12221
12303
  const isReadonly = this.draw.isReadonly();
12222
12304
  if (isReadonly)
12223
12305
  return;
12224
12306
  const { conceptId, properties } = payload;
12225
12307
  let isExistUpdate = false;
12226
- const pageComponentData = {
12227
- header: this.draw.getHeaderElementList(),
12228
- main: this.draw.getOriginalMainElementList(),
12229
- footer: this.draw.getFooterElementList()
12230
- };
12231
- for (const key in pageComponentData) {
12232
- const elementList = pageComponentData[key];
12308
+ function setProperties(elementList) {
12309
+ var _a;
12233
12310
  let i = 0;
12234
12311
  while (i < elementList.length) {
12235
12312
  const element = elementList[i];
12236
12313
  i++;
12314
+ if (element.type === ElementType.TABLE) {
12315
+ const trList = element.trList;
12316
+ for (let r = 0; r < trList.length; r++) {
12317
+ const tr = trList[r];
12318
+ for (let d = 0; d < tr.tdList.length; d++) {
12319
+ const td = tr.tdList[d];
12320
+ setProperties(td.value);
12321
+ }
12322
+ }
12323
+ }
12237
12324
  if (((_a = element == null ? void 0 : element.control) == null ? void 0 : _a.conceptId) !== conceptId)
12238
12325
  continue;
12239
12326
  isExistUpdate = true;
@@ -12250,6 +12337,15 @@ class Control {
12250
12337
  i = newEndIndex;
12251
12338
  }
12252
12339
  }
12340
+ const pageComponentData = {
12341
+ header: this.draw.getHeaderElementList(),
12342
+ main: this.draw.getOriginalMainElementList(),
12343
+ footer: this.draw.getFooterElementList()
12344
+ };
12345
+ for (const key in pageComponentData) {
12346
+ const elementList = pageComponentData[key];
12347
+ setProperties(elementList);
12348
+ }
12253
12349
  if (!isExistUpdate)
12254
12350
  return;
12255
12351
  for (const key in pageComponentData) {
@@ -14338,6 +14434,34 @@ class Group {
14338
14434
  this.clearFillInfo();
14339
14435
  }
14340
14436
  }
14437
+ class MouseObserver {
14438
+ constructor(draw) {
14439
+ __publicField(this, "draw");
14440
+ __publicField(this, "eventBus");
14441
+ __publicField(this, "pageContainer");
14442
+ this.draw = draw;
14443
+ this.eventBus = this.draw.getEventBus();
14444
+ this.pageContainer = this.draw.getPageContainer();
14445
+ this.pageContainer.addEventListener("mousemove", this._mousemove.bind(this));
14446
+ this.pageContainer.addEventListener("mouseenter", this._mouseenter.bind(this));
14447
+ this.pageContainer.addEventListener("mouseleave", this._mouseleave.bind(this));
14448
+ }
14449
+ _mousemove(evt) {
14450
+ if (!this.eventBus.isSubscribe("mousemove"))
14451
+ return;
14452
+ this.eventBus.emit("mousemove", evt);
14453
+ }
14454
+ _mouseenter(evt) {
14455
+ if (!this.eventBus.isSubscribe("mouseenter"))
14456
+ return;
14457
+ this.eventBus.emit("mouseenter", evt);
14458
+ }
14459
+ _mouseleave(evt) {
14460
+ if (!this.eventBus.isSubscribe("mouseleave"))
14461
+ return;
14462
+ this.eventBus.emit("mouseleave", evt);
14463
+ }
14464
+ }
14341
14465
  class Draw {
14342
14466
  constructor(rootContainer, options, data2, listener, eventBus, override) {
14343
14467
  __publicField(this, "container");
@@ -14456,6 +14580,7 @@ class Draw {
14456
14580
  this.scrollObserver = new ScrollObserver(this);
14457
14581
  this.selectionObserver = new SelectionObserver(this);
14458
14582
  this.imageObserver = new ImageObserver();
14583
+ new MouseObserver(this);
14459
14584
  this.canvasEvent = new CanvasEvent(this);
14460
14585
  this.cursor = new Cursor(this, this.canvasEvent);
14461
14586
  this.canvasEvent.register();
@@ -16164,6 +16289,7 @@ class Command {
16164
16289
  __publicField(this, "executeSetPaperMargin");
16165
16290
  __publicField(this, "executeInsertElementList");
16166
16291
  __publicField(this, "executeAppendElementList");
16292
+ __publicField(this, "executeUpdateElementById");
16167
16293
  __publicField(this, "executeSetValue");
16168
16294
  __publicField(this, "executeRemoveControl");
16169
16295
  __publicField(this, "executeSetLocale");
@@ -16202,6 +16328,7 @@ class Command {
16202
16328
  __publicField(this, "getControlList");
16203
16329
  __publicField(this, "getContainer");
16204
16330
  __publicField(this, "getTitleValue");
16331
+ __publicField(this, "getPositionContextByEvent");
16205
16332
  this.executeMode = adapt.mode.bind(adapt);
16206
16333
  this.executeCut = adapt.cut.bind(adapt);
16207
16334
  this.executeCopy = adapt.copy.bind(adapt);
@@ -16276,6 +16403,7 @@ class Command {
16276
16403
  this.executeSetPaperMargin = adapt.setPaperMargin.bind(adapt);
16277
16404
  this.executeInsertElementList = adapt.insertElementList.bind(adapt);
16278
16405
  this.executeAppendElementList = adapt.appendElementList.bind(adapt);
16406
+ this.executeUpdateElementById = adapt.updateElementById.bind(adapt);
16279
16407
  this.executeSetValue = adapt.setValue.bind(adapt);
16280
16408
  this.executeRemoveControl = adapt.removeControl.bind(adapt);
16281
16409
  this.executeSetLocale = adapt.setLocale.bind(adapt);
@@ -16307,6 +16435,7 @@ class Command {
16307
16435
  this.getGroupIds = adapt.getGroupIds.bind(adapt);
16308
16436
  this.getContainer = adapt.getContainer.bind(adapt);
16309
16437
  this.getTitleValue = adapt.getTitleValue.bind(adapt);
16438
+ this.getPositionContextByEvent = adapt.getPositionContextByEvent.bind(adapt);
16310
16439
  this.executeSetControlValue = adapt.setControlValue.bind(adapt);
16311
16440
  this.executeSetControlExtension = adapt.setControlExtension.bind(adapt);
16312
16441
  this.executeSetControlProperties = adapt.setControlProperties.bind(adapt);
@@ -16540,6 +16669,7 @@ class CommandAdapt {
16540
16669
  __publicField(this, "workerManager");
16541
16670
  __publicField(this, "searchManager");
16542
16671
  __publicField(this, "i18n");
16672
+ __publicField(this, "zone");
16543
16673
  this.draw = draw;
16544
16674
  this.range = draw.getRange();
16545
16675
  this.position = draw.getPosition();
@@ -16551,6 +16681,7 @@ class CommandAdapt {
16551
16681
  this.workerManager = draw.getWorkerManager();
16552
16682
  this.searchManager = draw.getSearch();
16553
16683
  this.i18n = draw.getI18n();
16684
+ this.zone = draw.getZone();
16554
16685
  }
16555
16686
  mode(payload) {
16556
16687
  this.draw.setMode(payload);
@@ -16704,13 +16835,9 @@ class CommandAdapt {
16704
16835
  if (!changeElementList.length)
16705
16836
  return;
16706
16837
  changeElementList.forEach((el) => {
16707
- delete el.size;
16708
- delete el.font;
16709
- delete el.color;
16710
- delete el.bold;
16711
- delete el.italic;
16712
- delete el.underline;
16713
- delete el.strikeout;
16838
+ EDITOR_ELEMENT_STYLE_ATTR.forEach((attr) => {
16839
+ delete el[attr];
16840
+ });
16714
16841
  });
16715
16842
  this.draw.render(renderOption);
16716
16843
  }
@@ -18334,8 +18461,12 @@ class CommandAdapt {
18334
18461
  const selectionText = this.range.toString();
18335
18462
  const selectionElementList = zipElementList(this.range.getSelectionElementList() || []);
18336
18463
  const elementList = this.draw.getElementList();
18337
- const startElement = pickElementAttr(elementList[isCollapsed ? startIndex : startIndex + 1]);
18338
- const endElement = pickElementAttr(elementList[endIndex]);
18464
+ const startElement = pickElementAttr(elementList[isCollapsed ? startIndex : startIndex + 1], {
18465
+ extraPickAttrs: ["id"]
18466
+ });
18467
+ const endElement = pickElementAttr(elementList[endIndex], {
18468
+ extraPickAttrs: ["id"]
18469
+ });
18339
18470
  const positionList = this.position.getPositionList();
18340
18471
  const startPageNo = positionList[startIndex].pageNo;
18341
18472
  const endPageNo = positionList[endIndex].pageNo;
@@ -18471,6 +18602,37 @@ class CommandAdapt {
18471
18602
  return;
18472
18603
  this.draw.appendElementList(deepClone(elementList), options);
18473
18604
  }
18605
+ updateElementById(payload) {
18606
+ function getElementIndexById(elementList) {
18607
+ for (let e = 0; e < elementList.length; e++) {
18608
+ const element = elementList[e];
18609
+ if (element.id === payload.id) {
18610
+ return e;
18611
+ }
18612
+ }
18613
+ return -1;
18614
+ }
18615
+ const getElementListFnList = [
18616
+ this.draw.getOriginalMainElementList,
18617
+ this.draw.getHeaderElementList,
18618
+ this.draw.getFooterElementList
18619
+ ];
18620
+ for (const getElementList of getElementListFnList) {
18621
+ const elementList = getElementList.call(this.draw);
18622
+ const elementIndex = getElementIndexById(elementList);
18623
+ if (~elementIndex) {
18624
+ elementList[elementIndex] = __spreadValues(__spreadValues({}, elementList[elementIndex]), payload.properties);
18625
+ formatElementList([elementList[elementIndex]], {
18626
+ isHandleFirstElement: false,
18627
+ editorOptions: this.options
18628
+ });
18629
+ this.draw.render({
18630
+ isSetCursor: false
18631
+ });
18632
+ break;
18633
+ }
18634
+ }
18635
+ }
18474
18636
  setValue(payload) {
18475
18637
  this.draw.setValue(payload);
18476
18638
  }
@@ -18769,6 +18931,50 @@ class CommandAdapt {
18769
18931
  }
18770
18932
  return result;
18771
18933
  }
18934
+ getPositionContextByEvent(evt) {
18935
+ var _a, _b, _c;
18936
+ const pageIndex = (_a = evt.target) == null ? void 0 : _a.dataset.index;
18937
+ if (!pageIndex)
18938
+ return null;
18939
+ const pageNo = Number(pageIndex);
18940
+ const positionContext = this.position.getPositionByXY({
18941
+ x: evt.offsetX,
18942
+ y: evt.offsetY,
18943
+ pageNo
18944
+ });
18945
+ const { isDirectHit, isTable, index: index2, trIndex, tdIndex, tdValueIndex, zone: zone2 } = positionContext;
18946
+ if (!isDirectHit || zone2 && zone2 !== this.zone.getZone())
18947
+ return null;
18948
+ let element = null;
18949
+ const elementList = this.draw.getOriginalElementList();
18950
+ let position = null;
18951
+ const positionList = this.position.getOriginalPositionList();
18952
+ if (isTable) {
18953
+ const td = (_b = elementList[index2].trList) == null ? void 0 : _b[trIndex].tdList[tdIndex];
18954
+ element = (td == null ? void 0 : td.value[tdValueIndex]) || null;
18955
+ position = ((_c = td == null ? void 0 : td.positionList) == null ? void 0 : _c[tdValueIndex]) || null;
18956
+ } else {
18957
+ element = elementList[index2] || null;
18958
+ position = positionList[index2] || null;
18959
+ }
18960
+ let rangeRect = null;
18961
+ if (position) {
18962
+ const { pageNo: pageNo2, coordinate: { leftTop, rightTop }, lineHeight } = position;
18963
+ const height = this.draw.getOriginalHeight();
18964
+ const pageGap = this.draw.getOriginalPageGap();
18965
+ rangeRect = {
18966
+ x: leftTop[0],
18967
+ y: leftTop[1] + pageNo2 * (height + pageGap),
18968
+ width: rightTop[0] - leftTop[0],
18969
+ height: lineHeight
18970
+ };
18971
+ }
18972
+ return {
18973
+ pageNo,
18974
+ element,
18975
+ rangeRect
18976
+ };
18977
+ }
18772
18978
  insertTitle(payload) {
18773
18979
  var _a;
18774
18980
  const isReadonly = this.draw.isReadonly();
@@ -19861,6 +20067,7 @@ class Override {
19861
20067
  constructor() {
19862
20068
  __publicField(this, "paste");
19863
20069
  __publicField(this, "copy");
20070
+ __publicField(this, "drop");
19864
20071
  }
19865
20072
  }
19866
20073
  class Editor {