@hufe921/canvas-editor 0.9.113 → 0.9.114

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,19 @@
1
+ ## [0.9.114](https://github.com/Hufe921/canvas-editor/compare/v0.9.113...v0.9.114) (2025-08-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * composition error while using input method editor #1193 ([87e7394](https://github.com/Hufe921/canvas-editor/commit/87e739455898d2c99485aa8621af26c02269b6be)), closes [#1193](https://github.com/Hufe921/canvas-editor/issues/1193)
7
+ * update position context when selecting table cells #1211 ([602896a](https://github.com/Hufe921/canvas-editor/commit/602896adb8989ca5f0a0f91441a90926307a7bb0)), closes [#1211](https://github.com/Hufe921/canvas-editor/issues/1211)
8
+
9
+
10
+ ### Features
11
+
12
+ * add extension option to executeImage api #1201 ([5845843](https://github.com/Hufe921/canvas-editor/commit/5845843e4bee5214745a5f93dcf392db21cbba20)), closes [#1201](https://github.com/Hufe921/canvas-editor/issues/1201)
13
+ * add location option to executeLocationArea api #1180 ([f6eff67](https://github.com/Hufe921/canvas-editor/commit/f6eff67e99e6472e065a60cecc5fb9091e8ac7cf)), closes [#1180](https://github.com/Hufe921/canvas-editor/issues/1180)
14
+
15
+
16
+
1
17
  ## [0.9.113](https://github.com/Hufe921/canvas-editor/compare/v0.9.112...v0.9.113) (2025-07-12)
2
18
 
3
19
 
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
23
23
  return value;
24
24
  };
25
25
  var index = "";
26
- const version = "0.9.113";
26
+ const version = "0.9.114";
27
27
  var MaxHeightRatio;
28
28
  (function(MaxHeightRatio2) {
29
29
  MaxHeightRatio2["HALF"] = "half";
@@ -5888,7 +5888,7 @@ class CursorAgent {
5888
5888
  this.container.append(agentCursorDom);
5889
5889
  this.agentCursorDom = agentCursorDom;
5890
5890
  agentCursorDom.onkeydown = (evt) => this._keyDown(evt);
5891
- agentCursorDom.oninput = debounce(this._input.bind(this), 0);
5891
+ agentCursorDom.oninput = this._input.bind(this);
5892
5892
  agentCursorDom.onpaste = (evt) => this._paste(evt);
5893
5893
  agentCursorDom.addEventListener("compositionstart", this._compositionstart.bind(this));
5894
5894
  agentCursorDom.addEventListener("compositionend", this._compositionend.bind(this));
@@ -6776,12 +6776,21 @@ function mousemove(evt, host) {
6776
6776
  });
6777
6777
  if (!~positionResult.index)
6778
6778
  return;
6779
- const { index: index2, isTable, tdValueIndex, tdIndex, trIndex, tableId } = positionResult;
6779
+ const { index: index2, isTable, tdValueIndex, tdIndex, trIndex, tableId, trId, tdId } = positionResult;
6780
6780
  const { index: startIndex, isTable: startIsTable, tdIndex: startTdIndex, trIndex: startTrIndex, tableId: startTableId } = host.mouseDownStartPosition;
6781
6781
  const endIndex = isTable ? tdValueIndex : index2;
6782
6782
  const rangeManager = draw.getRange();
6783
6783
  if (isTable && startIsTable && (tdIndex !== startTdIndex || trIndex !== startTrIndex)) {
6784
6784
  rangeManager.setRange(endIndex, endIndex, tableId, startTdIndex, tdIndex, startTrIndex, trIndex);
6785
+ position.setPositionContext({
6786
+ isTable,
6787
+ index: index2,
6788
+ trIndex,
6789
+ tdIndex,
6790
+ tdId,
6791
+ trId,
6792
+ tableId
6793
+ });
6785
6794
  } else {
6786
6795
  let end = ~endIndex ? endIndex : 0;
6787
6796
  if ((startIsTable || isTable) && startTableId !== tableId)
@@ -8120,11 +8129,9 @@ function compositionend(host, evt) {
8120
8129
  isSubmitHistory: false
8121
8130
  });
8122
8131
  } else {
8123
- setTimeout(() => {
8124
- if (host.compositionInfo) {
8125
- input(evt.data, host);
8126
- }
8127
- }, 1);
8132
+ if (host.compositionInfo) {
8133
+ input(evt.data, host);
8134
+ }
8128
8135
  }
8129
8136
  const cursor = draw.getCursor();
8130
8137
  cursor.clearAgentDomValue();
@@ -17640,20 +17647,34 @@ class Area {
17640
17647
  value: zipElementList(areaInfo.elementList)
17641
17648
  };
17642
17649
  }
17643
- getContextByAreaId(areaId) {
17650
+ getContextByAreaId(areaId, options) {
17651
+ var _a, _b, _c;
17644
17652
  const elementList = this.draw.getOriginalMainElementList();
17645
17653
  for (let e = 0; e < elementList.length; e++) {
17646
17654
  const element = elementList[e];
17647
- if (element.areaId === areaId) {
17648
- const positionList = this.position.getOriginalMainPositionList();
17649
- return {
17650
- range: {
17651
- startIndex: e,
17652
- endIndex: e
17653
- },
17654
- elementPosition: positionList[e]
17655
- };
17655
+ if ((options == null ? void 0 : options.position) === LocationPosition.OUTER_BEFORE) {
17656
+ if (((_a = elementList[e + 1]) == null ? void 0 : _a.areaId) !== areaId)
17657
+ continue;
17658
+ } else if ((options == null ? void 0 : options.position) === LocationPosition.AFTER) {
17659
+ if (!(element.areaId === areaId && ((_b = elementList[e + 1]) == null ? void 0 : _b.areaId) !== areaId)) {
17660
+ continue;
17661
+ }
17662
+ } else if ((options == null ? void 0 : options.position) === LocationPosition.OUTER_AFTER) {
17663
+ if (!(element.areaId !== areaId && ((_c = elementList[e - 1]) == null ? void 0 : _c.areaId) === areaId)) {
17664
+ continue;
17665
+ }
17666
+ } else {
17667
+ if (element.areaId !== areaId)
17668
+ continue;
17656
17669
  }
17670
+ const positionList = this.position.getOriginalMainPositionList();
17671
+ return {
17672
+ range: {
17673
+ startIndex: e,
17674
+ endIndex: e
17675
+ },
17676
+ elementPosition: positionList[e]
17677
+ };
17657
17678
  }
17658
17679
  return null;
17659
17680
  }
@@ -21156,18 +21177,12 @@ class CommandAdapt {
21156
21177
  const { startIndex, endIndex } = this.range.getRange();
21157
21178
  if (!~startIndex && !~endIndex)
21158
21179
  return null;
21159
- const { id, conceptId, value, width, height, imgDisplay } = payload;
21160
- const imageId = id || getUUID();
21180
+ const imageId = payload.id || getUUID();
21161
21181
  this.insertElementList([
21162
- {
21163
- value,
21164
- width,
21165
- height,
21166
- conceptId,
21182
+ __spreadProps(__spreadValues({}, payload), {
21167
21183
  id: imageId,
21168
- type: ElementType.IMAGE,
21169
- imgDisplay
21170
- }
21184
+ type: ElementType.IMAGE
21185
+ })
21171
21186
  ]);
21172
21187
  return imageId;
21173
21188
  }
@@ -22189,8 +22204,8 @@ class CommandAdapt {
22189
22204
  setAreaProperties(payload) {
22190
22205
  this.draw.getArea().setAreaProperties(payload);
22191
22206
  }
22192
- locationArea(areaId) {
22193
- const context = this.draw.getArea().getContextByAreaId(areaId);
22207
+ locationArea(areaId, options) {
22208
+ const context = this.draw.getArea().getContextByAreaId(areaId, options);
22194
22209
  if (!context)
22195
22210
  return;
22196
22211
  const { range: { endIndex }, elementPosition } = context;