@hufe921/canvas-editor 0.9.19 → 0.9.20

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 ADDED
@@ -0,0 +1,207 @@
1
+ ## [0.9.20](https://github.com/Hufe921/canvas-editor/compare/v0.9.19...v0.9.20) (2023-03-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * near highlight elements render error ([17b469b](https://github.com/Hufe921/canvas-editor/commit/17b469be6b95621b635383c9fc20c9c0adcb8d2b))
7
+
8
+
9
+ ### Chores
10
+
11
+ * add CHANGELOG.md ([367a247](https://github.com/Hufe921/canvas-editor/commit/367a24730a739514d24d7c882524f8ded479fb38))
12
+ * add issue template ([7a26819](https://github.com/Hufe921/canvas-editor/commit/7a268199b3607a8c629fc5bc0242be89abbbac90))
13
+
14
+
15
+ ### Features
16
+
17
+ * signature adapt to high-resolution screen ([4acf243](https://github.com/Hufe921/canvas-editor/commit/4acf243fed01b0b41ebbcc46c4b6603cabf6c825))
18
+ * open hyperlink shortcut ([3295e37](https://github.com/Hufe921/canvas-editor/commit/3295e3711ae92f5503064691c5558afea99e3f0c))
19
+ * copy and paste highlight element ([0493ae2](https://github.com/Hufe921/canvas-editor/commit/0493ae2d5e10daf917e39a9deb4e29c90e096420))
20
+
21
+
22
+
23
+ ## [0.9.19](https://github.com/Hufe921/canvas-editor/compare/v0.9.18...v0.9.19) (2023-03-03)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * continuity page render error in lazy mode ([ff06e50](https://github.com/Hufe921/canvas-editor/commit/ff06e50138697ef61ce308e78a7e873046664e30))
29
+ * format paste table data ([909096b](https://github.com/Hufe921/canvas-editor/commit/909096bd0d9d6e845ccecbee815ddebe35e6f021))
30
+
31
+
32
+ ### Performance Improvements
33
+
34
+ * improve:control element input ([dc54622](https://github.com/Hufe921/canvas-editor/commit/dc54622258872630ff39309f2b1da3baee1f508f))
35
+
36
+
37
+
38
+ ## [0.9.18](https://github.com/Hufe921/canvas-editor/compare/v0.9.17...v0.9.18) (2023-03-02)
39
+
40
+
41
+ ### Bug Fixes
42
+
43
+ * scrollbar scroll automatically ([8b5c41b](https://github.com/Hufe921/canvas-editor/commit/8b5c41bd58008a2945574ea178058638b64c0ffb))
44
+ * paper remove error in lazy render mode ([8aac99d](https://github.com/Hufe921/canvas-editor/commit/8aac99d5c3a984d8c89b251e53dd393e73c66327))
45
+ * cannot paste html at the end of the control #133 ([0694bf0](https://github.com/Hufe921/canvas-editor/commit/0694bf0bec5da94d800affbf60b79a16c7d4d0e1)), closes [#133](https://github.com/Hufe921/canvas-editor/issues/133)
46
+ * cannot delete control when it is first element #131 ([45ef8b6](https://github.com/Hufe921/canvas-editor/commit/45ef8b69540ee28f3d4c3b7cada5fbb44c26a023)), closes [#131](https://github.com/Hufe921/canvas-editor/issues/131)
47
+
48
+
49
+ ### Features
50
+
51
+ * add lazy render mode ([f428f56](https://github.com/Hufe921/canvas-editor/commit/f428f566e9e92c7d4cc2affe73b4fc01eaaa56dd))
52
+
53
+
54
+ ### Performance Improvements
55
+
56
+ * improve:position compute separate from draw row ([8910c7c](https://github.com/Hufe921/canvas-editor/commit/8910c7cf0a5d74f6ec46615bbc106773b3147cdc))
57
+
58
+
59
+
60
+ ## [0.9.17](https://github.com/Hufe921/canvas-editor/compare/v0.9.16...v0.9.17) (2023-02-28)
61
+
62
+
63
+ ### Bug Fixes
64
+
65
+ * composing input not save history ([c4f2687](https://github.com/Hufe921/canvas-editor/commit/c4f268772646f91d63c224cf72d5e23278ff2f5e))
66
+ * visible page computing method ([fcb96a6](https://github.com/Hufe921/canvas-editor/commit/fcb96a6f561d315945c1069b4a47d4f788212556))
67
+
68
+
69
+ ### Documentation
70
+
71
+ * next features road map ([6e99d8a](https://github.com/Hufe921/canvas-editor/commit/6e99d8ad93a7a907fd97a201186b51539980ba55))
72
+ * cursor style option ([92d65da](https://github.com/Hufe921/canvas-editor/commit/92d65da7d80e0e312d053006d0690d1f9a258ef4))
73
+
74
+
75
+ ### Features
76
+
77
+ * set the cursor style when dragging text ([2977183](https://github.com/Hufe921/canvas-editor/commit/29771838f0bdc5aef1f5714fd9d6110f482f3f64))
78
+
79
+
80
+
81
+ ## [0.9.16](https://github.com/Hufe921/canvas-editor/compare/v0.9.15...v0.9.16) (2023-02-21)
82
+
83
+
84
+ ### Features
85
+
86
+ * render composing text ([63487d4](https://github.com/Hufe921/canvas-editor/commit/63487d4f90332be68cb07f3eacfca3a0d04f8eff))
87
+ * redraw when device pixel ratio change ([4c370ae](https://github.com/Hufe921/canvas-editor/commit/4c370aec1adbc4056f394d2faf370327fd544e22))
88
+ * support mac os shortcut remark ([189e88c](https://github.com/Hufe921/canvas-editor/commit/189e88c5601b2a99b032ae966f945986b8acf8b1))
89
+
90
+
91
+ ### Tests
92
+
93
+ * optimize the method of get editor value ([708d578](https://github.com/Hufe921/canvas-editor/commit/708d57812e6ab145113e3fbab047970d155b515c))
94
+
95
+
96
+
97
+ ## [0.9.15](https://github.com/Hufe921/canvas-editor/compare/v0.9.14...v0.9.15) (2023-02-16)
98
+
99
+
100
+ ### Bug Fixes
101
+
102
+ * draw multi-segment richtext element in one row ([c522c22](https://github.com/Hufe921/canvas-editor/commit/c522c225b1c26d16abcccd74c0d2573fbeb88595))
103
+
104
+
105
+ ### Documentation
106
+
107
+ * mac os shortcut ([df8096e](https://github.com/Hufe921/canvas-editor/commit/df8096ebfb8259d02f19b1926457d96af574bda2))
108
+ * update next features ([338a67c](https://github.com/Hufe921/canvas-editor/commit/338a67c6e7baf38097f1ec801d8292000e94742b))
109
+ * update next features ([4cb8d2a](https://github.com/Hufe921/canvas-editor/commit/4cb8d2adf6aa25c7734f3a544e6bbb8a78fe5892))
110
+ * add i18n ([c912563](https://github.com/Hufe921/canvas-editor/commit/c9125635eae8cecf4bdeda56455b66221c2f1db3))
111
+
112
+
113
+ ### Features
114
+
115
+ * support mac os shortcut ([ef4bda2](https://github.com/Hufe921/canvas-editor/commit/ef4bda2a46fec7c901fe62abeee4e4315e740643))
116
+ * support mac os shortcut ([0d6e0cf](https://github.com/Hufe921/canvas-editor/commit/0d6e0cf4124ddbbc1333a3955acf6aa7b4e159cc))
117
+ * support partial fields to set i18n lang ([7287b57](https://github.com/Hufe921/canvas-editor/commit/7287b576e86447ebde026117d0e6068a3dfaf8f6))
118
+
119
+
120
+
121
+ ## [0.9.14](https://github.com/Hufe921/canvas-editor/compare/v0.9.13...v0.9.14) (2023-02-08)
122
+
123
+
124
+ ### Bug Fixes
125
+
126
+ * get rowFlex when line breaks ([34799d7](https://github.com/Hufe921/canvas-editor/commit/34799d7cb90a5ed2161c219121ca7b4fcd692558))
127
+ * paste table data format judgment ([8ff0d01](https://github.com/Hufe921/canvas-editor/commit/8ff0d01dde6f66a5ecdabb89703618f16b86ac75))
128
+
129
+
130
+ ### Features
131
+
132
+ * add i18n ([82b8d2c](https://github.com/Hufe921/canvas-editor/commit/82b8d2c5a965386720e029d52689f97b5c62f0bc))
133
+ * paste html with textAlign info ([eb0086a](https://github.com/Hufe921/canvas-editor/commit/eb0086a4b81cd87fdb558e89e92c304f16169cb6))
134
+
135
+
136
+
137
+ ## [0.9.13](https://github.com/Hufe921/canvas-editor/compare/v0.9.12...v0.9.13) (2023-02-03)
138
+
139
+
140
+ ### Bug Fixes
141
+
142
+ * remove style sheet when paste html ([5bf7029](https://github.com/Hufe921/canvas-editor/commit/5bf7029f0ada5a370f1dfdf6c09b2f977a08609a))
143
+ * copy table width colspan and rowspan info ([0f46db1](https://github.com/Hufe921/canvas-editor/commit/0f46db1f8addca04510c683855840770abde69a9))
144
+ * adjust selection boundary ([4865eb5](https://github.com/Hufe921/canvas-editor/commit/4865eb5d5a0ded64215a98651ab23dc6404681c2))
145
+
146
+
147
+ ### Documentation
148
+
149
+ * add algolia search ([8177c11](https://github.com/Hufe921/canvas-editor/commit/8177c11c2b4225196aa2a387dcf814fd5af73007))
150
+
151
+
152
+ ### Features
153
+
154
+ * paste table element ([db51a27](https://github.com/Hufe921/canvas-editor/commit/db51a27666e21a942ecabc9c6d5f926ce473fedb))
155
+ * paste image element ([0c07db7](https://github.com/Hufe921/canvas-editor/commit/0c07db7a5d53db47117e6fdd11bec995f0a3616b))
156
+ * paste separator element ([77d546f](https://github.com/Hufe921/canvas-editor/commit/77d546f476b0009f6925d660cdcbeefd5150b6c2))
157
+ * paste checkbox element ([e37da11](https://github.com/Hufe921/canvas-editor/commit/e37da11a79dd5e226f954833b102a8c01a19fef9))
158
+ * shrink the contextmenu scope ([64f5ff1](https://github.com/Hufe921/canvas-editor/commit/64f5ff15aa25aaede301277580be0770cec593b0))
159
+
160
+
161
+
162
+ ## [0.9.12](https://github.com/Hufe921/canvas-editor/compare/v0.9.11...v0.9.12) (2023-01-20)
163
+
164
+
165
+ ### Bug Fixes
166
+
167
+ * adjust selection by shortcut #111 ([a19a0a1](https://github.com/Hufe921/canvas-editor/commit/a19a0a1126f5d8521cde7d53d1042d4fa67ade89)), closes [#111](https://github.com/Hufe921/canvas-editor/issues/111)
168
+ * compatible with browsers that do not support ClipboardItem #108 ([196f638](https://github.com/Hufe921/canvas-editor/commit/196f63831849e555d1c24daa78d69e187e642214)), closes [#108](https://github.com/Hufe921/canvas-editor/issues/108)
169
+ * line thickness of rendered margin ([e8f3b2a](https://github.com/Hufe921/canvas-editor/commit/e8f3b2a6da725feb014d83ff96ab3c6a68b50655))
170
+ * cannot cut whole line except the first page ([ca13a3b](https://github.com/Hufe921/canvas-editor/commit/ca13a3b268791e18d7bc6b0b3297ef0ca5c76387))
171
+
172
+
173
+ ### Documentation
174
+
175
+ * adjust selection by direction key ([01353ad](https://github.com/Hufe921/canvas-editor/commit/01353ad59e208d1db1810f43f868201090273d02))
176
+ * adjust selection by shortcut ([81ac4d8](https://github.com/Hufe921/canvas-editor/commit/81ac4d8dc0177090ef11098c9916d156415b5db9))
177
+ * add global api ([3678b7f](https://github.com/Hufe921/canvas-editor/commit/3678b7f34b692e9e56141101e2c9e8b2d627a677))
178
+ * add docs url to README.md ([a369adb](https://github.com/Hufe921/canvas-editor/commit/a369adbe32c9f0779725a68b3f6b20cc9cfbe5b2))
179
+ * update index page ([38cb302](https://github.com/Hufe921/canvas-editor/commit/38cb302fa3a62d5db600ed2df3e8794497a59c52))
180
+
181
+
182
+ ### Features
183
+
184
+ * adjust selection by direction key ([1dfdd9a](https://github.com/Hufe921/canvas-editor/commit/1dfdd9a057f20c0fc512f869b3c914317c0fed85))
185
+ * adjust range by shortcut ([4a11bca](https://github.com/Hufe921/canvas-editor/commit/4a11bcacd94a6a0f1340b1741e8ce77d1c6d7e84))
186
+ * update server host ([bf93c29](https://github.com/Hufe921/canvas-editor/commit/bf93c2991ad7e657ea63f2ccb84d0ea803609125))
187
+ * add docs workflow ([f2374a1](https://github.com/Hufe921/canvas-editor/commit/f2374a14f562d25e9498b4ec0c96da9927849ebb))
188
+ * add docs workflow ([7fd0792](https://github.com/Hufe921/canvas-editor/commit/7fd07928b340e3a9795bc4c10d41820d5daffb61))
189
+ * add docs ([db52ab8](https://github.com/Hufe921/canvas-editor/commit/db52ab815d708b5f66df0f6661b17e1227067181))
190
+ * add font selection and font wysiwyg ([72d6174](https://github.com/Hufe921/canvas-editor/commit/72d6174d7b0b61be8db42dcf7a21512fafbc1f2d))
191
+
192
+
193
+
194
+ ## [0.9.11](https://github.com/Hufe921/canvas-editor/compare/v0.9.10...v0.9.11) (2022-12-25)
195
+
196
+
197
+ ### Features
198
+
199
+ * optimize event code structure ([f63affc](https://github.com/Hufe921/canvas-editor/commit/f63affc1c4219ee4d65485d11299dbfee47a8be2))
200
+ * add isPointInRange function to Range ([5e9c1ce](https://github.com/Hufe921/canvas-editor/commit/5e9c1ce57774012cb1903c2e97ac87ff42d1e245))
201
+ * drag text to editor ([4cf4ea5](https://github.com/Hufe921/canvas-editor/commit/4cf4ea5e45e0ee94a20b53f5e775bba0ef9bacca))
202
+ * use selection text when searching ([bcdb234](https://github.com/Hufe921/canvas-editor/commit/bcdb2340ae87dd72831d23b5ac83e984d09842e3))
203
+ * add cut row feature to contextmenu ([172cb6d](https://github.com/Hufe921/canvas-editor/commit/172cb6d88cf3069452c012b8a52b18d5dba1ff99))
204
+ * cut a whole line when no selection ([2c38f13](https://github.com/Hufe921/canvas-editor/commit/2c38f13113afb0889a3907a825f397de6a877181))
205
+
206
+
207
+
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
23
23
  return value;
24
24
  };
25
25
  var index = "";
26
- const version = "0.9.19";
26
+ const version = "0.9.20";
27
27
  const ZERO = "\u200B";
28
28
  const WRAP = "\n";
29
29
  var RowFlex;
@@ -3727,6 +3727,9 @@ function writeElementList(elementList, options) {
3727
3727
  if (element.size) {
3728
3728
  dom.style.fontSize = `${element.size}px`;
3729
3729
  }
3730
+ if (element.highlight) {
3731
+ dom.style.backgroundColor = element.highlight;
3732
+ }
3730
3733
  clipboardDom.append(dom);
3731
3734
  }
3732
3735
  }
@@ -3759,6 +3762,9 @@ function getElementListByHTML(htmlText, options) {
3759
3762
  if (rowFlex !== RowFlex.LEFT) {
3760
3763
  element.rowFlex = rowFlex;
3761
3764
  }
3765
+ if (style.backgroundColor !== "rgba(0, 0, 0, 0)") {
3766
+ element.highlight = style.backgroundColor;
3767
+ }
3762
3768
  elementList.push(element);
3763
3769
  }
3764
3770
  } else if (dom.nodeType === 1) {
@@ -4042,6 +4048,10 @@ var MouseEventButton;
4042
4048
  MouseEventButton2[MouseEventButton2["CENTER"] = 1] = "CENTER";
4043
4049
  MouseEventButton2[MouseEventButton2["RIGHT"] = 2] = "RIGHT";
4044
4050
  })(MouseEventButton || (MouseEventButton = {}));
4051
+ const isApple = typeof navigator !== "undefined" && /Mac OS X/.test(navigator.userAgent);
4052
+ function isMod(evt) {
4053
+ return isApple ? evt.metaKey : evt.ctrlKey;
4054
+ }
4045
4055
  var KeyMap;
4046
4056
  (function(KeyMap2) {
4047
4057
  KeyMap2["Delete"] = "Delete";
@@ -4306,7 +4316,11 @@ function mousedown(evt, host) {
4306
4316
  const hyperlinkParticle = draw.getHyperlinkParticle();
4307
4317
  hyperlinkParticle.clearHyperlinkPopup();
4308
4318
  if (curElement.type === ElementType.HYPERLINK) {
4309
- hyperlinkParticle.drawHyperlinkPopup(curElement, positionList[curIndex]);
4319
+ if (isMod(evt)) {
4320
+ hyperlinkParticle.openHyperlink(curElement);
4321
+ } else {
4322
+ hyperlinkParticle.drawHyperlinkPopup(curElement, positionList[curIndex]);
4323
+ }
4310
4324
  }
4311
4325
  const dateParticle = draw.getDateParticle();
4312
4326
  dateParticle.clearDatePicker();
@@ -4438,10 +4452,6 @@ function mousemove(evt, host) {
4438
4452
  isCompute: false
4439
4453
  });
4440
4454
  }
4441
- const isApple = typeof navigator !== "undefined" && /Mac OS X/.test(navigator.userAgent);
4442
- function isMod(evt) {
4443
- return isApple ? evt.metaKey : evt.ctrlKey;
4444
- }
4445
4455
  function keydown(evt, host) {
4446
4456
  var _a;
4447
4457
  if (host.isComposing)
@@ -6830,6 +6840,7 @@ class HyperlinkParticle {
6830
6840
  hyperlinkPopupContainer.classList.add(`${EDITOR_PREFIX}-hyperlink-popup`);
6831
6841
  const hyperlinkDom = document.createElement("a");
6832
6842
  hyperlinkDom.target = "_blank";
6843
+ hyperlinkDom.rel = "noopener";
6833
6844
  hyperlinkPopupContainer.append(hyperlinkDom);
6834
6845
  this.container.append(hyperlinkPopupContainer);
6835
6846
  return { hyperlinkPopupContainer, hyperlinkDom };
@@ -6849,6 +6860,12 @@ class HyperlinkParticle {
6849
6860
  clearHyperlinkPopup() {
6850
6861
  this.hyperlinkPopupContainer.style.display = "none";
6851
6862
  }
6863
+ openHyperlink(element) {
6864
+ const newTab = window.open(element.url, "_blank");
6865
+ if (newTab) {
6866
+ newTab.opener = null;
6867
+ }
6868
+ }
6852
6869
  render(ctx, element, x, y) {
6853
6870
  ctx.save();
6854
6871
  ctx.font = element.style;
@@ -9618,17 +9635,20 @@ class Draw {
9618
9635
  const preElement = curRow.elementList[j - 1];
9619
9636
  if (element.underline) {
9620
9637
  this.underline.recordFillInfo(ctx, x, y + curRow.height, metrics.width, 0, element.color);
9621
- } else if (preElement && preElement.underline) {
9638
+ } else if (preElement == null ? void 0 : preElement.underline) {
9622
9639
  this.underline.render(ctx);
9623
9640
  }
9624
9641
  if (element.strikeout) {
9625
9642
  this.strikeout.recordFillInfo(ctx, x, y + curRow.height / 2, metrics.width);
9626
- } else if (preElement && preElement.strikeout) {
9643
+ } else if (preElement == null ? void 0 : preElement.strikeout) {
9627
9644
  this.strikeout.render(ctx);
9628
9645
  }
9629
9646
  if (element.highlight) {
9647
+ if (preElement && preElement.highlight && preElement.highlight !== element.highlight) {
9648
+ this.highlight.render(ctx);
9649
+ }
9630
9650
  this.highlight.recordFillInfo(ctx, x, y, metrics.width, curRow.height, element.highlight);
9631
- } else if (preElement && preElement.highlight) {
9651
+ } else if (preElement == null ? void 0 : preElement.highlight) {
9632
9652
  this.highlight.render(ctx);
9633
9653
  }
9634
9654
  const { startIndex: startIndex2, endIndex } = this.range.getRange();