@versa_ai/vmml-editor 1.0.2
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/.turbo/turbo-build.log +335 -0
- package/CHANGELOG.md +16 -0
- package/README.md +1 -0
- package/biome.json +7 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2675 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2673 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +48 -0
- package/postcss.config.js +3 -0
- package/src/assets/css/closeLayer.scss +50 -0
- package/src/assets/css/colorSelector.scss +59 -0
- package/src/assets/css/editorTextMenu.less +130 -0
- package/src/assets/css/editorTextMenu.scss +149 -0
- package/src/assets/css/index.scss +252 -0
- package/src/assets/css/loading.scss +31 -0
- package/src/assets/css/maxTextLayer.scss +31 -0
- package/src/assets/img/icon_Brush.png +0 -0
- package/src/assets/img/icon_Change.png +0 -0
- package/src/assets/img/icon_Cut.png +0 -0
- package/src/assets/img/icon_Face.png +0 -0
- package/src/assets/img/icon_Graffiti.png +0 -0
- package/src/assets/img/icon_Mute.png +0 -0
- package/src/assets/img/icon_Refresh.png +0 -0
- package/src/assets/img/icon_Text1.png +0 -0
- package/src/assets/img/icon_Text2.png +0 -0
- package/src/assets/img/icon_Volume.png +0 -0
- package/src/assets/img/icon_Word.png +0 -0
- package/src/components/CloseLayer.tsx +25 -0
- package/src/components/ColorSelector.tsx +90 -0
- package/src/components/Controls.tsx +32 -0
- package/src/components/EditorCanvas.tsx +566 -0
- package/src/components/Loading.tsx +16 -0
- package/src/components/MaxTextLayer.tsx +27 -0
- package/src/components/SeekBar.tsx +126 -0
- package/src/components/TextMenu.tsx +332 -0
- package/src/components/VideoMenu.tsx +49 -0
- package/src/index.tsx +551 -0
- package/src/utils/HistoryClass.ts +131 -0
- package/src/utils/VmmlConverter.ts +339 -0
- package/src/utils/const.ts +10 -0
- package/src/utils/keyBoardUtils.ts +199 -0
- package/src/utils/usePeekControl.ts +242 -0
- package/tsconfig.json +5 -0
- package/tsup.config.ts +14 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2673 @@
|
|
|
1
|
+
import { VmmlPlayer } from '@versa_ai/vmml-player';
|
|
2
|
+
import { forwardRef, useState, useRef, useMemo, useEffect, useImperativeHandle, useCallback } from 'react';
|
|
3
|
+
import { isIOS, getFrames, getFontSize, argbToRgba, convertVmmlTextScaleByForbidden, rgbaToArgb, hexToArgb, urlToBlob, takeScreenshot, formatTime } from '@versa_ai/vmml-utils';
|
|
4
|
+
import { interpolate } from 'remotion';
|
|
5
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
|
+
import { fabric } from 'fabric';
|
|
7
|
+
import { v4 } from 'uuid';
|
|
8
|
+
import { toSvg } from 'dom-to-image';
|
|
9
|
+
|
|
10
|
+
// src/index.tsx
|
|
11
|
+
|
|
12
|
+
// src/assets/css/index.scss
|
|
13
|
+
var css = `@charset "UTF-8";
|
|
14
|
+
.editor {
|
|
15
|
+
background: #000;
|
|
16
|
+
width: 100%;
|
|
17
|
+
min-height: 100vh;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
}
|
|
22
|
+
.editor .padding-box {
|
|
23
|
+
flex: 1;
|
|
24
|
+
}
|
|
25
|
+
.editor > .header {
|
|
26
|
+
width: 100%;
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
align-items: center;
|
|
30
|
+
height: 11.467vw;
|
|
31
|
+
padding-left: 4.4vw;
|
|
32
|
+
padding-right: 3.2vw;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
position: relative;
|
|
35
|
+
}
|
|
36
|
+
.editor > .header > .close {
|
|
37
|
+
width: 4vw;
|
|
38
|
+
height: 4vw;
|
|
39
|
+
}
|
|
40
|
+
.editor > .header > .close img {
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
.editor > .header > .history-operate {
|
|
45
|
+
height: 7.2vw;
|
|
46
|
+
display: none;
|
|
47
|
+
align-items: center;
|
|
48
|
+
position: absolute;
|
|
49
|
+
left: 50%;
|
|
50
|
+
top: 50%;
|
|
51
|
+
transform: translate(-50%, -50%);
|
|
52
|
+
}
|
|
53
|
+
.editor > .header > .history-operate img {
|
|
54
|
+
width: 4.667vw;
|
|
55
|
+
height: 5.067vw;
|
|
56
|
+
}
|
|
57
|
+
.editor > .header > .history-operate > img:last-child {
|
|
58
|
+
margin-left: 8vw;
|
|
59
|
+
}
|
|
60
|
+
.editor > .header > .next-button {
|
|
61
|
+
width: 16vw;
|
|
62
|
+
height: 7.2vw;
|
|
63
|
+
line-height: 7.2vw;
|
|
64
|
+
background: #1677FF;
|
|
65
|
+
border-radius: 6.533vw;
|
|
66
|
+
text-align: center;
|
|
67
|
+
font-size: 3.2vw;
|
|
68
|
+
color: #fff;
|
|
69
|
+
}
|
|
70
|
+
.editor .text-style {
|
|
71
|
+
filter: blur(10px);
|
|
72
|
+
}
|
|
73
|
+
.editor .editor-vessel {
|
|
74
|
+
padding-top: 3.2vw;
|
|
75
|
+
}
|
|
76
|
+
.editor .main {
|
|
77
|
+
width: 81.467vw;
|
|
78
|
+
height: 144.8vw;
|
|
79
|
+
margin: auto;
|
|
80
|
+
position: relative;
|
|
81
|
+
display: flex;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
border-radius: 3.2vw;
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
}
|
|
86
|
+
.editor .main .vessel {
|
|
87
|
+
width: 100%;
|
|
88
|
+
height: 100%;
|
|
89
|
+
}
|
|
90
|
+
.editor .main .controls-box {
|
|
91
|
+
height: 12vw;
|
|
92
|
+
position: absolute;
|
|
93
|
+
bottom: 0;
|
|
94
|
+
width: 100%;
|
|
95
|
+
border-radius: 3.2vw;
|
|
96
|
+
}
|
|
97
|
+
.editor .main .player-controls {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
width: 100%;
|
|
101
|
+
height: 100%;
|
|
102
|
+
padding: 0 2.13vw;
|
|
103
|
+
box-sizing: border-box;
|
|
104
|
+
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
|
|
105
|
+
}
|
|
106
|
+
.editor .main .player-controls .mr-16 {
|
|
107
|
+
margin-right: 2.13vw;
|
|
108
|
+
}
|
|
109
|
+
.editor .main .player-controls .player-controls-toggle > img {
|
|
110
|
+
display: block;
|
|
111
|
+
width: 4.8vw;
|
|
112
|
+
height: 4.8vw;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
}
|
|
115
|
+
.editor .main .player-controls .player-controls-seekbar {
|
|
116
|
+
flex: 1;
|
|
117
|
+
position: relative;
|
|
118
|
+
}
|
|
119
|
+
.editor .main .player-controls .player-controls-seekbar .seekbar-container {
|
|
120
|
+
height: 100%;
|
|
121
|
+
user-select: none;
|
|
122
|
+
touch-action: none;
|
|
123
|
+
position: relative;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
box-sizing: border-box;
|
|
126
|
+
}
|
|
127
|
+
.editor .main .player-controls .player-controls-seekbar .seekbar-container .seekbar-background {
|
|
128
|
+
user-select: none;
|
|
129
|
+
height: 1.6vw;
|
|
130
|
+
width: 100%;
|
|
131
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
132
|
+
border-radius: 1vw;
|
|
133
|
+
}
|
|
134
|
+
.editor .main .player-controls .player-controls-seekbar .seekbar-container .seekbar-background .seekbar-fill {
|
|
135
|
+
position: absolute;
|
|
136
|
+
user-select: none;
|
|
137
|
+
width: 100%;
|
|
138
|
+
height: 100%;
|
|
139
|
+
border-radius: 1vw;
|
|
140
|
+
}
|
|
141
|
+
.editor .main .player-controls .player-controls-seekbar .seekbar-container .seekbar-background .seekbar-line {
|
|
142
|
+
height: 100%;
|
|
143
|
+
border-radius: 1vw;
|
|
144
|
+
background-color: #eeeeee;
|
|
145
|
+
}
|
|
146
|
+
.editor .main .player-controls .player-controls-seekbar .seekbar-container .seekbar-background .seekbar-sign {
|
|
147
|
+
width: 10px;
|
|
148
|
+
position: absolute;
|
|
149
|
+
top: 50%;
|
|
150
|
+
margin-top: -6px;
|
|
151
|
+
}
|
|
152
|
+
.editor .main .player-controls .player-controls-seekbar .seekbar-container .seekbar-background .seekbar-cirle {
|
|
153
|
+
position: absolute;
|
|
154
|
+
top: -0.8vw;
|
|
155
|
+
width: 3.2vw;
|
|
156
|
+
height: 3.2vw;
|
|
157
|
+
border-radius: 50%;
|
|
158
|
+
background: #eeeeee;
|
|
159
|
+
}
|
|
160
|
+
.editor .main .player-controls .player-controls-time {
|
|
161
|
+
width: 10vw;
|
|
162
|
+
color: #fff;
|
|
163
|
+
}
|
|
164
|
+
.editor .main .play-btn {
|
|
165
|
+
position: absolute;
|
|
166
|
+
bottom: 4vw;
|
|
167
|
+
left: 3vw;
|
|
168
|
+
width: 4.8vw;
|
|
169
|
+
height: 4.8vw;
|
|
170
|
+
}
|
|
171
|
+
.editor .main .play-btn img {
|
|
172
|
+
width: 100%;
|
|
173
|
+
height: 100%;
|
|
174
|
+
display: block;
|
|
175
|
+
}
|
|
176
|
+
.editor .main .opacity-06 {
|
|
177
|
+
opacity: 0.6;
|
|
178
|
+
}
|
|
179
|
+
.editor .footer {
|
|
180
|
+
display: flex;
|
|
181
|
+
justify-content: center;
|
|
182
|
+
box-sizing: border-box;
|
|
183
|
+
width: 100%;
|
|
184
|
+
padding: 0 20.333vw 10.933vw;
|
|
185
|
+
}
|
|
186
|
+
.editor .footer > div {
|
|
187
|
+
width: 30%;
|
|
188
|
+
margin: 0 15%;
|
|
189
|
+
}
|
|
190
|
+
.editor .footer > div img {
|
|
191
|
+
width: 6.4vw;
|
|
192
|
+
height: 6.4vw;
|
|
193
|
+
display: block;
|
|
194
|
+
margin: auto;
|
|
195
|
+
}
|
|
196
|
+
.editor .footer > div p {
|
|
197
|
+
font-size: 3.2vw;
|
|
198
|
+
color: #fff;
|
|
199
|
+
margin-top: 1.867vw;
|
|
200
|
+
text-align: center;
|
|
201
|
+
}
|
|
202
|
+
.editor .not-show-text {
|
|
203
|
+
justify-content: space-around;
|
|
204
|
+
}
|
|
205
|
+
.editor .editor-video-menu {
|
|
206
|
+
position: fixed;
|
|
207
|
+
height: 0;
|
|
208
|
+
width: 100%;
|
|
209
|
+
background: #1E1E1E;
|
|
210
|
+
bottom: 0;
|
|
211
|
+
border-radius: 8px 8px 0 0;
|
|
212
|
+
transition: all 0.5s ease-in-out;
|
|
213
|
+
}
|
|
214
|
+
.editor .editor-video-menu.active {
|
|
215
|
+
height: 38.13vh;
|
|
216
|
+
}
|
|
217
|
+
.editor .editor-video-menu .editor-video-menu-header {
|
|
218
|
+
display: flex;
|
|
219
|
+
padding: 1.6vw 1.6vw 0;
|
|
220
|
+
height: 4.81vh;
|
|
221
|
+
line-height: 4.81vh;
|
|
222
|
+
color: rgba(255, 255, 255, 0.4);
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
overflow-x: auto;
|
|
225
|
+
}
|
|
226
|
+
.editor .editor-video-menu .editor-video-menu-header::-webkit-scrollbar {
|
|
227
|
+
display: none; /* \u9690\u85CF\u6EDA\u52A8\u6761 */
|
|
228
|
+
}
|
|
229
|
+
.editor .editor-video-menu .editor-video-menu-header > div {
|
|
230
|
+
margin: 0 3.2vw;
|
|
231
|
+
white-space: nowrap;
|
|
232
|
+
}
|
|
233
|
+
.editor .editor-video-menu .editor-video-menu-header .active {
|
|
234
|
+
color: #FFFFFF;
|
|
235
|
+
}
|
|
236
|
+
.editor .editor-video-menu .editor-video-menu-itmes {
|
|
237
|
+
padding: 0 3.33vw;
|
|
238
|
+
max-height: calc(100% - 4.81vh - 1.6vw);
|
|
239
|
+
display: grid;
|
|
240
|
+
grid-template-columns: repeat(4, 1fr);
|
|
241
|
+
row-gap: 3.2vw;
|
|
242
|
+
column-gap: 2.6vw;
|
|
243
|
+
overflow: auto;
|
|
244
|
+
}
|
|
245
|
+
.editor .editor-video-menu .editor-video-menu-itmes > div {
|
|
246
|
+
width: 21.33vw;
|
|
247
|
+
height: 21.33vw;
|
|
248
|
+
background-color: #1e1e1e;
|
|
249
|
+
}
|
|
250
|
+
.editor .editor-video-menu .editor-video-menu-itmes > div img {
|
|
251
|
+
width: 100%;
|
|
252
|
+
height: 100%;
|
|
253
|
+
object-fit: contain;
|
|
254
|
+
}
|
|
255
|
+
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiRDpcXHByb2plY3RzXFx2bW1sLXBsYXllclxccGFja2FnZXNcXGVkaXRvclxcc3JjXFxhc3NldHNcXGNzcyIsInNvdXJjZXMiOlsiaW5kZXguc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBQ0E7RUFDRTs7QUFHRjtFQUNFO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7QUFDQTtFQUNFO0VBQ0E7O0FBQ0E7RUFDRTtFQUNBOztBQUdKO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBQ0E7RUFDRTtFQUNBOztBQUVGO0VBQ0U7O0FBR0o7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBOztBQUdKO0VBQ0U7O0FBR0Y7RUFDRTs7QUFHRjtFQUNFO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBQ0E7RUFDRTtFQUNBOztBQUVGO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7QUFFRjtFQUNFO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBOztBQUNBO0VBQ0U7O0FBR0E7RUFDRT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AgYm9yZGVyLXJhZGl1czogMy4ydnc7XHJcbiAgICB9XHJcbiAgICAucGxheWVyLWNvbnRyb2xzIHtcclxuICAgICAgZGlzcGxheTogZmxleDtcclxuICAgICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcclxuICAgICAgd2lkdGg6IDEwMCU7XHJcbiAgICAgIGhlaWdodDogMTAwJTtcclxuICAgICAgcGFkZGluZzogMCAyLjEzdnc7XHJcbiAgICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7XHJcbiAgICAgIGJhY2tncm91bmQ6IGxpbmVhci1ncmFkaWVudCggMTgwZGVnLCByZ2JhKDAsMCwwLDApIDAlLCByZ2JhKDAsMCwwLDAuNikgMTAwJSk7XHJcbiAgICAgIC5tci0xNiB7XHJcbiAgICAgICAgbWFyZ2luLXJpZ2h0OiAyLjEzdnc7XHJcbiAgICAgIH1cclxuICAgICAgLnBsYXllci1jb250cm9scy10b2dnbGUge1xyXG4gICAgICAgID5pbWcge1xyXG4gICAgICAgICAgZGlzcGxheTogYmxvY2s7XHJcbiAgICAgICAgICB3aWR0aDogNC44dnc7XHJcbiAgICAgICAgICBoZWlnaHQ6IDQuOHZ3O1xyXG4gICAgICAgICAgY3Vyc29yOiBwb2ludGVyO1xyXG4gICAgICAgIH1cclxuICAgICAgfVxyXG4gICAgICAucGxheWVyLWNvbnRyb2xzLXNlZWtiYXIge1xyXG4gICAgICAgIGZsZXg6IDE7XHJcbiAgICAgICAgcG9zaXRpb246IHJlbGF0aXZlO1xyXG4gICAgICAgIC5zZWVrYmFyLWNvbnRhaW5lciB7XHJcbiAgICAgICAgICBoZWlnaHQ6IDEwMCU7XHJcbiAgICAgICAgICB1c2VyLXNlbGVjdDogbm9uZTtcclxuICAgICAgICAgIHRvdWNoLWFjdGlvbjogbm9uZTtcclxuICAgICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcclxuICAgICAgICAgIGN1cnNvcjogcG9pbnRlcjtcclxuICAgICAgICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7XHJcbiAgICAgICAgICAuc2Vla2Jhci1iYWNrZ3JvdW5kIHtcclxuICAgICAgICAgICAgdXNlci1zZWxlY3Q6IG5vbmU7XHJcbiAgICAgICAgICAgIGhlaWdodDogMS42dnc7XHJcbiAgICAgICAgICAgIHdpZHRoOiAxMDAlO1xyXG4gICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiByZ2JhKDI1NSwgMjU1LCAyNTUsIDAuMik7XHJcbiAgICAgICAgICAgIGJvcmRlci1yYWRpdXM6IDF2dztcclxuICAgICAgICAgICAgLnNlZWtiYXItZmlsbCB7XHJcbiAgICAgICAgICAgICAgcG9zaXRpb246IGFic29sdXRlO1xyXG4gICAgICAgICAgICAgIHVzZXItc2VsZWN0OiBub25lO1xyXG4gICAgICAgICAgICAgIHdpZHRoOiAxMDAlO1xyXG4gICAgICAgICAgICAgIGhlaWdodDogMTAwJTtcclxuICAgICAgICAgICAgICBib3JkZXItcmFkaXVzOiAxdnc7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgLnNlZWtiYXItbGluZSB7XHJcbiAgICAgICAgICAgICAgaGVpZ2h0OiAxMDAlO1xyXG4gICAgICAgICAgICAgIGJvcmRlci1yYWRpdXM6IDF2dztcclxuICAgICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjZWVlZWVlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIC5zZWVrYmFyLXNpZ24ge1xyXG4gICAgICAgICAgICAgIHdpZHRoOiAxMHB4O1xyXG4gICAgICAgICAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcclxuICAgICAgICAgICAgICB0b3A6IDUwJTtcclxuICAgICAgICAgICAgICBtYXJnaW4tdG9wOiAtNnB4O1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIC5zZWVrYmFyLWNpcmxlIHtcclxuICAgICAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XHJcbiAgICAgICAgICAgICAgdG9wOiAtMC44dnc7XHJcbiAgICAgICAgICAgICAgd2lkdGg6IDMuMnZ3O1xyXG4gICAgICAgICAgICAgIGhlaWdodDogMy4ydnc7XHJcbiAgICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogNTAlO1xyXG4gICAgICAgICAgICAgIGJhY2tncm91bmQ6ICNlZWVlZWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgIH1cclxuICAgICAgICB9XHJcbiAgICAgIH1cclxuICAgICAgLnBsYXllci1jb250cm9scy10aW1lIHtcclxuICAgICAgICB3aWR0aDogMTB2dztcclxuICAgICAgICBjb2xvcjogI2ZmZjtcclxuICAgICAgfVxyXG4gICAgfVxyXG4gICAgLnBsYXktYnRuIHtcclxuICAgICAgcG9zaXRpb246IGFic29sdXRlO1xyXG4gICAgICBib3R0b206IDR2dztcclxuICAgICAgbGVmdDogM3Z3O1xyXG4gICAgICB3aWR0aDogNC44dnc7XHJcbiAgICAgIGhlaWdodDogNC44dnc7XHJcbiAgICAgIGltZyB7XHJcbiAgICAgICAgd2lkdGg6IDEwMCU7XHJcbiAgICAgICAgaGVpZ2h0OiAxMDAlO1xyXG4gICAgICAgIGRpc3BsYXk6IGJsb2NrO1xyXG4gICAgICB9XHJcbiAgICB9XHJcbiAgICAub3BhY2l0eS0wNiB7XHJcbiAgICAgIG9wYWNpdHk6IDAuNjtcclxuICAgIH1cclxuICB9XHJcblxyXG4gIC8v5bqV6YOoXHJcbiAgLmZvb3RlcntcclxuICAgIGRpc3BsYXk6IGZsZXg7XHJcbiAgICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcclxuICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7XHJcbiAgICB3aWR0aDogMTAwJTtcclxuICAgIHBhZGRpbmc6IDAgMjAuMzMzdncgMTAuOTMzdnc7XHJcbiAgICAmPmRpdntcclxuICAgICAgd2lkdGg6IDMwJTtcclxuICAgICAgbWFyZ2luOiAwIDE1JTt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ufVxyXG4iXX0= */`;
|
|
256
|
+
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css));
|
|
257
|
+
|
|
258
|
+
// src/utils/const.ts
|
|
259
|
+
var closeIcon = "https://mass.alipay.com/finmedia_versaassets/uri/file/as/c5dc68e4-2db5-4ea6-ada6-191bb9128a4c.png";
|
|
260
|
+
var wordIcon = "https://mass.alipay.com/finmedia_versaassets/uri/file/as/6ba37577-5fef-4722-9a61-f7ab5e5790ad.png";
|
|
261
|
+
var emotionIcon = "https://mass.alipay.com/finmedia_versaassets/uri/file/as/a6bb2684-4f26-481a-81dd-90500c1f7544.png";
|
|
262
|
+
var playIcon = "https://mass.alipay.com/finmedia_versaassets/uri/file/as/9c6d947f-071a-4875-9546-fd0dce371928.png";
|
|
263
|
+
var pauseIcon = "https://mass.alipay.com/finmedia_versaassets/uri/file/as/65076da8-c1e4-42a9-90af-839a2e42ace7.png";
|
|
264
|
+
var iconText2 = "https://mass.alipay.com/finmedia_versaassets/uri/file/as/f50a1be1-512b-49f5-8be5-61b85c7cbb66.png";
|
|
265
|
+
var iconText1 = "https://mass.alipay.com/finmedia_versaassets/uri/file/as/f9071de5-48d0-42ca-8b9a-13ae19ed48e3.png";
|
|
266
|
+
var signIcon = "https://mass.alipay.com/finmedia_versaassets/uri/file/as/bcbd9a71-ec40-4c4d-ba03-29c2bec2bf89.png";
|
|
267
|
+
var getFrameFromX = (clientX, durationInFrames, width) => {
|
|
268
|
+
const pos = clientX;
|
|
269
|
+
const frame = Math.round(
|
|
270
|
+
interpolate(pos, [0, width], [0, durationInFrames - 1], {
|
|
271
|
+
extrapolateLeft: "clamp",
|
|
272
|
+
extrapolateRight: "clamp"
|
|
273
|
+
})
|
|
274
|
+
);
|
|
275
|
+
return frame;
|
|
276
|
+
};
|
|
277
|
+
console.log(2222);
|
|
278
|
+
var SeekBar = ({ player, vmmlRef, frame, durationInFrames, intoEdit, setDragState, signList }) => {
|
|
279
|
+
const containerRef = useRef(null);
|
|
280
|
+
const [dragging, setDragging] = useState({
|
|
281
|
+
dragging: false
|
|
282
|
+
});
|
|
283
|
+
const fillStyle = useMemo(() => {
|
|
284
|
+
return {
|
|
285
|
+
width: `${frame / (durationInFrames - 1) * 100}%`
|
|
286
|
+
};
|
|
287
|
+
}, [frame, durationInFrames]);
|
|
288
|
+
const cirleStyle = useMemo(() => {
|
|
289
|
+
return {
|
|
290
|
+
left: `calc(${frame / (durationInFrames - 1) * 100}% - 1.6vw)`
|
|
291
|
+
};
|
|
292
|
+
}, [frame, durationInFrames]);
|
|
293
|
+
const onPointerDown = useCallback((e) => {
|
|
294
|
+
var _a;
|
|
295
|
+
if (e.button !== 0) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
const { left, width } = (_a = containerRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
299
|
+
const _frame = getFrameFromX(
|
|
300
|
+
e.clientX - left,
|
|
301
|
+
durationInFrames,
|
|
302
|
+
width
|
|
303
|
+
);
|
|
304
|
+
setDragState(1);
|
|
305
|
+
setDragging({
|
|
306
|
+
dragging: true,
|
|
307
|
+
wasPlaying: player.isPlaying()
|
|
308
|
+
});
|
|
309
|
+
player.pause();
|
|
310
|
+
player.seekTo(_frame);
|
|
311
|
+
vmmlRef.current && vmmlRef.current.onSeekStart();
|
|
312
|
+
}, [player, durationInFrames]);
|
|
313
|
+
const onPointerMove = useCallback((e) => {
|
|
314
|
+
var _a;
|
|
315
|
+
if (!dragging.dragging) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const { left, width } = (_a = containerRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
319
|
+
const _frame = getFrameFromX(
|
|
320
|
+
e.clientX - left,
|
|
321
|
+
durationInFrames,
|
|
322
|
+
width
|
|
323
|
+
);
|
|
324
|
+
setDragState(2);
|
|
325
|
+
player.seekTo(_frame);
|
|
326
|
+
}, [player, dragging.dragging, durationInFrames]);
|
|
327
|
+
const onPointerUp = (e) => {
|
|
328
|
+
setDragging({
|
|
329
|
+
dragging: false
|
|
330
|
+
});
|
|
331
|
+
if (!dragging.dragging) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
setDragState(3);
|
|
335
|
+
intoEdit();
|
|
336
|
+
vmmlRef.current && vmmlRef.current.onSeekEnd();
|
|
337
|
+
};
|
|
338
|
+
const onClickSign = (sign) => {
|
|
339
|
+
player.pause();
|
|
340
|
+
player.seekTo(sign.inFrame);
|
|
341
|
+
vmmlRef.current && vmmlRef.current.onSeekStart();
|
|
342
|
+
setTimeout(() => {
|
|
343
|
+
setDragState(4);
|
|
344
|
+
intoEdit(sign.inFrame);
|
|
345
|
+
vmmlRef.current && vmmlRef.current.onSeekEnd();
|
|
346
|
+
}, 100);
|
|
347
|
+
};
|
|
348
|
+
useEffect(() => {
|
|
349
|
+
if (!dragging.dragging) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
const body = document.querySelector("body");
|
|
353
|
+
if (body) {
|
|
354
|
+
body.addEventListener("pointermove", onPointerMove);
|
|
355
|
+
body.addEventListener("pointerup", onPointerUp);
|
|
356
|
+
return () => {
|
|
357
|
+
body.removeEventListener("pointermove", onPointerMove);
|
|
358
|
+
body.removeEventListener("pointerup", onPointerUp);
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
}, [dragging.dragging, onPointerMove, onPointerUp]);
|
|
362
|
+
return /* @__PURE__ */ jsx("div", { ref: containerRef, className: "seekbar-container", children: /* @__PURE__ */ jsxs("div", { className: "seekbar-background", children: [
|
|
363
|
+
/* @__PURE__ */ jsx("div", { className: "seekbar-fill", onPointerDown }),
|
|
364
|
+
/* @__PURE__ */ jsx("div", { className: "seekbar-line", style: fillStyle }),
|
|
365
|
+
/* @__PURE__ */ jsx("div", { className: "seekbar-signs", children: signList.map((item, index) => /* @__PURE__ */ jsx("img", { onClick: () => onClickSign(item), style: { left: `calc(${item.inFrame / durationInFrames * 100}% - 6px)` }, className: "seekbar-sign", src: signIcon, alt: "" }, index)) }),
|
|
366
|
+
/* @__PURE__ */ jsx("div", { className: "seekbar-cirle", style: cirleStyle, onPointerDown })
|
|
367
|
+
] }) });
|
|
368
|
+
};
|
|
369
|
+
var SeekBar_default = SeekBar;
|
|
370
|
+
var Controls = ({ player, vmmlRef, frame, fps, durationInFrames, intoEdit, isPlaying, setDragState, onControlsClick, signList }) => {
|
|
371
|
+
const onClickToggle = (e) => {
|
|
372
|
+
if (isPlaying) {
|
|
373
|
+
intoEdit();
|
|
374
|
+
} else {
|
|
375
|
+
onControlsClick();
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
return /* @__PURE__ */ jsxs("div", { className: "player-controls", children: [
|
|
379
|
+
/* @__PURE__ */ jsx("div", { className: "player-controls-toggle mr-16 opacity-06", onClick: onClickToggle, children: isPlaying ? /* @__PURE__ */ jsx("img", { src: pauseIcon, alt: "\u6682\u505C" }) : /* @__PURE__ */ jsx("img", { src: playIcon, alt: "\u64AD\u653E" }) }),
|
|
380
|
+
/* @__PURE__ */ jsx("div", { className: "player-controls-time opacity-06", children: formatTime(frame / fps) }),
|
|
381
|
+
/* @__PURE__ */ jsx("div", { className: "player-controls-seekbar mr-16", children: /* @__PURE__ */ jsx(SeekBar_default, { player, vmmlRef, frame, durationInFrames, intoEdit, setDragState, signList }) }),
|
|
382
|
+
/* @__PURE__ */ jsx("div", { className: "player-controls-time opacity-06", children: formatTime(durationInFrames / fps) })
|
|
383
|
+
] });
|
|
384
|
+
};
|
|
385
|
+
var Controls_default = Controls;
|
|
386
|
+
|
|
387
|
+
// src/utils/HistoryClass.ts
|
|
388
|
+
var HistoryClass = class {
|
|
389
|
+
historyUndo;
|
|
390
|
+
historyRedo;
|
|
391
|
+
cacheAction;
|
|
392
|
+
canvas;
|
|
393
|
+
historyProcessing;
|
|
394
|
+
editorInstance;
|
|
395
|
+
actionTypeList;
|
|
396
|
+
constructor(canvas) {
|
|
397
|
+
console.log("history init");
|
|
398
|
+
this.canvas = canvas;
|
|
399
|
+
this.historyUndo = [];
|
|
400
|
+
this.historyRedo = [];
|
|
401
|
+
this.cacheAction = [];
|
|
402
|
+
this.editorInstance = [];
|
|
403
|
+
this.actionTypeList = [];
|
|
404
|
+
this.historyProcessing = false;
|
|
405
|
+
this.initHistory();
|
|
406
|
+
}
|
|
407
|
+
initHistory() {
|
|
408
|
+
this.historyUndo = [];
|
|
409
|
+
this.historyRedo = [];
|
|
410
|
+
this.cacheAction = [];
|
|
411
|
+
this.canvas && this.canvas.on(this._historyEvents());
|
|
412
|
+
}
|
|
413
|
+
_historyNext() {
|
|
414
|
+
const keys = [
|
|
415
|
+
"id",
|
|
416
|
+
"gradientAngle",
|
|
417
|
+
"selectable",
|
|
418
|
+
"hasControls",
|
|
419
|
+
"linkData",
|
|
420
|
+
"editable",
|
|
421
|
+
"extensionType",
|
|
422
|
+
"extension",
|
|
423
|
+
"clipData"
|
|
424
|
+
];
|
|
425
|
+
const getJson = this.canvas && this.canvas.toJSON(keys);
|
|
426
|
+
return getJson;
|
|
427
|
+
}
|
|
428
|
+
_historyEvents() {
|
|
429
|
+
return {
|
|
430
|
+
"object:added": (e) => this._historySaveAction(e, "object:added"),
|
|
431
|
+
"object:removed": (e) => this._historySaveAction(e, "object:removed"),
|
|
432
|
+
"object:modified": (e) => this._historySaveAction(e, "object:modified"),
|
|
433
|
+
"object:skewing": (e) => this._historySaveAction(e, "object:skewing"),
|
|
434
|
+
"object:muteChange": (e) => this._historySaveAction(e, "object:muteChange")
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
_historySaveAction(e, type) {
|
|
438
|
+
if (this.historyProcessing) return;
|
|
439
|
+
this.actionTypeList.length < 1 && this.actionTypeList.push({ type });
|
|
440
|
+
if (!e || e.target && !e.target.excludeFromExport) {
|
|
441
|
+
const json = this._historyNext();
|
|
442
|
+
this.cacheAction.push(json);
|
|
443
|
+
if (this.cacheAction.length > 1) {
|
|
444
|
+
this.cacheAction.shift();
|
|
445
|
+
}
|
|
446
|
+
this.historyRedo = [];
|
|
447
|
+
this.canvas.fire("history:appnd", { json });
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
undo(callback) {
|
|
451
|
+
this.historyProcessing = true;
|
|
452
|
+
const history = this.historyUndo.pop();
|
|
453
|
+
if (history) {
|
|
454
|
+
this._loadHistory(history, "history:undo", callback);
|
|
455
|
+
} else {
|
|
456
|
+
this.historyProcessing = false;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
redo(callback) {
|
|
460
|
+
this.historyProcessing = true;
|
|
461
|
+
const history = this.historyRedo.pop();
|
|
462
|
+
if (history) {
|
|
463
|
+
this.historyUndo.push(this._historyNext());
|
|
464
|
+
this._loadHistory(history, "history:redo", callback);
|
|
465
|
+
} else {
|
|
466
|
+
this.historyProcessing = false;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
_loadHistory(history, event, callback) {
|
|
470
|
+
this.canvas && this.canvas.loadFromJSON(history, () => {
|
|
471
|
+
this.canvas.renderAll();
|
|
472
|
+
this.canvas.fire(event);
|
|
473
|
+
this.historyProcessing = false;
|
|
474
|
+
if (callback && typeof callback === "function") callback();
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
_historyDispose() {
|
|
478
|
+
this.canvas.off(this._historyEvents());
|
|
479
|
+
}
|
|
480
|
+
clearHistory() {
|
|
481
|
+
this.historyUndo = [];
|
|
482
|
+
this.historyRedo = [];
|
|
483
|
+
this.cacheAction = [];
|
|
484
|
+
this.canvas.fire("history:clear");
|
|
485
|
+
}
|
|
486
|
+
canUndo() {
|
|
487
|
+
return this.historyUndo.length > 0;
|
|
488
|
+
}
|
|
489
|
+
canRedo() {
|
|
490
|
+
return this.historyRedo.length > 0;
|
|
491
|
+
}
|
|
492
|
+
//离开画布保存上一次编辑的状态
|
|
493
|
+
onCanvasRoute(canvas) {
|
|
494
|
+
this.editorInstance.push(canvas);
|
|
495
|
+
}
|
|
496
|
+
getActionType() {
|
|
497
|
+
return this.actionTypeList;
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
var VmmlConverter = class {
|
|
501
|
+
vmml;
|
|
502
|
+
canvasSize;
|
|
503
|
+
tracks;
|
|
504
|
+
heightScale;
|
|
505
|
+
widthScale;
|
|
506
|
+
fontSize;
|
|
507
|
+
/**
|
|
508
|
+
* VmmlConverter 构造函数
|
|
509
|
+
* @param vmml - VMML 模板数据
|
|
510
|
+
* @param canvasSize - 画布尺寸
|
|
511
|
+
*/
|
|
512
|
+
constructor({ vmml, canvasSize }) {
|
|
513
|
+
const { width, height } = vmml.template.dimension;
|
|
514
|
+
this.vmml = vmml;
|
|
515
|
+
this.canvasSize = canvasSize;
|
|
516
|
+
this.tracks = vmml.template.tracks;
|
|
517
|
+
this.fontSize = getFontSize(width, height);
|
|
518
|
+
this.heightScale = height / canvasSize.height;
|
|
519
|
+
this.widthScale = width / canvasSize.width;
|
|
520
|
+
}
|
|
521
|
+
//更新位置
|
|
522
|
+
setPosParam(fObj) {
|
|
523
|
+
console.log("setPosParam fObj", fObj);
|
|
524
|
+
const {
|
|
525
|
+
clipData: { type },
|
|
526
|
+
centerPoint,
|
|
527
|
+
scaleX,
|
|
528
|
+
scaleY,
|
|
529
|
+
angle,
|
|
530
|
+
width,
|
|
531
|
+
height
|
|
532
|
+
} = fObj;
|
|
533
|
+
let _scaleX, _scaleY, _centerX, _centerY;
|
|
534
|
+
if (type === "\u6587\u5B57") {
|
|
535
|
+
_scaleX = 22 * scaleX * this.widthScale / this.fontSize;
|
|
536
|
+
_scaleY = 22 * scaleY * this.heightScale / this.fontSize;
|
|
537
|
+
_centerX = centerPoint.x / this.canvasSize.width;
|
|
538
|
+
_centerY = centerPoint.y / this.canvasSize.height;
|
|
539
|
+
} else if (type === "\u8868\u60C5\u5305") {
|
|
540
|
+
_scaleX = width * scaleX * this.widthScale / width;
|
|
541
|
+
_scaleY = height * scaleY * this.heightScale / height;
|
|
542
|
+
_centerX = centerPoint.x / this.canvasSize.width;
|
|
543
|
+
_centerY = centerPoint.y / this.canvasSize.height;
|
|
544
|
+
}
|
|
545
|
+
return {
|
|
546
|
+
scaleX: _scaleX,
|
|
547
|
+
scaleY: _scaleY,
|
|
548
|
+
centerX: _centerX,
|
|
549
|
+
centerY: _centerY,
|
|
550
|
+
rotationZ: angle
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* 转换 TextClip
|
|
555
|
+
* @param fObj - 画布fObj
|
|
556
|
+
*/
|
|
557
|
+
addTextClip(fObj) {
|
|
558
|
+
console.log("addTextClip fObj", fObj);
|
|
559
|
+
const posParam = this.setPosParam(fObj);
|
|
560
|
+
const { clipData: { id, inPoint, text, textColor, bgColor } } = fObj;
|
|
561
|
+
const { template: { duration } } = this.vmml;
|
|
562
|
+
const clips = [];
|
|
563
|
+
const editorTrack = this.tracks.find((track) => track.editorType === "\u6587\u5B57");
|
|
564
|
+
const tClipData = {
|
|
565
|
+
duration,
|
|
566
|
+
originDuration: duration,
|
|
567
|
+
start: 0,
|
|
568
|
+
end: duration,
|
|
569
|
+
inPoint,
|
|
570
|
+
id,
|
|
571
|
+
type: 202,
|
|
572
|
+
fObj,
|
|
573
|
+
textClip: {
|
|
574
|
+
lineSpacing: 0,
|
|
575
|
+
alignType: 0,
|
|
576
|
+
fontCode: "",
|
|
577
|
+
bold: false,
|
|
578
|
+
dimension: {
|
|
579
|
+
height: 282,
|
|
580
|
+
width: 825
|
|
581
|
+
},
|
|
582
|
+
posParam,
|
|
583
|
+
backgroundColor: this.toARGB(bgColor),
|
|
584
|
+
textContent: text,
|
|
585
|
+
textColor: this.toARGB(textColor)
|
|
586
|
+
// fontFamily:'unset'
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
if (!editorTrack) {
|
|
590
|
+
clips.push(tClipData);
|
|
591
|
+
this.tracks.push({
|
|
592
|
+
clips,
|
|
593
|
+
description: "editorText",
|
|
594
|
+
id: v4(),
|
|
595
|
+
type: 2,
|
|
596
|
+
editorType: "\u6587\u5B57"
|
|
597
|
+
});
|
|
598
|
+
} else {
|
|
599
|
+
editorTrack.clips.push(tClipData);
|
|
600
|
+
}
|
|
601
|
+
console.log("addTextClip \u6700\u7EC8vmml", this.vmml);
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* 转换 VideoClip
|
|
605
|
+
* @param fObj - 画布fObj
|
|
606
|
+
*/
|
|
607
|
+
addVideoClip(fObj) {
|
|
608
|
+
console.log("addVideoClip fObj", fObj);
|
|
609
|
+
const clips = [];
|
|
610
|
+
const editorTrack = this.tracks.find((track) => track.editorType === "\u8868\u60C5\u5305");
|
|
611
|
+
const clipData = this.loadClipData(fObj);
|
|
612
|
+
if (!editorTrack) {
|
|
613
|
+
const index = this.tracks.findIndex((track) => track.editorType === "\u6587\u5B57");
|
|
614
|
+
for (const item of clipData) {
|
|
615
|
+
if (item !== null) {
|
|
616
|
+
clips.push(item);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
const data = {
|
|
620
|
+
clips,
|
|
621
|
+
description: "editorEmoji",
|
|
622
|
+
id: v4(),
|
|
623
|
+
type: 1,
|
|
624
|
+
editorType: "\u8868\u60C5\u5305"
|
|
625
|
+
};
|
|
626
|
+
if (index !== -1) {
|
|
627
|
+
this.tracks.splice(index, 0, data);
|
|
628
|
+
} else {
|
|
629
|
+
this.tracks.push(data);
|
|
630
|
+
}
|
|
631
|
+
} else {
|
|
632
|
+
for (const item of clipData) {
|
|
633
|
+
if (item !== null) {
|
|
634
|
+
editorTrack.clips.push(item);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
console.log("addVideoClip \u6700\u7EC8vmml", this.vmml);
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* 更新 clip
|
|
642
|
+
* @param fObj - 画布fObj
|
|
643
|
+
*/
|
|
644
|
+
updateClip(fObj) {
|
|
645
|
+
console.log("updateClip fObj", fObj);
|
|
646
|
+
const posParam = this.setPosParam(fObj);
|
|
647
|
+
const {
|
|
648
|
+
// clipData: { id, type, lineSpacing },
|
|
649
|
+
clipData: { id, type, lineSpacing, originClip }
|
|
650
|
+
} = fObj;
|
|
651
|
+
let existClip = null;
|
|
652
|
+
if (originClip) {
|
|
653
|
+
existClip = originClip;
|
|
654
|
+
} else {
|
|
655
|
+
const editorTrack = this.tracks.find((track) => track.editorType === type);
|
|
656
|
+
existClip = ((editorTrack == null ? void 0 : editorTrack.clips) || []).find((clip) => clip.id === id);
|
|
657
|
+
}
|
|
658
|
+
if (existClip) {
|
|
659
|
+
!originClip && (existClip.fObj = fObj);
|
|
660
|
+
if (type === "\u8868\u60C5\u5305") {
|
|
661
|
+
existClip.videoClip.posParam = posParam;
|
|
662
|
+
} else if (type === "\u6587\u5B57") {
|
|
663
|
+
const { clipData: { text, textColor, bgColor } } = fObj;
|
|
664
|
+
const scale = this.fontSize / 22;
|
|
665
|
+
existClip.textClip = {
|
|
666
|
+
...existClip.textClip,
|
|
667
|
+
posParam,
|
|
668
|
+
backgroundColor: this.toARGB(bgColor),
|
|
669
|
+
textContent: text,
|
|
670
|
+
textColor: this.toARGB(textColor),
|
|
671
|
+
dimension: {
|
|
672
|
+
width: Math.floor(fObj.width * scale),
|
|
673
|
+
height: Math.floor(fObj.height * scale)
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
console.log("updateClip \u6700\u7EC8vmml", this.vmml);
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* 删除 Clip
|
|
682
|
+
* @param id - 实例 id
|
|
683
|
+
* @param type - 实例 类型
|
|
684
|
+
*/
|
|
685
|
+
deleteClip({ id, type, originClip }) {
|
|
686
|
+
if (originClip) {
|
|
687
|
+
originClip.duration = 0;
|
|
688
|
+
} else {
|
|
689
|
+
const editorTrack = this.tracks.find((track) => track.editorType === type);
|
|
690
|
+
const index = editorTrack.clips.findIndex((item) => item.id === id);
|
|
691
|
+
if (index !== -1) {
|
|
692
|
+
if (editorTrack.clips[index + 1] && editorTrack.clips[index + 1].audioClip) {
|
|
693
|
+
editorTrack.clips.splice(index, 2);
|
|
694
|
+
} else {
|
|
695
|
+
editorTrack.clips.splice(index, 1);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
if (editorTrack.clips.length === 0) {
|
|
699
|
+
const trackIndex = this.tracks.indexOf(editorTrack);
|
|
700
|
+
if (trackIndex !== -1) {
|
|
701
|
+
this.tracks.splice(trackIndex, 1);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
console.log("deleteClip \u6700\u7EC8Vmml", this.vmml);
|
|
706
|
+
}
|
|
707
|
+
//切换静音 视频/音频
|
|
708
|
+
changeMute({ id, isMute }) {
|
|
709
|
+
const editorTrack = this.tracks.find((track) => track.editorType === "\u8868\u60C5\u5305");
|
|
710
|
+
const index = editorTrack.clips.findIndex((item) => item.id === id);
|
|
711
|
+
if (index !== -1) {
|
|
712
|
+
const volume = isMute ? 0 : 1;
|
|
713
|
+
editorTrack.clips[index].videoClip.volume = volume;
|
|
714
|
+
if (editorTrack.clips[index + 1] && editorTrack.clips[index + 1].audioClip) {
|
|
715
|
+
editorTrack.clips[index + 1].audioClip.volume = volume;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
console.log("changeMute \u6700\u7EC8Vmml", this.vmml);
|
|
719
|
+
}
|
|
720
|
+
//加载clip数据
|
|
721
|
+
loadClipData(fObj) {
|
|
722
|
+
const posParam = this.setPosParam(fObj);
|
|
723
|
+
const {
|
|
724
|
+
clipData: { id, inPoint, fileUrl },
|
|
725
|
+
width,
|
|
726
|
+
height
|
|
727
|
+
} = fObj;
|
|
728
|
+
let aClipData = null;
|
|
729
|
+
const availableDuration = this.vmml.template.duration - inPoint;
|
|
730
|
+
const _duration = fileUrl.duration > availableDuration ? availableDuration : fileUrl.duration;
|
|
731
|
+
const vClipData = {
|
|
732
|
+
duration: _duration,
|
|
733
|
+
originDuration: fileUrl.duration,
|
|
734
|
+
start: 0,
|
|
735
|
+
end: _duration,
|
|
736
|
+
inPoint,
|
|
737
|
+
type: 102,
|
|
738
|
+
id,
|
|
739
|
+
fObj,
|
|
740
|
+
videoClip: {
|
|
741
|
+
grayMaskUrl: fileUrl.grayMaskUrl,
|
|
742
|
+
webmUrl: fileUrl.webmUrl,
|
|
743
|
+
movUrl: fileUrl.movUrl,
|
|
744
|
+
gifUrl: fileUrl.visibleUrl,
|
|
745
|
+
dimension: {
|
|
746
|
+
height,
|
|
747
|
+
width
|
|
748
|
+
},
|
|
749
|
+
posParam,
|
|
750
|
+
constantSpeed: 1,
|
|
751
|
+
volume: 1,
|
|
752
|
+
sourceUrl: fileUrl.visibleUrl,
|
|
753
|
+
thumbnailSourceUrl: fileUrl.thumbnailUrl,
|
|
754
|
+
sourceCode: "",
|
|
755
|
+
mimeType: fileUrl.visiableMimeType
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
if (fileUrl.hasAudio === "true") {
|
|
759
|
+
aClipData = {
|
|
760
|
+
duration: _duration,
|
|
761
|
+
originDuration: fileUrl.duration,
|
|
762
|
+
start: 0,
|
|
763
|
+
end: _duration,
|
|
764
|
+
inPoint,
|
|
765
|
+
type: 304,
|
|
766
|
+
id: v4(),
|
|
767
|
+
audioClip: {
|
|
768
|
+
sourceUrl: fileUrl.soundUrl,
|
|
769
|
+
volume: 1,
|
|
770
|
+
constantSpeed: 1
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
return [vClipData, aClipData];
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* 将颜色转换为 ARGB 格式
|
|
778
|
+
* @param color - 颜色字符串
|
|
779
|
+
* @returns ARGB 颜色字符串
|
|
780
|
+
*/
|
|
781
|
+
toARGB(color) {
|
|
782
|
+
if (color === "transparent") {
|
|
783
|
+
return "#00000000";
|
|
784
|
+
}
|
|
785
|
+
if (color.includes("rgb")) {
|
|
786
|
+
return rgbaToArgb(color);
|
|
787
|
+
}
|
|
788
|
+
if (color.includes("#")) {
|
|
789
|
+
return hexToArgb(color);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
var VmmlConverter_default = VmmlConverter;
|
|
794
|
+
function drawImg(ctx, left, top, img, wSize, hSize, angle) {
|
|
795
|
+
if (angle === void 0) return;
|
|
796
|
+
ctx.save();
|
|
797
|
+
ctx.translate(left, top);
|
|
798
|
+
ctx.rotate(fabric.util.degreesToRadians(angle));
|
|
799
|
+
ctx.drawImage(img, -wSize / 2, -hSize / 2, wSize, hSize);
|
|
800
|
+
ctx.restore();
|
|
801
|
+
}
|
|
802
|
+
function usePeekControl(canvas) {
|
|
803
|
+
const iconUrls = {
|
|
804
|
+
delete: "https://mass.alipay.com/finmedia_versaassets/uri/file/as/0c7084a9-6067-4277-a5af-2932983cbeb7.png",
|
|
805
|
+
// zoom: "https://mass.alipay.com/finmedia_versaassets/uri/file/as/ff6aea73-4d12-4201-9404-3134d5f9525c.png",
|
|
806
|
+
zoom: "https://mass.alipay.com/finmedia_versaassets/uri/file/as/0909485d-46db-47b4-8bb1-5a686510ddb3.png",
|
|
807
|
+
mute: "https://mass.alipay.com/finmedia_versaassets/uri/file/as/3fef2c5d-7576-424d-813c-34508b051884.png",
|
|
808
|
+
volume: "https://mass.alipay.com/finmedia_versaassets/uri/file/as/1ab2e829-c5b1-4177-8554-ae2f74b02e1d.png",
|
|
809
|
+
edit: "https://mass.alipay.com/finmedia_versaassets/uri/file/as/9e9ed472-62cf-4b71-891f-bc08c8b08a5d.png"
|
|
810
|
+
};
|
|
811
|
+
const createIconElement = (url) => {
|
|
812
|
+
const img = document.createElement("img");
|
|
813
|
+
img.src = url;
|
|
814
|
+
return img;
|
|
815
|
+
};
|
|
816
|
+
const deleteObject = (mouseEvent, target) => {
|
|
817
|
+
if (target.action === "rotate") return true;
|
|
818
|
+
const activeObject = canvas.getActiveObjects();
|
|
819
|
+
if (activeObject) {
|
|
820
|
+
activeObject.map((item) => canvas.remove(item));
|
|
821
|
+
canvas.requestRenderAll();
|
|
822
|
+
canvas.discardActiveObject();
|
|
823
|
+
}
|
|
824
|
+
return true;
|
|
825
|
+
};
|
|
826
|
+
const delImg = createIconElement(iconUrls.delete);
|
|
827
|
+
const zoomImg = createIconElement(iconUrls.zoom);
|
|
828
|
+
const muteImg = createIconElement(iconUrls.mute);
|
|
829
|
+
const volumeImg = createIconElement(iconUrls.volume);
|
|
830
|
+
const editImg = createIconElement(iconUrls.edit);
|
|
831
|
+
const renderDelIcon = (ctx, left, top, styleOverride, fabricObject) => {
|
|
832
|
+
drawImg(ctx, left, top, delImg, 28, 28, fabricObject.angle);
|
|
833
|
+
};
|
|
834
|
+
const renderIconRotate = (ctx, left, top, styleOverride, fabricObject) => {
|
|
835
|
+
drawImg(ctx, left, top, zoomImg, 28, 28, fabricObject.angle);
|
|
836
|
+
};
|
|
837
|
+
const renderMuteIcon = (ctx, left, top, styleOverride, fabricObject) => {
|
|
838
|
+
if (!fabricObject.clipData) return false;
|
|
839
|
+
if (fabricObject.clipData.type === "\u8868\u60C5\u5305") {
|
|
840
|
+
if (fabricObject.clipData.isMute === null || fabricObject.clipData.isMute === void 0) return false;
|
|
841
|
+
if (fabricObject.clipData.isMute) {
|
|
842
|
+
drawImg(ctx, left, top, muteImg, 28, 28, fabricObject.angle);
|
|
843
|
+
} else {
|
|
844
|
+
drawImg(ctx, left, top, volumeImg, 28, 28, fabricObject.angle);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
const renderEditIcon = (ctx, left, top, styleOverride, fabricObject) => {
|
|
849
|
+
if (!fabricObject.clipData) return false;
|
|
850
|
+
if (fabricObject.clipData.type === "\u6587\u5B57") {
|
|
851
|
+
drawImg(ctx, left, top, editImg, 28, 28, fabricObject.angle);
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
const muteAction = (eventData, transform, x, y) => {
|
|
855
|
+
if (transform.target.clipData.isMute === null) return false;
|
|
856
|
+
transform.target.clipData = JSON.parse(JSON.stringify(transform.target.clipData));
|
|
857
|
+
transform.target.clipData.isMute = !transform.target.clipData.isMute;
|
|
858
|
+
canvas.renderAll();
|
|
859
|
+
canvas.fire("object:muteChange", { target: transform.target });
|
|
860
|
+
return true;
|
|
861
|
+
};
|
|
862
|
+
const editAction = (eventData, transform, x, y) => {
|
|
863
|
+
if (transform.target.clipData.type === "\u6587\u5B57") {
|
|
864
|
+
canvas.fire("object:textEdit", { target: transform.target });
|
|
865
|
+
}
|
|
866
|
+
return true;
|
|
867
|
+
};
|
|
868
|
+
const actionHandler = (eventData, transform, x, y) => {
|
|
869
|
+
try {
|
|
870
|
+
const t = transform, target = t.target, pivotPoint = target.translateToOriginPoint(
|
|
871
|
+
target.getCenterPoint(),
|
|
872
|
+
t.originX,
|
|
873
|
+
t.originY
|
|
874
|
+
);
|
|
875
|
+
const lastAngle = Math.atan2(t.ey - pivotPoint.y, t.ex - pivotPoint.x), curAngle = Math.atan2(y - pivotPoint.y, x - pivotPoint.x);
|
|
876
|
+
let angle2 = Math.floor((curAngle - lastAngle + t.theta) * (180 / Math.PI));
|
|
877
|
+
fabric.controlsUtils.scalingEqually(eventData, transform, x, y);
|
|
878
|
+
const rotateAngles = [
|
|
879
|
+
[85, 95, 90],
|
|
880
|
+
[175, 185, 180],
|
|
881
|
+
[265, 275, 270],
|
|
882
|
+
[355, 365, 360],
|
|
883
|
+
[440, 460, 90],
|
|
884
|
+
[-5, 5, 0],
|
|
885
|
+
[-95, -85, 270],
|
|
886
|
+
[-185, -175, 180]
|
|
887
|
+
];
|
|
888
|
+
for (let i = 0; i < rotateAngles.length; i++) {
|
|
889
|
+
if (rotateAngles[i][0] < angle2 && angle2 < rotateAngles[i][1]) {
|
|
890
|
+
target.rotate(rotateAngles[i][2]);
|
|
891
|
+
return true;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
fabric.controlsUtils.rotationWithSnapping(eventData, transform, x, y);
|
|
895
|
+
return true;
|
|
896
|
+
} catch (error) {
|
|
897
|
+
console.error("Action handler error:", error);
|
|
898
|
+
return false;
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
fabric.Object.prototype.controls.tl = new fabric.Control({
|
|
902
|
+
x: -0.5,
|
|
903
|
+
y: -0.5,
|
|
904
|
+
mouseUpHandler: deleteObject,
|
|
905
|
+
render: renderDelIcon
|
|
906
|
+
});
|
|
907
|
+
fabric.Object.prototype.controls.bl = new fabric.Control({
|
|
908
|
+
x: -0.5,
|
|
909
|
+
y: 0.5,
|
|
910
|
+
mouseUpHandler: muteAction,
|
|
911
|
+
render: renderMuteIcon
|
|
912
|
+
});
|
|
913
|
+
fabric.Object.prototype.controls.tr = new fabric.Control({
|
|
914
|
+
x: 0.5,
|
|
915
|
+
y: -0.5,
|
|
916
|
+
mouseUpHandler: editAction,
|
|
917
|
+
render: renderEditIcon
|
|
918
|
+
});
|
|
919
|
+
fabric.Object.prototype.controls.ml = new fabric.Control({ visible: false });
|
|
920
|
+
fabric.Object.prototype.controls.mr = new fabric.Control({ visible: false });
|
|
921
|
+
fabric.Object.prototype.controls.mb = new fabric.Control({ visible: false });
|
|
922
|
+
fabric.Object.prototype.controls.mt = new fabric.Control({ visible: false });
|
|
923
|
+
fabric.Object.prototype.controls.mtr = new fabric.Control({ visible: false });
|
|
924
|
+
fabric.Object.prototype.controls.br = new fabric.Control({
|
|
925
|
+
x: 0.5,
|
|
926
|
+
y: 0.5,
|
|
927
|
+
actionName: "rotate",
|
|
928
|
+
actionHandler,
|
|
929
|
+
render: renderIconRotate
|
|
930
|
+
});
|
|
931
|
+
fabric.Object.prototype.set({
|
|
932
|
+
borderColor: "#d6d6d699",
|
|
933
|
+
borderScaleFactor: 1.5,
|
|
934
|
+
borderOpacityWhenMoving: 1,
|
|
935
|
+
padding: 5
|
|
936
|
+
});
|
|
937
|
+
return canvas;
|
|
938
|
+
}
|
|
939
|
+
var EditorCanvas = forwardRef(
|
|
940
|
+
({ previewState, showCanvas, canvasSize, enterPreview, intoTextEdit, frame, vmml, dragState, initFcObjs, onVideoChange }, ref) => {
|
|
941
|
+
const [fc, setFc] = useState(null);
|
|
942
|
+
const [history, setHistory] = useState(null);
|
|
943
|
+
const waitFcTasks = useRef([]);
|
|
944
|
+
const vmmlConverterRef = useRef(null);
|
|
945
|
+
const heightScaleRef = useRef(1);
|
|
946
|
+
const widthScaleRef = useRef(1);
|
|
947
|
+
const initCanvas = () => {
|
|
948
|
+
const canvas = new fabric.Canvas("canvas", {
|
|
949
|
+
width: canvasSize.width,
|
|
950
|
+
height: canvasSize.height,
|
|
951
|
+
selection: false
|
|
952
|
+
// 画布框选
|
|
953
|
+
});
|
|
954
|
+
heightScaleRef.current = vmml.template.dimension.height / canvasSize.height;
|
|
955
|
+
widthScaleRef.current = vmml.template.dimension.width / canvasSize.width;
|
|
956
|
+
if (initFcObjs.length) {
|
|
957
|
+
createFcObjs(canvas);
|
|
958
|
+
}
|
|
959
|
+
setFc(canvas);
|
|
960
|
+
initCanvasEvent(canvas);
|
|
961
|
+
usePeekControl(canvas);
|
|
962
|
+
};
|
|
963
|
+
const createFcObjs = (canvas) => {
|
|
964
|
+
const ns = Math.floor(frame / 30 * 1e6);
|
|
965
|
+
fabric.util.enlivenObjects(initFcObjs, (objects) => {
|
|
966
|
+
objects.forEach((item) => {
|
|
967
|
+
item.on("modified", () => {
|
|
968
|
+
const fObj = convertToJSON(item);
|
|
969
|
+
vmmlConverterRef.current.updateClip(fObj);
|
|
970
|
+
});
|
|
971
|
+
item.set("visible", ns >= item.clipData.inPoint);
|
|
972
|
+
canvas.add(item);
|
|
973
|
+
});
|
|
974
|
+
canvas.renderAll();
|
|
975
|
+
}, "");
|
|
976
|
+
};
|
|
977
|
+
const checkObjectInPoint = (f) => {
|
|
978
|
+
if (fc) {
|
|
979
|
+
const ns = Math.floor((f ?? frame) / 30 * 1e6);
|
|
980
|
+
const objects = fc.getObjects();
|
|
981
|
+
objects.forEach((item) => {
|
|
982
|
+
var _a, _b, _c;
|
|
983
|
+
if (((_a = item == null ? void 0 : item.clipData) == null ? void 0 : _a.type) === "\u6587\u5B57") {
|
|
984
|
+
item.set("visible", ns >= item.clipData.inPoint && ns < item.clipData.inPoint + (item.clipData.duration || vmml.template.duration));
|
|
985
|
+
} else {
|
|
986
|
+
item.set("visible", ns >= item.clipData.inPoint && ns < item.clipData.inPoint + ((_c = (_b = item.clipData) == null ? void 0 : _b.fileUrl) == null ? void 0 : _c.duration));
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
fc.discardActiveObject();
|
|
990
|
+
fc.renderAll();
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
const initCanvasEvent = (canvas) => {
|
|
994
|
+
canvas.on("mouse:down", (e) => {
|
|
995
|
+
const active = canvas.getActiveObject();
|
|
996
|
+
if (active) {
|
|
997
|
+
if (active.isSelected !== null && active.clipData.type === "\u6587\u5B57") {
|
|
998
|
+
imitateDBclick(active, canvas);
|
|
999
|
+
}
|
|
1000
|
+
} else {
|
|
1001
|
+
enterPreview(canvas);
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
canvas.on("object:removed", (e) => {
|
|
1005
|
+
if (e.target.clipData && !e.target.clipData.originClip) {
|
|
1006
|
+
onVideoChange(e.target.clipData);
|
|
1007
|
+
}
|
|
1008
|
+
const { clipData } = e.target.toJSON(["clipData"]);
|
|
1009
|
+
vmmlConverterRef.current.deleteClip(clipData);
|
|
1010
|
+
});
|
|
1011
|
+
canvas.on("object:muteChange", (e) => {
|
|
1012
|
+
const { clipData } = e.target.toJSON(["clipData"]);
|
|
1013
|
+
vmmlConverterRef.current.changeMute(clipData);
|
|
1014
|
+
});
|
|
1015
|
+
canvas.on("object:textEdit", (e) => {
|
|
1016
|
+
const active = canvas.getActiveObject();
|
|
1017
|
+
handleIntoTextMenu(active, canvas);
|
|
1018
|
+
});
|
|
1019
|
+
};
|
|
1020
|
+
const imitateDBclick = (active, canvas) => {
|
|
1021
|
+
active.isSelected++;
|
|
1022
|
+
const timer = setTimeout(() => {
|
|
1023
|
+
active.isSelected = 0;
|
|
1024
|
+
}, 500);
|
|
1025
|
+
if (active.isSelected === 2) {
|
|
1026
|
+
active.isSelected = 0;
|
|
1027
|
+
clearTimeout(timer);
|
|
1028
|
+
handleIntoTextMenu(active, canvas);
|
|
1029
|
+
}
|
|
1030
|
+
};
|
|
1031
|
+
const handleIntoTextMenu = (active, canvas) => {
|
|
1032
|
+
const {
|
|
1033
|
+
left,
|
|
1034
|
+
top,
|
|
1035
|
+
angle,
|
|
1036
|
+
scaleX,
|
|
1037
|
+
scaleY,
|
|
1038
|
+
zoomX,
|
|
1039
|
+
zoomY,
|
|
1040
|
+
clipData: { textBasicInfo, textColor, text, bgColor, fontFamily, id, fontAssetUrl }
|
|
1041
|
+
} = active;
|
|
1042
|
+
const textInfo = {
|
|
1043
|
+
id,
|
|
1044
|
+
text,
|
|
1045
|
+
textColor,
|
|
1046
|
+
bgColor,
|
|
1047
|
+
left,
|
|
1048
|
+
top,
|
|
1049
|
+
angle,
|
|
1050
|
+
scaleX,
|
|
1051
|
+
scaleY,
|
|
1052
|
+
zoomX,
|
|
1053
|
+
zoomY,
|
|
1054
|
+
textBasicInfo,
|
|
1055
|
+
fontFamily,
|
|
1056
|
+
fontAssetUrl
|
|
1057
|
+
// width,
|
|
1058
|
+
// height
|
|
1059
|
+
};
|
|
1060
|
+
active.set("visible", false);
|
|
1061
|
+
canvas.renderAll();
|
|
1062
|
+
intoTextEdit(textInfo);
|
|
1063
|
+
};
|
|
1064
|
+
const convertToJSON = (data) => {
|
|
1065
|
+
const centerPoint = data.getCenterPoint();
|
|
1066
|
+
return { ...data.toJSON(["clipData", "type"]), centerPoint };
|
|
1067
|
+
};
|
|
1068
|
+
const createImage = (file, emojiId) => {
|
|
1069
|
+
const url = file.resourcesType === "image" ? file.visibleUrl : "";
|
|
1070
|
+
return new Promise((resolve, reject) => {
|
|
1071
|
+
try {
|
|
1072
|
+
fabric.Image.fromURL(
|
|
1073
|
+
url,
|
|
1074
|
+
(img) => {
|
|
1075
|
+
const scaleX = canvasSize.width / 2 / file.width;
|
|
1076
|
+
img.set({
|
|
1077
|
+
width: file.width,
|
|
1078
|
+
height: file.height,
|
|
1079
|
+
scaleX,
|
|
1080
|
+
scaleY: scaleX,
|
|
1081
|
+
left: canvasSize.width / 2,
|
|
1082
|
+
top: canvasSize.height / 2,
|
|
1083
|
+
originX: "center",
|
|
1084
|
+
originY: "center",
|
|
1085
|
+
clipData: {
|
|
1086
|
+
id: v4(),
|
|
1087
|
+
isMute: file.hasAudio === "true" ? false : null,
|
|
1088
|
+
inPoint: Math.floor(frame / 30 * 1e6),
|
|
1089
|
+
inFrame: frame,
|
|
1090
|
+
type: "\u8868\u60C5\u5305",
|
|
1091
|
+
once: false,
|
|
1092
|
+
emojiId,
|
|
1093
|
+
fileUrl: file
|
|
1094
|
+
}
|
|
1095
|
+
});
|
|
1096
|
+
img.on("modified", () => {
|
|
1097
|
+
const fObj2 = convertToJSON(img);
|
|
1098
|
+
fObj2.src = "";
|
|
1099
|
+
vmmlConverterRef.current.updateClip(fObj2);
|
|
1100
|
+
});
|
|
1101
|
+
fc.add(img);
|
|
1102
|
+
onVideoChange(img.clipData);
|
|
1103
|
+
const fObj = convertToJSON(img);
|
|
1104
|
+
resolve(fObj);
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
padding: 3
|
|
1108
|
+
}
|
|
1109
|
+
);
|
|
1110
|
+
} catch (err) {
|
|
1111
|
+
reject(err + "\u6DFB\u52A0\u8868\u60C5\u5305\u5931\u8D25");
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
};
|
|
1115
|
+
const updateImage = (id, base64, fc2) => {
|
|
1116
|
+
const canvas = fc || fc2;
|
|
1117
|
+
if (canvas) {
|
|
1118
|
+
const imgs = canvas.getObjects().filter((item) => {
|
|
1119
|
+
var _a;
|
|
1120
|
+
return ((_a = item == null ? void 0 : item.clipData) == null ? void 0 : _a.type) === "\u8868\u60C5\u5305";
|
|
1121
|
+
});
|
|
1122
|
+
const target = imgs.find((item) => item.clipData.id === id);
|
|
1123
|
+
if (target) {
|
|
1124
|
+
target.setSrc(base64, (img) => {
|
|
1125
|
+
img.setCoords();
|
|
1126
|
+
canvas.renderAll();
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
} else {
|
|
1130
|
+
waitFcTasks.current.push(updateImage.bind(void 0, id, base64));
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
const createImageFromClip = (clip, fc2) => {
|
|
1134
|
+
const canvas = fc || fc2;
|
|
1135
|
+
if (canvas && canvasSize.width) {
|
|
1136
|
+
const url = /video/g.test(clip.videoClip.mimeType) ? "" : clip.videoClip.sourceUrl;
|
|
1137
|
+
fabric.Image.fromURL(url, (img) => {
|
|
1138
|
+
const { dimension, posParam } = clip.videoClip;
|
|
1139
|
+
const scaleX = posParam.scaleX / heightScaleRef.current;
|
|
1140
|
+
const scaleY = posParam.scaleY / widthScaleRef.current;
|
|
1141
|
+
const left = canvasSize.width * posParam.centerX;
|
|
1142
|
+
const top = canvasSize.height * posParam.centerY;
|
|
1143
|
+
const inFrame = getFrames(clip.inPoint, 30);
|
|
1144
|
+
const durationFrame = getFrames(clip.duration, 30);
|
|
1145
|
+
img.set({
|
|
1146
|
+
width: dimension.width,
|
|
1147
|
+
height: dimension.height,
|
|
1148
|
+
scaleX,
|
|
1149
|
+
scaleY,
|
|
1150
|
+
left,
|
|
1151
|
+
top,
|
|
1152
|
+
angle: posParam.rotationZ,
|
|
1153
|
+
originX: "center",
|
|
1154
|
+
originY: "center",
|
|
1155
|
+
clipData: {
|
|
1156
|
+
id: clip.id,
|
|
1157
|
+
isMute: null,
|
|
1158
|
+
inPoint: clip.inPoint,
|
|
1159
|
+
inFrame,
|
|
1160
|
+
type: "\u8868\u60C5\u5305",
|
|
1161
|
+
once: false,
|
|
1162
|
+
fileUrl: {
|
|
1163
|
+
duration: clip.duration
|
|
1164
|
+
},
|
|
1165
|
+
originClip: clip
|
|
1166
|
+
},
|
|
1167
|
+
visible: frame >= inFrame && frame < inFrame + durationFrame
|
|
1168
|
+
});
|
|
1169
|
+
canvas.add(img);
|
|
1170
|
+
img.on("modified", () => {
|
|
1171
|
+
const fObj = convertToJSON(img);
|
|
1172
|
+
fObj.src = "";
|
|
1173
|
+
vmmlConverterRef.current.updateClip(fObj);
|
|
1174
|
+
});
|
|
1175
|
+
});
|
|
1176
|
+
} else {
|
|
1177
|
+
waitFcTasks.current.push(createImageFromClip.bind(void 0, clip));
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
const handleRedo = () => {
|
|
1181
|
+
history.redo();
|
|
1182
|
+
};
|
|
1183
|
+
const handleUndo = () => {
|
|
1184
|
+
history.undo();
|
|
1185
|
+
};
|
|
1186
|
+
const createTextFromClip = async (clip, fc2) => {
|
|
1187
|
+
const canvas = fc || fc2;
|
|
1188
|
+
if (canvas) {
|
|
1189
|
+
const { width, height } = vmml.template.dimension;
|
|
1190
|
+
const fontSize = getFontSize(width, height);
|
|
1191
|
+
const { textContent, backgroundColor, textColor, posParam, fontAssetUrl, alignType } = clip.textClip;
|
|
1192
|
+
const scaleX = posParam.scaleX * fontSize / 22 / widthScaleRef.current;
|
|
1193
|
+
const scaleY = posParam.scaleY * fontSize / 22 / heightScaleRef.current;
|
|
1194
|
+
const left = canvasSize.width * posParam.centerX;
|
|
1195
|
+
const top = canvasSize.height * posParam.centerY;
|
|
1196
|
+
const bgColor = backgroundColor ? argbToRgba(backgroundColor) : "transparent";
|
|
1197
|
+
const isAiError = textContent === "\u8BF7\u8F93\u5165\u6587\u6848" && textColor === "#00000000";
|
|
1198
|
+
const textFill = argbToRgba(isAiError ? "#ffffffff" : textColor || "#ffffffff");
|
|
1199
|
+
const textBasicInfo = {
|
|
1200
|
+
isBack: backgroundColor ? true : false,
|
|
1201
|
+
colorValue: textFill,
|
|
1202
|
+
colorName: "custom",
|
|
1203
|
+
textAlign: alignType === 1 ? "center" : alignType === 2 ? "right" : "left"
|
|
1204
|
+
};
|
|
1205
|
+
const textImgData = await createTextImg({ textContent, bgColor, textColor: textFill, fontAssetUrl, textBasicInfo });
|
|
1206
|
+
const fontJSON = localStorage.getItem("VMML_PLAYER_FONTSMAP");
|
|
1207
|
+
let fontMap = {};
|
|
1208
|
+
try {
|
|
1209
|
+
fontMap = fontJSON ? JSON.parse(fontJSON) : {};
|
|
1210
|
+
} catch {
|
|
1211
|
+
fontMap = {};
|
|
1212
|
+
}
|
|
1213
|
+
const fontFamily = fontMap[fontAssetUrl] || "";
|
|
1214
|
+
fabric.Image.fromURL(textImgData.base64Image, (imgData) => {
|
|
1215
|
+
imgData.set({
|
|
1216
|
+
left,
|
|
1217
|
+
top,
|
|
1218
|
+
width: textImgData.width,
|
|
1219
|
+
height: textImgData.height,
|
|
1220
|
+
scaleX,
|
|
1221
|
+
scaleY,
|
|
1222
|
+
angle: posParam.rotationZ,
|
|
1223
|
+
originX: "center",
|
|
1224
|
+
originY: "center",
|
|
1225
|
+
clipData: {
|
|
1226
|
+
id: v4(),
|
|
1227
|
+
inPoint: clip.inPoint,
|
|
1228
|
+
inFrame: getFrames(clip.inPoint, 30),
|
|
1229
|
+
type: "\u6587\u5B57",
|
|
1230
|
+
textColor: textFill,
|
|
1231
|
+
text: textContent,
|
|
1232
|
+
bgColor,
|
|
1233
|
+
originClip: clip,
|
|
1234
|
+
fontAssetUrl,
|
|
1235
|
+
fontFamily,
|
|
1236
|
+
textBasicInfo,
|
|
1237
|
+
isAiError,
|
|
1238
|
+
duration: clip.duration
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
imgData.on("selected", (options) => {
|
|
1242
|
+
options.target.isSelected = -1;
|
|
1243
|
+
});
|
|
1244
|
+
imgData.on("moving", (options) => {
|
|
1245
|
+
options.transform.target.isSelected = 0;
|
|
1246
|
+
});
|
|
1247
|
+
imgData.on("modified", () => {
|
|
1248
|
+
const fObj = convertToJSON(imgData);
|
|
1249
|
+
if (fObj.clipData.isAiError) {
|
|
1250
|
+
fObj.clipData.textColor = "rgba(0, 0, 0, 0)";
|
|
1251
|
+
}
|
|
1252
|
+
vmmlConverterRef.current.updateClip(fObj);
|
|
1253
|
+
});
|
|
1254
|
+
canvas.add(imgData).renderAll();
|
|
1255
|
+
});
|
|
1256
|
+
} else {
|
|
1257
|
+
waitFcTasks.current.push(createTextFromClip.bind(void 0, clip));
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
const embedFontInSVG = async (svgString, url) => {
|
|
1261
|
+
if (url) {
|
|
1262
|
+
const res = await urlToBlob({ url });
|
|
1263
|
+
const fontFace = `
|
|
1264
|
+
@font-face {
|
|
1265
|
+
font-family: 'font-${url}';
|
|
1266
|
+
src: url(${res});
|
|
1267
|
+
}
|
|
1268
|
+
`;
|
|
1269
|
+
const styleElement = `<style type="text/css"><![CDATA[${fontFace}]]></style>`;
|
|
1270
|
+
return svgString.replace("</svg>", `${styleElement}</svg>`);
|
|
1271
|
+
}
|
|
1272
|
+
return svgString;
|
|
1273
|
+
};
|
|
1274
|
+
const createTextImg = async ({ textContent, bgColor, textColor, fontAssetUrl = null, textBasicInfo }) => {
|
|
1275
|
+
const container = document.createElement("div");
|
|
1276
|
+
container.style.backgroundColor = bgColor;
|
|
1277
|
+
container.style.boxSizing = "content-box";
|
|
1278
|
+
container.style.display = "inline-block";
|
|
1279
|
+
container.style.textAlign = textBasicInfo.textAlign || "left";
|
|
1280
|
+
const lines = textContent.split("\n");
|
|
1281
|
+
lines.forEach((line) => {
|
|
1282
|
+
const p = document.createElement("p");
|
|
1283
|
+
p.style.color = textColor;
|
|
1284
|
+
p.style.fontSize = "22px";
|
|
1285
|
+
p.style.lineHeight = "22px";
|
|
1286
|
+
const font = fontAssetUrl ? `font-${fontAssetUrl}` : "sansMedium";
|
|
1287
|
+
p.style.fontFamily = font;
|
|
1288
|
+
p.style.whiteSpace = "nowrap";
|
|
1289
|
+
p.style.padding = "0";
|
|
1290
|
+
p.textContent = line || " ";
|
|
1291
|
+
container.appendChild(p);
|
|
1292
|
+
});
|
|
1293
|
+
container.style.padding = "6.5px 7px 6.5px 7px";
|
|
1294
|
+
container.style.borderRadius = "5px";
|
|
1295
|
+
document.body.appendChild(container);
|
|
1296
|
+
const { width, height } = container == null ? void 0 : container.getBoundingClientRect();
|
|
1297
|
+
const dataurl = await toSvg(container);
|
|
1298
|
+
document.body.removeChild(container);
|
|
1299
|
+
const base64Image = await embedFontInSVG(dataurl, fontAssetUrl);
|
|
1300
|
+
return { base64Image, height, width };
|
|
1301
|
+
};
|
|
1302
|
+
const createText = async ({ textContent, bgColor, textColor, position, textBasicInfo, id }, fc2) => {
|
|
1303
|
+
const canvas = fc || fc2;
|
|
1304
|
+
const { left, top, angle, scaleX, scaleY, zoomX, zoomY } = position;
|
|
1305
|
+
const textImgData = await createTextImg({ textContent, bgColor, textColor, textBasicInfo });
|
|
1306
|
+
return new Promise((resolve, reject) => {
|
|
1307
|
+
fabric.Image.fromURL(textImgData.base64Image, (imgData) => {
|
|
1308
|
+
imgData.set({
|
|
1309
|
+
left,
|
|
1310
|
+
top,
|
|
1311
|
+
angle,
|
|
1312
|
+
width: textImgData.width,
|
|
1313
|
+
height: textImgData.height,
|
|
1314
|
+
scaleX,
|
|
1315
|
+
scaleY,
|
|
1316
|
+
clipData: {
|
|
1317
|
+
id: v4(),
|
|
1318
|
+
inPoint: Math.floor(frame / 30 * 1e6),
|
|
1319
|
+
inFrame: frame,
|
|
1320
|
+
type: "\u6587\u5B57",
|
|
1321
|
+
textBasicInfo,
|
|
1322
|
+
textColor,
|
|
1323
|
+
text: textContent,
|
|
1324
|
+
bgColor
|
|
1325
|
+
}
|
|
1326
|
+
});
|
|
1327
|
+
imgData.on("selected", (options) => {
|
|
1328
|
+
options.target.isSelected = -1;
|
|
1329
|
+
});
|
|
1330
|
+
imgData.on("moving", (options) => {
|
|
1331
|
+
options.transform.target.isSelected = 0;
|
|
1332
|
+
});
|
|
1333
|
+
imgData.on("modified", () => {
|
|
1334
|
+
const fObj = convertToJSON(imgData);
|
|
1335
|
+
vmmlConverterRef.current.updateClip(fObj);
|
|
1336
|
+
});
|
|
1337
|
+
canvas.centerObject(imgData);
|
|
1338
|
+
canvas.add(imgData);
|
|
1339
|
+
setTimeout(() => {
|
|
1340
|
+
canvas.renderAll();
|
|
1341
|
+
});
|
|
1342
|
+
onVideoChange(imgData.clipData);
|
|
1343
|
+
vmmlConverterRef.current.addTextClip(convertToJSON(imgData));
|
|
1344
|
+
resolve(true);
|
|
1345
|
+
});
|
|
1346
|
+
});
|
|
1347
|
+
};
|
|
1348
|
+
const updateText = async ({ id, textContent, bgColor, textColor, textBasicInfo, fontAssetUrl }) => {
|
|
1349
|
+
const textImgData = await createTextImg({ textContent, bgColor, textColor, fontAssetUrl, textBasicInfo });
|
|
1350
|
+
const target = fc.getObjects().find((item) => item.clipData.id === id);
|
|
1351
|
+
target.setSrc(textImgData.base64Image, (img) => {
|
|
1352
|
+
img.set({
|
|
1353
|
+
visible: true,
|
|
1354
|
+
clipData: {
|
|
1355
|
+
...img.clipData,
|
|
1356
|
+
textBasicInfo,
|
|
1357
|
+
textColor,
|
|
1358
|
+
text: textContent,
|
|
1359
|
+
bgColor,
|
|
1360
|
+
isAiError: false
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1363
|
+
img.setCoords();
|
|
1364
|
+
fc.renderAll();
|
|
1365
|
+
vmmlConverterRef.current.updateClip(convertToJSON(img));
|
|
1366
|
+
});
|
|
1367
|
+
};
|
|
1368
|
+
const changeObjectVisible = (id, visible = true) => {
|
|
1369
|
+
const target = fc.getObjects().find((item) => item.clipData.id === id);
|
|
1370
|
+
target.set({ visible });
|
|
1371
|
+
fc.renderAll();
|
|
1372
|
+
};
|
|
1373
|
+
const getfObjectNums = (type) => {
|
|
1374
|
+
if (fc) {
|
|
1375
|
+
const objects = fc.getObjects();
|
|
1376
|
+
return objects.filter((item) => item.clipData.type === type && !item.clipData.originClip).length;
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
const getfcObject = () => {
|
|
1380
|
+
if (fc) {
|
|
1381
|
+
return fc.getObjects();
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
const styles = useMemo(() => {
|
|
1385
|
+
return {
|
|
1386
|
+
position: "absolute",
|
|
1387
|
+
top: canvasSize.top,
|
|
1388
|
+
display: showCanvas ? "block" : "none"
|
|
1389
|
+
};
|
|
1390
|
+
}, [showCanvas]);
|
|
1391
|
+
useEffect(() => {
|
|
1392
|
+
if (!fc && canvasSize.width) {
|
|
1393
|
+
initCanvas();
|
|
1394
|
+
}
|
|
1395
|
+
return () => {
|
|
1396
|
+
if (fc) {
|
|
1397
|
+
fc.dispose();
|
|
1398
|
+
setFc(null);
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
}, [canvasSize.width]);
|
|
1402
|
+
useEffect(() => {
|
|
1403
|
+
if (!previewState && fc) {
|
|
1404
|
+
fc.discardActiveObject();
|
|
1405
|
+
checkObjectInPoint();
|
|
1406
|
+
}
|
|
1407
|
+
}, [previewState]);
|
|
1408
|
+
useEffect(() => {
|
|
1409
|
+
if (fc) {
|
|
1410
|
+
if (dragState === 1) {
|
|
1411
|
+
fc.discardActiveObject();
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}, [fc, dragState]);
|
|
1415
|
+
useEffect(() => {
|
|
1416
|
+
if (canvasSize.width && canvasSize.height && !vmmlConverterRef.current) {
|
|
1417
|
+
vmmlConverterRef.current = new VmmlConverter_default({ vmml, canvasSize });
|
|
1418
|
+
}
|
|
1419
|
+
}, [canvasSize, vmml]);
|
|
1420
|
+
useEffect(() => {
|
|
1421
|
+
if (fc) {
|
|
1422
|
+
const historyClass2 = new HistoryClass(fc);
|
|
1423
|
+
setHistory(historyClass2);
|
|
1424
|
+
if (waitFcTasks.current.length) {
|
|
1425
|
+
waitFcTasks.current.forEach((item) => item(fc));
|
|
1426
|
+
waitFcTasks.current = [];
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
}, [fc]);
|
|
1430
|
+
useImperativeHandle(ref, () => ({
|
|
1431
|
+
createImage,
|
|
1432
|
+
createText,
|
|
1433
|
+
updateText,
|
|
1434
|
+
handleRedo,
|
|
1435
|
+
handleUndo,
|
|
1436
|
+
getActions,
|
|
1437
|
+
getfObjectNums,
|
|
1438
|
+
updateImage,
|
|
1439
|
+
getfcObject,
|
|
1440
|
+
checkObjectInPoint,
|
|
1441
|
+
createImageFromClip,
|
|
1442
|
+
createTextFromClip,
|
|
1443
|
+
changeObjectVisible
|
|
1444
|
+
}));
|
|
1445
|
+
const getActions = () => {
|
|
1446
|
+
if (history) {
|
|
1447
|
+
return history.getActionType();
|
|
1448
|
+
}
|
|
1449
|
+
return [];
|
|
1450
|
+
};
|
|
1451
|
+
return /* @__PURE__ */ jsx("div", { style: styles, children: /* @__PURE__ */ jsx("canvas", { id: "canvas" }) });
|
|
1452
|
+
}
|
|
1453
|
+
);
|
|
1454
|
+
var EditorCanvas_default = EditorCanvas;
|
|
1455
|
+
|
|
1456
|
+
// src/assets/css/loading.scss
|
|
1457
|
+
var css2 = `.page-loader {
|
|
1458
|
+
position: absolute;
|
|
1459
|
+
top: 0;
|
|
1460
|
+
width: 100%;
|
|
1461
|
+
height: 100%;
|
|
1462
|
+
display: flex;
|
|
1463
|
+
justify-content: center;
|
|
1464
|
+
align-items: center;
|
|
1465
|
+
z-index: 100;
|
|
1466
|
+
overflow: hidden;
|
|
1467
|
+
}
|
|
1468
|
+
.page-loader .light {
|
|
1469
|
+
width: 75%;
|
|
1470
|
+
height: 100%;
|
|
1471
|
+
background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
|
|
1472
|
+
transform: skew(-45deg) translateX(-400%);
|
|
1473
|
+
animation: animate_light 1s infinite;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
@keyframes animate_light {
|
|
1477
|
+
100% {
|
|
1478
|
+
transform: skew(-45deg) translateX(200%);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiRDpcXHByb2plY3RzXFx2bW1sLXBsYXllclxccGFja2FnZXNcXGVkaXRvclxcc3JjXFxhc3NldHNcXGNzcyIsInNvdXJjZXMiOlsibG9hZGluZy5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBOztBQUNBO0VBQ0U7RUFDQTtFQUNBO0VBT0E7RUFDQTs7O0FBSUo7RUFDRTtJQUNFIiwic291cmNlc0NvbnRlbnQiOlsiXHJcbi5wYWdlLWxvYWRlciB7XHJcbiAgcG9zaXRpb246IGFic29sdXRlO1xyXG4gIHRvcDogMDtcclxuICB3aWR0aDogMTAwJTtcclxuICBoZWlnaHQ6IDEwMCU7XHJcbiAgZGlzcGxheTogZmxleDtcclxuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcclxuICBhbGlnbi1pdGVtczogY2VudGVyO1xyXG4gIHotaW5kZXg6IDEwMDtcclxuICBvdmVyZmxvdzogaGlkZGVuO1xyXG4gIC5saWdodCB7XHJcbiAgICB3aWR0aDogNzUlO1xyXG4gICAgaGVpZ2h0OiAxMDAlO1xyXG4gICAgYmFja2dyb3VuZDogbGluZWFyLWdyYWRpZW50KDkwZGVnLFxyXG4gICAgICAgIHJnYmEoMjU1LCAyNTUsIDI1NSwgMCksXHJcbiAgICAgICAgcmdiYSgyNTUsIDI1NSwgMjU1LCAwLjE1KSxcclxuICAgICAgICByZ2JhKDI1NSwgMjU1LCAyNTUsIDAuMyksXHJcbiAgICAgICAgcmdiYSgyNTUsIDI1NSwgMjU1LCAwLjE1KSxcclxuICAgICAgICByZ2JhKDI1NSwgMjU1LCAyNTUsIDAuMCksXHJcbiAgICAgICk7XHJcbiAgICB0cmFuc2Zvcm06IHNrZXcoLTQ1ZGVnKSB0cmFuc2xhdGVYKC00MDAlKTtcclxuICAgIGFuaW1hdGlvbjogYW5pbWF0ZV9saWdodCAxcyBpbmZpbml0ZTtcclxuICB9XHJcbn1cclxuXHJcbkBrZXlmcmFtZXMgYW5pbWF0ZV9saWdodCB7XHJcbiAgMTAwJSB7XHJcbiAgICB0cmFuc2Zvcm06IHNrZXcoLTQ1ZGVnKSB0cmFuc2xhdGVYKDIwMCUpO1xyXG4gIH1cclxufSJdfQ== */`;
|
|
1482
|
+
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css2));
|
|
1483
|
+
var Loaidng = ({ show }) => {
|
|
1484
|
+
const styles = {
|
|
1485
|
+
display: show ? "flex" : "none"
|
|
1486
|
+
};
|
|
1487
|
+
return /* @__PURE__ */ jsx("div", { style: styles, className: "page-loader", children: /* @__PURE__ */ jsx("div", { className: "light" }) });
|
|
1488
|
+
};
|
|
1489
|
+
var Loading_default = Loaidng;
|
|
1490
|
+
|
|
1491
|
+
// src/assets/css/maxTextLayer.scss
|
|
1492
|
+
var css3 = `.container {
|
|
1493
|
+
width: 100vw;
|
|
1494
|
+
height: 100vh;
|
|
1495
|
+
position: fixed;
|
|
1496
|
+
left: 0;
|
|
1497
|
+
top: 0;
|
|
1498
|
+
display: flex;
|
|
1499
|
+
flex-flow: row nowrap;
|
|
1500
|
+
align-items: center;
|
|
1501
|
+
justify-content: center;
|
|
1502
|
+
}
|
|
1503
|
+
.container .main_text {
|
|
1504
|
+
background: #000000;
|
|
1505
|
+
border-radius: 16px;
|
|
1506
|
+
backdrop-filter: blur(40px);
|
|
1507
|
+
padding: 3.2vw;
|
|
1508
|
+
font-weight: 400;
|
|
1509
|
+
font-size: 4vw;
|
|
1510
|
+
color: #FFFFFF;
|
|
1511
|
+
line-height: 5.6vw;
|
|
1512
|
+
text-align: right;
|
|
1513
|
+
font-style: normal;
|
|
1514
|
+
}
|
|
1515
|
+
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiRDpcXHByb2plY3RzXFx2bW1sLXBsYXllclxccGFja2FnZXNcXGVkaXRvclxcc3JjXFxhc3NldHNcXGNzcyIsInNvdXJjZXMiOlsibWF4VGV4dExheWVyLnNjc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBUUE7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBQ0E7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQSIsInNvdXJjZXNDb250ZW50IjpbIiR2bV9iYXNlOiA3NTA7XHJcblxyXG5AZnVuY3Rpb24gdm0oJHB4KSB7XHJcblxyXG4gICAgQHJldHVybiAoJHB4IC8gNzUwKSAqIDEwMHZ3O1xyXG5cclxufVxyXG5cclxuLmNvbnRhaW5lcntcclxuICB3aWR0aDogMTAwdnc7XHJcbiAgaGVpZ2h0OiAxMDB2aDtcclxuICBwb3NpdGlvbjogZml4ZWQ7XHJcbiAgbGVmdDogMDtcclxuICB0b3A6IDA7XHJcbiAgZGlzcGxheTogZmxleDtcclxuICBmbGV4LWZsb3c6IHJvdyBub3dyYXA7XHJcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcclxuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcclxuICAubWFpbl90ZXh0e1xyXG4gICAgYmFja2dyb3VuZDogIzAwMDAwMDtcclxuICAgIGJvcmRlci1yYWRpdXM6IDE2cHg7XHJcbiAgICBiYWNrZHJvcC1maWx0ZXI6IGJsdXIoNDBweCk7XHJcbiAgICBwYWRkaW5nOiB2bSgyNCk7XHJcbiAgICBmb250LXdlaWdodDogNDAwO1xyXG4gICAgZm9udC1zaXplOiB2bSgzMCk7XHJcbiAgICBjb2xvcjogI0ZGRkZGRjtcclxuICAgIGxpbmUtaGVpZ2h0OiB2bSg0Mik7XHJcbiAgICB0ZXh0LWFsaWduOiByaWdodDtcclxuICAgIGZvbnQtc3R5bGU6IG5vcm1hbDtcclxuICB9XHJcbn0iXX0= */`;
|
|
1516
|
+
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css3));
|
|
1517
|
+
var MaxTextLayer = ({
|
|
1518
|
+
show = false,
|
|
1519
|
+
textLayerHide,
|
|
1520
|
+
text
|
|
1521
|
+
}) => {
|
|
1522
|
+
useEffect(() => {
|
|
1523
|
+
const timer = setTimeout(() => {
|
|
1524
|
+
textLayerHide();
|
|
1525
|
+
}, 2e3);
|
|
1526
|
+
return () => {
|
|
1527
|
+
clearTimeout(timer);
|
|
1528
|
+
};
|
|
1529
|
+
});
|
|
1530
|
+
return show && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "container", onClick: textLayerHide, children: /* @__PURE__ */ jsx("span", { className: "main_text", children: text }) }) });
|
|
1531
|
+
};
|
|
1532
|
+
var MaxTextLayer_default = MaxTextLayer;
|
|
1533
|
+
|
|
1534
|
+
// src/assets/css/editorTextMenu.scss
|
|
1535
|
+
var css4 = `@charset "UTF-8";
|
|
1536
|
+
.overlay {
|
|
1537
|
+
position: fixed;
|
|
1538
|
+
top: 0;
|
|
1539
|
+
left: 0;
|
|
1540
|
+
width: 100%;
|
|
1541
|
+
height: 100%;
|
|
1542
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
1543
|
+
display: flex;
|
|
1544
|
+
justify-content: center;
|
|
1545
|
+
align-items: center;
|
|
1546
|
+
color: white;
|
|
1547
|
+
font-size: 24px;
|
|
1548
|
+
overflow: hidden;
|
|
1549
|
+
}
|
|
1550
|
+
.overlay > .text-header {
|
|
1551
|
+
width: 100%;
|
|
1552
|
+
display: flex;
|
|
1553
|
+
justify-content: space-between;
|
|
1554
|
+
align-items: center;
|
|
1555
|
+
height: 11.467vw;
|
|
1556
|
+
padding-left: 4.4vw;
|
|
1557
|
+
padding-right: 3.2vw;
|
|
1558
|
+
box-sizing: border-box;
|
|
1559
|
+
position: fixed;
|
|
1560
|
+
top: 0;
|
|
1561
|
+
transition: all 0.01s;
|
|
1562
|
+
z-index: 16;
|
|
1563
|
+
}
|
|
1564
|
+
.overlay > .text-header > .close {
|
|
1565
|
+
width: 5.0666666667vw;
|
|
1566
|
+
height: 5.0666666667vw;
|
|
1567
|
+
}
|
|
1568
|
+
.overlay > .text-header > .close img {
|
|
1569
|
+
width: 100%;
|
|
1570
|
+
height: 100%;
|
|
1571
|
+
}
|
|
1572
|
+
.overlay > .text-header > .history-operate {
|
|
1573
|
+
height: 7.2vw;
|
|
1574
|
+
display: none;
|
|
1575
|
+
align-items: center;
|
|
1576
|
+
position: absolute;
|
|
1577
|
+
left: 50%;
|
|
1578
|
+
top: 50%;
|
|
1579
|
+
transform: translate(-50%, -50%);
|
|
1580
|
+
}
|
|
1581
|
+
.overlay > .text-header > .history-operate img {
|
|
1582
|
+
width: 4.667vw;
|
|
1583
|
+
height: 5.067vw;
|
|
1584
|
+
}
|
|
1585
|
+
.overlay > .text-header > .history-operate > img:last-child {
|
|
1586
|
+
margin-left: 8vw;
|
|
1587
|
+
}
|
|
1588
|
+
.overlay > .text-header > .next-button {
|
|
1589
|
+
display: flex;
|
|
1590
|
+
justify-content: center;
|
|
1591
|
+
align-items: center;
|
|
1592
|
+
width: 16vw;
|
|
1593
|
+
height: 7.2vw;
|
|
1594
|
+
line-height: 7.2vw;
|
|
1595
|
+
background: #1677FF;
|
|
1596
|
+
border-radius: 6.533vw;
|
|
1597
|
+
text-align: center;
|
|
1598
|
+
font-size: 3.2vw;
|
|
1599
|
+
color: #fff;
|
|
1600
|
+
border: 0;
|
|
1601
|
+
}
|
|
1602
|
+
.overlay .cover {
|
|
1603
|
+
position: fixed;
|
|
1604
|
+
bottom: 8vw;
|
|
1605
|
+
width: 100%;
|
|
1606
|
+
height: 10.6666666667vw;
|
|
1607
|
+
z-index: 999;
|
|
1608
|
+
transition: all 0.1s;
|
|
1609
|
+
}
|
|
1610
|
+
.overlay .text-input, .overlay .mappingarea {
|
|
1611
|
+
font-family: PingFangSC, PingFang SC;
|
|
1612
|
+
border: none;
|
|
1613
|
+
font-size: 22px;
|
|
1614
|
+
/* \u53D6\u6D88\u5916\u8FB9\u6846 */
|
|
1615
|
+
outline: none;
|
|
1616
|
+
background-color: rgba(0, 0, 0, 0);
|
|
1617
|
+
line-height: 30px;
|
|
1618
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
1619
|
+
scrollbar-width: none; /* Firefox */
|
|
1620
|
+
transition: all 0.1s;
|
|
1621
|
+
}
|
|
1622
|
+
.overlay .text-input::-webkit-scrollbar, .overlay .mappingarea::-webkit-scrollbar {
|
|
1623
|
+
display: none;
|
|
1624
|
+
}
|
|
1625
|
+
.overlay .text-input {
|
|
1626
|
+
padding-top: 1.0666666667vw;
|
|
1627
|
+
padding-bottom: 1.0666666667vw;
|
|
1628
|
+
padding-left: 1.6vw;
|
|
1629
|
+
padding-right: 1.3333333333vw;
|
|
1630
|
+
z-index: 10;
|
|
1631
|
+
width: 84vw;
|
|
1632
|
+
caret-color: #1677ff;
|
|
1633
|
+
position: absolute;
|
|
1634
|
+
top: 30%;
|
|
1635
|
+
left: 5%;
|
|
1636
|
+
height: 200px;
|
|
1637
|
+
word-break: break-all;
|
|
1638
|
+
}
|
|
1639
|
+
.overlay .mappingarea {
|
|
1640
|
+
padding-top: 1.0666666667vw;
|
|
1641
|
+
padding-bottom: 1.0666666667vw;
|
|
1642
|
+
padding-left: 1.6vw;
|
|
1643
|
+
padding-right: 1.3333333333vw;
|
|
1644
|
+
border-radius: 1.3333333333vw;
|
|
1645
|
+
border: 0;
|
|
1646
|
+
position: fixed;
|
|
1647
|
+
top: 30%;
|
|
1648
|
+
left: 5%;
|
|
1649
|
+
height: fit-content;
|
|
1650
|
+
max-height: 200px;
|
|
1651
|
+
color: transparent;
|
|
1652
|
+
overflow-y: scroll;
|
|
1653
|
+
z-index: 9;
|
|
1654
|
+
display: flex;
|
|
1655
|
+
flex-flow: column nowrap;
|
|
1656
|
+
box-sizing: content-box;
|
|
1657
|
+
}
|
|
1658
|
+
.overlay .mappingarea .mappingarea_span {
|
|
1659
|
+
font-size: 22px;
|
|
1660
|
+
max-width: 84vw;
|
|
1661
|
+
white-space: pre-wrap;
|
|
1662
|
+
word-break: break-all;
|
|
1663
|
+
}
|
|
1664
|
+
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiRDpcXHByb2plY3RzXFx2bW1sLXBsYXllclxccGFja2FnZXNcXGVkaXRvclxcc3JjXFxhc3NldHNcXGNzcyIsInNvdXJjZXMiOlsiZWRpdG9yVGV4dE1lbnUuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBT0E7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFHQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBRUE7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBQ0E7RUFDRTtFQUNBOztBQUVBO0VBQ0U7RUFDQTs7QUFJSjtFQUNFO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBOztBQUVBO0VBQ0U7RUFDQTs7QUFHRjtFQUNFOztBQUlKO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBOztBQUlKO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBOztBQUdGO0VBRUU7RUFDQTtFQUVBO0FBQ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hlaWdodDogZml0LWNvbnRlbnQ7XHJcbiAgICBtYXgtaGVpZ2h0OiAyMDBweDtcclxuICAgIGNvbG9yOiB0cmFuc3BhcmVudDsgLy/orr7nva7popzoibLpgI/mmI7vvIzkv53or4Hog4zmma/popzoibJcclxuICAgIG92ZXJmbG93LXk6IHNjcm9sbDtcclxuICAgIHotaW5kZXg6IDk7XHJcbiAgICBkaXNwbGF5OiBmbGV4O1xyXG4gICAgZmxleC1mbG93OiBjb2x1bW4gbm93cmFwO1xyXG4gICAgYm94LXNpemluZzogY29udGVudC1ib3g7XHJcbiAgICAubWFwcGluZ2FyZWFfc3BhbntcclxuICAgICAgZm9udC1zaXplOiAyMnB4O1xyXG4gICAgICBtYXgtd2lkdGg6IDg0dnc7XHJcbiAgICAgIHdoaXRlLXNwYWNlOiBwcmUtd3JhcDtcclxuICAgICAgd29yZC1icmVhazogYnJlYWstYWxsO1xyXG4gICAgfVxyXG4gIH1cclxufSJdfQ== */`;
|
|
1665
|
+
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css4));
|
|
1666
|
+
var checkIPhoneSeries = () => {
|
|
1667
|
+
const screenWidth = window.screen.width;
|
|
1668
|
+
const screenHeight = window.screen.height;
|
|
1669
|
+
if (screenWidth === 320 && screenHeight === 480) {
|
|
1670
|
+
return "iPhone 4 or 4S";
|
|
1671
|
+
} else if (screenWidth === 375 && screenHeight === 667) {
|
|
1672
|
+
return "iPhone 6/7/8";
|
|
1673
|
+
} else if (screenWidth === 414 && screenHeight === 736) {
|
|
1674
|
+
return "iPhone 6/7/8 Plus";
|
|
1675
|
+
} else if (screenWidth === 375 && screenHeight === 812) {
|
|
1676
|
+
return "iPhone X/XS";
|
|
1677
|
+
} else if (screenWidth === 414 && screenHeight === 896) {
|
|
1678
|
+
return "iPhone XR/11";
|
|
1679
|
+
} else if (screenWidth === 414 && screenHeight === 844) {
|
|
1680
|
+
return "iPhone 12 mini";
|
|
1681
|
+
} else if (screenWidth === 414 && screenHeight === 915) {
|
|
1682
|
+
return "iPhone 13 Pro Max/12 Pro Max";
|
|
1683
|
+
} else if (screenWidth === 390 && screenHeight === 844) {
|
|
1684
|
+
return "iPhone 13 mini";
|
|
1685
|
+
} else {
|
|
1686
|
+
return "Unknown iPhone model";
|
|
1687
|
+
}
|
|
1688
|
+
};
|
|
1689
|
+
var iPhoneAdapter = (series) => {
|
|
1690
|
+
const seriesArr = ["iPhone 6/7/8 Plus", "iPhone 6/7/8"];
|
|
1691
|
+
return seriesArr.includes(series);
|
|
1692
|
+
};
|
|
1693
|
+
var watchKeyBoard = (callback) => {
|
|
1694
|
+
const focusInHandler = (e) => {
|
|
1695
|
+
callback(true);
|
|
1696
|
+
stopMove();
|
|
1697
|
+
};
|
|
1698
|
+
const focusOutHandler = (e) => {
|
|
1699
|
+
callback(false);
|
|
1700
|
+
};
|
|
1701
|
+
document.body.addEventListener("focusin", focusInHandler);
|
|
1702
|
+
document.body.addEventListener("focusout", focusOutHandler);
|
|
1703
|
+
return () => {
|
|
1704
|
+
document.body.removeEventListener("focusin", focusInHandler);
|
|
1705
|
+
document.body.removeEventListener("focusout", focusOutHandler);
|
|
1706
|
+
};
|
|
1707
|
+
};
|
|
1708
|
+
var stopMove = () => {
|
|
1709
|
+
const dom = document.getElementsByClassName("overlay")[0];
|
|
1710
|
+
const element = document.querySelector(".mappingarea");
|
|
1711
|
+
const stopScroll = (e) => {
|
|
1712
|
+
var _a, _b, _c;
|
|
1713
|
+
const lastTouchPositionX = 0;
|
|
1714
|
+
const lastTouchPositionY = 0;
|
|
1715
|
+
const currentTouchPositionX = e.touches[0].clientX;
|
|
1716
|
+
const currentTouchPositionY = e.touches[0].clientY;
|
|
1717
|
+
const deltaX = currentTouchPositionX - lastTouchPositionX;
|
|
1718
|
+
const deltaY = currentTouchPositionY - lastTouchPositionY;
|
|
1719
|
+
if (["text-header", "overlay", "text_bg_change"].includes((_a = e.target) == null ? void 0 : _a.className)) {
|
|
1720
|
+
e.preventDefault();
|
|
1721
|
+
}
|
|
1722
|
+
if (element) {
|
|
1723
|
+
const willOverflow = element.scrollHeight > element.clientHeight;
|
|
1724
|
+
if (willOverflow) {
|
|
1725
|
+
return;
|
|
1726
|
+
} else if (((_b = e.target) == null ? void 0 : _b.className.split(" ").includes("color-item")) || ((_c = e.target) == null ? void 0 : _c.className) === "text_color_change") {
|
|
1727
|
+
if (deltaX < 0 || deltaX > 0) {
|
|
1728
|
+
return;
|
|
1729
|
+
} else {
|
|
1730
|
+
e.preventDefault();
|
|
1731
|
+
}
|
|
1732
|
+
} else {
|
|
1733
|
+
if (Math.abs(deltaY) > Math.abs(deltaX)) {
|
|
1734
|
+
e.preventDefault();
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
e.preventDefault();
|
|
1739
|
+
};
|
|
1740
|
+
if (dom) {
|
|
1741
|
+
dom.addEventListener("touchmove", stopScroll);
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
var onKeyBoardAction = (status, headerRef, textareaRef, coverRef, mappingareaRef, aimTop) => {
|
|
1745
|
+
if (isIOS()) {
|
|
1746
|
+
forIos(status, headerRef, textareaRef, coverRef);
|
|
1747
|
+
}
|
|
1748
|
+
};
|
|
1749
|
+
var forIos = (status, headerRef, textareaRef, coverRef, mappingareaRef) => {
|
|
1750
|
+
const series = checkIPhoneSeries();
|
|
1751
|
+
const isIPhoneAdapt = iPhoneAdapter(series);
|
|
1752
|
+
if (status) {
|
|
1753
|
+
const totalHeight = document.documentElement.clientHeight || document.body.clientHeight;
|
|
1754
|
+
const keyBoardHeight = totalHeight * 0.25;
|
|
1755
|
+
if (coverRef && textareaRef) {
|
|
1756
|
+
const textareaRefPos = textareaRef.getBoundingClientRect();
|
|
1757
|
+
const { height } = textareaRefPos;
|
|
1758
|
+
if (isIPhoneAdapt) {
|
|
1759
|
+
coverRef.style.bottom = `${keyBoardHeight + 50}px`;
|
|
1760
|
+
} else {
|
|
1761
|
+
coverRef.style.transform = `translateY(${-(height + 10)}px)`;
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
} else {
|
|
1765
|
+
if (coverRef) {
|
|
1766
|
+
if (isIPhoneAdapt) {
|
|
1767
|
+
coverRef.style.bottom = `8vw`;
|
|
1768
|
+
} else {
|
|
1769
|
+
coverRef.style.transform = `translateY(0px)`;
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
|
|
1775
|
+
// src/assets/css/colorSelector.scss
|
|
1776
|
+
var css5 = `@charset "UTF-8";
|
|
1777
|
+
.color-selector {
|
|
1778
|
+
width: 100%;
|
|
1779
|
+
height: 100%;
|
|
1780
|
+
display: flex;
|
|
1781
|
+
flex-flow: row nowrap;
|
|
1782
|
+
align-items: center;
|
|
1783
|
+
padding-right: 2.6666666667vw;
|
|
1784
|
+
}
|
|
1785
|
+
.color-selector .text_bg_change {
|
|
1786
|
+
width: 6.4vw;
|
|
1787
|
+
height: 6.4vw;
|
|
1788
|
+
flex: 0 0 auto;
|
|
1789
|
+
text-align: center;
|
|
1790
|
+
line-height: 6.4vw;
|
|
1791
|
+
padding: 0 4.8vw;
|
|
1792
|
+
margin-right: 4vw;
|
|
1793
|
+
border-right: 2px solid rgba(255, 255, 255, 0.4); /* \u8BBE\u7F6E\u5DE6\u8FB9\u6846\u7684\u5BBD\u5EA6\u3001\u6837\u5F0F\u548C\u989C\u8272 */
|
|
1794
|
+
}
|
|
1795
|
+
.color-selector .text_color_change {
|
|
1796
|
+
flex: 1 1 auto;
|
|
1797
|
+
display: flex;
|
|
1798
|
+
flex-flow: row nowrap;
|
|
1799
|
+
overflow-x: auto;
|
|
1800
|
+
white-space: nowrap;
|
|
1801
|
+
height: 100%;
|
|
1802
|
+
padding-right: 1.3333333333vw;
|
|
1803
|
+
align-items: center;
|
|
1804
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
1805
|
+
scrollbar-width: none; /* Firefox */
|
|
1806
|
+
}
|
|
1807
|
+
.color-selector .text_color_change > * {
|
|
1808
|
+
flex-shrink: 0;
|
|
1809
|
+
}
|
|
1810
|
+
.color-selector .text_color_change .color-item {
|
|
1811
|
+
width: 6.4vw;
|
|
1812
|
+
height: 6.4vw;
|
|
1813
|
+
border-radius: 50%;
|
|
1814
|
+
margin: 0 2vw;
|
|
1815
|
+
box-sizing: border-box;
|
|
1816
|
+
}
|
|
1817
|
+
.color-selector .text_color_change .black-border {
|
|
1818
|
+
border: 0.2666666667vw solid #333333;
|
|
1819
|
+
}
|
|
1820
|
+
.color-selector .text_color_change .current {
|
|
1821
|
+
box-shadow: 0 0 0 0.8vw #1677FF;
|
|
1822
|
+
}
|
|
1823
|
+
.color-selector .text_color_change::-webkit-scrollbar {
|
|
1824
|
+
display: none;
|
|
1825
|
+
}
|
|
1826
|
+
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiRDpcXHByb2plY3RzXFx2bW1sLXBsYXllclxccGFja2FnZXNcXGVkaXRvclxcc3JjXFxhc3NldHNcXGNzcyIsInNvdXJjZXMiOlsiY29sb3JTZWxlY3Rvci5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFRQTtFQUNFO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7QUFDQTtFQUNFO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBRUY7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBc0JBO0VBQ0E7O0FBdEJBO0VBQ0U7O0FBRUY7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBOztBQUVGO0VBQ0U7O0FBRUY7RUFFRTs7QUFHRjtFQUNJIiwic291cmNlc0NvbnRlbnQiOlsiJHZtX2Jhc2U6IDc1MDtcclxuXHJcbkBmdW5jdGlvbiB2bSgkcHgpIHtcclxuXHJcbiAgIC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yDpmLLmraLlrZDlhYPntKDnvKnlsI9cclxuICAgIH1cclxuICAgIC5jb2xvci1pdGVte1xyXG4gICAgICB3aWR0aDogdm0oNDgpO1xyXG4gICAgICBoZWlnaHQ6dm0oNDgpO1xyXG4gICAgICBib3JkZXItcmFkaXVzOiA1MCU7XHJcbiAgICAgIG1hcmdpbjogMCB2bSgxNSk7XHJcbiAgICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7XHJcbiAgICB9XHJcbiAgICAuYmxhY2stYm9yZGVye1xyXG4gICAgICBib3JkZXI6dm0oMikgc29saWQgIzMzMzMzM0ZGXHJcbiAgICB9XHJcbiAgICAuY3VycmVudHtcclxuICAgICAgLy8gYm9yZGVyOiB2bSg2KSBzb2xpZCAjMTY3N0ZGO1xyXG4gICAgICBib3gtc2hhZG93OiAwIDAgMCB2bSg2KSAjMTY3N0ZGO1xyXG4gICAgfVxyXG4gICAgLy8g6ZqQ6JeP5rua5Yqo5p2h77yM5L2G5LuN54S25L+d5oyB5rua5Yqo5Yqf6IO9XHJcbiAgICAmOjotd2Via2l0LXNjcm9sbGJhciB7IFxyXG4gICAgICAgIGRpc3BsYXk6IG5vbmU7IFxyXG4gICAgfVxyXG4gICAgLW1zLW92ZXJmbG93LXN0eWxlOiBub25lOyAgLyogSUUgYW5kIEVkZ2UgKi9cclxuICAgIHNjcm9sbGJhci13aWR0aDogbm9uZTsgIC8qIEZpcmVmb3ggKi9cclxuICB9XHJcbn0iXX0= */`;
|
|
1827
|
+
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css5));
|
|
1828
|
+
var colorList = [
|
|
1829
|
+
{ colorName: "white", colorValue: "rgb(255,255,255)" },
|
|
1830
|
+
{ colorName: "black", colorValue: "rgb(0,0,0)" },
|
|
1831
|
+
{ colorName: "gray", colorValue: "rgb(153,153,153)" },
|
|
1832
|
+
{ colorName: "red", colorValue: "rgb(248,82,81)" },
|
|
1833
|
+
{ colorName: "orange", colorValue: "rgb(250,158,60)" },
|
|
1834
|
+
{ colorName: "yellow", colorValue: "rgb(255,196,0)" },
|
|
1835
|
+
{ colorName: "lightGreen", colorValue: "rgb(145,212,0)" },
|
|
1836
|
+
{ colorName: "green", colorValue: "rgb(0,181,212)" },
|
|
1837
|
+
{ colorName: "lightBlue", colorValue: "rgb(0,183,244)" },
|
|
1838
|
+
{ colorName: "blue", colorValue: "rgb(23,120,255)" },
|
|
1839
|
+
{ colorName: "purple", colorValue: "rgb(82,95,255)" }
|
|
1840
|
+
];
|
|
1841
|
+
var ColorSelector = forwardRef(({ onColorChange, onBackGroundChange }, ref) => {
|
|
1842
|
+
const [currentColorItem, setCurrentColorItem] = useState(colorList.find((color) => color.colorName === "red"));
|
|
1843
|
+
useState(null);
|
|
1844
|
+
const [isSetBack, setIsSetBack] = useState(false);
|
|
1845
|
+
const setColorClass = (item) => {
|
|
1846
|
+
const { colorName } = currentColorItem;
|
|
1847
|
+
const classes = [
|
|
1848
|
+
item.colorName === "black" && "black-border",
|
|
1849
|
+
item.colorName === colorName && "current",
|
|
1850
|
+
"color-item"
|
|
1851
|
+
].filter(Boolean).join(" ");
|
|
1852
|
+
return classes;
|
|
1853
|
+
};
|
|
1854
|
+
const handleColorClick = (item) => {
|
|
1855
|
+
setCurrentColorItem(item);
|
|
1856
|
+
onColorChange(item);
|
|
1857
|
+
};
|
|
1858
|
+
const handleChangeBackGround = () => {
|
|
1859
|
+
const setBgStatus = new Promise((resolve, reject) => {
|
|
1860
|
+
setIsSetBack(!isSetBack);
|
|
1861
|
+
resolve();
|
|
1862
|
+
});
|
|
1863
|
+
setBgStatus.then(() => {
|
|
1864
|
+
onBackGroundChange(currentColorItem);
|
|
1865
|
+
});
|
|
1866
|
+
};
|
|
1867
|
+
const getBackState = () => {
|
|
1868
|
+
return isSetBack;
|
|
1869
|
+
};
|
|
1870
|
+
useImperativeHandle(ref, () => ({
|
|
1871
|
+
getBackState,
|
|
1872
|
+
setIsSetBack,
|
|
1873
|
+
setCurrentColorItem
|
|
1874
|
+
}));
|
|
1875
|
+
return /* @__PURE__ */ jsxs("div", { className: "color-selector", children: [
|
|
1876
|
+
/* @__PURE__ */ jsx(
|
|
1877
|
+
"div",
|
|
1878
|
+
{
|
|
1879
|
+
className: "text_bg_change",
|
|
1880
|
+
onClick: () => {
|
|
1881
|
+
handleChangeBackGround();
|
|
1882
|
+
},
|
|
1883
|
+
children: /* @__PURE__ */ jsx("img", { alt: "", src: isSetBack ? iconText2 : iconText1, style: { width: "100%", height: "100%" } })
|
|
1884
|
+
}
|
|
1885
|
+
),
|
|
1886
|
+
/* @__PURE__ */ jsx("div", { className: "text_color_change", children: colorList.map((item) => {
|
|
1887
|
+
return /* @__PURE__ */ jsx(
|
|
1888
|
+
"div",
|
|
1889
|
+
{
|
|
1890
|
+
className: setColorClass(item),
|
|
1891
|
+
style: { backgroundColor: item.colorValue },
|
|
1892
|
+
onClick: () => {
|
|
1893
|
+
handleColorClick(item);
|
|
1894
|
+
}
|
|
1895
|
+
},
|
|
1896
|
+
item.colorName
|
|
1897
|
+
);
|
|
1898
|
+
}) })
|
|
1899
|
+
] });
|
|
1900
|
+
});
|
|
1901
|
+
var ColorSelector_default = ColorSelector;
|
|
1902
|
+
var formatText = (text, maxLengthBase = 40) => {
|
|
1903
|
+
var _a;
|
|
1904
|
+
const newlineRegex = /(\r\n|\r|\n)/g;
|
|
1905
|
+
const matches = ((_a = text.match(newlineRegex)) == null ? void 0 : _a.length) || 0;
|
|
1906
|
+
const maxLength = maxLengthBase + matches;
|
|
1907
|
+
let trimmedText = text.substring(0, maxLength);
|
|
1908
|
+
if (text.length - matches === maxLengthBase) {
|
|
1909
|
+
trimmedText = trimmedText.replace(/(\r\n|\r|\n)+$/g, "");
|
|
1910
|
+
}
|
|
1911
|
+
return trimmedText;
|
|
1912
|
+
};
|
|
1913
|
+
var TextMenu = forwardRef(({ createText, textClose, textInfo, showTextButtons }, ref) => {
|
|
1914
|
+
const formRef = useRef(null);
|
|
1915
|
+
const headerRef = useRef(null);
|
|
1916
|
+
const textareaRef = useRef(null);
|
|
1917
|
+
const coverRef = useRef(null);
|
|
1918
|
+
const mappingarea = useRef(null);
|
|
1919
|
+
const [textContent, setTextContent] = useState("");
|
|
1920
|
+
const [bgColor, setBgColor] = useState("transparent");
|
|
1921
|
+
const [textColor, setTextColor] = useState("rgb(248,82,81)");
|
|
1922
|
+
const [textPos, setTextPos] = useState({ left: 0, top: 0, angle: 0, scaleX: 0.75, scaleY: 0.75, zoomX: 0, zoomY: 0 });
|
|
1923
|
+
const [textBasicInfo, setTextBasicInfo] = useState({
|
|
1924
|
+
colorName: "red",
|
|
1925
|
+
colorValue: "rgb(248,82,81)",
|
|
1926
|
+
isBack: false,
|
|
1927
|
+
textAlign: "left"
|
|
1928
|
+
});
|
|
1929
|
+
const colorSelectorRef = useRef(null);
|
|
1930
|
+
const [textContentOnShow, setTextContentOnShow] = useState([]);
|
|
1931
|
+
const [scrollYValue, setScrollYValue] = useState(() => {
|
|
1932
|
+
return Number.parseInt(localStorage.getItem("scrollYValue")) || null;
|
|
1933
|
+
});
|
|
1934
|
+
const scrollYValueRef = useRef(scrollYValue);
|
|
1935
|
+
useEffect(() => {
|
|
1936
|
+
const callback = (status) => {
|
|
1937
|
+
if (scrollYValueRef.current === null) {
|
|
1938
|
+
setTimeout(() => {
|
|
1939
|
+
const newScrollYValue = window.scrollY;
|
|
1940
|
+
setScrollYValue(newScrollYValue);
|
|
1941
|
+
scrollYValueRef.current = newScrollYValue;
|
|
1942
|
+
localStorage.setItem("scrollYValue", newScrollYValue.toString());
|
|
1943
|
+
}, 150);
|
|
1944
|
+
}
|
|
1945
|
+
setTimeout(() => {
|
|
1946
|
+
onKeyBoardAction(
|
|
1947
|
+
status,
|
|
1948
|
+
headerRef.current,
|
|
1949
|
+
textareaRef.current,
|
|
1950
|
+
coverRef.current,
|
|
1951
|
+
mappingarea.current
|
|
1952
|
+
);
|
|
1953
|
+
}, 200);
|
|
1954
|
+
};
|
|
1955
|
+
const removeListeners = watchKeyBoard(callback);
|
|
1956
|
+
return () => {
|
|
1957
|
+
removeListeners();
|
|
1958
|
+
};
|
|
1959
|
+
}, []);
|
|
1960
|
+
useEffect(() => {
|
|
1961
|
+
const syncScroll = () => {
|
|
1962
|
+
if (textareaRef.current && mappingarea.current) {
|
|
1963
|
+
const scrollPosition = textareaRef.current.scrollTop;
|
|
1964
|
+
mappingarea.current.scrollTop = scrollPosition;
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
1967
|
+
if (textareaRef.current) {
|
|
1968
|
+
textareaRef.current.addEventListener("scroll", syncScroll);
|
|
1969
|
+
textareaRef.current.addEventListener("input", syncScroll);
|
|
1970
|
+
}
|
|
1971
|
+
return () => {
|
|
1972
|
+
if (textareaRef.current) {
|
|
1973
|
+
textareaRef.current.removeEventListener("scroll", syncScroll);
|
|
1974
|
+
textareaRef.current.removeEventListener("input", syncScroll);
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
}, []);
|
|
1978
|
+
useEffect(() => {
|
|
1979
|
+
let lines = [];
|
|
1980
|
+
if (textContent.includes("\r")) {
|
|
1981
|
+
lines = textContent.split("\r");
|
|
1982
|
+
} else {
|
|
1983
|
+
lines = textContent.split("\n");
|
|
1984
|
+
}
|
|
1985
|
+
setTextContentOnShow(lines);
|
|
1986
|
+
}, [textContent]);
|
|
1987
|
+
useEffect(() => {
|
|
1988
|
+
if (Object.keys(textInfo).length > 0) {
|
|
1989
|
+
setText(textInfo);
|
|
1990
|
+
} else {
|
|
1991
|
+
resetInfo();
|
|
1992
|
+
}
|
|
1993
|
+
}, [textInfo]);
|
|
1994
|
+
useEffect(() => {
|
|
1995
|
+
if (!isIOS()) {
|
|
1996
|
+
if (mappingarea.current && textareaRef.current) {
|
|
1997
|
+
textareaRef.current.style.position = "static";
|
|
1998
|
+
mappingarea.current.style.maxHeight = textareaRef.current.style.height = "50vh";
|
|
1999
|
+
mappingarea.current.style.maxWidth = getComputedStyle(textareaRef.current).width;
|
|
2000
|
+
textareaRef.current.focus();
|
|
2001
|
+
}
|
|
2002
|
+
} else {
|
|
2003
|
+
if (textareaRef.current) {
|
|
2004
|
+
textareaRef.current.focus();
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
}, []);
|
|
2008
|
+
const handleOnChange = (e) => {
|
|
2009
|
+
const inputValue = e.target.value;
|
|
2010
|
+
setTextContent(formatText(inputValue));
|
|
2011
|
+
};
|
|
2012
|
+
const handleSubmit = (e) => {
|
|
2013
|
+
if (showTextButtons) {
|
|
2014
|
+
e.preventDefault();
|
|
2015
|
+
}
|
|
2016
|
+
if (formRef.current) {
|
|
2017
|
+
const formData = new FormData(formRef.current);
|
|
2018
|
+
const formJson = Object.fromEntries(formData.entries());
|
|
2019
|
+
const { input_content } = formJson;
|
|
2020
|
+
renderText(input_content);
|
|
2021
|
+
}
|
|
2022
|
+
};
|
|
2023
|
+
const handleChangeColor = (item) => {
|
|
2024
|
+
setColor(item);
|
|
2025
|
+
};
|
|
2026
|
+
const onBackGroundChange = (currentColorItem) => {
|
|
2027
|
+
setColor(currentColorItem);
|
|
2028
|
+
};
|
|
2029
|
+
const setColor = (colorItem) => {
|
|
2030
|
+
if (textareaRef.current) {
|
|
2031
|
+
textareaRef.current.focus();
|
|
2032
|
+
}
|
|
2033
|
+
const { current } = colorSelectorRef;
|
|
2034
|
+
const { colorName, colorValue } = colorItem;
|
|
2035
|
+
const isBack = current ? current.getBackState() : false;
|
|
2036
|
+
const textBasic = {
|
|
2037
|
+
colorName,
|
|
2038
|
+
colorValue,
|
|
2039
|
+
isBack,
|
|
2040
|
+
textAlign: textBasicInfo.textAlign
|
|
2041
|
+
};
|
|
2042
|
+
setTextBasicInfo(textBasic);
|
|
2043
|
+
if (!isBack) {
|
|
2044
|
+
setBgColor("transparent");
|
|
2045
|
+
setTextColor(colorValue);
|
|
2046
|
+
} else {
|
|
2047
|
+
setBgColor(colorValue);
|
|
2048
|
+
colorName === "white" || colorValue === "rgba(255, 255, 255, 1)" ? setTextColor("#000") : setTextColor("#fff");
|
|
2049
|
+
}
|
|
2050
|
+
};
|
|
2051
|
+
const setText = (textInfo2) => {
|
|
2052
|
+
const { bgColor: bgColor2, text, textColor: textColor2, left, top, angle, scaleX, scaleY, zoomX, zoomY, textBasicInfo: textBasicInfo2, width, height } = textInfo2;
|
|
2053
|
+
const { isBack, colorName, colorValue } = textBasicInfo2;
|
|
2054
|
+
const fillColor = text === "\u8BF7\u8F93\u5165\u6587\u6848" && textColor2 === "rgba(0, 0, 0, 0)" ? "rgba(255, 255, 255, 1)" : textColor2;
|
|
2055
|
+
setBgColor(bgColor2);
|
|
2056
|
+
setTextColor(fillColor);
|
|
2057
|
+
setTextContent(text);
|
|
2058
|
+
setTextBasicInfo(textBasicInfo2);
|
|
2059
|
+
setTextPos({ left, top, angle, scaleX, scaleY, zoomX, zoomY, width, height });
|
|
2060
|
+
const { current } = colorSelectorRef;
|
|
2061
|
+
if (!current) return;
|
|
2062
|
+
current.setIsSetBack(isBack);
|
|
2063
|
+
current.setCurrentColorItem({ colorName, colorValue });
|
|
2064
|
+
};
|
|
2065
|
+
const resetInfo = () => {
|
|
2066
|
+
setBgColor("transparent");
|
|
2067
|
+
setTextColor("rgb(248,82,81)");
|
|
2068
|
+
setTextContent("");
|
|
2069
|
+
setTextPos({ left: 0, top: 0, angle: 0, scaleX: 0.75, scaleY: 0.75, zoomX: 0, zoomY: 0 });
|
|
2070
|
+
};
|
|
2071
|
+
const close = () => {
|
|
2072
|
+
textClose(textInfo.id);
|
|
2073
|
+
};
|
|
2074
|
+
const renderText = (input_content) => {
|
|
2075
|
+
const { current } = mappingarea;
|
|
2076
|
+
if (current) {
|
|
2077
|
+
const computedStyle = window.getComputedStyle(current);
|
|
2078
|
+
const { width, height } = computedStyle;
|
|
2079
|
+
setTextPos(
|
|
2080
|
+
Object.assign(textPos, { width: Number(width.split("px")[0]), height: Number(height.split("px")[0]) })
|
|
2081
|
+
);
|
|
2082
|
+
}
|
|
2083
|
+
if (input_content && input_content.trim() !== "") {
|
|
2084
|
+
const { id, fontFamily, fontAssetUrl } = textInfo;
|
|
2085
|
+
createText({ textContent: input_content, bgColor, textColor, position: textPos, textBasicInfo, id, fontFamily, fontAssetUrl });
|
|
2086
|
+
} else {
|
|
2087
|
+
textClose(textInfo.id);
|
|
2088
|
+
}
|
|
2089
|
+
};
|
|
2090
|
+
useImperativeHandle(ref, () => ({
|
|
2091
|
+
setText,
|
|
2092
|
+
close,
|
|
2093
|
+
handleSubmit
|
|
2094
|
+
}));
|
|
2095
|
+
return /* @__PURE__ */ jsx("form", { method: "post", onSubmit: handleSubmit, ref: formRef, children: /* @__PURE__ */ jsxs("div", { className: "overlay", children: [
|
|
2096
|
+
showTextButtons && /* @__PURE__ */ jsxs("div", { className: "text-header", ref: headerRef, children: [
|
|
2097
|
+
/* @__PURE__ */ jsx("div", { onClick: () => close(), className: "close", children: /* @__PURE__ */ jsx("img", { crossOrigin: "anonymous", src: closeIcon, alt: "close" }) }),
|
|
2098
|
+
/* @__PURE__ */ jsx("button", { type: "submit", className: "next-button", children: "\u5B8C\u6210" })
|
|
2099
|
+
] }),
|
|
2100
|
+
!isIOS() && /* @__PURE__ */ jsxs("div", { className: "edit_container", style: {
|
|
2101
|
+
width: "100%",
|
|
2102
|
+
position: "relative",
|
|
2103
|
+
paddingLeft: "4.4vw",
|
|
2104
|
+
paddingRight: "3.2vw",
|
|
2105
|
+
display: "flex"
|
|
2106
|
+
}, children: [
|
|
2107
|
+
/* @__PURE__ */ jsx(
|
|
2108
|
+
"textarea",
|
|
2109
|
+
{
|
|
2110
|
+
ref: textareaRef,
|
|
2111
|
+
cols: 20,
|
|
2112
|
+
wrap: "hard",
|
|
2113
|
+
name: "input_content",
|
|
2114
|
+
className: "text-input",
|
|
2115
|
+
value: textContent,
|
|
2116
|
+
onChange: handleOnChange,
|
|
2117
|
+
style: { color: textColor, width: "94%", fontFamily: textInfo.fontFamily }
|
|
2118
|
+
}
|
|
2119
|
+
),
|
|
2120
|
+
/* @__PURE__ */ jsx(
|
|
2121
|
+
"div",
|
|
2122
|
+
{
|
|
2123
|
+
className: "mappingarea",
|
|
2124
|
+
ref: mappingarea,
|
|
2125
|
+
contentEditable: true,
|
|
2126
|
+
suppressContentEditableWarning: true,
|
|
2127
|
+
style: {
|
|
2128
|
+
background: bgColor,
|
|
2129
|
+
position: "absolute",
|
|
2130
|
+
top: "0",
|
|
2131
|
+
zIndex: "-1",
|
|
2132
|
+
left: "4.4vw"
|
|
2133
|
+
},
|
|
2134
|
+
children: textContentOnShow.map((text, index) => {
|
|
2135
|
+
return /* @__PURE__ */ jsx("span", { className: "mappingarea_span", style: { maxWidth: "100%" }, children: text ? text : " " }, index);
|
|
2136
|
+
})
|
|
2137
|
+
}
|
|
2138
|
+
)
|
|
2139
|
+
] }),
|
|
2140
|
+
isIOS() && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2141
|
+
/* @__PURE__ */ jsx(
|
|
2142
|
+
"textarea",
|
|
2143
|
+
{
|
|
2144
|
+
ref: textareaRef,
|
|
2145
|
+
cols: 20,
|
|
2146
|
+
wrap: "hard",
|
|
2147
|
+
name: "input_content",
|
|
2148
|
+
className: "text-input",
|
|
2149
|
+
value: textContent,
|
|
2150
|
+
onChange: handleOnChange,
|
|
2151
|
+
style: { color: textColor, fontFamily: textInfo.fontFamily }
|
|
2152
|
+
}
|
|
2153
|
+
),
|
|
2154
|
+
/* @__PURE__ */ jsx(
|
|
2155
|
+
"div",
|
|
2156
|
+
{
|
|
2157
|
+
className: "mappingarea",
|
|
2158
|
+
ref: mappingarea,
|
|
2159
|
+
contentEditable: true,
|
|
2160
|
+
suppressContentEditableWarning: true,
|
|
2161
|
+
style: { background: bgColor },
|
|
2162
|
+
children: textContentOnShow.map((text, index) => {
|
|
2163
|
+
return /* @__PURE__ */ jsx("span", { className: "mappingarea_span", children: text ? text : " " }, index);
|
|
2164
|
+
})
|
|
2165
|
+
}
|
|
2166
|
+
)
|
|
2167
|
+
] }),
|
|
2168
|
+
/* @__PURE__ */ jsx("div", { ref: coverRef, className: "cover", children: /* @__PURE__ */ jsx(
|
|
2169
|
+
ColorSelector_default,
|
|
2170
|
+
{
|
|
2171
|
+
ref: colorSelectorRef,
|
|
2172
|
+
onColorChange: handleChangeColor,
|
|
2173
|
+
onBackGroundChange
|
|
2174
|
+
}
|
|
2175
|
+
) })
|
|
2176
|
+
] }) });
|
|
2177
|
+
});
|
|
2178
|
+
var TextMenu_default = TextMenu;
|
|
2179
|
+
var VideoMenu = ({ createImage, videoMenus, menuState }) => {
|
|
2180
|
+
const [active, setActive] = useState();
|
|
2181
|
+
const [menus, setMenus] = useState([]);
|
|
2182
|
+
const [items, setItems] = useState([]);
|
|
2183
|
+
const onClickClass = ({ id, emojiList }) => {
|
|
2184
|
+
setActive(id);
|
|
2185
|
+
setItems(emojiList);
|
|
2186
|
+
};
|
|
2187
|
+
const onClickItem = ({ emojiId, fileUrl }) => {
|
|
2188
|
+
if (menuState === "video") {
|
|
2189
|
+
createImage(fileUrl, emojiId);
|
|
2190
|
+
}
|
|
2191
|
+
};
|
|
2192
|
+
useEffect(() => {
|
|
2193
|
+
setMenus(videoMenus);
|
|
2194
|
+
if (videoMenus.length) {
|
|
2195
|
+
onClickClass(videoMenus[0]);
|
|
2196
|
+
}
|
|
2197
|
+
}, [videoMenus]);
|
|
2198
|
+
return /* @__PURE__ */ jsxs("div", { className: `editor-video-menu ${menuState === "video" ? "active" : ""}`, children: [
|
|
2199
|
+
/* @__PURE__ */ jsx("div", { className: "editor-video-menu-header", children: menus.map((item) => /* @__PURE__ */ jsx("div", { className: active === item.id ? "active" : "", onClick: () => onClickClass(item), children: item.classifyType }, item.id)) }),
|
|
2200
|
+
/* @__PURE__ */ jsx("div", { className: "editor-video-menu-itmes", children: items.map((item) => /* @__PURE__ */ jsx("div", { onClick: () => onClickItem(item), children: /* @__PURE__ */ jsx("img", { loading: "lazy", src: item.fileUrl.thumbnailUrl, alt: "\u7D20\u6750" }) }, item.emojiId)) })
|
|
2201
|
+
] });
|
|
2202
|
+
};
|
|
2203
|
+
var VideoMenu_default = VideoMenu;
|
|
2204
|
+
var historyClass = new HistoryClass();
|
|
2205
|
+
var EditorFn = ({
|
|
2206
|
+
vmml,
|
|
2207
|
+
pauseFrame = 0,
|
|
2208
|
+
maxText = 10,
|
|
2209
|
+
maxVideo = 5,
|
|
2210
|
+
videoMenus = [],
|
|
2211
|
+
onMenuChange,
|
|
2212
|
+
showTextButtons = false,
|
|
2213
|
+
editableArray = [],
|
|
2214
|
+
templateId,
|
|
2215
|
+
strategyId,
|
|
2216
|
+
pauseWhenBuffering = false
|
|
2217
|
+
}, ref) => {
|
|
2218
|
+
var _a;
|
|
2219
|
+
vmml = convertVmmlTextScaleByForbidden(vmml);
|
|
2220
|
+
const textMenuRef = useRef(null);
|
|
2221
|
+
const vmmlPlayerRef = useRef();
|
|
2222
|
+
const canvasRef = useRef();
|
|
2223
|
+
const fps = 30;
|
|
2224
|
+
const once = useRef(false);
|
|
2225
|
+
const [player, setPlayer] = useState();
|
|
2226
|
+
const [loading, setLoading] = useState(true);
|
|
2227
|
+
const [frame, setFrame] = useState(pauseFrame);
|
|
2228
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
2229
|
+
const [showCanvas, setShowCanvas] = useState(false);
|
|
2230
|
+
const [durationInFrames, setDurationInFrames] = useState(getFrames(((_a = vmml == null ? void 0 : vmml.template) == null ? void 0 : _a.duration) || 1, fps));
|
|
2231
|
+
const [previewState, setPreviewState] = useState(true);
|
|
2232
|
+
const [menuState, setMenuState] = useState("");
|
|
2233
|
+
const [canvasSize, setCanvasSize] = useState({ width: 0, height: 0, top: 0 });
|
|
2234
|
+
const [textInfo, setTextInfo] = useState({});
|
|
2235
|
+
const [isShowMaxTextLayer, setIsShowMaxTextLayer] = useState(false);
|
|
2236
|
+
const [buffering, setBuffering] = useState(false);
|
|
2237
|
+
const videoList = useRef([]);
|
|
2238
|
+
const [signList, setSignList] = useState([]);
|
|
2239
|
+
const [tips, setTips] = useState("");
|
|
2240
|
+
const [dragState, setDragState] = useState(0);
|
|
2241
|
+
const vmmlConverterRef = useRef(null);
|
|
2242
|
+
const [initFcObjs, setInitFcObjs] = useState([]);
|
|
2243
|
+
const vmmlFlag = useRef(false);
|
|
2244
|
+
const needPlay = useRef(true);
|
|
2245
|
+
const setVmml = () => {
|
|
2246
|
+
const { current } = vmmlPlayerRef;
|
|
2247
|
+
if (!current) return;
|
|
2248
|
+
if (!once.current) {
|
|
2249
|
+
current.setVmml(vmml, pauseFrame);
|
|
2250
|
+
} else {
|
|
2251
|
+
current.setVmml(vmml, Math.max(0, frame - 3));
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
const hideLoading = () => {
|
|
2255
|
+
const { current } = vmmlPlayerRef;
|
|
2256
|
+
vmmlFlag.current = false;
|
|
2257
|
+
if (current && current.playerRef) {
|
|
2258
|
+
setPlayer(current.playerRef);
|
|
2259
|
+
current.unmute();
|
|
2260
|
+
if (!once.current) {
|
|
2261
|
+
once.current = true;
|
|
2262
|
+
} else {
|
|
2263
|
+
if (needPlay.current) {
|
|
2264
|
+
current.play();
|
|
2265
|
+
} else {
|
|
2266
|
+
needPlay.current = true;
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
setShowCanvas(false);
|
|
2271
|
+
setLoading(false);
|
|
2272
|
+
};
|
|
2273
|
+
const onClickMain = () => {
|
|
2274
|
+
if (buffering) return;
|
|
2275
|
+
const { current } = vmmlPlayerRef;
|
|
2276
|
+
if (current) {
|
|
2277
|
+
if (isPlaying) {
|
|
2278
|
+
intoEdit();
|
|
2279
|
+
} else {
|
|
2280
|
+
current.unmute();
|
|
2281
|
+
current.play();
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
};
|
|
2285
|
+
const enterPreview = (canvas, hiddenMenu = false) => {
|
|
2286
|
+
if (hiddenMenu) {
|
|
2287
|
+
setMenuState("");
|
|
2288
|
+
} else {
|
|
2289
|
+
setMenuState("");
|
|
2290
|
+
setPreviewState(true);
|
|
2291
|
+
historyClass.onCanvasRoute(canvas);
|
|
2292
|
+
}
|
|
2293
|
+
};
|
|
2294
|
+
const onControlsClick = () => {
|
|
2295
|
+
if (previewState) {
|
|
2296
|
+
const { current } = vmmlPlayerRef;
|
|
2297
|
+
current.unmute();
|
|
2298
|
+
current.play();
|
|
2299
|
+
} else {
|
|
2300
|
+
setMenuState("");
|
|
2301
|
+
setPreviewState(true);
|
|
2302
|
+
}
|
|
2303
|
+
};
|
|
2304
|
+
const onClickMenu = (type) => {
|
|
2305
|
+
if (type === "text" && checkTextNum()) return;
|
|
2306
|
+
if (type === "video" && checkVideoNum()) return;
|
|
2307
|
+
if (previewState) {
|
|
2308
|
+
intoEdit();
|
|
2309
|
+
}
|
|
2310
|
+
setTextInfo({});
|
|
2311
|
+
setMenuState(type);
|
|
2312
|
+
};
|
|
2313
|
+
const checkTextNum = () => {
|
|
2314
|
+
const { current } = canvasRef;
|
|
2315
|
+
if (current) {
|
|
2316
|
+
const textNums = current.getfObjectNums("\u6587\u5B57");
|
|
2317
|
+
if (textNums >= maxText) {
|
|
2318
|
+
setTips(`\u6700\u591A\u6DFB\u52A0${maxText}\u4E2A\u6587\u5B57`);
|
|
2319
|
+
setIsShowMaxTextLayer(true);
|
|
2320
|
+
return true;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
return false;
|
|
2324
|
+
};
|
|
2325
|
+
const checkVideoNum = () => {
|
|
2326
|
+
const { current } = canvasRef;
|
|
2327
|
+
if (current) {
|
|
2328
|
+
const videoNum = current.getfObjectNums("\u8868\u60C5\u5305");
|
|
2329
|
+
if (videoNum >= maxVideo) {
|
|
2330
|
+
setTips(`\u6700\u591A\u6DFB\u52A0${maxVideo}\u4E2A\u8868\u60C5\u5305`);
|
|
2331
|
+
setIsShowMaxTextLayer(true);
|
|
2332
|
+
return true;
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
return false;
|
|
2336
|
+
};
|
|
2337
|
+
const getfcObject = () => {
|
|
2338
|
+
const { current } = canvasRef;
|
|
2339
|
+
if (current) {
|
|
2340
|
+
return current.getfcObject();
|
|
2341
|
+
}
|
|
2342
|
+
return [];
|
|
2343
|
+
};
|
|
2344
|
+
const intoEdit = (frame2) => {
|
|
2345
|
+
const { current } = vmmlPlayerRef;
|
|
2346
|
+
if (current) {
|
|
2347
|
+
frame2 && current.seekTo(frame2);
|
|
2348
|
+
current.pause();
|
|
2349
|
+
if (canvasRef.current) {
|
|
2350
|
+
const { current: canvasC } = canvasRef;
|
|
2351
|
+
canvasC.checkObjectInPoint(frame2);
|
|
2352
|
+
}
|
|
2353
|
+
getAllVideoFrames();
|
|
2354
|
+
setShowCanvas(true);
|
|
2355
|
+
setPreviewState(false);
|
|
2356
|
+
}
|
|
2357
|
+
};
|
|
2358
|
+
const getAllVideoFrames = () => {
|
|
2359
|
+
const { current } = canvasRef;
|
|
2360
|
+
const doms = document.querySelectorAll("[data-clipid][data-cliptype=video][data-editorType],[data-editclip='true'][data-cliptype=video]");
|
|
2361
|
+
for (const item of Array.from(doms)) {
|
|
2362
|
+
const id = item.getAttribute("data-clipid");
|
|
2363
|
+
const video = item.querySelector("video");
|
|
2364
|
+
const base64 = takeScreenshot(video);
|
|
2365
|
+
current.updateImage(id, base64);
|
|
2366
|
+
}
|
|
2367
|
+
switchClipDisplay("none");
|
|
2368
|
+
};
|
|
2369
|
+
const switchClipDisplay = (display) => {
|
|
2370
|
+
const clips = document.querySelectorAll("[data-editorType],[data-editclip='true']");
|
|
2371
|
+
clips.forEach((clip) => {
|
|
2372
|
+
clip.style.display = display;
|
|
2373
|
+
});
|
|
2374
|
+
};
|
|
2375
|
+
const createImage = async (file, emojiId) => {
|
|
2376
|
+
const { current } = canvasRef;
|
|
2377
|
+
if (current && !checkVideoNum()) {
|
|
2378
|
+
const fObj = await current.createImage(file, emojiId);
|
|
2379
|
+
vmmlConverterRef.current.addVideoClip(fObj);
|
|
2380
|
+
setMenuState("");
|
|
2381
|
+
setPreviewState(true);
|
|
2382
|
+
}
|
|
2383
|
+
};
|
|
2384
|
+
const createText = async (data) => {
|
|
2385
|
+
const { current } = canvasRef;
|
|
2386
|
+
if (current) {
|
|
2387
|
+
const server = data.id ? "updateText" : "createText";
|
|
2388
|
+
await current[server](data);
|
|
2389
|
+
setMenuState("");
|
|
2390
|
+
}
|
|
2391
|
+
};
|
|
2392
|
+
const onVideoChange = (clipData) => {
|
|
2393
|
+
const index = videoList.current.findIndex((item) => item.id === clipData.id);
|
|
2394
|
+
if (index > -1) {
|
|
2395
|
+
videoList.current.splice(index, 1);
|
|
2396
|
+
} else {
|
|
2397
|
+
videoList.current.push(clipData);
|
|
2398
|
+
}
|
|
2399
|
+
setSignList([...videoList.current]);
|
|
2400
|
+
};
|
|
2401
|
+
const getActions = () => {
|
|
2402
|
+
const { current } = canvasRef;
|
|
2403
|
+
return current.getActions().length;
|
|
2404
|
+
};
|
|
2405
|
+
const textClose = (id) => {
|
|
2406
|
+
const { current } = canvasRef;
|
|
2407
|
+
id && current.changeObjectVisible(id);
|
|
2408
|
+
setMenuState("");
|
|
2409
|
+
};
|
|
2410
|
+
const intoTextEdit = (textInfo2) => {
|
|
2411
|
+
setMenuState("text");
|
|
2412
|
+
setTextInfo(textInfo2);
|
|
2413
|
+
};
|
|
2414
|
+
const onFrameUpdate = (e) => {
|
|
2415
|
+
setFrame(e.detail.frame);
|
|
2416
|
+
};
|
|
2417
|
+
const onPlay = () => {
|
|
2418
|
+
setIsPlaying(true);
|
|
2419
|
+
};
|
|
2420
|
+
const onPause = () => {
|
|
2421
|
+
setIsPlaying(false);
|
|
2422
|
+
};
|
|
2423
|
+
const onWaiting = () => {
|
|
2424
|
+
setShowCanvas(false);
|
|
2425
|
+
setPreviewState(true);
|
|
2426
|
+
setBuffering(true);
|
|
2427
|
+
};
|
|
2428
|
+
const onResume = () => {
|
|
2429
|
+
setBuffering(false);
|
|
2430
|
+
};
|
|
2431
|
+
const initCanEditClips = (tracks = []) => {
|
|
2432
|
+
if (editableArray.length) {
|
|
2433
|
+
const list = findEditClips(tracks);
|
|
2434
|
+
if (list.length) {
|
|
2435
|
+
const { current } = canvasRef;
|
|
2436
|
+
list.forEach((clip) => {
|
|
2437
|
+
if (clip.videoClip) {
|
|
2438
|
+
current.createImageFromClip(clip);
|
|
2439
|
+
} else {
|
|
2440
|
+
current.createTextFromClip(clip);
|
|
2441
|
+
}
|
|
2442
|
+
});
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
};
|
|
2446
|
+
const findEditClips = (tracks = []) => {
|
|
2447
|
+
const list = [];
|
|
2448
|
+
tracks.forEach((track) => {
|
|
2449
|
+
track.clips.forEach((clip) => {
|
|
2450
|
+
if (editableArray.includes(clip.id)) {
|
|
2451
|
+
clip.edit = true;
|
|
2452
|
+
list.push(clip);
|
|
2453
|
+
}
|
|
2454
|
+
});
|
|
2455
|
+
});
|
|
2456
|
+
return list;
|
|
2457
|
+
};
|
|
2458
|
+
const initFcObjects = (tracks = []) => {
|
|
2459
|
+
const fcTracks = tracks.filter((item) => item.editorType);
|
|
2460
|
+
if (fcTracks.length) {
|
|
2461
|
+
const clips = fcTracks.map((item) => item.clips).flat().filter((item) => Reflect.has(item, "fObj"));
|
|
2462
|
+
const fObjs = clips.map((item) => item.fObj);
|
|
2463
|
+
setInitFcObjs(fObjs);
|
|
2464
|
+
fObjs.forEach((item) => {
|
|
2465
|
+
onVideoChange(item.clipData);
|
|
2466
|
+
});
|
|
2467
|
+
}
|
|
2468
|
+
};
|
|
2469
|
+
const getVmml = () => {
|
|
2470
|
+
try {
|
|
2471
|
+
const tracks = vmml.template.tracks.filter((item) => item.editorType === "\u6587\u5B57");
|
|
2472
|
+
tracks.forEach((track) => {
|
|
2473
|
+
track.clips.forEach((clip) => {
|
|
2474
|
+
clip.fObj.src = "";
|
|
2475
|
+
});
|
|
2476
|
+
});
|
|
2477
|
+
} catch {
|
|
2478
|
+
console.log("\u51FA\u9519\u4E86");
|
|
2479
|
+
}
|
|
2480
|
+
return vmml;
|
|
2481
|
+
};
|
|
2482
|
+
const getPlayer = () => {
|
|
2483
|
+
return player;
|
|
2484
|
+
};
|
|
2485
|
+
useEffect(() => {
|
|
2486
|
+
if (onMenuChange && typeof onMenuChange === "function") {
|
|
2487
|
+
onMenuChange(menuState);
|
|
2488
|
+
}
|
|
2489
|
+
}, [menuState]);
|
|
2490
|
+
useEffect(() => {
|
|
2491
|
+
if (previewState && !vmmlFlag.current) {
|
|
2492
|
+
vmmlFlag.current = true;
|
|
2493
|
+
setVmml();
|
|
2494
|
+
}
|
|
2495
|
+
}, [previewState]);
|
|
2496
|
+
useEffect(() => {
|
|
2497
|
+
if (canvasSize.width && canvasSize.height && !vmmlConverterRef.current && vmml) {
|
|
2498
|
+
vmmlConverterRef.current = new VmmlConverter_default({ vmml, canvasSize });
|
|
2499
|
+
}
|
|
2500
|
+
if (canvasSize.width) {
|
|
2501
|
+
initCanEditClips(vmml.template.tracks);
|
|
2502
|
+
}
|
|
2503
|
+
}, [canvasSize, vmml]);
|
|
2504
|
+
useEffect(() => {
|
|
2505
|
+
if (vmml) {
|
|
2506
|
+
initFcObjects(vmml.template.tracks);
|
|
2507
|
+
}
|
|
2508
|
+
}, [vmml]);
|
|
2509
|
+
useEffect(() => {
|
|
2510
|
+
if (!showCanvas) {
|
|
2511
|
+
switchClipDisplay("block");
|
|
2512
|
+
}
|
|
2513
|
+
}, [showCanvas]);
|
|
2514
|
+
useEffect(() => {
|
|
2515
|
+
if (player) {
|
|
2516
|
+
const parent = player.getContainerNode();
|
|
2517
|
+
if (!canvasSize.width) {
|
|
2518
|
+
const playerElement = parent == null ? void 0 : parent.children[0];
|
|
2519
|
+
const { width, height } = (playerElement == null ? void 0 : playerElement.getBoundingClientRect()) || {};
|
|
2520
|
+
setCanvasSize({ width, height, top: playerElement.offsetTop });
|
|
2521
|
+
}
|
|
2522
|
+
player.addEventListener("play", onPlay);
|
|
2523
|
+
player.addEventListener("pause", onPause);
|
|
2524
|
+
player.addEventListener("frameupdate", onFrameUpdate);
|
|
2525
|
+
player.addEventListener("waiting", onWaiting);
|
|
2526
|
+
player.addEventListener("resume", onResume);
|
|
2527
|
+
return () => {
|
|
2528
|
+
player.removeEventListener("play", onPlay);
|
|
2529
|
+
player.removeEventListener("pause", onPause);
|
|
2530
|
+
player.removeEventListener("frameupdate", onFrameUpdate);
|
|
2531
|
+
player.removeEventListener("waiting", onWaiting);
|
|
2532
|
+
player.removeEventListener("resume", onResume);
|
|
2533
|
+
};
|
|
2534
|
+
}
|
|
2535
|
+
}, [player]);
|
|
2536
|
+
useEffect(() => {
|
|
2537
|
+
if (dragState === 2) {
|
|
2538
|
+
needPlay.current = false;
|
|
2539
|
+
const { current } = vmmlPlayerRef;
|
|
2540
|
+
current.setVmml(vmml, frame, false);
|
|
2541
|
+
setShowCanvas(false);
|
|
2542
|
+
}
|
|
2543
|
+
if (dragState === 3 || dragState === 4) {
|
|
2544
|
+
setShowCanvas(true);
|
|
2545
|
+
setPreviewState(false);
|
|
2546
|
+
}
|
|
2547
|
+
}, [dragState]);
|
|
2548
|
+
useImperativeHandle(
|
|
2549
|
+
ref,
|
|
2550
|
+
() => ({
|
|
2551
|
+
getActions,
|
|
2552
|
+
getfcObject,
|
|
2553
|
+
getVmml,
|
|
2554
|
+
getPlayer,
|
|
2555
|
+
texteditClose,
|
|
2556
|
+
textFinish
|
|
2557
|
+
}),
|
|
2558
|
+
[vmml, player]
|
|
2559
|
+
);
|
|
2560
|
+
const texteditClose = () => {
|
|
2561
|
+
if (textMenuRef) {
|
|
2562
|
+
textMenuRef.current.close();
|
|
2563
|
+
}
|
|
2564
|
+
};
|
|
2565
|
+
const textFinish = () => {
|
|
2566
|
+
if (textMenuRef) {
|
|
2567
|
+
textMenuRef.current.handleSubmit();
|
|
2568
|
+
}
|
|
2569
|
+
};
|
|
2570
|
+
const menuStyles = useMemo(() => {
|
|
2571
|
+
if (loading) {
|
|
2572
|
+
return {
|
|
2573
|
+
opacity: 0.4,
|
|
2574
|
+
pointerEvents: "none"
|
|
2575
|
+
};
|
|
2576
|
+
}
|
|
2577
|
+
return {};
|
|
2578
|
+
}, [loading]);
|
|
2579
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2580
|
+
/* @__PURE__ */ jsxs("div", { className: "editor", children: [
|
|
2581
|
+
/* @__PURE__ */ jsx("div", { className: "editor-vessel", onClick: () => {
|
|
2582
|
+
setMenuState("");
|
|
2583
|
+
}, children: /* @__PURE__ */ jsxs("section", { className: `main ${menuState === "text" ? "text-style" : ""}`, children: [
|
|
2584
|
+
/* @__PURE__ */ jsx("div", { className: "vessel", onClick: onClickMain, children: /* @__PURE__ */ jsx(
|
|
2585
|
+
VmmlPlayer,
|
|
2586
|
+
{
|
|
2587
|
+
ref: vmmlPlayerRef,
|
|
2588
|
+
vmml,
|
|
2589
|
+
existenceBorderRadio: true,
|
|
2590
|
+
moveToBeginningWhenEnded: true,
|
|
2591
|
+
isEditorState: true,
|
|
2592
|
+
muted: true,
|
|
2593
|
+
fps,
|
|
2594
|
+
hideLoading,
|
|
2595
|
+
editableArray,
|
|
2596
|
+
premountFor: 40,
|
|
2597
|
+
pauseWhenBuffering
|
|
2598
|
+
}
|
|
2599
|
+
) }),
|
|
2600
|
+
/* @__PURE__ */ jsx(
|
|
2601
|
+
EditorCanvas_default,
|
|
2602
|
+
{
|
|
2603
|
+
ref: canvasRef,
|
|
2604
|
+
previewState,
|
|
2605
|
+
showCanvas,
|
|
2606
|
+
canvasSize,
|
|
2607
|
+
enterPreview,
|
|
2608
|
+
intoTextEdit,
|
|
2609
|
+
frame,
|
|
2610
|
+
vmml,
|
|
2611
|
+
dragState,
|
|
2612
|
+
initFcObjs,
|
|
2613
|
+
onVideoChange
|
|
2614
|
+
}
|
|
2615
|
+
),
|
|
2616
|
+
/* @__PURE__ */ jsx("div", { className: "controls-box", children: /* @__PURE__ */ jsx(
|
|
2617
|
+
Controls_default,
|
|
2618
|
+
{
|
|
2619
|
+
player,
|
|
2620
|
+
vmmlRef: vmmlPlayerRef,
|
|
2621
|
+
fps,
|
|
2622
|
+
durationInFrames,
|
|
2623
|
+
intoEdit,
|
|
2624
|
+
frame,
|
|
2625
|
+
isPlaying,
|
|
2626
|
+
setDragState,
|
|
2627
|
+
onControlsClick,
|
|
2628
|
+
signList
|
|
2629
|
+
}
|
|
2630
|
+
) }),
|
|
2631
|
+
/* @__PURE__ */ jsx(Loading_default, { show: loading })
|
|
2632
|
+
] }) }),
|
|
2633
|
+
/* @__PURE__ */ jsx("div", { className: "padding-box" }),
|
|
2634
|
+
/* @__PURE__ */ jsxs("section", { style: menuStyles, className: `footer ${menuState === "text" ? "text-style" : ""}`, children: [
|
|
2635
|
+
maxText > 0 && /* @__PURE__ */ jsxs(
|
|
2636
|
+
"div",
|
|
2637
|
+
{
|
|
2638
|
+
onClick: () => onClickMenu("text"),
|
|
2639
|
+
"data-aspm-click": "c375146.d480849",
|
|
2640
|
+
"data-aspm-expo": true,
|
|
2641
|
+
"data-aspm-param": `Template_Id=${templateId}^Strategy_Id=${strategyId}`,
|
|
2642
|
+
children: [
|
|
2643
|
+
/* @__PURE__ */ jsx("img", { src: wordIcon, alt: "word" }),
|
|
2644
|
+
/* @__PURE__ */ jsx("p", { children: "\u6587\u5B57" })
|
|
2645
|
+
]
|
|
2646
|
+
}
|
|
2647
|
+
),
|
|
2648
|
+
maxVideo > 0 && /* @__PURE__ */ jsxs(
|
|
2649
|
+
"div",
|
|
2650
|
+
{
|
|
2651
|
+
onClick: () => onClickMenu("video"),
|
|
2652
|
+
"data-aspm-click": "c375146.d480850",
|
|
2653
|
+
"data-aspm-expo": true,
|
|
2654
|
+
"data-aspm-param": `Template_Id=${templateId}^Strategy_Id=${strategyId}`,
|
|
2655
|
+
children: [
|
|
2656
|
+
/* @__PURE__ */ jsx("img", { src: emotionIcon, alt: "emotion" }),
|
|
2657
|
+
/* @__PURE__ */ jsx("p", { children: "\u8868\u60C5\u5305" })
|
|
2658
|
+
]
|
|
2659
|
+
}
|
|
2660
|
+
)
|
|
2661
|
+
] }),
|
|
2662
|
+
maxVideo > 0 && /* @__PURE__ */ jsx(VideoMenu_default, { menuState, createImage, videoMenus }),
|
|
2663
|
+
menuState === "text" && /* @__PURE__ */ jsx(TextMenu_default, { ref: textMenuRef, createText, textClose, textInfo, showTextButtons })
|
|
2664
|
+
] }),
|
|
2665
|
+
/* @__PURE__ */ jsx(MaxTextLayer_default, { textLayerHide: () => setIsShowMaxTextLayer(false), show: isShowMaxTextLayer, text: tips })
|
|
2666
|
+
] });
|
|
2667
|
+
};
|
|
2668
|
+
var forward = forwardRef;
|
|
2669
|
+
var Editor = forward(EditorFn);
|
|
2670
|
+
|
|
2671
|
+
export { Editor };
|
|
2672
|
+
//# sourceMappingURL=index.mjs.map
|
|
2673
|
+
//# sourceMappingURL=index.mjs.map
|