@hufe921/canvas-editor 0.9.30 → 0.9.31

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,17 @@
1
+ ## [0.9.31](https://github.com/Hufe921/canvas-editor/compare/v0.9.30...v0.9.31) (2023-04-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * lose line break when set title ([722a910](https://github.com/Hufe921/canvas-editor/commit/722a91014508d9a8d65a30ab7d71b23924fa9b91))
7
+
8
+
9
+ ### Performance Improvements
10
+
11
+ * range style anchor element ([d9eec5b](https://github.com/Hufe921/canvas-editor/commit/d9eec5b9be6cbb545c57cf8816b197a214c70f3e))
12
+
13
+
14
+
1
15
  ## [0.9.30](https://github.com/Hufe921/canvas-editor/compare/v0.9.29...v0.9.30) (2023-04-07)
2
16
 
3
17
 
package/README.md CHANGED
@@ -43,12 +43,12 @@ new Editor(document.querySelector(".canvas-editor"), [
43
43
 
44
44
  ## dev
45
45
 
46
- `yarn run dev`
46
+ `npm run dev`
47
47
 
48
48
  ## build
49
49
 
50
50
  #### app
51
- `yarn run build`
51
+ `npm run build`
52
52
 
53
53
  #### lib
54
- `yarn run lib`
54
+ `npm run lib`
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
23
23
  return value;
24
24
  };
25
25
  var index = "";
26
- const version = "0.9.30";
26
+ const version = "0.9.31";
27
27
  var MaxHeightRatio;
28
28
  (function(MaxHeightRatio2) {
29
29
  MaxHeightRatio2["HALF"] = "half";
@@ -6049,16 +6049,15 @@ class RangeManager {
6049
6049
  setRangeStyle() {
6050
6050
  if (!this.listener.rangeStyleChange)
6051
6051
  return;
6052
- let curElementList = this.getSelection();
6053
- if (!curElementList) {
6054
- const elementList = this.draw.getElementList();
6055
- const { endIndex } = this.range;
6056
- const index2 = ~endIndex ? endIndex : 0;
6057
- curElementList = [elementList[index2]];
6058
- }
6059
- const curElement = curElementList[curElementList.length - 1];
6052
+ const { endIndex } = this.range;
6053
+ const index2 = ~endIndex ? endIndex : 0;
6054
+ const elementList = this.draw.getElementList();
6055
+ const endElement = elementList[index2];
6056
+ const endNextElement = elementList[index2 + 1];
6057
+ const curElement = endElement.value === ZERO && endNextElement ? endNextElement : endElement;
6060
6058
  if (!curElement)
6061
6059
  return;
6060
+ const curElementList = this.getSelection() || [curElement];
6062
6061
  const type = curElement.type || ElementType.TEXT;
6063
6062
  const font = curElement.font || this.options.defaultFont;
6064
6063
  const size = curElement.size || this.options.defaultSize;
@@ -11670,6 +11669,8 @@ class CommandAdapt {
11670
11669
  const titleId = getUUID();
11671
11670
  const titleOptions = this.draw.getOptions().title;
11672
11671
  changeElementList.forEach((el) => {
11672
+ if (!el.type && el.value === ZERO)
11673
+ return;
11673
11674
  if (payload) {
11674
11675
  el.level = payload;
11675
11676
  el.titleId = titleId;