@wangeditor-next/video-module 1.3.0 → 1.3.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -34
- package/README.md +3 -3
- package/dist/index.esm.js +60 -29
- package/dist/index.js +60 -29
- package/dist/video-module/src/module/menu/index.d.ts +1 -1
- package/dist/video-module/src/utils/util.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.3.2-alpha.0](https://github.com/cycleccc/wangEditor/compare/@wangeditor-next/video-module@1.3.1...@wangeditor-next/video-module@1.3.2-alpha.0) (2024-07-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **video module:** edit size style ([a543684](https://github.com/cycleccc/wangEditor/commit/a5436842b6f84ca02788f6f4f754d07c492b3f49))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.3.1](https://github.com/cycleccc/wangEditor/compare/@wangeditor-next/video-module@1.3.0...@wangeditor-next/video-module@1.3.1) (2024-07-23)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **video:** remove empty line ([9f5f0ba](https://github.com/cycleccc/wangEditor/commit/9f5f0bae4e290e99651bf3dda4af2b6332baf875))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [1.3.0](https://github.com/cycleccc/wangEditor/compare/@wangeditor-next/video-module@1.2.4...@wangeditor-next/video-module@1.3.0) (2024-06-24)
|
|
7
29
|
|
|
8
30
|
|
|
@@ -104,7 +126,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
104
126
|
|
|
105
127
|
|
|
106
128
|
|
|
107
|
-
## [1.1.4](https://github.com/
|
|
129
|
+
## [1.1.4](https://github.com/cycleccc/wangEditor/compare/@wangeditor/video-module@1.1.3...@wangeditor/video-module@1.1.4) (2022-09-27)
|
|
108
130
|
|
|
109
131
|
**Note:** Version bump only for package @wangeditor/video-module
|
|
110
132
|
|
|
@@ -112,49 +134,49 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
112
134
|
|
|
113
135
|
|
|
114
136
|
|
|
115
|
-
## [1.1.3](https://github.com/
|
|
137
|
+
## [1.1.3](https://github.com/cycleccc/wangEditor/compare/@wangeditor/video-module@1.1.2...@wangeditor/video-module@1.1.3) (2022-09-15)
|
|
116
138
|
|
|
117
139
|
|
|
118
140
|
### Bug Fixes
|
|
119
141
|
|
|
120
|
-
* customInsert 不触发 onSuccess ([d6f4a1b](https://github.com/
|
|
121
|
-
* 上传视频 - customBrowseAndUpload 缺少 poster ([c24627a](https://github.com/
|
|
142
|
+
* customInsert 不触发 onSuccess ([d6f4a1b](https://github.com/cycleccc/wangEditor/commit/d6f4a1b1494864b116a1310cce2d9e8632c92c6f))
|
|
143
|
+
* 上传视频 - customBrowseAndUpload 缺少 poster ([c24627a](https://github.com/cycleccc/wangEditor/commit/c24627aaa4c173c5d435e3077dfe8f6b4a9a87b1))
|
|
122
144
|
|
|
123
145
|
|
|
124
146
|
|
|
125
147
|
|
|
126
148
|
|
|
127
|
-
## [1.1.2](https://github.com/
|
|
149
|
+
## [1.1.2](https://github.com/cycleccc/wangEditor/compare/@wangeditor/video-module@1.1.1...@wangeditor/video-module@1.1.2) (2022-08-30)
|
|
128
150
|
|
|
129
151
|
|
|
130
152
|
### Bug Fixes
|
|
131
153
|
|
|
132
|
-
* checkVideo 增加 poster 参数 ([c0402e1](https://github.com/
|
|
154
|
+
* checkVideo 增加 poster 参数 ([c0402e1](https://github.com/cycleccc/wangEditor/commit/c0402e155470233d256e037d863dab74c026b7f6))
|
|
133
155
|
|
|
134
156
|
|
|
135
157
|
|
|
136
158
|
|
|
137
159
|
|
|
138
|
-
## [1.1.1](https://github.com/
|
|
160
|
+
## [1.1.1](https://github.com/cycleccc/wangEditor/compare/@wangeditor/video-module@1.1.0...@wangeditor/video-module@1.1.1) (2022-07-14)
|
|
139
161
|
|
|
140
162
|
|
|
141
163
|
### Bug Fixes
|
|
142
164
|
|
|
143
|
-
* video poster(不想升级大版本,所有暂用 fix 不用 feature) ([5a2aff9](https://github.com/
|
|
165
|
+
* video poster(不想升级大版本,所有暂用 fix 不用 feature) ([5a2aff9](https://github.com/cycleccc/wangEditor/commit/5a2aff92bc23f240bd249a7294874940cfc9f717))
|
|
144
166
|
|
|
145
167
|
|
|
146
168
|
|
|
147
169
|
|
|
148
170
|
|
|
149
|
-
# [1.1.0](https://github.com/
|
|
171
|
+
# [1.1.0](https://github.com/cycleccc/wangEditor/compare/@wangeditor/video-module@1.0.1...@wangeditor/video-module@1.1.0) (2022-05-25)
|
|
150
172
|
|
|
151
173
|
|
|
152
174
|
### Features
|
|
153
175
|
|
|
154
|
-
* editVideoSize ([375eecb](https://github.com/
|
|
155
|
-
* enter menu ([988fc31](https://github.com/
|
|
156
|
-
* setHtml ([f4f91b8](https://github.com/
|
|
157
|
-
* 表格拖拽列宽 ([46ea2c0](https://github.com/
|
|
176
|
+
* editVideoSize ([375eecb](https://github.com/cycleccc/wangEditor/commit/375eecba826eac681268c55c47bcd922f7157d63))
|
|
177
|
+
* enter menu ([988fc31](https://github.com/cycleccc/wangEditor/commit/988fc31f31de3d37dffbf54abb784cceb8e6118d))
|
|
178
|
+
* setHtml ([f4f91b8](https://github.com/cycleccc/wangEditor/commit/f4f91b883298091e3679ca6b206ae0d796003772))
|
|
179
|
+
* 表格拖拽列宽 ([46ea2c0](https://github.com/cycleccc/wangEditor/commit/46ea2c0f831b03ebca5fddfd59d682fed0b3476e))
|
|
158
180
|
|
|
159
181
|
|
|
160
182
|
|
|
@@ -165,28 +187,28 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
165
187
|
|
|
166
188
|
### Bug Fixes
|
|
167
189
|
|
|
168
|
-
* 部分菜单 disabled ([87f1233](https://github.com/
|
|
169
|
-
* 插入图片的 < > 替换 ([5721560](https://github.com/
|
|
170
|
-
* 更新各包之间依赖版本 ([75c552c](https://github.com/
|
|
171
|
-
* 修复 pnpm 安装 @wangeditor/editor 出现警告的问题 ([4087fbe](https://github.com/
|
|
172
|
-
* 修复视频无法被xml-formatter解析的问题 ([e081518](https://github.com/
|
|
173
|
-
* 移除了每个包下的 publishConfig directory 配置 ([16559f0](https://github.com/
|
|
174
|
-
* fix插入视频报错的问题 ([f78b06d](https://github.com/
|
|
175
|
-
* fix视频插入iframe时报错的问题 ([ad8f9ce](https://github.com/
|
|
176
|
-
* menu active ([10829e2](https://github.com/
|
|
177
|
-
* parse html - v4 video ([8dca822](https://github.com/
|
|
178
|
-
* rename es module filename ([1821d4e](https://github.com/
|
|
179
|
-
* shadow dom 中 modal 输入框异常 ([ef3b199](https://github.com/
|
|
180
|
-
* table - elemToHtml ([e36e609](https://github.com/
|
|
181
|
-
* video - 键盘删除 ([5a6bedd](https://github.com/
|
|
190
|
+
* 部分菜单 disabled ([87f1233](https://github.com/cycleccc/wangEditor/commit/87f12332a087072406c1988dc5cef2eae8335375))
|
|
191
|
+
* 插入图片的 < > 替换 ([5721560](https://github.com/cycleccc/wangEditor/commit/57215609ada8b9d15f5505d1ba52e49707b5b183))
|
|
192
|
+
* 更新各包之间依赖版本 ([75c552c](https://github.com/cycleccc/wangEditor/commit/75c552cc8ed54765bebb86a7ec5329a7fc79e85f))
|
|
193
|
+
* 修复 pnpm 安装 @wangeditor/editor 出现警告的问题 ([4087fbe](https://github.com/cycleccc/wangEditor/commit/4087fbee01c76bdd55e747a5e86c5e4a8d6a8353))
|
|
194
|
+
* 修复视频无法被xml-formatter解析的问题 ([e081518](https://github.com/cycleccc/wangEditor/commit/e08151863628e0241fe4a3d5858cda4c8ea57949)), closes [#101](https://github.com/cycleccc/wangEditor/issues/101) [#95](https://github.com/cycleccc/wangEditor/issues/95) [#70](https://github.com/cycleccc/wangEditor/issues/70) [#69](https://github.com/cycleccc/wangEditor/issues/69)
|
|
195
|
+
* 移除了每个包下的 publishConfig directory 配置 ([16559f0](https://github.com/cycleccc/wangEditor/commit/16559f052545c111318be760e64291a521bdcc65))
|
|
196
|
+
* fix插入视频报错的问题 ([f78b06d](https://github.com/cycleccc/wangEditor/commit/f78b06d7f75c288f306f04fbfec1dfeb1332a861))
|
|
197
|
+
* fix视频插入iframe时报错的问题 ([ad8f9ce](https://github.com/cycleccc/wangEditor/commit/ad8f9cea0f7eae1cb0bc51dba64585be05dfda2f))
|
|
198
|
+
* menu active ([10829e2](https://github.com/cycleccc/wangEditor/commit/10829e2e9e1d864d4900821ee3d5fa516b8cca2a))
|
|
199
|
+
* parse html - v4 video ([8dca822](https://github.com/cycleccc/wangEditor/commit/8dca822f9f1b52fd71dd6e17f0954d6aa016324b))
|
|
200
|
+
* rename es module filename ([1821d4e](https://github.com/cycleccc/wangEditor/commit/1821d4eef49e64efcb41b848849ca7a5e6472044))
|
|
201
|
+
* shadow dom 中 modal 输入框异常 ([ef3b199](https://github.com/cycleccc/wangEditor/commit/ef3b199a3e74c6b8ba61ed781e1aa13a1c5acfde))
|
|
202
|
+
* table - elemToHtml ([e36e609](https://github.com/cycleccc/wangEditor/commit/e36e6092ef721723169afc8bf0560a47ac9f4dfc))
|
|
203
|
+
* video - 键盘删除 ([5a6bedd](https://github.com/cycleccc/wangEditor/commit/5a6bedd80fa0d758270731f62115637ad7f313d0))
|
|
182
204
|
|
|
183
205
|
|
|
184
206
|
### Features
|
|
185
207
|
|
|
186
|
-
* 增加 enable disable API(删除 setConfig setMenuConfig API) ([984fc50](https://github.com/
|
|
187
|
-
* i18n ([c11b244](https://github.com/
|
|
188
|
-
* parse html ([2a5eace](https://github.com/
|
|
189
|
-
* parse src (link image video) ([715a841](https://github.com/
|
|
190
|
-
* toHtml 机制 ([1c4d872](https://github.com/
|
|
191
|
-
* upload video ([ac8e6f8](https://github.com/
|
|
192
|
-
* video menu config ([7fa3783](https://github.com/
|
|
208
|
+
* 增加 enable disable API(删除 setConfig setMenuConfig API) ([984fc50](https://github.com/cycleccc/wangEditor/commit/984fc50520061fc34ea08f4136bdeb93dee46564))
|
|
209
|
+
* i18n ([c11b244](https://github.com/cycleccc/wangEditor/commit/c11b2440f91b99d40bca18b675c66a22b6e160c9))
|
|
210
|
+
* parse html ([2a5eace](https://github.com/cycleccc/wangEditor/commit/2a5eace00f33cded50b68e8164748ec2480213fd))
|
|
211
|
+
* parse src (link image video) ([715a841](https://github.com/cycleccc/wangEditor/commit/715a841fc6c730ee2b448a1799a07ce778128aad))
|
|
212
|
+
* toHtml 机制 ([1c4d872](https://github.com/cycleccc/wangEditor/commit/1c4d8729f84aaab6a448f23064b34a20596305e9))
|
|
213
|
+
* upload video ([ac8e6f8](https://github.com/cycleccc/wangEditor/commit/ac8e6f8b5258e593714676a6f6be359ba525833c))
|
|
214
|
+
* video menu config ([7fa3783](https://github.com/cycleccc/wangEditor/commit/7fa3783c42aa83f7d53c8be34be3c8b7c8a64754))
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# wangEditor video-module
|
|
2
|
-
|
|
3
|
-
Video module built in [
|
|
1
|
+
# wangEditor video-module
|
|
2
|
+
|
|
3
|
+
Video module built in [wangeditor-next](https://cycleccc.github.io/docs/) by default.
|
package/dist/index.esm.js
CHANGED
|
@@ -40,7 +40,7 @@ var zhResources = {
|
|
|
40
40
|
videoPosterPlaceHolder: '封面图片 url',
|
|
41
41
|
ok: '确定',
|
|
42
42
|
editSize: '修改尺寸',
|
|
43
|
-
edit: '
|
|
43
|
+
edit: '编辑视频',
|
|
44
44
|
width: '宽度',
|
|
45
45
|
height: '高度',
|
|
46
46
|
},
|
|
@@ -53,7 +53,7 @@ var zhResources = {
|
|
|
53
53
|
i18nAddResources('en', enResources);
|
|
54
54
|
i18nAddResources('zh-CN', zhResources);
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
/******************************************************************************
|
|
57
57
|
Copyright (c) Microsoft Corporation.
|
|
58
58
|
|
|
59
59
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -95,7 +95,7 @@ function __generator(thisArg, body) {
|
|
|
95
95
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
96
96
|
function step(op) {
|
|
97
97
|
if (f) throw new TypeError("Generator is already executing.");
|
|
98
|
-
while (_) try {
|
|
98
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
99
99
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
100
100
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
101
101
|
switch (op[0]) {
|
|
@@ -152,7 +152,12 @@ function __asyncValues(o) {
|
|
|
152
152
|
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
153
153
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
154
154
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
155
|
-
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
158
|
+
var e = new Error(message);
|
|
159
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
160
|
+
};
|
|
156
161
|
|
|
157
162
|
/**
|
|
158
163
|
* @description editor 插件,重写 editor API
|
|
@@ -356,6 +361,40 @@ var preParseHtmlConf = {
|
|
|
356
361
|
preParseHtml: preParse,
|
|
357
362
|
};
|
|
358
363
|
|
|
364
|
+
/**
|
|
365
|
+
* @description 工具函数
|
|
366
|
+
* @author wangfupeng
|
|
367
|
+
*/
|
|
368
|
+
/**
|
|
369
|
+
* 获取随机数字符串
|
|
370
|
+
* @param prefix 前缀
|
|
371
|
+
* @returns 随机数字符串
|
|
372
|
+
*/
|
|
373
|
+
function genRandomStr(prefix) {
|
|
374
|
+
if (prefix === void 0) { prefix = 'r'; }
|
|
375
|
+
return prefix + "-" + nanoid();
|
|
376
|
+
}
|
|
377
|
+
function replaceSymbols(str) {
|
|
378
|
+
return str.replace(/</g, '<').replace(/>/g, '>');
|
|
379
|
+
}
|
|
380
|
+
function styleStringToObject(styleString) {
|
|
381
|
+
var styleObject = {};
|
|
382
|
+
// 去掉字符串两端的空格,然后按分号分割
|
|
383
|
+
var styles = styleString.trim().split(';');
|
|
384
|
+
// 迭代每一个样式属性对
|
|
385
|
+
styles.forEach(function (style) {
|
|
386
|
+
if (style) {
|
|
387
|
+
// 忽略空字符串
|
|
388
|
+
var _a = __read(style.split(':'), 2), property = _a[0], value = _a[1];
|
|
389
|
+
if (property && value) {
|
|
390
|
+
// 去掉两端的空格并将结果存储在对象中
|
|
391
|
+
styleObject[property.trim()] = value.trim();
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
return styleObject;
|
|
396
|
+
}
|
|
397
|
+
|
|
359
398
|
/**
|
|
360
399
|
* @description parse html
|
|
361
400
|
* @author wangfupeng
|
|
@@ -387,7 +426,8 @@ function parseHtml(elem, children, editor) {
|
|
|
387
426
|
if ($iframe.length > 0) {
|
|
388
427
|
width = $iframe.attr('width') || 'auto';
|
|
389
428
|
height = $iframe.attr('height') || 'auto';
|
|
390
|
-
style = $iframe.attr('style') ||
|
|
429
|
+
style = $iframe.attr('style') || '';
|
|
430
|
+
style = styleStringToObject(style);
|
|
391
431
|
src = $iframe[0].outerHTML;
|
|
392
432
|
return genVideoElem(src, poster, width, height, style);
|
|
393
433
|
}
|
|
@@ -403,7 +443,8 @@ function parseHtml(elem, children, editor) {
|
|
|
403
443
|
width = $video.attr('width') || 'auto';
|
|
404
444
|
height = $video.attr('height') || 'auto';
|
|
405
445
|
poster = $video.attr('poster') || '';
|
|
406
|
-
style = $
|
|
446
|
+
style = $video.attr('style') || '';
|
|
447
|
+
style = styleStringToObject(style);
|
|
407
448
|
return genVideoElem(src, poster, width, height, style);
|
|
408
449
|
}
|
|
409
450
|
var parseHtmlConf = {
|
|
@@ -411,23 +452,6 @@ var parseHtmlConf = {
|
|
|
411
452
|
parseElemHtml: parseHtml,
|
|
412
453
|
};
|
|
413
454
|
|
|
414
|
-
/**
|
|
415
|
-
* @description 工具函数
|
|
416
|
-
* @author wangfupeng
|
|
417
|
-
*/
|
|
418
|
-
/**
|
|
419
|
-
* 获取随机数字符串
|
|
420
|
-
* @param prefix 前缀
|
|
421
|
-
* @returns 随机数字符串
|
|
422
|
-
*/
|
|
423
|
-
function genRandomStr(prefix) {
|
|
424
|
-
if (prefix === void 0) { prefix = 'r'; }
|
|
425
|
-
return prefix + "-" + nanoid();
|
|
426
|
-
}
|
|
427
|
-
function replaceSymbols(str) {
|
|
428
|
-
return str.replace(/</g, '<').replace(/>/g, '>');
|
|
429
|
-
}
|
|
430
|
-
|
|
431
455
|
/**
|
|
432
456
|
* @description icon svg
|
|
433
457
|
* @author wangfupeng
|
|
@@ -489,6 +513,9 @@ function insertVideo (editor, src, poster, width, height) {
|
|
|
489
513
|
if (parsedSrc.trim().indexOf('<iframe ') !== 0) {
|
|
490
514
|
parsedSrc = replaceSymbols(parsedSrc);
|
|
491
515
|
}
|
|
516
|
+
if (DomEditor.isSelectedEmptyParagraph(editor)) {
|
|
517
|
+
Transforms.removeNodes(editor, { mode: 'highest' });
|
|
518
|
+
}
|
|
492
519
|
video = {
|
|
493
520
|
type: 'video',
|
|
494
521
|
src: parsedSrc,
|
|
@@ -917,10 +944,9 @@ var EditorVideoSizeMenu = /** @class */ (function () {
|
|
|
917
944
|
}
|
|
918
945
|
var _a = videoNode.style, style = _a === void 0 ? {} : _a;
|
|
919
946
|
editor.restoreSelection();
|
|
920
|
-
var props =
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
} });
|
|
947
|
+
var props = {
|
|
948
|
+
style: __assign(__assign({}, style), { width: width, height: height }),
|
|
949
|
+
};
|
|
924
950
|
// 修改尺寸
|
|
925
951
|
Transforms.setNodes(editor, props, {
|
|
926
952
|
match: function (n) { return DomEditor.checkNodeType(n, 'video'); },
|
|
@@ -1158,7 +1184,7 @@ var uploadVideoMenuConf = {
|
|
|
1158
1184
|
// 创建编辑器时,可通过 editorConfig.MENU_CONF[key] = {...} 来修改
|
|
1159
1185
|
config: genUploadVideoMenuConfig(),
|
|
1160
1186
|
};
|
|
1161
|
-
var
|
|
1187
|
+
var editorVideoSizeMenuConf = {
|
|
1162
1188
|
key: 'editVideoSize',
|
|
1163
1189
|
factory: function () {
|
|
1164
1190
|
return new EditorVideoSizeMenu();
|
|
@@ -1187,7 +1213,12 @@ var video = {
|
|
|
1187
1213
|
elemsToHtml: [videoToHtmlConf],
|
|
1188
1214
|
preParseHtml: [preParseHtmlConf],
|
|
1189
1215
|
parseElemsHtml: [parseHtmlConf],
|
|
1190
|
-
menus: [
|
|
1216
|
+
menus: [
|
|
1217
|
+
insertVideoMenuConf,
|
|
1218
|
+
uploadVideoMenuConf,
|
|
1219
|
+
editorVideoSizeMenuConf,
|
|
1220
|
+
editorVideoSrcMenuConf,
|
|
1221
|
+
],
|
|
1191
1222
|
editorPlugin: withVideo,
|
|
1192
1223
|
};
|
|
1193
1224
|
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
videoPosterPlaceHolder: '封面图片 url',
|
|
45
45
|
ok: '确定',
|
|
46
46
|
editSize: '修改尺寸',
|
|
47
|
-
edit: '
|
|
47
|
+
edit: '编辑视频',
|
|
48
48
|
width: '宽度',
|
|
49
49
|
height: '高度',
|
|
50
50
|
},
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
core.i18nAddResources('en', enResources);
|
|
58
58
|
core.i18nAddResources('zh-CN', zhResources);
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
/******************************************************************************
|
|
61
61
|
Copyright (c) Microsoft Corporation.
|
|
62
62
|
|
|
63
63
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
100
100
|
function step(op) {
|
|
101
101
|
if (f) throw new TypeError("Generator is already executing.");
|
|
102
|
-
while (_) try {
|
|
102
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
103
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
104
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
105
105
|
switch (op[0]) {
|
|
@@ -156,7 +156,12 @@
|
|
|
156
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
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
158
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
159
|
-
}
|
|
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
|
+
};
|
|
160
165
|
|
|
161
166
|
/**
|
|
162
167
|
* @description editor 插件,重写 editor API
|
|
@@ -360,6 +365,40 @@
|
|
|
360
365
|
preParseHtml: preParse,
|
|
361
366
|
};
|
|
362
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
|
+
|
|
363
402
|
/**
|
|
364
403
|
* @description parse html
|
|
365
404
|
* @author wangfupeng
|
|
@@ -391,7 +430,8 @@
|
|
|
391
430
|
if ($iframe.length > 0) {
|
|
392
431
|
width = $iframe.attr('width') || 'auto';
|
|
393
432
|
height = $iframe.attr('height') || 'auto';
|
|
394
|
-
style = $iframe.attr('style') ||
|
|
433
|
+
style = $iframe.attr('style') || '';
|
|
434
|
+
style = styleStringToObject(style);
|
|
395
435
|
src = $iframe[0].outerHTML;
|
|
396
436
|
return genVideoElem(src, poster, width, height, style);
|
|
397
437
|
}
|
|
@@ -407,7 +447,8 @@
|
|
|
407
447
|
width = $video.attr('width') || 'auto';
|
|
408
448
|
height = $video.attr('height') || 'auto';
|
|
409
449
|
poster = $video.attr('poster') || '';
|
|
410
|
-
style = $
|
|
450
|
+
style = $video.attr('style') || '';
|
|
451
|
+
style = styleStringToObject(style);
|
|
411
452
|
return genVideoElem(src, poster, width, height, style);
|
|
412
453
|
}
|
|
413
454
|
var parseHtmlConf = {
|
|
@@ -415,23 +456,6 @@
|
|
|
415
456
|
parseElemHtml: parseHtml,
|
|
416
457
|
};
|
|
417
458
|
|
|
418
|
-
/**
|
|
419
|
-
* @description 工具函数
|
|
420
|
-
* @author wangfupeng
|
|
421
|
-
*/
|
|
422
|
-
/**
|
|
423
|
-
* 获取随机数字符串
|
|
424
|
-
* @param prefix 前缀
|
|
425
|
-
* @returns 随机数字符串
|
|
426
|
-
*/
|
|
427
|
-
function genRandomStr(prefix) {
|
|
428
|
-
if (prefix === void 0) { prefix = 'r'; }
|
|
429
|
-
return prefix + "-" + nanoid.nanoid();
|
|
430
|
-
}
|
|
431
|
-
function replaceSymbols(str) {
|
|
432
|
-
return str.replace(/</g, '<').replace(/>/g, '>');
|
|
433
|
-
}
|
|
434
|
-
|
|
435
459
|
/**
|
|
436
460
|
* @description icon svg
|
|
437
461
|
* @author wangfupeng
|
|
@@ -493,6 +517,9 @@
|
|
|
493
517
|
if (parsedSrc.trim().indexOf('<iframe ') !== 0) {
|
|
494
518
|
parsedSrc = replaceSymbols(parsedSrc);
|
|
495
519
|
}
|
|
520
|
+
if (core.DomEditor.isSelectedEmptyParagraph(editor)) {
|
|
521
|
+
slate.Transforms.removeNodes(editor, { mode: 'highest' });
|
|
522
|
+
}
|
|
496
523
|
video = {
|
|
497
524
|
type: 'video',
|
|
498
525
|
src: parsedSrc,
|
|
@@ -921,10 +948,9 @@
|
|
|
921
948
|
}
|
|
922
949
|
var _a = videoNode.style, style = _a === void 0 ? {} : _a;
|
|
923
950
|
editor.restoreSelection();
|
|
924
|
-
var props =
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
} });
|
|
951
|
+
var props = {
|
|
952
|
+
style: __assign(__assign({}, style), { width: width, height: height }),
|
|
953
|
+
};
|
|
928
954
|
// 修改尺寸
|
|
929
955
|
slate.Transforms.setNodes(editor, props, {
|
|
930
956
|
match: function (n) { return core.DomEditor.checkNodeType(n, 'video'); },
|
|
@@ -1162,7 +1188,7 @@
|
|
|
1162
1188
|
// 创建编辑器时,可通过 editorConfig.MENU_CONF[key] = {...} 来修改
|
|
1163
1189
|
config: genUploadVideoMenuConfig(),
|
|
1164
1190
|
};
|
|
1165
|
-
var
|
|
1191
|
+
var editorVideoSizeMenuConf = {
|
|
1166
1192
|
key: 'editVideoSize',
|
|
1167
1193
|
factory: function () {
|
|
1168
1194
|
return new EditorVideoSizeMenu();
|
|
@@ -1191,7 +1217,12 @@
|
|
|
1191
1217
|
elemsToHtml: [videoToHtmlConf],
|
|
1192
1218
|
preParseHtml: [preParseHtmlConf],
|
|
1193
1219
|
parseElemsHtml: [parseHtmlConf],
|
|
1194
|
-
menus: [
|
|
1220
|
+
menus: [
|
|
1221
|
+
insertVideoMenuConf,
|
|
1222
|
+
uploadVideoMenuConf,
|
|
1223
|
+
editorVideoSizeMenuConf,
|
|
1224
|
+
editorVideoSrcMenuConf,
|
|
1225
|
+
],
|
|
1195
1226
|
editorPlugin: withVideo,
|
|
1196
1227
|
};
|
|
1197
1228
|
|
|
@@ -20,7 +20,7 @@ export declare const uploadVideoMenuConf: {
|
|
|
20
20
|
factory(): UploadVideoMenu;
|
|
21
21
|
config: import("./config").IUploadConfigForVideo;
|
|
22
22
|
};
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const editorVideoSizeMenuConf: {
|
|
24
24
|
key: string;
|
|
25
25
|
factory(): EditorVideoSizeMenu;
|
|
26
26
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wangeditor-next/video-module",
|
|
3
|
-
"version": "1.3.0",
|
|
3
|
+
"version": "1.3.2-alpha.0",
|
|
4
4
|
"description": "wangEditor video module",
|
|
5
5
|
"author": "cycleccc <2991205548@qq.com>",
|
|
6
6
|
"contributors": [],
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"slate": "^0.72.0",
|
|
49
49
|
"snabbdom": "^3.1.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "f1f99fe27bf74e20f0098aa1f43d39b9bcacf352"
|
|
52
52
|
}
|