@wangeditor-next/video-module 1.3.0 → 1.3.1

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/dist/index.esm.js CHANGED
@@ -1,1199 +1,2 @@
1
- import { i18nAddResources, DomEditor, t, genModalInputElems, genModalButtonElems, createUploader } from '@wangeditor-next/core';
2
- import { Transforms, Range } from 'slate';
3
- import { jsx, h } from 'snabbdom';
4
- import $, { append, on, focus, attr, val, html, parent, hasClass, empty } from 'dom7';
5
- import { nanoid } from 'nanoid';
6
-
7
- /**
8
- * @description i18n en
9
- * @author wangfupeng
10
- */
11
- var enResources = {
12
- videoModule: {
13
- delete: 'Delete',
14
- uploadVideo: 'Upload video',
15
- insertVideo: 'Insert video',
16
- videoSrc: 'Video source',
17
- videoSrcPlaceHolder: 'Video file url, or third-party <iframe>',
18
- videoPoster: 'Video poster',
19
- videoPosterPlaceHolder: 'Poster image url',
20
- ok: 'Ok',
21
- editSize: 'Edit size',
22
- edit: 'Edit video',
23
- width: 'Width',
24
- height: 'Height',
25
- },
26
- };
27
-
28
- /**
29
- * @description i18n zh-CN
30
- * @author wangfupeng
31
- */
32
- var zhResources = {
33
- videoModule: {
34
- delete: '删除视频',
35
- uploadVideo: '上传视频',
36
- insertVideo: '插入视频',
37
- videoSrc: '视频地址',
38
- videoSrcPlaceHolder: '视频文件 url 或第三方 <iframe>',
39
- videoPoster: '视频封面',
40
- videoPosterPlaceHolder: '封面图片 url',
41
- ok: '确定',
42
- editSize: '修改尺寸',
43
- edit: '编辑 视频',
44
- width: '宽度',
45
- height: '高度',
46
- },
47
- };
48
-
49
- /**
50
- * @description i18n entry
51
- * @author wangfupeng
52
- */
53
- i18nAddResources('en', enResources);
54
- i18nAddResources('zh-CN', zhResources);
55
-
56
- /*! *****************************************************************************
57
- Copyright (c) Microsoft Corporation.
58
-
59
- Permission to use, copy, modify, and/or distribute this software for any
60
- purpose with or without fee is hereby granted.
61
-
62
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
63
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
64
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
65
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
66
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
67
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
68
- PERFORMANCE OF THIS SOFTWARE.
69
- ***************************************************************************** */
70
-
71
- var __assign = function() {
72
- __assign = Object.assign || function __assign(t) {
73
- for (var s, i = 1, n = arguments.length; i < n; i++) {
74
- s = arguments[i];
75
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
76
- }
77
- return t;
78
- };
79
- return __assign.apply(this, arguments);
80
- };
81
-
82
- function __awaiter(thisArg, _arguments, P, generator) {
83
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
84
- return new (P || (P = Promise))(function (resolve, reject) {
85
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
86
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
87
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
88
- step((generator = generator.apply(thisArg, _arguments || [])).next());
89
- });
90
- }
91
-
92
- function __generator(thisArg, body) {
93
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
94
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
95
- function verb(n) { return function (v) { return step([n, v]); }; }
96
- function step(op) {
97
- if (f) throw new TypeError("Generator is already executing.");
98
- while (_) try {
99
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
100
- if (y = 0, t) op = [op[0] & 2, t.value];
101
- switch (op[0]) {
102
- case 0: case 1: t = op; break;
103
- case 4: _.label++; return { value: op[1], done: false };
104
- case 5: _.label++; y = op[1]; op = [0]; continue;
105
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
106
- default:
107
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
108
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
109
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
110
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
111
- if (t[2]) _.ops.pop();
112
- _.trys.pop(); continue;
113
- }
114
- op = body.call(thisArg, _);
115
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
116
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
117
- }
118
- }
119
-
120
- function __values(o) {
121
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
122
- if (m) return m.call(o);
123
- if (o && typeof o.length === "number") return {
124
- next: function () {
125
- if (o && i >= o.length) o = void 0;
126
- return { value: o && o[i++], done: !o };
127
- }
128
- };
129
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
130
- }
131
-
132
- function __read(o, n) {
133
- var m = typeof Symbol === "function" && o[Symbol.iterator];
134
- if (!m) return o;
135
- var i = m.call(o), r, ar = [], e;
136
- try {
137
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
138
- }
139
- catch (error) { e = { error: error }; }
140
- finally {
141
- try {
142
- if (r && !r.done && (m = i["return"])) m.call(i);
143
- }
144
- finally { if (e) throw e.error; }
145
- }
146
- return ar;
147
- }
148
-
149
- function __asyncValues(o) {
150
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
151
- var m = o[Symbol.asyncIterator], i;
152
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
153
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
154
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
155
- }
156
-
157
- /**
158
- * @description editor 插件,重写 editor API
159
- * @author wangfupeng
160
- */
161
- function withVideo(editor) {
162
- var isVoid = editor.isVoid, normalizeNode = editor.normalizeNode;
163
- var newEditor = editor;
164
- // 重写 isVoid
165
- newEditor.isVoid = function (elem) {
166
- var type = elem.type;
167
- if (type === 'video') {
168
- return true;
169
- }
170
- return isVoid(elem);
171
- };
172
- // 重写 normalizeNode
173
- newEditor.normalizeNode = function (_a) {
174
- var _b = __read(_a, 2), node = _b[0], path = _b[1];
175
- var type = DomEditor.getNodeType(node);
176
- // ----------------- video 后面必须跟一个 p header blockquote -----------------
177
- if (type === 'video') {
178
- // -------------- video 是 editor 最后一个节点,需要后面插入 p --------------
179
- var isLast = DomEditor.isLastNode(newEditor, node);
180
- if (isLast) {
181
- Transforms.insertNodes(newEditor, DomEditor.genEmptyParagraph(), { at: [path[0] + 1] });
182
- }
183
- }
184
- // 执行默认的 normalizeNode ,重要!!!
185
- return normalizeNode([node, path]);
186
- };
187
- // 返回 editor ,重要!
188
- return newEditor;
189
- }
190
-
191
- /**
192
- * @description DOM 操作
193
- * @author wangfupeng
194
- */
195
- if (append)
196
- $.fn.append = append;
197
- if (on)
198
- $.fn.on = on;
199
- if (focus)
200
- $.fn.focus = focus;
201
- if (attr)
202
- $.fn.attr = attr;
203
- if (val)
204
- $.fn.val = val;
205
- if (html)
206
- $.fn.html = html;
207
- if (parent)
208
- $.fn.parent = parent;
209
- if (hasClass)
210
- $.fn.hasClass = hasClass;
211
- if (empty)
212
- $.fn.empty = empty;
213
- /**
214
- * 获取 tagName lower-case
215
- * @param $elem $elem
216
- */
217
- function getTagName($elem) {
218
- if ($elem.length)
219
- return $elem[0].tagName.toLowerCase();
220
- return '';
221
- }
222
- /**
223
- * 生成带 size 样式的 iframe html
224
- * @param iframeHtml iframe html string
225
- * @param width width
226
- * @param height height
227
- * @returns iframe html string with size style
228
- */
229
- function genSizeStyledIframeHtml(iframeHtml, width, height, style) {
230
- if (width === void 0) { width = 'auto'; }
231
- if (height === void 0) { height = 'auto'; }
232
- if (style === void 0) { style = {}; }
233
- var $iframe = $(iframeHtml);
234
- var _a = style.width, styleWidth = _a === void 0 ? '' : _a, _b = style.height, styleHeight = _b === void 0 ? '' : _b;
235
- var styleStr = '';
236
- if (styleWidth)
237
- styleStr += "width: " + styleWidth + ";";
238
- if (styleHeight)
239
- styleStr += "height: " + styleHeight + ";";
240
- $iframe.attr('width', width);
241
- $iframe.attr('height', height);
242
- $iframe.attr('style', styleStr);
243
- return $iframe[0].outerHTML;
244
- }
245
-
246
- /**
247
- * @description video render elem
248
- * @author wangfupeng
249
- */
250
- function renderVideo(elemNode, children, editor) {
251
- var _a = elemNode, _b = _a.src, src = _b === void 0 ? '' : _b, _c = _a.poster, poster = _c === void 0 ? '' : _c, _d = _a.key, key = _d === void 0 ? '' : _d, _e = _a.width, width = _e === void 0 ? 'auto' : _e, _f = _a.height, height = _f === void 0 ? 'auto' : _f, _g = _a.style, style = _g === void 0 ? {} : _g, _h = _a.textAlign, textAlign = _h === void 0 ? 'center' : _h;
252
- // 是否选中
253
- var selected = DomEditor.isNodeSelected(editor, elemNode);
254
- var vnode;
255
- if (src.trim().indexOf('<iframe ') === 0) {
256
- // 增加尺寸样式
257
- var iframeHtml = genSizeStyledIframeHtml(src, width, height, style);
258
- // iframe 形式,第三方视频
259
- vnode = (jsx("div", { className: "w-e-textarea-video-container", "data-selected": selected ? 'true' : '', style: { textAlign: textAlign }, innerHTML: iframeHtml }));
260
- }
261
- else {
262
- // 其他,mp4 格式
263
- var videoVnode = (jsx("video", { key: key, poster: poster, controls: true, style: style },
264
- jsx("source", { src: src, type: "video/mp4" }), "Sorry, your browser doesn't support embedded videos.\n \u62B1\u6B49\uFF0C\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 video \u89C6\u9891"));
265
- // @ts-ignore 添加尺寸
266
- if (width !== 'auto')
267
- videoVnode.data.width = width;
268
- // @ts-ignore
269
- if (height !== 'auto')
270
- videoVnode.data.height = height;
271
- vnode = (jsx("div", { className: "w-e-textarea-video-container", "data-selected": selected ? 'true' : '', style: { textAlign: textAlign } }, videoVnode));
272
- }
273
- // 【注意】void node 中,renderElem 不用处理 children 。core 会统一处理。
274
- var containerVnode = h('div', {
275
- props: {
276
- contentEditable: false,
277
- },
278
- on: {
279
- mousedown: function (e) { return e.preventDefault(); },
280
- },
281
- }, vnode);
282
- return containerVnode;
283
- }
284
- var renderVideoConf = {
285
- type: 'video',
286
- renderElem: renderVideo,
287
- };
288
-
289
- /**
290
- * @description to html
291
- * @author wangfupeng
292
- */
293
- function videoToHtml(elemNode, childrenHtml) {
294
- var _a = elemNode, _b = _a.src, src = _b === void 0 ? '' : _b, _c = _a.poster, poster = _c === void 0 ? '' : _c, _d = _a.width, width = _d === void 0 ? 'auto' : _d, _e = _a.height, height = _e === void 0 ? 'auto' : _e, _f = _a.style, style = _f === void 0 ? {} : _f, _g = _a.textAlign, textAlign = _g === void 0 ? 'center' : _g;
295
- var res = "<div data-w-e-type=\"video\" data-w-e-is-void style=\"text-align: " + textAlign + ";\">\n";
296
- if (src.trim().indexOf('<iframe ') === 0) {
297
- // iframe 形式
298
- var iframeHtml = genSizeStyledIframeHtml(src, width, height, style);
299
- res += iframeHtml;
300
- }
301
- else {
302
- // 其他,mp4 等 url 格式
303
- var _h = style.width, styleWidth = _h === void 0 ? '' : _h, _j = style.height, styleHeight = _j === void 0 ? '' : _j;
304
- var styleStr = '';
305
- if (styleWidth)
306
- styleStr += "width: " + styleWidth + ";";
307
- if (styleHeight)
308
- styleStr += "height: " + styleHeight + ";";
309
- res += "<video poster=\"" + poster + "\" controls=\"true\" width=\"" + width + "\" height=\"" + height + "\" style=\"" + styleStr + "\"><source src=\"" + src + "\" type=\"video/mp4\"/></video>";
310
- }
311
- res += '\n</div>';
312
- return res;
313
- }
314
- var videoToHtmlConf = {
315
- type: 'video',
316
- elemToHtml: videoToHtml,
317
- };
318
-
319
- /**
320
- * @description pre parse html
321
- * @author wangfupeng
322
- */
323
- /**
324
- * pre-prase video ,兼容 V4
325
- * @param elem elem
326
- */
327
- function preParse(elem) {
328
- var $elem = $(elem);
329
- var $video = $elem;
330
- var elemTagName = getTagName($elem);
331
- if (elemTagName === 'p') {
332
- // v4 的 video 或 iframe 是被 p 包裹的
333
- var children = $elem.children();
334
- if (children.length === 1) {
335
- var firstChild = children[0];
336
- var firstChildTagName = firstChild.tagName.toLowerCase();
337
- if (['iframe', 'video'].includes(firstChildTagName)) {
338
- // p 下面包含 iframe 或 video
339
- $video = $(firstChild);
340
- }
341
- }
342
- }
343
- var videoTagName = getTagName($video);
344
- if (videoTagName !== 'iframe' && videoTagName !== 'video')
345
- return $video[0];
346
- // 已经符合 V5 格式
347
- var $parent = $video.parent();
348
- if ($parent.attr('data-w-e-type') === 'video')
349
- return $video[0];
350
- var $container = $("<div data-w-e-type=\"video\" data-w-e-is-void style=\"text-align: center;\"></div>");
351
- $container.append($video);
352
- return $container[0];
353
- }
354
- var preParseHtmlConf = {
355
- selector: 'iframe,video,p',
356
- preParseHtml: preParse,
357
- };
358
-
359
- /**
360
- * @description parse html
361
- * @author wangfupeng
362
- */
363
- function genVideoElem(src, poster, width, height, style) {
364
- if (poster === void 0) { poster = ''; }
365
- if (width === void 0) { width = 'auto'; }
366
- if (height === void 0) { height = 'auto'; }
367
- if (style === void 0) { style = {}; }
368
- return {
369
- type: 'video',
370
- src: src,
371
- poster: poster,
372
- width: width,
373
- height: height,
374
- style: style,
375
- children: [{ text: '' }], // void 元素有一个空 text
376
- };
377
- }
378
- function parseHtml(elem, children, editor) {
379
- var $elem = $(elem);
380
- var src = '';
381
- var poster = '';
382
- var width = 'auto';
383
- var height = 'auto';
384
- var style = {};
385
- // <iframe> 形式
386
- var $iframe = $elem.find('iframe');
387
- if ($iframe.length > 0) {
388
- width = $iframe.attr('width') || 'auto';
389
- height = $iframe.attr('height') || 'auto';
390
- style = $iframe.attr('style') || {};
391
- src = $iframe[0].outerHTML;
392
- return genVideoElem(src, poster, width, height, style);
393
- }
394
- // <video> 形式
395
- var $video = $elem.find('video');
396
- src = $video.attr('src') || '';
397
- if (!src) {
398
- if ($video.length > 0) {
399
- var $source = $video.find('source');
400
- src = $source.attr('src') || '';
401
- }
402
- }
403
- width = $video.attr('width') || 'auto';
404
- height = $video.attr('height') || 'auto';
405
- poster = $video.attr('poster') || '';
406
- style = $iframe.attr('style') || {};
407
- return genVideoElem(src, poster, width, height, style);
408
- }
409
- var parseHtmlConf = {
410
- selector: 'div[data-w-e-type="video"]',
411
- parseElemHtml: parseHtml,
412
- };
413
-
414
- /**
415
- * @description 工具函数
416
- * @author wangfupeng
417
- */
418
- /**
419
- * 获取随机数字符串
420
- * @param prefix 前缀
421
- * @returns 随机数字符串
422
- */
423
- function genRandomStr(prefix) {
424
- if (prefix === void 0) { prefix = 'r'; }
425
- return prefix + "-" + nanoid();
426
- }
427
- function replaceSymbols(str) {
428
- return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
429
- }
430
-
431
- /**
432
- * @description icon svg
433
- * @author wangfupeng
434
- */
435
- /**
436
- * 【注意】svg 字符串的长度 ,否则会导致代码体积过大
437
- * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
438
- * 找不到再从 iconfont.com 搜索
439
- */
440
- // 视频
441
- var VIDEO_SVG = '<svg viewBox="0 0 1024 1024"><path d="M981.184 160.096C837.568 139.456 678.848 128 512 128S186.432 139.456 42.816 160.096C15.296 267.808 0 386.848 0 512s15.264 244.16 42.816 351.904C186.464 884.544 345.152 896 512 896s325.568-11.456 469.184-32.096C1008.704 756.192 1024 637.152 1024 512s-15.264-244.16-42.816-351.904zM384 704V320l320 192-320 192z"></path></svg>';
442
- // 上传视频
443
- var UPLOAD_VIDEO_SVG = '<svg viewBox="0 0 1056 1024"><path d="M805.902261 521.819882a251.441452 251.441452 0 0 0-251.011972 246.600033 251.051015 251.051015 0 1 0 502.023944 8.823877 253.237463 253.237463 0 0 0-251.011972-255.42391z m59.463561 240.001647v129.898403h-116.701631v-129.898403h-44.041298l101.279368-103.504859 101.279368 103.504859z" p-id="6802"></path><path d="M788.254507 0.000781H99.094092A98.663439 98.663439 0 0 0 0.001171 99.093701v590.067495a98.663439 98.663439 0 0 0 99.092921 99.092921h411.7549a266.434235 266.434235 0 0 1-2.186448-41.815807 275.843767 275.843767 0 0 1 275.180024-270.729042 270.650955 270.650955 0 0 1 103.504859 19.834201V99.093701A101.51363 101.51363 0 0 0 788.254507 0.000781zM295.054441 640.747004V147.507894l394.146189 246.600033z"></path></svg>';
444
- // 编辑
445
- var PENCIL_SVG = '<svg viewBox="0 0 1024 1024"><path d="M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z"></path></svg>';
446
- // // 垃圾桶(删除)
447
- // export const TRASH_SVG =
448
- // '<svg viewBox="0 0 1024 1024"><path d="M826.8032 356.5312c-19.328 0-36.3776 15.6928-36.3776 35.0464v524.2624c0 19.328-16 34.56-35.328 34.56H264.9344c-19.328 0-35.5072-15.3088-35.5072-34.56V390.0416c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.6928-33.5104 35.0464V915.712c0 57.9328 44.6208 108.288 102.528 108.288H755.2c57.9328 0 108.0832-50.4576 108.0832-108.288V391.4752c-0.1024-19.2512-17.1264-34.944-36.48-34.944z" p-id="9577"></path><path d="M437.1712 775.7568V390.6048c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.616-33.5104 35.0464v385.152c0 19.328 14.1568 35.0464 33.5104 35.0464s33.5104-15.7184 33.5104-35.0464zM649.7024 775.7568V390.6048c0-19.328-17.0496-35.0464-36.3776-35.0464s-36.3776 15.616-36.3776 35.0464v385.152c0 19.328 17.0496 35.0464 36.3776 35.0464s36.3776-15.7184 36.3776-35.0464zM965.0432 217.0368h-174.6176V145.5104c0-57.9328-47.2064-101.76-104.6528-101.76h-350.976c-57.8304 0-105.3952 43.8528-105.3952 101.76v71.5264H54.784c-19.4304 0-35.0464 14.1568-35.0464 33.5104 0 19.328 15.616 33.5104 35.0464 33.5104h910.3616c19.328 0 35.0464-14.1568 35.0464-33.5104 0-19.3536-15.6928-33.5104-35.1488-33.5104z m-247.3728 0H297.3952V145.5104c0-19.328 18.2016-34.7648 37.4272-34.7648h350.976c19.1488 0 31.872 15.1296 31.872 34.7648v71.5264z"></path></svg>'
449
-
450
- /**
451
- * @description insert video
452
- * @author wangfupeng
453
- */
454
- /**
455
- * 插入视频
456
- * @param editor editor
457
- * @param src video src
458
- * @param poster video poster
459
- */
460
- function insertVideo (editor, src, poster, width, height) {
461
- if (poster === void 0) { poster = ''; }
462
- if (width === void 0) { width = ''; }
463
- if (height === void 0) { height = ''; }
464
- return __awaiter(this, void 0, void 0, function () {
465
- var _a, onInsertedVideo, checkVideo, parseVideoSrc, checkRes, parsedSrc, video;
466
- return __generator(this, function (_b) {
467
- switch (_b.label) {
468
- case 0:
469
- if (!src)
470
- return [2 /*return*/];
471
- // 还原选区
472
- editor.restoreSelection();
473
- _a = editor.getMenuConfig('insertVideo'), onInsertedVideo = _a.onInsertedVideo, checkVideo = _a.checkVideo, parseVideoSrc = _a.parseVideoSrc;
474
- return [4 /*yield*/, checkVideo(src, poster)];
475
- case 1:
476
- checkRes = _b.sent();
477
- if (typeof checkRes === 'string') {
478
- // 校验失败,给出提示
479
- editor.alert(checkRes, 'error');
480
- return [2 /*return*/];
481
- }
482
- if (checkRes == null) {
483
- // 校验失败,不给提示
484
- return [2 /*return*/];
485
- }
486
- return [4 /*yield*/, parseVideoSrc(src)];
487
- case 2:
488
- parsedSrc = _b.sent();
489
- if (parsedSrc.trim().indexOf('<iframe ') !== 0) {
490
- parsedSrc = replaceSymbols(parsedSrc);
491
- }
492
- video = {
493
- type: 'video',
494
- src: parsedSrc,
495
- poster: poster,
496
- children: [{ text: '' }],
497
- style: {
498
- width: width,
499
- height: height,
500
- },
501
- };
502
- // 插入视频
503
- // 不使用此方式会比正常的选区选取先执行
504
- Promise.resolve().then(function () {
505
- Transforms.insertNodes(editor, video);
506
- });
507
- // 调用 callback
508
- onInsertedVideo(video);
509
- return [2 /*return*/];
510
- }
511
- });
512
- });
513
- }
514
-
515
- /**
516
- * @description insert video menu
517
- * @author wangfupeng
518
- */
519
- /**
520
- * 生成唯一的 DOM ID
521
- */
522
- function genDomID$2() {
523
- return genRandomStr('w-e-insert-video');
524
- }
525
- var InsertVideoMenu = /** @class */ (function () {
526
- function InsertVideoMenu() {
527
- this.title = t('videoModule.insertVideo');
528
- this.iconSvg = VIDEO_SVG;
529
- this.tag = 'button';
530
- this.showModal = true; // 点击 button 时显示 modal
531
- this.modalWidth = 320;
532
- this.$content = null;
533
- this.srcInputId = genDomID$2();
534
- this.posterInputId = genDomID$2();
535
- this.buttonId = genDomID$2();
536
- }
537
- InsertVideoMenu.prototype.getValue = function (editor) {
538
- // 插入菜单,不需要 value
539
- return '';
540
- };
541
- InsertVideoMenu.prototype.isActive = function (editor) {
542
- // 任何时候,都不用激活 menu
543
- return false;
544
- };
545
- InsertVideoMenu.prototype.exec = function (editor, value) {
546
- // 点击菜单时,弹出 modal 之前,不需要执行其他代码
547
- // 此处空着即可
548
- };
549
- InsertVideoMenu.prototype.isDisabled = function (editor) {
550
- var selection = editor.selection;
551
- if (selection == null)
552
- return true;
553
- if (!Range.isCollapsed(selection))
554
- return true; // 选区非折叠,禁用
555
- var selectedElems = DomEditor.getSelectedElems(editor);
556
- var hasVoidOrPre = selectedElems.some(function (elem) {
557
- var type = DomEditor.getNodeType(elem);
558
- if (type === 'pre')
559
- return true;
560
- if (type === 'list-item')
561
- return true;
562
- if (editor.isVoid(elem))
563
- return true;
564
- return false;
565
- });
566
- if (hasVoidOrPre)
567
- return true; // void 或 pre ,禁用
568
- return false;
569
- };
570
- InsertVideoMenu.prototype.getModalPositionNode = function (editor) {
571
- return null; // modal 依据选区定位
572
- };
573
- InsertVideoMenu.prototype.getModalContentElem = function (editor) {
574
- var _this = this;
575
- var _a = this, srcInputId = _a.srcInputId, posterInputId = _a.posterInputId, buttonId = _a.buttonId;
576
- // 获取 input button elem
577
- var _b = __read(genModalInputElems(t('videoModule.videoSrc'), srcInputId, t('videoModule.videoSrcPlaceHolder')), 2), srcContainerElem = _b[0], inputSrcElem = _b[1];
578
- var _c = __read(genModalInputElems(t('videoModule.videoPoster'), posterInputId, t('videoModule.videoPosterPlaceHolder')), 2), posterContainerElem = _c[0], inputPosterElem = _c[1];
579
- var $inputSrc = $(inputSrcElem);
580
- var $inputPoster = $(inputPosterElem);
581
- var _d = __read(genModalButtonElems(buttonId, t('videoModule.ok')), 1), buttonContainerElem = _d[0];
582
- if (this.$content == null) {
583
- // 第一次渲染
584
- var $content_1 = $('<div></div>');
585
- // 绑定事件(第一次渲染时绑定,不要重复绑定)
586
- $content_1.on('click', "#" + buttonId, function (e) { return __awaiter(_this, void 0, void 0, function () {
587
- var src, poster;
588
- return __generator(this, function (_a) {
589
- switch (_a.label) {
590
- case 0:
591
- e.preventDefault();
592
- src = $content_1.find("#" + srcInputId).val().trim();
593
- poster = $content_1.find("#" + posterInputId).val().trim();
594
- return [4 /*yield*/, insertVideo(editor, src, poster)];
595
- case 1:
596
- _a.sent();
597
- editor.hidePanelOrModal(); // 隐藏 modal
598
- return [2 /*return*/];
599
- }
600
- });
601
- }); });
602
- // 记录属性,重要
603
- this.$content = $content_1;
604
- }
605
- var $content = this.$content;
606
- $content.empty(); // 先清空内容
607
- // append inputs and button
608
- $content.append(srcContainerElem);
609
- $content.append(posterContainerElem);
610
- $content.append(buttonContainerElem);
611
- // 设置 input val
612
- $inputSrc.val('');
613
- $inputPoster.val('');
614
- // focus 一个 input(异步,此时 DOM 尚未渲染)
615
- setTimeout(function () {
616
- $inputSrc.focus();
617
- });
618
- return $content[0];
619
- };
620
- return InsertVideoMenu;
621
- }());
622
-
623
- /**
624
- * @description upload video
625
- * @author wangfupeng
626
- */
627
- function getMenuConfig(editor) {
628
- // 获取配置,见 `./config.js`
629
- return editor.getMenuConfig('uploadVideo');
630
- }
631
- // 存储 editor uppy 的关系 - 缓存 uppy ,不重复创建
632
- var EDITOR_TO_UPPY_MAP = new WeakMap();
633
- /**
634
- * 获取 uppy 实例(并通过 editor 缓存)
635
- * @param editor editor
636
- */
637
- function getUppy(editor) {
638
- // 从缓存中获取
639
- var uppy = EDITOR_TO_UPPY_MAP.get(editor);
640
- if (uppy != null)
641
- return uppy;
642
- var menuConfig = getMenuConfig(editor);
643
- var onSuccess = menuConfig.onSuccess, onProgress = menuConfig.onProgress, onFailed = menuConfig.onFailed, customInsert = menuConfig.customInsert, onError = menuConfig.onError;
644
- // 上传完成之后
645
- var successHandler = function (file, res) {
646
- // 预期 res 格式:
647
- // 成功:{ errno: 0, data: { url, poster } }
648
- // 失败:{ errno: !0, message: '失败信息' }
649
- if (customInsert) {
650
- // 用户自定义插入视频,此时 res 格式可能不符合预期
651
- customInsert(res, function (src, poster) { return insertVideo(editor, src, poster); });
652
- // success 回调
653
- onSuccess(file, res);
654
- return;
655
- }
656
- var _a = res.errno, errno = _a === void 0 ? 1 : _a, _b = res.data, data = _b === void 0 ? {} : _b;
657
- if (errno !== 0) {
658
- // failed 回调
659
- onFailed(file, res);
660
- return;
661
- }
662
- var _c = data.url, url = _c === void 0 ? '' : _c, _d = data.poster, poster = _d === void 0 ? '' : _d;
663
- insertVideo(editor, url, poster);
664
- // success 回调
665
- onSuccess(file, res);
666
- };
667
- // progress 显示进度条
668
- var progressHandler = function (progress) {
669
- editor.showProgressBar(progress);
670
- // 回调函数
671
- onProgress && onProgress(progress);
672
- };
673
- // onError 提示错误
674
- var errorHandler = function (file, err, res) {
675
- onError(file, err, res);
676
- };
677
- // 创建 uppy
678
- uppy = createUploader(__assign(__assign({}, menuConfig), { onProgress: progressHandler, onSuccess: successHandler, onError: errorHandler }));
679
- // 缓存 uppy
680
- EDITOR_TO_UPPY_MAP.set(editor, uppy);
681
- return uppy;
682
- }
683
- /**
684
- * 上传视频文件
685
- * @param editor editor
686
- * @param file file
687
- */
688
- function uploadFile(editor, file) {
689
- return __awaiter(this, void 0, void 0, function () {
690
- var uppy, name, type, size;
691
- return __generator(this, function (_a) {
692
- switch (_a.label) {
693
- case 0:
694
- uppy = getUppy(editor);
695
- name = file.name, type = file.type, size = file.size;
696
- uppy.addFile({
697
- name: name,
698
- type: type,
699
- size: size,
700
- data: file,
701
- });
702
- return [4 /*yield*/, uppy.upload()];
703
- case 1:
704
- _a.sent();
705
- return [2 /*return*/];
706
- }
707
- });
708
- });
709
- }
710
- function uploadVideos (editor, files) {
711
- var e_1, _a;
712
- return __awaiter(this, void 0, void 0, function () {
713
- var fileList, customUpload, fileList_1, fileList_1_1, file, e_1_1;
714
- return __generator(this, function (_b) {
715
- switch (_b.label) {
716
- case 0:
717
- if (files == null)
718
- return [2 /*return*/];
719
- fileList = Array.prototype.slice.call(files);
720
- customUpload = getMenuConfig(editor).customUpload;
721
- _b.label = 1;
722
- case 1:
723
- _b.trys.push([1, 9, 10, 15]);
724
- fileList_1 = __asyncValues(fileList);
725
- _b.label = 2;
726
- case 2: return [4 /*yield*/, fileList_1.next()];
727
- case 3:
728
- if (!(fileList_1_1 = _b.sent(), !fileList_1_1.done)) return [3 /*break*/, 8];
729
- file = fileList_1_1.value;
730
- if (!customUpload) return [3 /*break*/, 5];
731
- // 自定义上传
732
- return [4 /*yield*/, customUpload(file, function (src, poster) { return insertVideo(editor, src, poster); })];
733
- case 4:
734
- // 自定义上传
735
- _b.sent();
736
- return [3 /*break*/, 7];
737
- case 5:
738
- // 默认上传
739
- return [4 /*yield*/, uploadFile(editor, file)];
740
- case 6:
741
- // 默认上传
742
- _b.sent();
743
- _b.label = 7;
744
- case 7: return [3 /*break*/, 2];
745
- case 8: return [3 /*break*/, 15];
746
- case 9:
747
- e_1_1 = _b.sent();
748
- e_1 = { error: e_1_1 };
749
- return [3 /*break*/, 15];
750
- case 10:
751
- _b.trys.push([10, , 13, 14]);
752
- if (!(fileList_1_1 && !fileList_1_1.done && (_a = fileList_1.return))) return [3 /*break*/, 12];
753
- return [4 /*yield*/, _a.call(fileList_1)];
754
- case 11:
755
- _b.sent();
756
- _b.label = 12;
757
- case 12: return [3 /*break*/, 14];
758
- case 13:
759
- if (e_1) throw e_1.error;
760
- return [7 /*endfinally*/];
761
- case 14: return [7 /*endfinally*/];
762
- case 15: return [2 /*return*/];
763
- }
764
- });
765
- });
766
- }
767
-
768
- /**
769
- * @description upload video menu
770
- * @author wangfupeng
771
- */
772
- var UploadVideoMenu = /** @class */ (function () {
773
- function UploadVideoMenu() {
774
- this.title = t('videoModule.uploadVideo');
775
- this.iconSvg = UPLOAD_VIDEO_SVG;
776
- this.tag = 'button';
777
- }
778
- UploadVideoMenu.prototype.getValue = function (editor) {
779
- // 无需获取 val
780
- return '';
781
- };
782
- UploadVideoMenu.prototype.isActive = function (editor) {
783
- // 任何时候,都不用激活 menu
784
- return false;
785
- };
786
- UploadVideoMenu.prototype.exec = function (editor, value) {
787
- var _a = this.getMenuConfig(editor), _b = _a.allowedFileTypes, allowedFileTypes = _b === void 0 ? [] : _b, customBrowseAndUpload = _a.customBrowseAndUpload;
788
- // 自定义选择图片,并上传,如图床
789
- if (customBrowseAndUpload) {
790
- customBrowseAndUpload(function (src, poster) { return insertVideo(editor, src, poster); });
791
- return;
792
- }
793
- // 设置选择文件的类型
794
- var acceptAttr = '';
795
- if (allowedFileTypes.length > 0) {
796
- acceptAttr = "accept=\"" + allowedFileTypes.join(', ') + "\"";
797
- }
798
- // 添加 file input(每次重新创建 input)
799
- var $body = $('body');
800
- var $inputFile = $("<input type=\"file\" " + acceptAttr + " multiple/>");
801
- $inputFile.hide();
802
- $body.append($inputFile);
803
- $inputFile.click();
804
- // 选中文件
805
- $inputFile.on('change', function () {
806
- var files = $inputFile[0].files;
807
- uploadVideos(editor, files); // 上传文件
808
- });
809
- };
810
- UploadVideoMenu.prototype.isDisabled = function (editor) {
811
- var selection = editor.selection;
812
- if (selection == null)
813
- return true;
814
- if (!Range.isCollapsed(selection))
815
- return true; // 选区非折叠,禁用
816
- var selectedElems = DomEditor.getSelectedElems(editor);
817
- var hasVoidOrPre = selectedElems.some(function (elem) {
818
- var type = DomEditor.getNodeType(elem);
819
- if (type === 'pre')
820
- return true;
821
- if (type === 'list-item')
822
- return true;
823
- if (editor.isVoid(elem))
824
- return true;
825
- return false;
826
- });
827
- if (hasVoidOrPre)
828
- return true; // void 或 pre ,禁用
829
- return false;
830
- };
831
- UploadVideoMenu.prototype.getMenuConfig = function (editor) {
832
- // 获取配置,见 `./config.js`
833
- return editor.getMenuConfig('uploadVideo');
834
- };
835
- return UploadVideoMenu;
836
- }());
837
-
838
- /**
839
- * @description 修改视频尺寸
840
- * @author wangfupeng
841
- */
842
- /**
843
- * 生成唯一的 DOM ID
844
- */
845
- function genDomID$1() {
846
- return genRandomStr('w-e-insert-video');
847
- }
848
- var EditorVideoSizeMenu = /** @class */ (function () {
849
- function EditorVideoSizeMenu() {
850
- this.title = t('videoModule.editSize');
851
- this.tag = 'button';
852
- this.showModal = true; // 点击 button 时显示 modal
853
- this.modalWidth = 320;
854
- this.$content = null;
855
- this.widthInputId = genDomID$1();
856
- this.heightInputId = genDomID$1();
857
- this.buttonId = genDomID$1();
858
- }
859
- EditorVideoSizeMenu.prototype.getSelectedVideoNode = function (editor) {
860
- return DomEditor.getSelectedNodeByType(editor, 'video');
861
- };
862
- EditorVideoSizeMenu.prototype.getValue = function (editor) {
863
- // 插入菜单,不需要 value
864
- return '';
865
- };
866
- EditorVideoSizeMenu.prototype.isActive = function (editor) {
867
- // 任何时候,都不用激活 menu
868
- return false;
869
- };
870
- EditorVideoSizeMenu.prototype.exec = function (editor, value) {
871
- // 点击菜单时,弹出 modal 之前,不需要执行其他代码
872
- // 此处空着即可
873
- };
874
- EditorVideoSizeMenu.prototype.isDisabled = function (editor) {
875
- if (editor.selection == null)
876
- return true;
877
- var videoNode = this.getSelectedVideoNode(editor);
878
- if (videoNode == null) {
879
- // 选区未处于 video node ,则禁用
880
- return true;
881
- }
882
- return false;
883
- };
884
- EditorVideoSizeMenu.prototype.getModalPositionNode = function (editor) {
885
- return this.getSelectedVideoNode(editor);
886
- };
887
- EditorVideoSizeMenu.prototype.getModalContentElem = function (editor) {
888
- var _a = this, widthInputId = _a.widthInputId, heightInputId = _a.heightInputId, buttonId = _a.buttonId;
889
- var _b = __read(genModalInputElems(t('videoModule.width'), widthInputId, 'auto'), 2), widthContainerElem = _b[0], inputWidthElem = _b[1];
890
- var $inputWidth = $(inputWidthElem);
891
- var _c = __read(genModalInputElems(t('videoModule.height'), heightInputId, 'auto'), 2), heightContainerElem = _c[0], inputHeightElem = _c[1];
892
- var $inputHeight = $(inputHeightElem);
893
- var _d = __read(genModalButtonElems(buttonId, t('videoModule.ok')), 1), buttonContainerElem = _d[0];
894
- if (this.$content == null) {
895
- // 第一次渲染
896
- var $content_1 = $('<div></div>');
897
- // 绑定事件(第一次渲染时绑定,不要重复绑定)
898
- $content_1.on('click', "#" + buttonId, function (e) {
899
- e.preventDefault();
900
- var rawWidth = $content_1.find("#" + widthInputId).val().trim();
901
- var rawHeight = $content_1.find("#" + heightInputId).val().trim();
902
- var isPercentage = function (value) { return /^\d+(\.\d+)?%$/.test(value); }; // 检查是否为合法的百分比字符串
903
- var isNumeric = function (value) { return /^\d+(\.\d+)?$/.test(value); }; // 检查是否为合法的数字
904
- var width = 'auto';
905
- var height = 'auto';
906
- if (isPercentage(rawWidth)) {
907
- width = rawWidth;
908
- }
909
- else if (isNumeric(rawWidth)) {
910
- width = parseInt(rawWidth) + 'px';
911
- }
912
- if (isPercentage(rawHeight)) {
913
- height = rawHeight;
914
- }
915
- else if (isNumeric(rawHeight)) {
916
- height = parseInt(rawHeight) + 'px';
917
- }
918
- var _a = videoNode.style, style = _a === void 0 ? {} : _a;
919
- editor.restoreSelection();
920
- var props = __assign(__assign({}, style), { style: {
921
- width: width,
922
- height: height,
923
- } });
924
- // 修改尺寸
925
- Transforms.setNodes(editor, props, {
926
- match: function (n) { return DomEditor.checkNodeType(n, 'video'); },
927
- });
928
- editor.hidePanelOrModal(); // 隐藏 modal
929
- });
930
- this.$content = $content_1;
931
- }
932
- var $content = this.$content;
933
- // 先清空,再重新添加 DOM 内容
934
- $content.empty();
935
- $content.append(widthContainerElem);
936
- $content.append(heightContainerElem);
937
- $content.append(buttonContainerElem);
938
- var videoNode = this.getSelectedVideoNode(editor);
939
- if (videoNode == null)
940
- return $content[0];
941
- // 初始化 input 值
942
- var _e = videoNode.style, style = _e === void 0 ? {} : _e;
943
- var _f = style.width, width = _f === void 0 ? '' : _f, _g = style.height, height = _g === void 0 ? '' : _g;
944
- $inputWidth.val(width);
945
- $inputHeight.val(height);
946
- setTimeout(function () {
947
- $inputWidth.focus();
948
- });
949
- return $content[0];
950
- };
951
- return EditorVideoSizeMenu;
952
- }());
953
-
954
- /**
955
- * @description editor video menu
956
- * @author
957
- */
958
- /**
959
- * 生成唯一的 DOM ID
960
- */
961
- function genDomID() {
962
- return genRandomStr('w-e-edit-video');
963
- }
964
- var Editvideo = /** @class */ (function () {
965
- function Editvideo() {
966
- this.title = t('videoModule.edit');
967
- this.iconSvg = PENCIL_SVG;
968
- this.tag = 'button';
969
- this.showModal = true; // 点击 button 时显示 modal
970
- this.modalWidth = 300;
971
- this.$content = null;
972
- this.srcInputId = genDomID();
973
- this.posterInputId = genDomID();
974
- this.buttonId = genDomID();
975
- }
976
- Editvideo.prototype.getSelectedVideoNode = function (editor) {
977
- return DomEditor.getSelectedNodeByType(editor, 'video');
978
- };
979
- Editvideo.prototype.getValue = function (editor) {
980
- // 编辑视频,用不到 getValue
981
- return '';
982
- };
983
- Editvideo.prototype.isActive = function (editor) {
984
- // 无需 active
985
- return false;
986
- };
987
- Editvideo.prototype.exec = function (editor, value) {
988
- // 点击菜单时,弹出 modal 之前,不需要执行其他代码
989
- // 此处空着即可
990
- };
991
- Editvideo.prototype.isDisabled = function (editor) {
992
- if (editor.selection == null)
993
- return true;
994
- var videoNode = this.getSelectedVideoNode(editor);
995
- if (videoNode == null) {
996
- // 选区未处于 video node ,则禁用
997
- return true;
998
- }
999
- return false;
1000
- };
1001
- Editvideo.prototype.getModalPositionNode = function (editor) {
1002
- return this.getSelectedVideoNode(editor);
1003
- };
1004
- Editvideo.prototype.getModalContentElem = function (editor) {
1005
- var _this = this;
1006
- var _a = this, srcInputId = _a.srcInputId, posterInputId = _a.posterInputId, buttonId = _a.buttonId;
1007
- // 获取 input button elem
1008
- var _b = __read(genModalInputElems(t('videoModule.videoSrc'), srcInputId, t('videoModule.videoSrcPlaceHolder')), 2), srcContainerElem = _b[0], inputSrcElem = _b[1];
1009
- var _c = __read(genModalInputElems(t('videoModule.videoPoster'), posterInputId, t('videoModule.videoPosterPlaceHolder')), 2), posterContainerElem = _c[0], inputPosterElem = _c[1];
1010
- var $inputSrc = $(inputSrcElem);
1011
- var $inputPoster = $(inputPosterElem);
1012
- var _d = __read(genModalButtonElems(buttonId, t('videoModule.ok')), 1), buttonContainerElem = _d[0];
1013
- if (this.$content == null) {
1014
- // 第一次渲染
1015
- var $content_1 = $('<div></div>');
1016
- // 绑定事件(第一次渲染时绑定,不要重复绑定)
1017
- $content_1.on('click', "#" + buttonId, function (e) { return __awaiter(_this, void 0, void 0, function () {
1018
- var src, poster, videoId, props;
1019
- return __generator(this, function (_a) {
1020
- e.preventDefault();
1021
- src = $content_1.find("#" + srcInputId).val().trim();
1022
- poster = $content_1.find("#" + posterInputId).val().trim();
1023
- videoId = genRandomStr('video-');
1024
- props = {
1025
- src: src,
1026
- poster: poster,
1027
- key: videoId,
1028
- };
1029
- editor.restoreSelection();
1030
- // 修改尺寸
1031
- Transforms.setNodes(editor, props, {
1032
- match: function (n) { return DomEditor.checkNodeType(n, 'video'); },
1033
- });
1034
- editor.hidePanelOrModal(); // 隐藏 modal
1035
- return [2 /*return*/];
1036
- });
1037
- }); });
1038
- // 记录属性,重要
1039
- this.$content = $content_1;
1040
- }
1041
- var $content = this.$content;
1042
- $content.empty(); // 先清空内容
1043
- // append inputs and button
1044
- $content.append(srcContainerElem);
1045
- $content.append(posterContainerElem);
1046
- $content.append(buttonContainerElem);
1047
- var videoNode = this.getSelectedVideoNode(editor);
1048
- if (videoNode == null)
1049
- return $content[0];
1050
- // 初始化 input 值
1051
- var _e = videoNode.src, src = _e === void 0 ? '' : _e, _f = videoNode.poster, poster = _f === void 0 ? '' : _f;
1052
- $inputSrc.val(src);
1053
- $inputPoster.val(poster);
1054
- // focus 一个 input(异步,此时 DOM 尚未渲染)
1055
- setTimeout(function () {
1056
- $inputSrc.focus();
1057
- });
1058
- return $content[0];
1059
- };
1060
- return Editvideo;
1061
- }());
1062
-
1063
- /**
1064
- * @description video menu config
1065
- * @author wangfupeng
1066
- */
1067
- function genUploadVideoMenuConfig() {
1068
- return {
1069
- server: '',
1070
- fieldName: 'wangeditor-uploaded-video',
1071
- maxFileSize: 10 * 1024 * 1024,
1072
- maxNumberOfFiles: 5,
1073
- allowedFileTypes: ['video/*'],
1074
- meta: {
1075
- // 自定义上传参数,例如传递验证的 token 等。参数会被添加到 formData 中,一起上传到服务端。
1076
- // 例如:token: 'xxxxx', x: 100
1077
- },
1078
- metaWithUrl: false,
1079
- // headers: {
1080
- // // 自定义 http headers
1081
- // // 例如:Accept: 'text/x-json', a: 100,
1082
- // },
1083
- withCredentials: false,
1084
- timeout: 30 * 1000,
1085
- onBeforeUpload: function (files) { return files; },
1086
- onProgress: function (progress) {
1087
- /* on progress */
1088
- },
1089
- onSuccess: function (file, res) {
1090
- /* on success */
1091
- },
1092
- onFailed: function (file, res) {
1093
- /* on failed */
1094
- console.error("'" + file.name + "' upload failed", res);
1095
- },
1096
- onError: function (file, err, res) {
1097
- /* on error */
1098
- /* on timeout */
1099
- console.error("'" + file.name + " upload error", err, res);
1100
- },
1101
- // 自定义插入视频,用户配置
1102
- // customInsert: (res, insertFn) => {},
1103
- // 自定义上传视频,用户配置
1104
- // customUpload: (file, insertFn) => {},
1105
- // 自定义选择,并上传视频,如:图床 (用户配置)
1106
- // customBrowseAndUpload: insertFn => {},
1107
- };
1108
- }
1109
- /**
1110
- * 生成插入网络视频的配置
1111
- */
1112
- function genInsertVideoMenuConfig() {
1113
- return {
1114
- onInsertedVideo: function (node) {
1115
- // 插入视频之后的 callback
1116
- },
1117
- /**
1118
- * 检查 video ,支持 async
1119
- * @param src src
1120
- * @param poster poster
1121
- */
1122
- checkVideo: function (src, poster) {
1123
- // 1. 返回 true ,说明检查通过
1124
- // 2. 返回一个字符串,说明检查未通过,编辑器会阻止插入。会 alert 出错误信息(即返回的字符串)
1125
- // 3. 返回 undefined(即没有任何返回),说明检查未通过,编辑器会阻止插入
1126
- return true;
1127
- },
1128
- /**
1129
- * 转换 video src
1130
- * @param src src
1131
- * @returns new src
1132
- */
1133
- parseVideoSrc: function (src) {
1134
- return src;
1135
- },
1136
- };
1137
- }
1138
-
1139
- /**
1140
- * @description video menu
1141
- * @author wangfupeng
1142
- */
1143
- var insertVideoMenuConf = {
1144
- key: 'insertVideo',
1145
- factory: function () {
1146
- return new InsertVideoMenu();
1147
- },
1148
- // 默认的菜单菜单配置,将存储在 editorConfig.MENU_CONF[key] 中
1149
- // 创建编辑器时,可通过 editorConfig.MENU_CONF[key] = {...} 来修改
1150
- config: genInsertVideoMenuConfig(),
1151
- };
1152
- var uploadVideoMenuConf = {
1153
- key: 'uploadVideo',
1154
- factory: function () {
1155
- return new UploadVideoMenu();
1156
- },
1157
- // 默认的菜单菜单配置,将存储在 editorConfig.MENU_CONF[key] 中
1158
- // 创建编辑器时,可通过 editorConfig.MENU_CONF[key] = {...} 来修改
1159
- config: genUploadVideoMenuConfig(),
1160
- };
1161
- var editorVideSizeMenuConf = {
1162
- key: 'editVideoSize',
1163
- factory: function () {
1164
- return new EditorVideoSizeMenu();
1165
- },
1166
- };
1167
- var editorVideoSrcMenuConf = {
1168
- key: 'editVideoSrc',
1169
- factory: function () {
1170
- return new Editvideo();
1171
- },
1172
- };
1173
- // export const deleteVideoMenuConf = {
1174
- // key: 'deleteVideo',
1175
- // factory() {
1176
- // return new DeleteVideoMenu()
1177
- // },
1178
- // }
1179
- // 键盘能删除 video 了,注释掉这个菜单 wangfupeng 22.02.23
1180
-
1181
- /**
1182
- * @description video module
1183
- * @author wangfupeng
1184
- */
1185
- var video = {
1186
- renderElems: [renderVideoConf],
1187
- elemsToHtml: [videoToHtmlConf],
1188
- preParseHtml: [preParseHtmlConf],
1189
- parseElemsHtml: [parseHtmlConf],
1190
- menus: [insertVideoMenuConf, uploadVideoMenuConf, editorVideSizeMenuConf, editorVideoSrcMenuConf],
1191
- editorPlugin: withVideo,
1192
- };
1193
-
1194
- /**
1195
- * @description video module
1196
- * @author wangfupeng
1197
- */
1198
-
1199
- export { video as default };
1
+ import{i18nAddResources as t,DomEditor as e,t as n,genModalInputElems as r,genModalButtonElems as o,createUploader as i}from"@wangeditor-next/core";import{Transforms as u,Range as a}from"slate";import{jsx as c,h as s}from"snabbdom";import f,{append as l,on as d,focus as v,attr as p,val as h,html as y,parent as g,hasClass as m,empty as b}from"dom7";import{nanoid as w}from"nanoid";t("en",{videoModule:{delete:"Delete",uploadVideo:"Upload video",insertVideo:"Insert video",videoSrc:"Video source",videoSrcPlaceHolder:"Video file url, or third-party <iframe>",videoPoster:"Video poster",videoPosterPlaceHolder:"Poster image url",ok:"Ok",editSize:"Edit size",edit:"Edit video",width:"Width",height:"Height"}}),t("zh-CN",{videoModule:{delete:"删除视频",uploadVideo:"上传视频",insertVideo:"插入视频",videoSrc:"视频地址",videoSrcPlaceHolder:"视频文件 url 或第三方 <iframe>",videoPoster:"视频封面",videoPosterPlaceHolder:"封面图片 url",ok:"确定",editSize:"修改尺寸",edit:"编辑视频",width:"宽度",height:"高度"}});var S=function(){return S=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},S.apply(this,arguments)};function x(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,a)}c((r=r.apply(t,e||[])).next())}))}function O(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function E(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function I(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function j(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=E(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(e=t[n](e)).done,e.value)}))}}}"function"==typeof SuppressedError&&SuppressedError;var P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function T(t){var e={exports:{}};return t(e,e.exports),e.exports}var M,A,k=function(t){return t&&t.Math==Math&&t},N=k("object"==typeof globalThis&&globalThis)||k("object"==typeof window&&window)||k("object"==typeof self&&self)||k("object"==typeof P&&P)||function(){return this}()||Function("return this")(),R=function(t){try{return!!t()}catch(t){return!0}},V=!R((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),C=Function.prototype.call,L=C.bind?C.bind(C):function(){return C.apply(C,arguments)},z={}.propertyIsEnumerable,F=Object.getOwnPropertyDescriptor,_={f:F&&!z.call({1:2},1)?function(t){var e=F(this,t);return!!e&&e.enumerable}:z},D=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},$=Function.prototype,H=$.bind,B=$.call,G=H&&H.bind(B),W=H?function(t){return t&&G(B,t)}:function(t){return t&&function(){return B.apply(t,arguments)}},U=W({}.toString),K=W("".slice),X=function(t){return K(U(t),8,-1)},Y=N.Object,q=W("".split),J=R((function(){return!Y("z").propertyIsEnumerable(0)}))?function(t){return"String"==X(t)?q(t,""):Y(t)}:Y,Q=N.TypeError,Z=function(t){if(null==t)throw Q("Can't call method on "+t);return t},tt=function(t){return J(Z(t))},et=function(t){return"function"==typeof t},nt=function(t){return"object"==typeof t?null!==t:et(t)},rt=function(t){return et(t)?t:void 0},ot=function(t,e){return arguments.length<2?rt(N[t]):N[t]&&N[t][e]},it=W({}.isPrototypeOf),ut=ot("navigator","userAgent")||"",at=N.process,ct=N.Deno,st=at&&at.versions||ct&&ct.version,ft=st&&st.v8;ft&&(A=(M=ft.split("."))[0]>0&&M[0]<4?1:+(M[0]+M[1])),!A&&ut&&(!(M=ut.match(/Edge\/(\d+)/))||M[1]>=74)&&(M=ut.match(/Chrome\/(\d+)/))&&(A=+M[1]);var lt=A,dt=!!Object.getOwnPropertySymbols&&!R((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&lt&&lt<41})),vt=dt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,pt=N.Object,ht=vt?function(t){return"symbol"==typeof t}:function(t){var e=ot("Symbol");return et(e)&&it(e.prototype,pt(t))},yt=N.String,gt=function(t){try{return yt(t)}catch(t){return"Object"}},mt=N.TypeError,bt=function(t){if(et(t))return t;throw mt(gt(t)+" is not a function")},wt=function(t,e){var n=t[e];return null==n?void 0:bt(n)},St=N.TypeError,xt=Object.defineProperty,Ot=function(t,e){try{xt(N,t,{value:e,configurable:!0,writable:!0})}catch(n){N[t]=e}return e},Et=N["__core-js_shared__"]||Ot("__core-js_shared__",{}),It=T((function(t){(t.exports=function(t,e){return Et[t]||(Et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),jt=N.Object,Pt=function(t){return jt(Z(t))},Tt=W({}.hasOwnProperty),Mt=Object.hasOwn||function(t,e){return Tt(Pt(t),e)},At=0,kt=Math.random(),Nt=W(1..toString),Rt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Nt(++At+kt,36)},Vt=It("wks"),Ct=N.Symbol,Lt=Ct&&Ct.for,zt=vt?Ct:Ct&&Ct.withoutSetter||Rt,Ft=function(t){if(!Mt(Vt,t)||!dt&&"string"!=typeof Vt[t]){var e="Symbol."+t;dt&&Mt(Ct,t)?Vt[t]=Ct[t]:Vt[t]=vt&&Lt?Lt(e):zt(e)}return Vt[t]},_t=N.TypeError,Dt=Ft("toPrimitive"),$t=function(t,e){if(!nt(t)||ht(t))return t;var n,r=wt(t,Dt);if(r){if(void 0===e&&(e="default"),n=L(r,t,e),!nt(n)||ht(n))return n;throw _t("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,r;if("string"===e&&et(n=t.toString)&&!nt(r=L(n,t)))return r;if(et(n=t.valueOf)&&!nt(r=L(n,t)))return r;if("string"!==e&&et(n=t.toString)&&!nt(r=L(n,t)))return r;throw St("Can't convert object to primitive value")}(t,e)},Ht=function(t){var e=$t(t,"string");return ht(e)?e:e+""},Bt=N.document,Gt=nt(Bt)&&nt(Bt.createElement),Wt=function(t){return Gt?Bt.createElement(t):{}},Ut=!V&&!R((function(){return 7!=Object.defineProperty(Wt("div"),"a",{get:function(){return 7}}).a})),Kt=Object.getOwnPropertyDescriptor,Xt={f:V?Kt:function(t,e){if(t=tt(t),e=Ht(e),Ut)try{return Kt(t,e)}catch(t){}if(Mt(t,e))return D(!L(_.f,t,e),t[e])}},Yt=N.String,qt=N.TypeError,Jt=function(t){if(nt(t))return t;throw qt(Yt(t)+" is not an object")},Qt=N.TypeError,Zt=Object.defineProperty,te={f:V?Zt:function(t,e,n){if(Jt(t),e=Ht(e),Jt(n),Ut)try{return Zt(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Qt("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},ee=V?function(t,e,n){return te.f(t,e,D(1,n))}:function(t,e,n){return t[e]=n,t},ne=W(Function.toString);et(Et.inspectSource)||(Et.inspectSource=function(t){return ne(t)});var re,oe,ie,ue=Et.inspectSource,ae=N.WeakMap,ce=et(ae)&&/native code/.test(ue(ae)),se=It("keys"),fe=function(t){return se[t]||(se[t]=Rt(t))},le={},de=N.TypeError,ve=N.WeakMap;if(ce||Et.state){var pe=Et.state||(Et.state=new ve),he=W(pe.get),ye=W(pe.has),ge=W(pe.set);re=function(t,e){if(ye(pe,t))throw new de("Object already initialized");return e.facade=t,ge(pe,t,e),e},oe=function(t){return he(pe,t)||{}},ie=function(t){return ye(pe,t)}}else{var me=fe("state");le[me]=!0,re=function(t,e){if(Mt(t,me))throw new de("Object already initialized");return e.facade=t,ee(t,me,e),e},oe=function(t){return Mt(t,me)?t[me]:{}},ie=function(t){return Mt(t,me)}}var be={set:re,get:oe,has:ie,enforce:function(t){return ie(t)?oe(t):re(t,{})},getterFor:function(t){return function(e){var n;if(!nt(e)||(n=oe(e)).type!==t)throw de("Incompatible receiver, "+t+" required");return n}}},we=Function.prototype,Se=V&&Object.getOwnPropertyDescriptor,xe=Mt(we,"name"),Oe={EXISTS:xe,PROPER:xe&&"something"===function(){}.name,CONFIGURABLE:xe&&(!V||V&&Se(we,"name").configurable)},Ee=T((function(t){var e=Oe.CONFIGURABLE,n=be.get,r=be.enforce,o=String(String).split("String");(t.exports=function(t,n,i,u){var a,c=!!u&&!!u.unsafe,s=!!u&&!!u.enumerable,f=!!u&&!!u.noTargetGet,l=u&&void 0!==u.name?u.name:n;et(i)&&("Symbol("===String(l).slice(0,7)&&(l="["+String(l).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Mt(i,"name")||e&&i.name!==l)&&ee(i,"name",l),(a=r(i)).source||(a.source=o.join("string"==typeof l?l:""))),t!==N?(c?!f&&t[n]&&(s=!0):delete t[n],s?t[n]=i:ee(t,n,i)):s?t[n]=i:Ot(n,i)})(Function.prototype,"toString",(function(){return et(this)&&n(this).source||ue(this)}))})),Ie=Math.ceil,je=Math.floor,Pe=function(t){var e=+t;return e!=e||0===e?0:(e>0?je:Ie)(e)},Te=Math.max,Me=Math.min,Ae=function(t,e){var n=Pe(t);return n<0?Te(n+e,0):Me(n,e)},ke=Math.min,Ne=function(t){return t>0?ke(Pe(t),9007199254740991):0},Re=function(t){return Ne(t.length)},Ve=function(t){return function(e,n,r){var o,i=tt(e),u=Re(i),a=Ae(r,u);if(t&&n!=n){for(;u>a;)if((o=i[a++])!=o)return!0}else for(;u>a;a++)if((t||a in i)&&i[a]===n)return t||a||0;return!t&&-1}},Ce={includes:Ve(!0),indexOf:Ve(!1)},Le=Ce.indexOf,ze=W([].push),Fe=function(t,e){var n,r=tt(t),o=0,i=[];for(n in r)!Mt(le,n)&&Mt(r,n)&&ze(i,n);for(;e.length>o;)Mt(r,n=e[o++])&&(~Le(i,n)||ze(i,n));return i},_e=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],De=_e.concat("length","prototype"),$e={f:Object.getOwnPropertyNames||function(t){return Fe(t,De)}},He={f:Object.getOwnPropertySymbols},Be=W([].concat),Ge=ot("Reflect","ownKeys")||function(t){var e=$e.f(Jt(t)),n=He.f;return n?Be(e,n(t)):e},We=function(t,e){for(var n=Ge(e),r=te.f,o=Xt.f,i=0;i<n.length;i++){var u=n[i];Mt(t,u)||r(t,u,o(e,u))}},Ue=/#|\.prototype\./,Ke=function(t,e){var n=Ye[Xe(t)];return n==Je||n!=qe&&(et(e)?R(e):!!e)},Xe=Ke.normalize=function(t){return String(t).replace(Ue,".").toLowerCase()},Ye=Ke.data={},qe=Ke.NATIVE="N",Je=Ke.POLYFILL="P",Qe=Ke,Ze=Xt.f,tn=function(t,e){var n,r,o,i,u,a=t.target,c=t.global,s=t.stat;if(n=c?N:s?N[a]||Ot(a,{}):(N[a]||{}).prototype)for(r in e){if(i=e[r],o=t.noTargetGet?(u=Ze(n,r))&&u.value:n[r],!Qe(c?r:a+(s?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;We(i,o)}(t.sham||o&&o.sham)&&ee(i,"sham",!0),Ee(n,r,i,t)}},en={};en[Ft("toStringTag")]="z";var nn,rn="[object z]"===String(en),on=Ft("toStringTag"),un=N.Object,an="Arguments"==X(function(){return arguments}()),cn=rn?X:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=un(t),on))?n:an?X(e):"Object"==(r=X(e))&&et(e.callee)?"Arguments":r},sn=N.String,fn=function(t){if("Symbol"===cn(t))throw TypeError("Cannot convert a Symbol value to a string");return sn(t)},ln="\t\n\v\f\r                 \u2028\u2029\ufeff",dn=W("".replace),vn="["+ln+"]",pn=RegExp("^"+vn+vn+"*"),hn=RegExp(vn+vn+"*$"),yn=function(t){return function(e){var n=fn(Z(e));return 1&t&&(n=dn(n,pn,"")),2&t&&(n=dn(n,hn,"")),n}},gn={start:yn(1),end:yn(2),trim:yn(3)},mn=Oe.PROPER,bn=gn.trim;function wn(t){return t.length?t[0].tagName.toLowerCase():""}function Sn(t,e,n,r){void 0===e&&(e="auto"),void 0===n&&(n="auto"),void 0===r&&(r={});var o=f(t),i=r.width,u=void 0===i?"":i,a=r.height,c=void 0===a?"":a,s="";return u&&(s+="width: "+u+";"),c&&(s+="height: "+c+";"),o.attr("width",e),o.attr("height",n),o.attr("style",s),o[0].outerHTML}tn({target:"String",proto:!0,forced:(nn="trim",R((function(){return!!ln[nn]()||"​…᠎"!=="​…᠎"[nn]()||mn&&ln[nn].name!==nn})))},{trim:function(){return bn(this)}}),tn({global:!0},{globalThis:N}),l&&(f.fn.append=l),d&&(f.fn.on=d),v&&(f.fn.focus=v),p&&(f.fn.attr=p),h&&(f.fn.val=h),y&&(f.fn.html=y),g&&(f.fn.parent=g),m&&(f.fn.hasClass=m),b&&(f.fn.empty=b);var xn={type:"video",renderElem:function(t,n,r){var o,i=t,u=i.src,a=void 0===u?"":u,f=i.poster,l=void 0===f?"":f,d=i.key,v=void 0===d?"":d,p=i.width,h=void 0===p?"auto":p,y=i.height,g=void 0===y?"auto":y,m=i.style,b=void 0===m?{}:m,w=i.textAlign,S=void 0===w?"center":w,x=e.isNodeSelected(r,t);if(0===a.trim().indexOf("<iframe ")){var O=Sn(a,h,g,b);o=c("div",{className:"w-e-textarea-video-container","data-selected":x?"true":"",style:{textAlign:S},innerHTML:O})}else{var E=c("video",{key:v,poster:l,controls:!0,style:b},c("source",{src:a,type:"video/mp4"}),"Sorry, your browser doesn't support embedded videos.\n 抱歉,浏览器不支持 video 视频");"auto"!==h&&(E.data.width=h),"auto"!==g&&(E.data.height=g),o=c("div",{className:"w-e-textarea-video-container","data-selected":x?"true":"",style:{textAlign:S}},E)}return s("div",{props:{contentEditable:!1},on:{mousedown:function(t){return t.preventDefault()}}},o)}};var On,En={type:"video",elemToHtml:function(t,e){var n=t,r=n.src,o=void 0===r?"":r,i=n.poster,u=void 0===i?"":i,a=n.width,c=void 0===a?"auto":a,s=n.height,f=void 0===s?"auto":s,l=n.style,d=void 0===l?{}:l,v=n.textAlign,p='<div data-w-e-type="video" data-w-e-is-void style="text-align: '+(void 0===v?"center":v)+';">\n';if(0===o.trim().indexOf("<iframe ")){p+=Sn(o,c,f,d)}else{var h=d.width,y=void 0===h?"":h,g=d.height,m=void 0===g?"":g,b="";y&&(b+="width: "+y+";"),m&&(b+="height: "+m+";"),p+='<video poster="'+u+'" controls="true" width="'+c+'" height="'+f+'" style="'+b+'"><source src="'+o+'" type="video/mp4"/></video>'}return p+="\n</div>"}},In=Object.keys||function(t){return Fe(t,_e)},jn=V?Object.defineProperties:function(t,e){Jt(t);for(var n,r=tt(e),o=In(e),i=o.length,u=0;i>u;)te.f(t,n=o[u++],r[n]);return t},Pn=ot("document","documentElement"),Tn=fe("IE_PROTO"),Mn=function(){},An=function(t){return"<script>"+t+"<\/script>"},kn=function(t){t.write(An("")),t.close();var e=t.parentWindow.Object;return t=null,e},Nn=function(){try{On=new ActiveXObject("htmlfile")}catch(t){}var t,e;Nn="undefined"!=typeof document?document.domain&&On?kn(On):((e=Wt("iframe")).style.display="none",Pn.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(An("document.F=Object")),t.close(),t.F):kn(On);for(var n=_e.length;n--;)delete Nn.prototype[_e[n]];return Nn()};le[Tn]=!0;var Rn=Object.create||function(t,e){var n;return null!==t?(Mn.prototype=Jt(t),n=new Mn,Mn.prototype=null,n[Tn]=t):n=Nn(),void 0===e?n:jn(n,e)},Vn=Ft("unscopables"),Cn=Array.prototype;null==Cn[Vn]&&te.f(Cn,Vn,{configurable:!0,value:Rn(null)});var Ln=function(t){Cn[Vn][t]=!0},zn=Ce.includes;tn({target:"Array",proto:!0},{includes:function(t){return zn(this,t,arguments.length>1?arguments[1]:void 0)}}),Ln("includes");var Fn={selector:"iframe,video,p",preParseHtml:function(t){var e=f(t),n=e;if("p"===wn(e)){var r=e.children();if(1===r.length){var o=r[0],i=o.tagName.toLowerCase();["iframe","video"].includes(i)&&(n=f(o))}}var u=wn(n);if("iframe"!==u&&"video"!==u)return n[0];if("video"===n.parent().attr("data-w-e-type"))return n[0];var a=f('<div data-w-e-type="video" data-w-e-is-void style="text-align: center;"></div>');return a.append(n),a[0]}},_n=W(W.bind),Dn=function(t,e){return bt(t),void 0===e?t:_n?_n(t,e):function(){return t.apply(e,arguments)}},$n=Array.isArray||function(t){return"Array"==X(t)},Hn=function(){},Bn=[],Gn=ot("Reflect","construct"),Wn=/^\s*(?:class|function)\b/,Un=W(Wn.exec),Kn=!Wn.exec(Hn),Xn=function(t){if(!et(t))return!1;try{return Gn(Hn,Bn,t),!0}catch(t){return!1}},Yn=!Gn||R((function(){var t;return Xn(Xn.call)||!Xn(Object)||!Xn((function(){t=!0}))||t}))?function(t){if(!et(t))return!1;switch(cn(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return Kn||!!Un(Wn,ue(t))}:Xn,qn=Ft("species"),Jn=N.Array,Qn=function(t,e){return new(function(t){var e;return $n(t)&&(e=t.constructor,(Yn(e)&&(e===Jn||$n(e.prototype))||nt(e)&&null===(e=e[qn]))&&(e=void 0)),void 0===e?Jn:e}(t))(0===e?0:e)},Zn=W([].push),tr=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,u=7==t,a=5==t||i;return function(c,s,f,l){for(var d,v,p=Pt(c),h=J(p),y=Dn(s,f),g=Re(h),m=0,b=l||Qn,w=e?b(c,g):n||u?b(c,0):void 0;g>m;m++)if((a||m in h)&&(v=y(d=h[m],m,p),t))if(e)w[m]=v;else if(v)switch(t){case 3:return!0;case 5:return d;case 6:return m;case 2:Zn(w,d)}else switch(t){case 4:return!1;case 7:Zn(w,d)}return i?-1:r||o?o:w}},er={forEach:tr(0),map:tr(1),filter:tr(2),some:tr(3),every:tr(4),find:tr(5),findIndex:tr(6),filterReject:tr(7)},nr=er.find,rr=!0;"find"in[]&&Array(1).find((function(){rr=!1})),tn({target:"Array",proto:!0,forced:rr},{find:function(t){return nr(this,t,arguments.length>1?arguments[1]:void 0)}}),Ln("find");var or=rn?{}.toString:function(){return"[object "+cn(this)+"]"};function ir(t,e,n,r,o){return void 0===e&&(e=""),void 0===n&&(n="auto"),void 0===r&&(r="auto"),void 0===o&&(o={}),{type:"video",src:t,poster:e,width:n,height:r,style:o,children:[{text:""}]}}rn||Ee(Object.prototype,"toString",or,{unsafe:!0});var ur,ar,cr={selector:'div[data-w-e-type="video"]',parseElemHtml:function(t,e,n){var r=f(t),o="",i="",u="auto",a="auto",c={},s=r.find("iframe");if(s.length>0)return u=s.attr("width")||"auto",a=s.attr("height")||"auto",c=s.attr("style")||{},ir(o=s[0].outerHTML,i,u,a,c);var l=r.find("video");return(o=l.attr("src")||"")||l.length>0&&(o=l.find("source").attr("src")||""),u=l.attr("width")||"auto",a=l.attr("height")||"auto",ir(o,i=l.attr("poster")||"",u,a,c=s.attr("style")||{})}},sr=function(){var t=Jt(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},fr=N.RegExp,lr=R((function(){var t=fr("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),dr=lr||R((function(){return!fr("a","y").sticky})),vr={BROKEN_CARET:lr||R((function(){var t=fr("^r","gy");return t.lastIndex=2,null!=t.exec("str")})),MISSED_STICKY:dr,UNSUPPORTED_Y:lr},pr=N.RegExp,hr=R((function(){var t=pr(".","s");return!(t.dotAll&&t.exec("\n")&&"s"===t.flags)})),yr=N.RegExp,gr=R((function(){var t=yr("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})),mr=be.get,br=It("native-string-replace",String.prototype.replace),wr=RegExp.prototype.exec,Sr=wr,xr=W("".charAt),Or=W("".indexOf),Er=W("".replace),Ir=W("".slice),jr=(ar=/b*/g,L(wr,ur=/a/,"a"),L(wr,ar,"a"),0!==ur.lastIndex||0!==ar.lastIndex),Pr=vr.BROKEN_CARET,Tr=void 0!==/()??/.exec("")[1];(jr||Tr||Pr||hr||gr)&&(Sr=function(t){var e,n,r,o,i,u,a,c=this,s=mr(c),f=fn(t),l=s.raw;if(l)return l.lastIndex=c.lastIndex,e=L(Sr,l,f),c.lastIndex=l.lastIndex,e;var d=s.groups,v=Pr&&c.sticky,p=L(sr,c),h=c.source,y=0,g=f;if(v&&(p=Er(p,"y",""),-1===Or(p,"g")&&(p+="g"),g=Ir(f,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==xr(f,c.lastIndex-1))&&(h="(?: "+h+")",g=" "+g,y++),n=new RegExp("^(?:"+h+")",p)),Tr&&(n=new RegExp("^"+h+"$(?!\\s)",p)),jr&&(r=c.lastIndex),o=L(wr,v?n:c,g),v?o?(o.input=Ir(o.input,y),o[0]=Ir(o[0],y),o.index=c.lastIndex,c.lastIndex+=o[0].length):c.lastIndex=0:jr&&o&&(c.lastIndex=c.global?o.index+o[0].length:r),Tr&&o&&o.length>1&&L(br,o[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(o[i]=void 0)})),o&&d)for(o.groups=u=Rn(null),i=0;i<d.length;i++)u[(a=d[i])[0]]=o[a[1]];return o});var Mr=Sr;tn({target:"RegExp",proto:!0,forced:/./.exec!==Mr},{exec:Mr});var Ar=Function.prototype,kr=Ar.apply,Nr=Ar.bind,Rr=Ar.call,Vr="object"==typeof Reflect&&Reflect.apply||(Nr?Rr.bind(kr):function(){return Rr.apply(kr,arguments)}),Cr=Ft("species"),Lr=RegExp.prototype,zr=W("".charAt),Fr=W("".charCodeAt),_r=W("".slice),Dr=function(t){return function(e,n){var r,o,i=fn(Z(e)),u=Pe(n),a=i.length;return u<0||u>=a?t?"":void 0:(r=Fr(i,u))<55296||r>56319||u+1===a||(o=Fr(i,u+1))<56320||o>57343?t?zr(i,u):r:t?_r(i,u,u+2):o-56320+(r-55296<<10)+65536}},$r={codeAt:Dr(!1),charAt:Dr(!0)},Hr=$r.charAt,Br=function(t,e,n){return e+(n?Hr(t,e).length:1)},Gr=Math.floor,Wr=W("".charAt),Ur=W("".replace),Kr=W("".slice),Xr=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Yr=/\$([$&'`]|\d{1,2})/g,qr=function(t,e,n,r,o,i){var u=n+t.length,a=r.length,c=Yr;return void 0!==o&&(o=Pt(o),c=Xr),Ur(i,c,(function(i,c){var s;switch(Wr(c,0)){case"$":return"$";case"&":return t;case"`":return Kr(e,0,n);case"'":return Kr(e,u);case"<":s=o[Kr(c,1,-1)];break;default:var f=+c;if(0===f)return i;if(f>a){var l=Gr(f/10);return 0===l?i:l<=a?void 0===r[l-1]?Wr(c,1):r[l-1]+Wr(c,1):i}s=r[f-1]}return void 0===s?"":s}))},Jr=N.TypeError,Qr=function(t,e){var n=t.exec;if(et(n)){var r=L(n,t,e);return null!==r&&Jt(r),r}if("RegExp"===X(t))return L(Mr,t,e);throw Jr("RegExp#exec called on incompatible receiver")},Zr=Ft("replace"),to=Math.max,eo=Math.min,no=W([].concat),ro=W([].push),oo=W("".indexOf),io=W("".slice),uo="$0"==="a".replace(/./,"$0"),ao=!!/./[Zr]&&""===/./[Zr]("a","$0");function co(t){return void 0===t&&(t="r"),t+"-"+w()}!function(t,e,n,r){var o=Ft(t),i=!R((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),u=i&&!R((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[Cr]=function(){return n},n.flags="",n[o]=/./[o]),n.exec=function(){return e=!0,null},n[o](""),!e}));if(!i||!u||n){var a=W(/./[o]),c=e(o,""[t],(function(t,e,n,r,o){var u=W(t),c=e.exec;return c===Mr||c===Lr.exec?i&&!o?{done:!0,value:a(e,n,r)}:{done:!0,value:u(n,e,r)}:{done:!1}}));Ee(String.prototype,t,c[0]),Ee(Lr,o,c[1])}r&&ee(Lr[o],"sham",!0)}("replace",(function(t,e,n){var r=ao?"$":"$0";return[function(t,n){var r=Z(this),o=null==t?void 0:wt(t,Zr);return o?L(o,t,r,n):L(e,fn(r),t,n)},function(t,o){var i=Jt(this),u=fn(t);if("string"==typeof o&&-1===oo(o,r)&&-1===oo(o,"$<")){var a=n(e,i,u,o);if(a.done)return a.value}var c=et(o);c||(o=fn(o));var s=i.global;if(s){var f=i.unicode;i.lastIndex=0}for(var l=[];;){var d=Qr(i,u);if(null===d)break;if(ro(l,d),!s)break;""===fn(d[0])&&(i.lastIndex=Br(u,Ne(i.lastIndex),f))}for(var v,p="",h=0,y=0;y<l.length;y++){for(var g=fn((d=l[y])[0]),m=to(eo(Pe(d.index),u.length),0),b=[],w=1;w<d.length;w++)ro(b,void 0===(v=d[w])?v:String(v));var S=d.groups;if(c){var x=no([g],b,m,u);void 0!==S&&ro(x,S);var O=fn(Vr(o,void 0,x))}else O=qr(g,u,m,b,S,o);m>=h&&(p+=io(u,h,m)+O,h=m+g.length)}return p+io(u,h)}]}),!!R((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}))||!uo||ao);var so=N.Promise,fo=function(t,e,n){for(var r in e)Ee(t,r,e[r],n);return t},lo=N.String,vo=N.TypeError,po=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=W(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return Jt(n),function(t){if("object"==typeof t||et(t))return t;throw vo("Can't set "+lo(t)+" as a prototype")}(r),e?t(n,r):n.__proto__=r,n}}():void 0),ho=te.f,yo=Ft("toStringTag"),go=function(t,e,n){t&&!Mt(t=n?t:t.prototype,yo)&&ho(t,yo,{configurable:!0,value:e})},mo=Ft("species"),bo=N.TypeError,wo=function(t,e){if(it(e,t))return t;throw bo("Incorrect invocation")},So={},xo=Ft("iterator"),Oo=Array.prototype,Eo=Ft("iterator"),Io=function(t){if(null!=t)return wt(t,Eo)||wt(t,"@@iterator")||So[cn(t)]},jo=N.TypeError,Po=function(t,e,n){var r,o;Jt(t);try{if(!(r=wt(t,"return"))){if("throw"===e)throw n;return n}r=L(r,t)}catch(t){o=!0,r=t}if("throw"===e)throw n;if(o)throw r;return Jt(r),n},To=N.TypeError,Mo=function(t,e){this.stopped=t,this.result=e},Ao=Mo.prototype,ko=function(t,e,n){var r,o,i,u,a,c,s,f,l=n&&n.that,d=!(!n||!n.AS_ENTRIES),v=!(!n||!n.IS_ITERATOR),p=!(!n||!n.INTERRUPTED),h=Dn(e,l),y=function(t){return r&&Po(r,"normal",t),new Mo(!0,t)},g=function(t){return d?(Jt(t),p?h(t[0],t[1],y):h(t[0],t[1])):p?h(t,y):h(t)};if(v)r=t;else{if(!(o=Io(t)))throw To(gt(t)+" is not iterable");if(void 0!==(f=o)&&(So.Array===f||Oo[xo]===f)){for(i=0,u=Re(t);u>i;i++)if((a=g(t[i]))&&it(Ao,a))return a;return new Mo(!1)}r=function(t,e){var n=arguments.length<2?Io(t):e;if(bt(n))return Jt(L(n,t));throw jo(gt(t)+" is not iterable")}(t,o)}for(c=r.next;!(s=L(c,r)).done;){try{a=g(s.value)}catch(t){Po(r,"throw",t)}if("object"==typeof a&&a&&it(Ao,a))return a}return new Mo(!1)},No=Ft("iterator"),Ro=!1;try{var Vo=0,Co={next:function(){return{done:!!Vo++}},return:function(){Ro=!0}};Co[No]=function(){return this},Array.from(Co,(function(){throw 2}))}catch(t){}var Lo,zo,Fo,_o,Do=function(t,e){if(!e&&!Ro)return!1;var n=!1;try{var r={};r[No]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n},$o=N.TypeError,Ho=Ft("species"),Bo=function(t,e){var n,r=Jt(t).constructor;return void 0===r||null==(n=Jt(r)[Ho])?e:function(t){if(Yn(t))return t;throw $o(gt(t)+" is not a constructor")}(n)},Go=W([].slice),Wo=/(?:ipad|iphone|ipod).*applewebkit/i.test(ut),Uo="process"==X(N.process),Ko=N.setImmediate,Xo=N.clearImmediate,Yo=N.process,qo=N.Dispatch,Jo=N.Function,Qo=N.MessageChannel,Zo=N.String,ti=0,ei={};try{Lo=N.location}catch(t){}var ni=function(t){if(Mt(ei,t)){var e=ei[t];delete ei[t],e()}},ri=function(t){return function(){ni(t)}},oi=function(t){ni(t.data)},ii=function(t){N.postMessage(Zo(t),Lo.protocol+"//"+Lo.host)};Ko&&Xo||(Ko=function(t){var e=Go(arguments,1);return ei[++ti]=function(){Vr(et(t)?t:Jo(t),void 0,e)},zo(ti),ti},Xo=function(t){delete ei[t]},Uo?zo=function(t){Yo.nextTick(ri(t))}:qo&&qo.now?zo=function(t){qo.now(ri(t))}:Qo&&!Wo?(_o=(Fo=new Qo).port2,Fo.port1.onmessage=oi,zo=Dn(_o.postMessage,_o)):N.addEventListener&&et(N.postMessage)&&!N.importScripts&&Lo&&"file:"!==Lo.protocol&&!R(ii)?(zo=ii,N.addEventListener("message",oi,!1)):zo="onreadystatechange"in Wt("script")?function(t){Pn.appendChild(Wt("script")).onreadystatechange=function(){Pn.removeChild(this),ni(t)}}:function(t){setTimeout(ri(t),0)});var ui,ai,ci,si,fi,li,di,vi,pi={set:Ko,clear:Xo},hi=/ipad|iphone|ipod/i.test(ut)&&void 0!==N.Pebble,yi=/web0s(?!.*chrome)/i.test(ut),gi=Xt.f,mi=pi.set,bi=N.MutationObserver||N.WebKitMutationObserver,wi=N.document,Si=N.process,xi=N.Promise,Oi=gi(N,"queueMicrotask"),Ei=Oi&&Oi.value;Ei||(ui=function(){var t,e;for(Uo&&(t=Si.domain)&&t.exit();ai;){e=ai.fn,ai=ai.next;try{e()}catch(t){throw ai?si():ci=void 0,t}}ci=void 0,t&&t.enter()},Wo||Uo||yi||!bi||!wi?!hi&&xi&&xi.resolve?((di=xi.resolve(void 0)).constructor=xi,vi=Dn(di.then,di),si=function(){vi(ui)}):Uo?si=function(){Si.nextTick(ui)}:(mi=Dn(mi,N),si=function(){mi(ui)}):(fi=!0,li=wi.createTextNode(""),new bi(ui).observe(li,{characterData:!0}),si=function(){li.data=fi=!fi}));var Ii,ji,Pi,Ti,Mi=Ei||function(t){var e={fn:t,next:void 0};ci&&(ci.next=e),ai||(ai=e,si()),ci=e},Ai=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r})),this.resolve=bt(e),this.reject=bt(n)},ki={f:function(t){return new Ai(t)}},Ni=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},Ri="object"==typeof window,Vi=pi.set,Ci=Ft("species"),Li="Promise",zi=be.getterFor(Li),Fi=be.set,_i=be.getterFor(Li),Di=so&&so.prototype,$i=so,Hi=Di,Bi=N.TypeError,Gi=N.document,Wi=N.process,Ui=ki.f,Ki=Ui,Xi=!!(Gi&&Gi.createEvent&&N.dispatchEvent),Yi=et(N.PromiseRejectionEvent),qi=!1,Ji=Qe(Li,(function(){var t=ue($i),e=t!==String($i);if(!e&&66===lt)return!0;if(lt>=51&&/native code/.test(t))return!1;var n=new $i((function(t){t(1)})),r=function(t){t((function(){}),(function(){}))};return(n.constructor={})[Ci]=r,!(qi=n.then((function(){}))instanceof r)||!e&&Ri&&!Yi})),Qi=Ji||!Do((function(t){$i.all(t).catch((function(){}))})),Zi=function(t){var e;return!(!nt(t)||!et(e=t.then))&&e},tu=function(t,e){if(!t.notified){t.notified=!0;var n=t.reactions;Mi((function(){for(var r=t.value,o=1==t.state,i=0;n.length>i;){var u,a,c,s=n[i++],f=o?s.ok:s.fail,l=s.resolve,d=s.reject,v=s.domain;try{f?(o||(2===t.rejection&&ou(t),t.rejection=1),!0===f?u=r:(v&&v.enter(),u=f(r),v&&(v.exit(),c=!0)),u===s.promise?d(Bi("Promise-chain cycle")):(a=Zi(u))?L(a,u,l,d):l(u)):d(r)}catch(t){v&&!c&&v.exit(),d(t)}}t.reactions=[],t.notified=!1,e&&!t.rejection&&nu(t)}))}},eu=function(t,e,n){var r,o;Xi?((r=Gi.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),N.dispatchEvent(r)):r={promise:e,reason:n},!Yi&&(o=N["on"+t])?o(r):"unhandledrejection"===t&&function(t,e){var n=N.console;n&&n.error&&(1==arguments.length?n.error(t):n.error(t,e))}("Unhandled promise rejection",n)},nu=function(t){L(Vi,N,(function(){var e,n=t.facade,r=t.value;if(ru(t)&&(e=Ni((function(){Uo?Wi.emit("unhandledRejection",r,n):eu("unhandledrejection",n,r)})),t.rejection=Uo||ru(t)?2:1,e.error))throw e.value}))},ru=function(t){return 1!==t.rejection&&!t.parent},ou=function(t){L(Vi,N,(function(){var e=t.facade;Uo?Wi.emit("rejectionHandled",e):eu("rejectionhandled",e,t.value)}))},iu=function(t,e,n){return function(r){t(e,r,n)}},uu=function(t,e,n){t.done||(t.done=!0,n&&(t=n),t.value=e,t.state=2,tu(t,!0))},au=function(t,e,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===e)throw Bi("Promise can't be resolved itself");var r=Zi(e);r?Mi((function(){var n={done:!1};try{L(r,e,iu(au,n,t),iu(uu,n,t))}catch(e){uu(n,e,t)}})):(t.value=e,t.state=1,tu(t,!1))}catch(e){uu({done:!1},e,t)}}};if(Ji&&(Hi=($i=function(t){wo(this,Hi),bt(t),L(Ii,this);var e=zi(this);try{t(iu(au,e),iu(uu,e))}catch(t){uu(e,t)}}).prototype,(Ii=function(t){Fi(this,{type:Li,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=fo(Hi,{then:function(t,e){var n=_i(this),r=n.reactions,o=Ui(Bo(this,$i));return o.ok=!et(t)||t,o.fail=et(e)&&e,o.domain=Uo?Wi.domain:void 0,n.parent=!0,r[r.length]=o,0!=n.state&&tu(n,!1),o.promise},catch:function(t){return this.then(void 0,t)}}),ji=function(){var t=new Ii,e=zi(t);this.promise=t,this.resolve=iu(au,e),this.reject=iu(uu,e)},ki.f=Ui=function(t){return t===$i||t===Pi?new ji(t):Ki(t)},et(so)&&Di!==Object.prototype)){Ti=Di.then,qi||(Ee(Di,"then",(function(t,e){var n=this;return new $i((function(t,e){L(Ti,n,t,e)})).then(t,e)}),{unsafe:!0}),Ee(Di,"catch",Hi.catch,{unsafe:!0}));try{delete Di.constructor}catch(t){}po&&po(Di,Hi)}function cu(t,n,r,o,i){return void 0===r&&(r=""),void 0===o&&(o=""),void 0===i&&(i=""),x(this,void 0,void 0,(function(){var a,c,s,f,l,d,v;return O(this,(function(p){switch(p.label){case 0:return n?(t.restoreSelection(),a=t.getMenuConfig("insertVideo"),c=a.onInsertedVideo,s=a.checkVideo,f=a.parseVideoSrc,[4,s(n,r)]):[2];case 1:return"string"==typeof(l=p.sent())?(t.alert(l,"error"),[2]):null==l?[2]:[4,f(n)];case 2:return 0!==(d=p.sent()).trim().indexOf("<iframe ")&&(d=d.replace(/</g,"&lt;").replace(/>/g,"&gt;")),e.isSelectedEmptyParagraph(t)&&u.removeNodes(t,{mode:"highest"}),v={type:"video",src:d,poster:r,children:[{text:""}],style:{width:o,height:i}},Promise.resolve().then((function(){u.insertNodes(t,v)})),c(v),[2]}}))}))}function su(){return co("w-e-insert-video")}tn({global:!0,wrap:!0,forced:Ji},{Promise:$i}),go($i,Li,!1),function(t){var e=ot(t),n=te.f;V&&e&&!e[mo]&&n(e,mo,{configurable:!0,get:function(){return this}})}(Li),Pi=ot(Li),tn({target:Li,stat:!0,forced:Ji},{reject:function(t){var e=Ui(this);return L(e.reject,void 0,t),e.promise}}),tn({target:Li,stat:!0,forced:Ji},{resolve:function(t){return function(t,e){if(Jt(t),nt(e)&&e.constructor===t)return e;var n=ki.f(t);return(0,n.resolve)(e),n.promise}(this,t)}}),tn({target:Li,stat:!0,forced:Qi},{all:function(t){var e=this,n=Ui(e),r=n.resolve,o=n.reject,i=Ni((function(){var n=bt(e.resolve),i=[],u=0,a=1;ko(t,(function(t){var c=u++,s=!1;a++,L(n,e,t).then((function(t){s||(s=!0,i[c]=t,--a||r(i))}),o)})),--a||r(i)}));return i.error&&o(i.value),n.promise},race:function(t){var e=this,n=Ui(e),r=n.reject,o=Ni((function(){var o=bt(e.resolve);ko(t,(function(t){L(o,e,t).then(n.resolve,r)}))}));return o.error&&r(o.value),n.promise}});var fu=function(){function t(){this.title=n("videoModule.insertVideo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M981.184 160.096C837.568 139.456 678.848 128 512 128S186.432 139.456 42.816 160.096C15.296 267.808 0 386.848 0 512s15.264 244.16 42.816 351.904C186.464 884.544 345.152 896 512 896s325.568-11.456 469.184-32.096C1008.704 756.192 1024 637.152 1024 512s-15.264-244.16-42.816-351.904zM384 704V320l320 192-320 192z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=320,this.$content=null,this.srcInputId=su(),this.posterInputId=su(),this.buttonId=su()}return t.prototype.getValue=function(t){return""},t.prototype.isActive=function(t){return!1},t.prototype.exec=function(t,e){},t.prototype.isDisabled=function(t){var n=t.selection;return null==n||(!a.isCollapsed(n)||!!e.getSelectedElems(t).some((function(n){var r=e.getNodeType(n);return"pre"===r||("list-item"===r||!!t.isVoid(n))})))},t.prototype.getModalPositionNode=function(t){return null},t.prototype.getModalContentElem=function(t){var e=this,i=this,u=i.srcInputId,a=i.posterInputId,c=i.buttonId,s=I(r(n("videoModule.videoSrc"),u,n("videoModule.videoSrcPlaceHolder")),2),l=s[0],d=s[1],v=I(r(n("videoModule.videoPoster"),a,n("videoModule.videoPosterPlaceHolder")),2),p=v[0],h=v[1],y=f(d),g=f(h),m=I(o(c,n("videoModule.ok")),1)[0];if(null==this.$content){var b=f("<div></div>");b.on("click","#"+c,(function(n){return x(e,void 0,void 0,(function(){var e,r;return O(this,(function(o){switch(o.label){case 0:return n.preventDefault(),e=b.find("#"+u).val().trim(),r=b.find("#"+a).val().trim(),[4,cu(t,e,r)];case 1:return o.sent(),t.hidePanelOrModal(),[2]}}))}))})),this.$content=b}var w=this.$content;return w.empty(),w.append(l),w.append(p),w.append(m),y.val(""),g.val(""),setTimeout((function(){y.focus()})),w[0]},t}(),lu=W([].join),du=J!=Object,vu=function(t,e){var n=[][t];return!!n&&R((function(){n.call(null,e||function(){throw 1},1)}))}("join",",");tn({target:"Array",proto:!0,forced:du||!vu},{join:function(t){return lu(tt(this),void 0===t?",":t)}});var pu,hu,yu,gu=!R((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),mu=fe("IE_PROTO"),bu=N.Object,wu=bu.prototype,Su=gu?bu.getPrototypeOf:function(t){var e=Pt(t);if(Mt(e,mu))return e[mu];var n=e.constructor;return et(n)&&e instanceof n?n.prototype:e instanceof bu?wu:null},xu=Ft("iterator"),Ou=!1;[].keys&&("next"in(yu=[].keys())?(hu=Su(Su(yu)))!==Object.prototype&&(pu=hu):Ou=!0);var Eu=null==pu||R((function(){var t={};return pu[xu].call(t)!==t}));Eu&&(pu={}),et(pu[xu])||Ee(pu,xu,(function(){return this}));var Iu={IteratorPrototype:pu,BUGGY_SAFARI_ITERATORS:Ou},ju=Iu.IteratorPrototype,Pu=function(){return this},Tu=Oe.PROPER,Mu=Oe.CONFIGURABLE,Au=Iu.IteratorPrototype,ku=Iu.BUGGY_SAFARI_ITERATORS,Nu=Ft("iterator"),Ru=function(){return this},Vu=function(t,e,n,r,o,i,u){!function(t,e,n,r){var o=e+" Iterator";t.prototype=Rn(ju,{next:D(+!r,n)}),go(t,o,!1),So[o]=Pu}(n,e,r);var a,c,s,f=function(t){if(t===o&&h)return h;if(!ku&&t in v)return v[t];switch(t){case"keys":case"values":case"entries":return function(){return new n(this,t)}}return function(){return new n(this)}},l=e+" Iterator",d=!1,v=t.prototype,p=v[Nu]||v["@@iterator"]||o&&v[o],h=!ku&&p||f(o),y="Array"==e&&v.entries||p;if(y&&(a=Su(y.call(new t)))!==Object.prototype&&a.next&&(Su(a)!==Au&&(po?po(a,Au):et(a[Nu])||Ee(a,Nu,Ru)),go(a,l,!0)),Tu&&"values"==o&&p&&"values"!==p.name&&(Mu?ee(v,"name","values"):(d=!0,h=function(){return L(p,this)})),o)if(c={values:f("values"),keys:i?h:f("keys"),entries:f("entries")},u)for(s in c)(ku||d||!(s in v))&&Ee(v,s,c[s]);else tn({target:e,proto:!0,forced:ku||d},c);return v[Nu]!==h&&Ee(v,Nu,h,{name:o}),So[e]=h,c},Cu=be.set,Lu=be.getterFor("Array Iterator"),zu=Vu(Array,"Array",(function(t,e){Cu(this,{type:"Array Iterator",target:tt(t),index:0,kind:e})}),(function(){var t=Lu(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}}),"values");So.Arguments=So.Array,Ln("keys"),Ln("values"),Ln("entries");var Fu=$r.charAt,_u=be.set,Du=be.getterFor("String Iterator");Vu(String,"String",(function(t){_u(this,{type:"String Iterator",string:fn(t),index:0})}),(function(){var t,e=Du(this),n=e.string,r=e.index;return r>=n.length?{value:void 0,done:!0}:(t=Fu(n,r),e.index+=t.length,{value:t,done:!1})}));var $u=function(t,e,n){var r=Ht(e);r in t?te.f(t,r,D(0,n)):t[r]=n},Hu=N.Array,Bu=Math.max,Gu=$e.f,Wu="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Uu=function(t){try{return Gu(t)}catch(t){return function(t,e,n){for(var r=Re(t),o=Ae(e,r),i=Ae(void 0===n?r:n,r),u=Hu(Bu(i-o,0)),a=0;o<i;o++,a++)$u(u,a,t[o]);return u.length=a,u}(Wu)}},Ku={f:function(t){return Wu&&"Window"==X(t)?Uu(t):Gu(tt(t))}},Xu=R((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),Yu=Object.isExtensible,qu=R((function(){Yu(1)}))||Xu?function(t){return!!nt(t)&&((!Xu||"ArrayBuffer"!=X(t))&&(!Yu||Yu(t)))}:Yu,Ju=!R((function(){return Object.isExtensible(Object.preventExtensions({}))})),Qu=T((function(t){var e=te.f,n=!1,r=Rt("meta"),o=0,i=function(t){e(t,r,{value:{objectID:"O"+o++,weakData:{}}})},u=t.exports={enable:function(){u.enable=function(){},n=!0;var t=$e.f,e=W([].splice),o={};o[r]=1,t(o).length&&($e.f=function(n){for(var o=t(n),i=0,u=o.length;i<u;i++)if(o[i]===r){e(o,i,1);break}return o},tn({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Ku.f}))},fastKey:function(t,e){if(!nt(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!Mt(t,r)){if(!qu(t))return"F";if(!e)return"E";i(t)}return t[r].objectID},getWeakData:function(t,e){if(!Mt(t,r)){if(!qu(t))return!0;if(!e)return!1;i(t)}return t[r].weakData},onFreeze:function(t){return Ju&&n&&qu(t)&&!Mt(t,r)&&i(t),t}};le[r]=!0})),Zu=Qu.getWeakData,ta=be.set,ea=be.getterFor,na=er.find,ra=er.findIndex,oa=W([].splice),ia=0,ua=function(t){return t.frozen||(t.frozen=new aa)},aa=function(){this.entries=[]},ca=function(t,e){return na(t.entries,(function(t){return t[0]===e}))};aa.prototype={get:function(t){var e=ca(this,t);if(e)return e[1]},has:function(t){return!!ca(this,t)},set:function(t,e){var n=ca(this,t);n?n[1]=e:this.entries.push([t,e])},delete:function(t){var e=ra(this.entries,(function(e){return e[0]===t}));return~e&&oa(this.entries,e,1),!!~e}};var sa,fa={getConstructor:function(t,e,n,r){var o=t((function(t,o){wo(t,i),ta(t,{type:e,id:ia++,frozen:void 0}),null!=o&&ko(o,t[r],{that:t,AS_ENTRIES:n})})),i=o.prototype,u=ea(e),a=function(t,e,n){var r=u(t),o=Zu(Jt(e),!0);return!0===o?ua(r).set(e,n):o[r.id]=n,t};return fo(i,{delete:function(t){var e=u(this);if(!nt(t))return!1;var n=Zu(t);return!0===n?ua(e).delete(t):n&&Mt(n,e.id)&&delete n[e.id]},has:function(t){var e=u(this);if(!nt(t))return!1;var n=Zu(t);return!0===n?ua(e).has(t):n&&Mt(n,e.id)}}),fo(i,n?{get:function(t){var e=u(this);if(nt(t)){var n=Zu(t);return!0===n?ua(e).get(t):n?n[e.id]:void 0}},set:function(t,e){return a(this,t,e)}}:{add:function(t){return a(this,t,!0)}}),o}},la=be.enforce,da=!N.ActiveXObject&&"ActiveXObject"in N,va=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},pa=function(t,e,n){var r=-1!==t.indexOf("Map"),o=-1!==t.indexOf("Weak"),i=r?"set":"add",u=N[t],a=u&&u.prototype,c=u,s={},f=function(t){var e=W(a[t]);Ee(a,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(o&&!nt(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return o&&!nt(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(o&&!nt(t))&&e(this,0===t?0:t)}:function(t,n){return e(this,0===t?0:t,n),this})};if(Qe(t,!et(u)||!(o||a.forEach&&!R((function(){(new u).entries().next()})))))c=n.getConstructor(e,t,r,i),Qu.enable();else if(Qe(t,!0)){var l=new c,d=l[i](o?{}:-0,1)!=l,v=R((function(){l.has(1)})),p=Do((function(t){new u(t)})),h=!o&&R((function(){for(var t=new u,e=5;e--;)t[i](e,e);return!t.has(-0)}));p||((c=e((function(t,e){wo(t,a);var n=function(t,e,n){var r,o;return po&&et(r=e.constructor)&&r!==n&&nt(o=r.prototype)&&o!==n.prototype&&po(t,o),t}(new u,t,c);return null!=e&&ko(e,n[i],{that:n,AS_ENTRIES:r}),n}))).prototype=a,a.constructor=c),(v||h)&&(f("delete"),f("has"),r&&f("get")),(h||d)&&f(i),o&&a.clear&&delete a.clear}return s[t]=c,tn({global:!0,forced:c!=u},s),go(c,t),o||n.setStrong(c,t,r),c}("WeakMap",va,fa);if(ce&&da){sa=fa.getConstructor(va,"WeakMap",!0),Qu.enable();var ha=pa.prototype,ya=W(ha.delete),ga=W(ha.has),ma=W(ha.get),ba=W(ha.set);fo(ha,{delete:function(t){if(nt(t)&&!qu(t)){var e=la(this);return e.frozen||(e.frozen=new sa),ya(this,t)||e.frozen.delete(t)}return ya(this,t)},has:function(t){if(nt(t)&&!qu(t)){var e=la(this);return e.frozen||(e.frozen=new sa),ga(this,t)||e.frozen.has(t)}return ga(this,t)},get:function(t){if(nt(t)&&!qu(t)){var e=la(this);return e.frozen||(e.frozen=new sa),ga(this,t)?ma(this,t):e.frozen.get(t)}return ma(this,t)},set:function(t,e){if(nt(t)&&!qu(t)){var n=la(this);n.frozen||(n.frozen=new sa),ga(this,t)?ba(this,t,e):n.frozen.set(t,e)}else ba(this,t,e);return this}})}var wa={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Sa=Wt("span").classList,xa=Sa&&Sa.constructor&&Sa.constructor.prototype,Oa=xa===Object.prototype?void 0:xa,Ea=Ft("iterator"),Ia=Ft("toStringTag"),ja=zu.values,Pa=function(t,e){if(t){if(t[Ea]!==ja)try{ee(t,Ea,ja)}catch(e){t[Ea]=ja}if(t[Ia]||ee(t,Ia,e),wa[e])for(var n in zu)if(t[n]!==zu[n])try{ee(t,n,zu[n])}catch(e){t[n]=zu[n]}}};for(var Ta in wa)Pa(N[Ta]&&N[Ta].prototype,Ta);Pa(Oa,"DOMTokenList");var Ma=Oe.EXISTS,Aa=te.f,ka=Function.prototype,Na=W(ka.toString),Ra=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Va=W(Ra.exec);V&&!Ma&&Aa(ka,"name",{configurable:!0,get:function(){try{return Va(Ra,Na(this))[1]}catch(t){return""}}});var Ca=Ft("species"),La=function(t){return lt>=51||!R((function(){var e=[];return(e.constructor={})[Ca]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}("slice"),za=Ft("species"),Fa=N.Array,_a=Math.max;function Da(t){return t.getMenuConfig("uploadVideo")}tn({target:"Array",proto:!0,forced:!La},{slice:function(t,e){var n,r,o,i=tt(this),u=Re(i),a=Ae(t,u),c=Ae(void 0===e?u:e,u);if($n(i)&&(n=i.constructor,(Yn(n)&&(n===Fa||$n(n.prototype))||nt(n)&&null===(n=n[za]))&&(n=void 0),n===Fa||void 0===n))return Go(i,a,c);for(r=new(void 0===n?Fa:n)(_a(c-a,0)),o=0;a<c;a++,o++)a in i&&$u(r,o,i[a]);return r.length=o,r}});var $a=new WeakMap;function Ha(t,e){return x(this,void 0,void 0,(function(){var n,r,o,u;return O(this,(function(a){switch(a.label){case 0:return n=function(t){var e=$a.get(t);if(null!=e)return e;var n=Da(t),r=n.onSuccess,o=n.onProgress,u=n.onFailed,a=n.customInsert,c=n.onError;return e=i(S(S({},n),{onProgress:function(e){t.showProgressBar(e),o&&o(e)},onSuccess:function(e,n){if(a)return a(n,(function(e,n){return cu(t,e,n)})),void r(e,n);var o=n.errno,i=void 0===o?1:o,c=n.data,s=void 0===c?{}:c;if(0===i){var f=s.url,l=void 0===f?"":f,d=s.poster;cu(t,l,void 0===d?"":d),r(e,n)}else u(e,n)},onError:function(t,e,n){c(t,e,n)}})),$a.set(t,e),e}(t),r=e.name,o=e.type,u=e.size,n.addFile({name:r,type:o,size:u,data:e}),[4,n.upload()];case 1:return a.sent(),[2]}}))}))}var Ba=function(){function t(){this.title=n("videoModule.uploadVideo"),this.iconSvg='<svg viewBox="0 0 1056 1024"><path d="M805.902261 521.819882a251.441452 251.441452 0 0 0-251.011972 246.600033 251.051015 251.051015 0 1 0 502.023944 8.823877 253.237463 253.237463 0 0 0-251.011972-255.42391z m59.463561 240.001647v129.898403h-116.701631v-129.898403h-44.041298l101.279368-103.504859 101.279368 103.504859z" p-id="6802"></path><path d="M788.254507 0.000781H99.094092A98.663439 98.663439 0 0 0 0.001171 99.093701v590.067495a98.663439 98.663439 0 0 0 99.092921 99.092921h411.7549a266.434235 266.434235 0 0 1-2.186448-41.815807 275.843767 275.843767 0 0 1 275.180024-270.729042 270.650955 270.650955 0 0 1 103.504859 19.834201V99.093701A101.51363 101.51363 0 0 0 788.254507 0.000781zM295.054441 640.747004V147.507894l394.146189 246.600033z"></path></svg>',this.tag="button"}return t.prototype.getValue=function(t){return""},t.prototype.isActive=function(t){return!1},t.prototype.exec=function(t,e){var n=this.getMenuConfig(t),r=n.allowedFileTypes,o=void 0===r?[]:r,i=n.customBrowseAndUpload;if(i)i((function(e,n){return cu(t,e,n)}));else{var u="";o.length>0&&(u='accept="'+o.join(", ")+'"');var a=f("body"),c=f('<input type="file" '+u+" multiple/>");c.hide(),a.append(c),c.click(),c.on("change",(function(){var e=c[0].files;!function(t,e){var n,r;x(this,void 0,void 0,(function(){var o,i,u,a,c,s;return O(this,(function(f){switch(f.label){case 0:if(null==e)return[2];o=Array.prototype.slice.call(e),i=Da(t).customUpload,f.label=1;case 1:f.trys.push([1,9,10,15]),u=j(o),f.label=2;case 2:return[4,u.next()];case 3:return(a=f.sent()).done?[3,8]:(c=a.value,i?[4,i(c,(function(e,n){return cu(t,e,n)}))]:[3,5]);case 4:return f.sent(),[3,7];case 5:return[4,Ha(t,c)];case 6:f.sent(),f.label=7;case 7:return[3,2];case 8:return[3,15];case 9:return s=f.sent(),n={error:s},[3,15];case 10:return f.trys.push([10,,13,14]),a&&!a.done&&(r=u.return)?[4,r.call(u)]:[3,12];case 11:f.sent(),f.label=12;case 12:return[3,14];case 13:if(n)throw n.error;return[7];case 14:return[7];case 15:return[2]}}))}))}(t,e)}))}},t.prototype.isDisabled=function(t){var n=t.selection;return null==n||(!a.isCollapsed(n)||!!e.getSelectedElems(t).some((function(n){var r=e.getNodeType(n);return"pre"===r||("list-item"===r||!!t.isVoid(n))})))},t.prototype.getMenuConfig=function(t){return t.getMenuConfig("uploadVideo")},t}();function Ga(){return co("w-e-insert-video")}var Wa=function(){function t(){this.title=n("videoModule.editSize"),this.tag="button",this.showModal=!0,this.modalWidth=320,this.$content=null,this.widthInputId=Ga(),this.heightInputId=Ga(),this.buttonId=Ga()}return t.prototype.getSelectedVideoNode=function(t){return e.getSelectedNodeByType(t,"video")},t.prototype.getValue=function(t){return""},t.prototype.isActive=function(t){return!1},t.prototype.exec=function(t,e){},t.prototype.isDisabled=function(t){return null==t.selection||null==this.getSelectedVideoNode(t)},t.prototype.getModalPositionNode=function(t){return this.getSelectedVideoNode(t)},t.prototype.getModalContentElem=function(t){var i=this,a=i.widthInputId,c=i.heightInputId,s=i.buttonId,l=I(r(n("videoModule.width"),a,"auto"),2),d=l[0],v=l[1],p=f(v),h=I(r(n("videoModule.height"),c,"auto"),2),y=h[0],g=h[1],m=f(g),b=I(o(s,n("videoModule.ok")),1)[0];if(null==this.$content){var w=f("<div></div>");w.on("click","#"+s,(function(n){n.preventDefault();var r=w.find("#"+a).val().trim(),o=w.find("#"+c).val().trim(),i=function(t){return/^\d+(\.\d+)?%$/.test(t)},s=function(t){return/^\d+(\.\d+)?$/.test(t)},f="auto",l="auto";i(r)?f=r:s(r)&&(f=parseInt(r)+"px"),i(o)?l=o:s(o)&&(l=parseInt(o)+"px");var d=O.style,v=void 0===d?{}:d;t.restoreSelection();var p=S(S({},v),{style:{width:f,height:l}});u.setNodes(t,p,{match:function(t){return e.checkNodeType(t,"video")}}),t.hidePanelOrModal()})),this.$content=w}var x=this.$content;x.empty(),x.append(d),x.append(y),x.append(b);var O=this.getSelectedVideoNode(t);if(null==O)return x[0];var E=O.style,j=void 0===E?{}:E,P=j.width,T=void 0===P?"":P,M=j.height,A=void 0===M?"":M;return p.val(T),m.val(A),setTimeout((function(){p.focus()})),x[0]},t}();function Ua(){return co("w-e-edit-video")}var Ka=function(){function t(){this.title=n("videoModule.edit"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.srcInputId=Ua(),this.posterInputId=Ua(),this.buttonId=Ua()}return t.prototype.getSelectedVideoNode=function(t){return e.getSelectedNodeByType(t,"video")},t.prototype.getValue=function(t){return""},t.prototype.isActive=function(t){return!1},t.prototype.exec=function(t,e){},t.prototype.isDisabled=function(t){return null==t.selection||null==this.getSelectedVideoNode(t)},t.prototype.getModalPositionNode=function(t){return this.getSelectedVideoNode(t)},t.prototype.getModalContentElem=function(t){var i=this,a=this,c=a.srcInputId,s=a.posterInputId,l=a.buttonId,d=I(r(n("videoModule.videoSrc"),c,n("videoModule.videoSrcPlaceHolder")),2),v=d[0],p=d[1],h=I(r(n("videoModule.videoPoster"),s,n("videoModule.videoPosterPlaceHolder")),2),y=h[0],g=h[1],m=f(p),b=f(g),w=I(o(l,n("videoModule.ok")),1)[0];if(null==this.$content){var S=f("<div></div>");S.on("click","#"+l,(function(n){return x(i,void 0,void 0,(function(){var r,o,i,a;return O(this,(function(f){return n.preventDefault(),r=S.find("#"+c).val().trim(),o=S.find("#"+s).val().trim(),i=co("video-"),a={src:r,poster:o,key:i},t.restoreSelection(),u.setNodes(t,a,{match:function(t){return e.checkNodeType(t,"video")}}),t.hidePanelOrModal(),[2]}))}))})),this.$content=S}var E=this.$content;E.empty(),E.append(v),E.append(y),E.append(w);var j=this.getSelectedVideoNode(t);if(null==j)return E[0];var P=j.src,T=void 0===P?"":P,M=j.poster,A=void 0===M?"":M;return m.val(T),b.val(A),setTimeout((function(){m.focus()})),E[0]},t}();var Xa={renderElems:[xn],elemsToHtml:[En],preParseHtml:[Fn],parseElemsHtml:[cr],menus:[{key:"insertVideo",factory:function(){return new fu},config:{onInsertedVideo:function(t){},checkVideo:function(t,e){return!0},parseVideoSrc:function(t){return t}}},{key:"uploadVideo",factory:function(){return new Ba},config:{server:"",fieldName:"wangeditor-uploaded-video",maxFileSize:10485760,maxNumberOfFiles:5,allowedFileTypes:["video/*"],meta:{},metaWithUrl:!1,withCredentials:!1,timeout:3e4,onBeforeUpload:function(t){return t},onProgress:function(t){},onSuccess:function(t,e){},onFailed:function(t,e){console.error("'"+t.name+"' upload failed",e)},onError:function(t,e,n){console.error("'"+t.name+" upload error",e,n)}}},{key:"editVideoSize",factory:function(){return new Wa}},{key:"editVideoSrc",factory:function(){return new Ka}}],editorPlugin:function(t){var n=t.isVoid,r=t.normalizeNode,o=t;return o.isVoid=function(t){return"video"===t.type||n(t)},o.normalizeNode=function(t){var n=I(t,2),i=n[0],a=n[1];"video"===e.getNodeType(i)&&(e.isLastNode(o,i)&&u.insertNodes(o,e.genEmptyParagraph(),{at:[a[0]+1]}));return r([i,a])},o}};export{Xa as default};
2
+ //# sourceMappingURL=index.esm.js.map