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