@hufe921/canvas-editor 0.9.18 → 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 +207 -0
- package/dist/canvas-editor.es.js +98 -60
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +15 -15
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/draw/Draw.d.ts +3 -3
- package/dist/src/editor/core/draw/control/Control.d.ts +1 -0
- package/dist/src/editor/core/draw/frame/Margin.d.ts +1 -1
- package/dist/src/editor/core/draw/particle/HyperlinkParticle.d.ts +1 -0
- package/dist/src/editor/utils/hotkey.d.ts +1 -1
- package/package.json +2 -1
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
|
+
|
package/dist/canvas-editor.es.js
CHANGED
|
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23
23
|
return value;
|
|
24
24
|
};
|
|
25
25
|
var index = "";
|
|
26
|
-
const version = "0.9.
|
|
26
|
+
const version = "0.9.20";
|
|
27
27
|
const ZERO = "\u200B";
|
|
28
28
|
const WRAP = "\n";
|
|
29
29
|
var RowFlex;
|
|
@@ -3273,7 +3273,9 @@ function formatElementList(elementList, options) {
|
|
|
3273
3273
|
const td = tr.tdList[d];
|
|
3274
3274
|
const tdId = getUUID();
|
|
3275
3275
|
td.id = tdId;
|
|
3276
|
-
formatElementList(td.value, options)
|
|
3276
|
+
formatElementList(td.value, __spreadProps(__spreadValues({}, options), {
|
|
3277
|
+
isHandleFirstElement: true
|
|
3278
|
+
}));
|
|
3277
3279
|
for (let v = 0; v < td.value.length; v++) {
|
|
3278
3280
|
const value = td.value[v];
|
|
3279
3281
|
value.tdId = tdId;
|
|
@@ -3725,6 +3727,9 @@ function writeElementList(elementList, options) {
|
|
|
3725
3727
|
if (element.size) {
|
|
3726
3728
|
dom.style.fontSize = `${element.size}px`;
|
|
3727
3729
|
}
|
|
3730
|
+
if (element.highlight) {
|
|
3731
|
+
dom.style.backgroundColor = element.highlight;
|
|
3732
|
+
}
|
|
3728
3733
|
clipboardDom.append(dom);
|
|
3729
3734
|
}
|
|
3730
3735
|
}
|
|
@@ -3757,6 +3762,9 @@ function getElementListByHTML(htmlText, options) {
|
|
|
3757
3762
|
if (rowFlex !== RowFlex.LEFT) {
|
|
3758
3763
|
element.rowFlex = rowFlex;
|
|
3759
3764
|
}
|
|
3765
|
+
if (style.backgroundColor !== "rgba(0, 0, 0, 0)") {
|
|
3766
|
+
element.highlight = style.backgroundColor;
|
|
3767
|
+
}
|
|
3760
3768
|
elementList.push(element);
|
|
3761
3769
|
}
|
|
3762
3770
|
} else if (dom.nodeType === 1) {
|
|
@@ -4040,6 +4048,10 @@ var MouseEventButton;
|
|
|
4040
4048
|
MouseEventButton2[MouseEventButton2["CENTER"] = 1] = "CENTER";
|
|
4041
4049
|
MouseEventButton2[MouseEventButton2["RIGHT"] = 2] = "RIGHT";
|
|
4042
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
|
+
}
|
|
4043
4055
|
var KeyMap;
|
|
4044
4056
|
(function(KeyMap2) {
|
|
4045
4057
|
KeyMap2["Delete"] = "Delete";
|
|
@@ -4168,8 +4180,7 @@ class CheckboxControl {
|
|
|
4168
4180
|
return data2;
|
|
4169
4181
|
}
|
|
4170
4182
|
setValue() {
|
|
4171
|
-
|
|
4172
|
-
return endIndex;
|
|
4183
|
+
return -1;
|
|
4173
4184
|
}
|
|
4174
4185
|
setSelect() {
|
|
4175
4186
|
const { control } = this.element;
|
|
@@ -4305,7 +4316,11 @@ function mousedown(evt, host) {
|
|
|
4305
4316
|
const hyperlinkParticle = draw.getHyperlinkParticle();
|
|
4306
4317
|
hyperlinkParticle.clearHyperlinkPopup();
|
|
4307
4318
|
if (curElement.type === ElementType.HYPERLINK) {
|
|
4308
|
-
|
|
4319
|
+
if (isMod(evt)) {
|
|
4320
|
+
hyperlinkParticle.openHyperlink(curElement);
|
|
4321
|
+
} else {
|
|
4322
|
+
hyperlinkParticle.drawHyperlinkPopup(curElement, positionList[curIndex]);
|
|
4323
|
+
}
|
|
4309
4324
|
}
|
|
4310
4325
|
const dateParticle = draw.getDateParticle();
|
|
4311
4326
|
dateParticle.clearDatePicker();
|
|
@@ -4437,10 +4452,6 @@ function mousemove(evt, host) {
|
|
|
4437
4452
|
isCompute: false
|
|
4438
4453
|
});
|
|
4439
4454
|
}
|
|
4440
|
-
const isApple = typeof navigator !== "undefined" && /Mac OS X/.test(navigator.userAgent);
|
|
4441
|
-
function isMod(evt) {
|
|
4442
|
-
return isApple ? evt.metaKey : evt.ctrlKey;
|
|
4443
|
-
}
|
|
4444
4455
|
function keydown(evt, host) {
|
|
4445
4456
|
var _a;
|
|
4446
4457
|
if (host.isComposing)
|
|
@@ -4512,7 +4523,7 @@ function keydown(evt, host) {
|
|
|
4512
4523
|
value: ZERO
|
|
4513
4524
|
}, restArg);
|
|
4514
4525
|
let curIndex;
|
|
4515
|
-
if (activeControl) {
|
|
4526
|
+
if (activeControl && !control.isRangInPostfix()) {
|
|
4516
4527
|
curIndex = control.setValue([enterText]);
|
|
4517
4528
|
} else {
|
|
4518
4529
|
if (isCollapsed) {
|
|
@@ -4522,8 +4533,10 @@ function keydown(evt, host) {
|
|
|
4522
4533
|
}
|
|
4523
4534
|
curIndex = index2 + 1;
|
|
4524
4535
|
}
|
|
4525
|
-
|
|
4526
|
-
|
|
4536
|
+
if (~curIndex) {
|
|
4537
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4538
|
+
draw.render({ curIndex });
|
|
4539
|
+
}
|
|
4527
4540
|
evt.preventDefault();
|
|
4528
4541
|
} else if (evt.key === KeyMap.Left) {
|
|
4529
4542
|
if (isReadonly)
|
|
@@ -4699,7 +4712,6 @@ function keydown(evt, host) {
|
|
|
4699
4712
|
}
|
|
4700
4713
|
}
|
|
4701
4714
|
function input(data2, host) {
|
|
4702
|
-
var _a;
|
|
4703
4715
|
const draw = host.getDraw();
|
|
4704
4716
|
const isReadonly = draw.isReadonly();
|
|
4705
4717
|
if (isReadonly)
|
|
@@ -4752,7 +4764,7 @@ function input(data2, host) {
|
|
|
4752
4764
|
return newElement;
|
|
4753
4765
|
});
|
|
4754
4766
|
let curIndex;
|
|
4755
|
-
if (activeControl && (
|
|
4767
|
+
if (activeControl && !control.isRangInPostfix()) {
|
|
4756
4768
|
curIndex = control.setValue(inputData);
|
|
4757
4769
|
} else {
|
|
4758
4770
|
const start = startIndex + 1;
|
|
@@ -4764,11 +4776,13 @@ function input(data2, host) {
|
|
|
4764
4776
|
}
|
|
4765
4777
|
curIndex = startIndex + inputData.length;
|
|
4766
4778
|
}
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4779
|
+
if (~curIndex) {
|
|
4780
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4781
|
+
draw.render({
|
|
4782
|
+
curIndex,
|
|
4783
|
+
isSubmitHistory: !isComposing
|
|
4784
|
+
});
|
|
4785
|
+
}
|
|
4772
4786
|
if (isComposing) {
|
|
4773
4787
|
host.compositionInfo = {
|
|
4774
4788
|
elementList,
|
|
@@ -5890,10 +5904,10 @@ class Margin {
|
|
|
5890
5904
|
this.draw = draw;
|
|
5891
5905
|
this.options = draw.getOptions();
|
|
5892
5906
|
}
|
|
5893
|
-
render(ctx) {
|
|
5907
|
+
render(ctx, pageNo) {
|
|
5894
5908
|
const { marginIndicatorColor, pageMode } = this.options;
|
|
5895
5909
|
const width = this.draw.getWidth();
|
|
5896
|
-
const height = pageMode === PageMode.CONTINUITY ? this.draw.getCanvasHeight() : this.draw.getHeight();
|
|
5910
|
+
const height = pageMode === PageMode.CONTINUITY ? this.draw.getCanvasHeight(pageNo) : this.draw.getHeight();
|
|
5897
5911
|
const margins = this.draw.getMargins();
|
|
5898
5912
|
const marginIndicatorSize = this.draw.getMarginIndicatorSize();
|
|
5899
5913
|
ctx.save();
|
|
@@ -6277,7 +6291,7 @@ class PageNumber {
|
|
|
6277
6291
|
render(ctx, pageNo) {
|
|
6278
6292
|
const { pageNumberSize, pageNumberFont, scale, pageMode } = this.options;
|
|
6279
6293
|
const width = this.draw.getWidth();
|
|
6280
|
-
const height = pageMode === PageMode.CONTINUITY ? this.draw.getCanvasHeight() : this.draw.getHeight();
|
|
6294
|
+
const height = pageMode === PageMode.CONTINUITY ? this.draw.getCanvasHeight(pageNo) : this.draw.getHeight();
|
|
6281
6295
|
const pageNumberBottom = this.draw.getPageNumberBottom();
|
|
6282
6296
|
ctx.save();
|
|
6283
6297
|
ctx.fillStyle = "#00000";
|
|
@@ -6826,6 +6840,7 @@ class HyperlinkParticle {
|
|
|
6826
6840
|
hyperlinkPopupContainer.classList.add(`${EDITOR_PREFIX}-hyperlink-popup`);
|
|
6827
6841
|
const hyperlinkDom = document.createElement("a");
|
|
6828
6842
|
hyperlinkDom.target = "_blank";
|
|
6843
|
+
hyperlinkDom.rel = "noopener";
|
|
6829
6844
|
hyperlinkPopupContainer.append(hyperlinkDom);
|
|
6830
6845
|
this.container.append(hyperlinkPopupContainer);
|
|
6831
6846
|
return { hyperlinkPopupContainer, hyperlinkDom };
|
|
@@ -6845,6 +6860,12 @@ class HyperlinkParticle {
|
|
|
6845
6860
|
clearHyperlinkPopup() {
|
|
6846
6861
|
this.hyperlinkPopupContainer.style.display = "none";
|
|
6847
6862
|
}
|
|
6863
|
+
openHyperlink(element) {
|
|
6864
|
+
const newTab = window.open(element.url, "_blank");
|
|
6865
|
+
if (newTab) {
|
|
6866
|
+
newTab.opener = null;
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6848
6869
|
render(ctx, element, x, y) {
|
|
6849
6870
|
ctx.save();
|
|
6850
6871
|
ctx.font = element.style;
|
|
@@ -7026,8 +7047,7 @@ class SelectControl {
|
|
|
7026
7047
|
return data2;
|
|
7027
7048
|
}
|
|
7028
7049
|
setValue() {
|
|
7029
|
-
|
|
7030
|
-
return range.endIndex;
|
|
7050
|
+
return -1;
|
|
7031
7051
|
}
|
|
7032
7052
|
keydown(evt) {
|
|
7033
7053
|
const elementList = this.control.getElementList();
|
|
@@ -7326,6 +7346,16 @@ class Control {
|
|
|
7326
7346
|
}
|
|
7327
7347
|
return false;
|
|
7328
7348
|
}
|
|
7349
|
+
isRangInPostfix() {
|
|
7350
|
+
if (!this.activeControl)
|
|
7351
|
+
return false;
|
|
7352
|
+
const { startIndex, endIndex } = this.getRange();
|
|
7353
|
+
if (startIndex !== endIndex)
|
|
7354
|
+
return false;
|
|
7355
|
+
const elementList = this.getElementList();
|
|
7356
|
+
const element = elementList[startIndex];
|
|
7357
|
+
return element.controlComponent === ControlComponent.POSTFIX;
|
|
7358
|
+
}
|
|
7329
7359
|
getContainer() {
|
|
7330
7360
|
return this.draw.getContainer();
|
|
7331
7361
|
}
|
|
@@ -8911,12 +8941,12 @@ class Draw {
|
|
|
8911
8941
|
getHeight() {
|
|
8912
8942
|
return Math.floor(this.options.height * this.options.scale);
|
|
8913
8943
|
}
|
|
8914
|
-
getCanvasWidth() {
|
|
8915
|
-
const page = this.getPage();
|
|
8944
|
+
getCanvasWidth(pageNo = -1) {
|
|
8945
|
+
const page = this.getPage(pageNo);
|
|
8916
8946
|
return page.width;
|
|
8917
8947
|
}
|
|
8918
|
-
getCanvasHeight() {
|
|
8919
|
-
const page = this.getPage();
|
|
8948
|
+
getCanvasHeight(pageNo = -1) {
|
|
8949
|
+
const page = this.getPage(pageNo);
|
|
8920
8950
|
return page.height;
|
|
8921
8951
|
}
|
|
8922
8952
|
getInnerWidth() {
|
|
@@ -8982,8 +9012,8 @@ class Draw {
|
|
|
8982
9012
|
setPageNo(payload) {
|
|
8983
9013
|
this.pageNo = payload;
|
|
8984
9014
|
}
|
|
8985
|
-
getPage() {
|
|
8986
|
-
return this.pageList[this.pageNo];
|
|
9015
|
+
getPage(pageNo = -1) {
|
|
9016
|
+
return this.pageList[~pageNo ? pageNo : this.pageNo];
|
|
8987
9017
|
}
|
|
8988
9018
|
getPageList() {
|
|
8989
9019
|
return this.pageList;
|
|
@@ -9023,12 +9053,6 @@ class Draw {
|
|
|
9023
9053
|
insertElementList(payload) {
|
|
9024
9054
|
if (!payload.length)
|
|
9025
9055
|
return;
|
|
9026
|
-
const activeControl = this.control.getActiveControl();
|
|
9027
|
-
if (activeControl) {
|
|
9028
|
-
const element = activeControl.getElement();
|
|
9029
|
-
if (element.controlComponent !== ControlComponent.POSTFIX)
|
|
9030
|
-
return;
|
|
9031
|
-
}
|
|
9032
9056
|
const isPartRangeInControlOutside = this.control.isPartRangeInControlOutside();
|
|
9033
9057
|
if (isPartRangeInControlOutside)
|
|
9034
9058
|
return;
|
|
@@ -9039,27 +9063,35 @@ class Draw {
|
|
|
9039
9063
|
isHandleFirstElement: false,
|
|
9040
9064
|
editorOptions: this.options
|
|
9041
9065
|
});
|
|
9042
|
-
|
|
9043
|
-
const
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
element.tdId = positionContext.tdId;
|
|
9053
|
-
element.trId = positionContext.trId;
|
|
9054
|
-
element.tableId = positionContext.tableId;
|
|
9066
|
+
let curIndex = -1;
|
|
9067
|
+
const activeControl = this.control.getActiveControl();
|
|
9068
|
+
if (activeControl && !this.control.isRangInPostfix()) {
|
|
9069
|
+
curIndex = activeControl.setValue(payload);
|
|
9070
|
+
} else {
|
|
9071
|
+
const elementList = this.getElementList();
|
|
9072
|
+
const isCollapsed = startIndex === endIndex;
|
|
9073
|
+
const start = startIndex + 1;
|
|
9074
|
+
if (!isCollapsed) {
|
|
9075
|
+
elementList.splice(start, endIndex - startIndex);
|
|
9055
9076
|
}
|
|
9056
|
-
|
|
9077
|
+
const positionContext = this.position.getPositionContext();
|
|
9078
|
+
for (let i = 0; i < payload.length; i++) {
|
|
9079
|
+
const element = payload[i];
|
|
9080
|
+
if (positionContext.isTable) {
|
|
9081
|
+
element.tdId = positionContext.tdId;
|
|
9082
|
+
element.trId = positionContext.trId;
|
|
9083
|
+
element.tableId = positionContext.tableId;
|
|
9084
|
+
}
|
|
9085
|
+
elementList.splice(start + i, 0, element);
|
|
9086
|
+
}
|
|
9087
|
+
curIndex = startIndex + payload.length;
|
|
9088
|
+
}
|
|
9089
|
+
if (~curIndex) {
|
|
9090
|
+
this.range.setRange(curIndex, curIndex);
|
|
9091
|
+
this.render({
|
|
9092
|
+
curIndex
|
|
9093
|
+
});
|
|
9057
9094
|
}
|
|
9058
|
-
const curIndex = startIndex + payload.length;
|
|
9059
|
-
this.range.setRange(curIndex, curIndex);
|
|
9060
|
-
this.render({
|
|
9061
|
-
curIndex
|
|
9062
|
-
});
|
|
9063
9095
|
}
|
|
9064
9096
|
getOriginalElementList() {
|
|
9065
9097
|
return this.elementList;
|
|
@@ -9145,6 +9177,7 @@ class Draw {
|
|
|
9145
9177
|
const canvas = this.pageList[0];
|
|
9146
9178
|
canvas.style.height = `${height}px`;
|
|
9147
9179
|
canvas.height = height * dpr;
|
|
9180
|
+
this.ctxList[0].scale(dpr, dpr);
|
|
9148
9181
|
}
|
|
9149
9182
|
this.render({
|
|
9150
9183
|
isSubmitHistory: false,
|
|
@@ -9514,6 +9547,7 @@ class Draw {
|
|
|
9514
9547
|
pageDom.style.height = `${reduceHeight}px`;
|
|
9515
9548
|
pageDom.height = reduceHeight * dpr;
|
|
9516
9549
|
}
|
|
9550
|
+
this.ctxList[0].scale(dpr, dpr);
|
|
9517
9551
|
} else {
|
|
9518
9552
|
for (let i = 0; i < this.rowList.length; i++) {
|
|
9519
9553
|
const row = this.rowList[i];
|
|
@@ -9601,17 +9635,20 @@ class Draw {
|
|
|
9601
9635
|
const preElement = curRow.elementList[j - 1];
|
|
9602
9636
|
if (element.underline) {
|
|
9603
9637
|
this.underline.recordFillInfo(ctx, x, y + curRow.height, metrics.width, 0, element.color);
|
|
9604
|
-
} else if (preElement
|
|
9638
|
+
} else if (preElement == null ? void 0 : preElement.underline) {
|
|
9605
9639
|
this.underline.render(ctx);
|
|
9606
9640
|
}
|
|
9607
9641
|
if (element.strikeout) {
|
|
9608
9642
|
this.strikeout.recordFillInfo(ctx, x, y + curRow.height / 2, metrics.width);
|
|
9609
|
-
} else if (preElement
|
|
9643
|
+
} else if (preElement == null ? void 0 : preElement.strikeout) {
|
|
9610
9644
|
this.strikeout.render(ctx);
|
|
9611
9645
|
}
|
|
9612
9646
|
if (element.highlight) {
|
|
9647
|
+
if (preElement && preElement.highlight && preElement.highlight !== element.highlight) {
|
|
9648
|
+
this.highlight.render(ctx);
|
|
9649
|
+
}
|
|
9613
9650
|
this.highlight.recordFillInfo(ctx, x, y, metrics.width, curRow.height, element.highlight);
|
|
9614
|
-
} else if (preElement
|
|
9651
|
+
} else if (preElement == null ? void 0 : preElement.highlight) {
|
|
9615
9652
|
this.highlight.render(ctx);
|
|
9616
9653
|
}
|
|
9617
9654
|
const { startIndex: startIndex2, endIndex } = this.range.getRange();
|
|
@@ -9681,7 +9718,7 @@ class Draw {
|
|
|
9681
9718
|
const ctx = this.ctxList[pageNo];
|
|
9682
9719
|
this._clearPage(pageNo);
|
|
9683
9720
|
this.background.render(ctx);
|
|
9684
|
-
this.margin.render(ctx);
|
|
9721
|
+
this.margin.render(ctx, pageNo);
|
|
9685
9722
|
const index2 = rowList[0].startIndex;
|
|
9686
9723
|
this._drawRow(ctx, {
|
|
9687
9724
|
positionList,
|
|
@@ -9723,6 +9760,7 @@ class Draw {
|
|
|
9723
9760
|
}
|
|
9724
9761
|
render(payload) {
|
|
9725
9762
|
var _a;
|
|
9763
|
+
const { pageMode } = this.options;
|
|
9726
9764
|
const { isSubmitHistory = true, isSetCursor = true, isCompute = true, isLazy = true } = payload || {};
|
|
9727
9765
|
let { curIndex } = payload || {};
|
|
9728
9766
|
const innerWidth = this.getInnerWidth();
|
|
@@ -9750,7 +9788,7 @@ class Draw {
|
|
|
9750
9788
|
this.ctxList.splice(curPageCount, deleteCount);
|
|
9751
9789
|
this.pageList.splice(curPageCount, deleteCount).forEach((page) => page.remove());
|
|
9752
9790
|
}
|
|
9753
|
-
if (isLazy) {
|
|
9791
|
+
if (isLazy && pageMode === PageMode.PAGING) {
|
|
9754
9792
|
this._lazyRender();
|
|
9755
9793
|
} else {
|
|
9756
9794
|
this._immediateRender();
|