@wangeditor-next/editor 5.2.3 → 5.2.5
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 +19 -0
- package/dist/index.esm.js +285 -60
- package/dist/index.js +285 -60
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -17751,7 +17751,7 @@ var shouldClear = op => {
|
|
|
17751
17751
|
return true;
|
|
17752
17752
|
};
|
|
17753
17753
|
|
|
17754
|
-
|
|
17754
|
+
/******************************************************************************
|
|
17755
17755
|
Copyright (c) Microsoft Corporation.
|
|
17756
17756
|
|
|
17757
17757
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -17765,7 +17765,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
17765
17765
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17766
17766
|
PERFORMANCE OF THIS SOFTWARE.
|
|
17767
17767
|
***************************************************************************** */
|
|
17768
|
-
/* global Reflect, Promise */
|
|
17768
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
17769
17769
|
|
|
17770
17770
|
var extendStatics$2 = function(d, b) {
|
|
17771
17771
|
extendStatics$2 = Object.setPrototypeOf ||
|
|
@@ -17822,11 +17822,20 @@ function __read$6(o, n) {
|
|
|
17822
17822
|
return ar;
|
|
17823
17823
|
}
|
|
17824
17824
|
|
|
17825
|
-
function __spreadArray(to, from) {
|
|
17826
|
-
for (var i = 0,
|
|
17827
|
-
|
|
17828
|
-
|
|
17829
|
-
|
|
17825
|
+
function __spreadArray(to, from, pack) {
|
|
17826
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
17827
|
+
if (ar || !(i in from)) {
|
|
17828
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17829
|
+
ar[i] = from[i];
|
|
17830
|
+
}
|
|
17831
|
+
}
|
|
17832
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
17833
|
+
}
|
|
17834
|
+
|
|
17835
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
17836
|
+
var e = new Error(message);
|
|
17837
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
17838
|
+
};
|
|
17830
17839
|
|
|
17831
17840
|
/**
|
|
17832
17841
|
* An auto-incrementing identifier for keys.
|
|
@@ -19781,6 +19790,14 @@ function parseElemHtml($elem, editor) {
|
|
|
19781
19790
|
return parseCommonElemHtml($elem, editor);
|
|
19782
19791
|
}
|
|
19783
19792
|
else {
|
|
19793
|
+
if ($elem[0].childNodes.length > 1) {
|
|
19794
|
+
var childNodes = $elem[0].childNodes;
|
|
19795
|
+
return Array.from(childNodes).map(function (child) {
|
|
19796
|
+
$($elem[0]).empty();
|
|
19797
|
+
$($elem[0]).append($(child));
|
|
19798
|
+
return parseTextElemHtml($($elem[0]), editor);
|
|
19799
|
+
});
|
|
19800
|
+
}
|
|
19784
19801
|
return parseTextElemHtml($elem, editor);
|
|
19785
19802
|
}
|
|
19786
19803
|
}
|
|
@@ -24186,7 +24203,6 @@ var HoverBar = /** @class */ (function () {
|
|
|
24186
24203
|
}
|
|
24187
24204
|
//替换 icon svg
|
|
24188
24205
|
var menuConf = editor.getMenuConfig(key);
|
|
24189
|
-
console.log('🚀 ~ HoverBar ~ registerSingleItem ~ menuConf:', menuConf, menu);
|
|
24190
24206
|
if (menuConf && menuConf.iconSvg !== undefined) {
|
|
24191
24207
|
menu.iconSvg = menuConf.iconSvg;
|
|
24192
24208
|
}
|
|
@@ -27381,10 +27397,14 @@ var enResources$5 = {
|
|
|
27381
27397
|
netImage: 'Net image',
|
|
27382
27398
|
delete: 'Delete image',
|
|
27383
27399
|
edit: 'Edit image',
|
|
27400
|
+
editSize: 'Edit size',
|
|
27384
27401
|
viewLink: 'View link',
|
|
27385
27402
|
src: 'Image src',
|
|
27386
27403
|
desc: 'Description',
|
|
27387
27404
|
link: 'Image link',
|
|
27405
|
+
ok: 'Ok',
|
|
27406
|
+
width: 'Width',
|
|
27407
|
+
height: 'Height',
|
|
27388
27408
|
},
|
|
27389
27409
|
indent: {
|
|
27390
27410
|
decrease: 'Decrease',
|
|
@@ -27475,10 +27495,14 @@ var zhResources$5 = {
|
|
|
27475
27495
|
netImage: '网络图片',
|
|
27476
27496
|
delete: '删除图片',
|
|
27477
27497
|
edit: '编辑图片',
|
|
27498
|
+
editSize: '修改尺寸',
|
|
27478
27499
|
viewLink: '查看链接',
|
|
27479
27500
|
src: '图片地址',
|
|
27480
27501
|
desc: '图片描述',
|
|
27481
27502
|
link: '图片链接',
|
|
27503
|
+
ok: '确定',
|
|
27504
|
+
width: '宽度',
|
|
27505
|
+
height: '高度',
|
|
27482
27506
|
},
|
|
27483
27507
|
indent: {
|
|
27484
27508
|
decrease: '减少缩进',
|
|
@@ -27699,7 +27723,7 @@ var parseParagraphHtmlConf = {
|
|
|
27699
27723
|
parseElemHtml: parseParagraphHtml,
|
|
27700
27724
|
};
|
|
27701
27725
|
|
|
27702
|
-
|
|
27726
|
+
/******************************************************************************
|
|
27703
27727
|
Copyright (c) Microsoft Corporation.
|
|
27704
27728
|
|
|
27705
27729
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -27713,7 +27737,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
27713
27737
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
27714
27738
|
PERFORMANCE OF THIS SOFTWARE.
|
|
27715
27739
|
***************************************************************************** */
|
|
27716
|
-
/* global Reflect, Promise */
|
|
27740
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
27717
27741
|
|
|
27718
27742
|
var extendStatics$1 = function(d, b) {
|
|
27719
27743
|
extendStatics$1 = Object.setPrototypeOf ||
|
|
@@ -27757,7 +27781,7 @@ function __generator$2(thisArg, body) {
|
|
|
27757
27781
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
27758
27782
|
function step(op) {
|
|
27759
27783
|
if (f) throw new TypeError("Generator is already executing.");
|
|
27760
|
-
while (_) try {
|
|
27784
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
27761
27785
|
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;
|
|
27762
27786
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
27763
27787
|
switch (op[0]) {
|
|
@@ -27806,7 +27830,12 @@ function __read$5(o, n) {
|
|
|
27806
27830
|
finally { if (e) throw e.error; }
|
|
27807
27831
|
}
|
|
27808
27832
|
return ar;
|
|
27809
|
-
}
|
|
27833
|
+
}
|
|
27834
|
+
|
|
27835
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
27836
|
+
var e = new Error(message);
|
|
27837
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
27838
|
+
};
|
|
27810
27839
|
|
|
27811
27840
|
/**
|
|
27812
27841
|
* @description editor 插件,重写 editor API
|
|
@@ -29681,7 +29710,7 @@ var parseHtmlConf$4 = {
|
|
|
29681
29710
|
/**
|
|
29682
29711
|
* 生成唯一的 DOM ID
|
|
29683
29712
|
*/
|
|
29684
|
-
function genDomID$
|
|
29713
|
+
function genDomID$4() {
|
|
29685
29714
|
return genRandomStr$1('w-e-insert-link');
|
|
29686
29715
|
}
|
|
29687
29716
|
var InsertLinkMenu = /** @class */ (function () {
|
|
@@ -29692,9 +29721,9 @@ var InsertLinkMenu = /** @class */ (function () {
|
|
|
29692
29721
|
this.showModal = true; // 点击 button 时显示 modal
|
|
29693
29722
|
this.modalWidth = 300;
|
|
29694
29723
|
this.$content = null;
|
|
29695
|
-
this.textInputId = genDomID$
|
|
29696
|
-
this.urlInputId = genDomID$
|
|
29697
|
-
this.buttonId = genDomID$
|
|
29724
|
+
this.textInputId = genDomID$4();
|
|
29725
|
+
this.urlInputId = genDomID$4();
|
|
29726
|
+
this.buttonId = genDomID$4();
|
|
29698
29727
|
}
|
|
29699
29728
|
InsertLinkMenu.prototype.getValue = function (editor) {
|
|
29700
29729
|
// 插入菜单,不需要 value
|
|
@@ -29770,7 +29799,7 @@ var InsertLinkMenu = /** @class */ (function () {
|
|
|
29770
29799
|
/**
|
|
29771
29800
|
* 生成唯一的 DOM ID
|
|
29772
29801
|
*/
|
|
29773
|
-
function genDomID$
|
|
29802
|
+
function genDomID$3() {
|
|
29774
29803
|
return genRandomStr$1('w-e-update-link');
|
|
29775
29804
|
}
|
|
29776
29805
|
var EditLinkMenu = /** @class */ (function () {
|
|
@@ -29781,8 +29810,8 @@ var EditLinkMenu = /** @class */ (function () {
|
|
|
29781
29810
|
this.showModal = true; // 点击 button 时显示 modal
|
|
29782
29811
|
this.modalWidth = 300;
|
|
29783
29812
|
this.$content = null;
|
|
29784
|
-
this.urlInputId = genDomID$
|
|
29785
|
-
this.buttonId = genDomID$
|
|
29813
|
+
this.urlInputId = genDomID$3();
|
|
29814
|
+
this.buttonId = genDomID$3();
|
|
29786
29815
|
}
|
|
29787
29816
|
EditLinkMenu.prototype.getSelectedLinkElem = function (editor) {
|
|
29788
29817
|
var node = DomEditor.getSelectedNodeByType(editor, 'link');
|
|
@@ -30410,7 +30439,7 @@ function isInsertImageMenuDisabled(editor) {
|
|
|
30410
30439
|
/**
|
|
30411
30440
|
* 生成唯一的 DOM ID
|
|
30412
30441
|
*/
|
|
30413
|
-
function genDomID$
|
|
30442
|
+
function genDomID$2() {
|
|
30414
30443
|
return genRandomStr$1('w-e-insert-image');
|
|
30415
30444
|
}
|
|
30416
30445
|
var InsertImage = /** @class */ (function () {
|
|
@@ -30421,10 +30450,10 @@ var InsertImage = /** @class */ (function () {
|
|
|
30421
30450
|
this.showModal = true; // 点击 button 时显示 modal
|
|
30422
30451
|
this.modalWidth = 300;
|
|
30423
30452
|
this.$content = null;
|
|
30424
|
-
this.srcInputId = genDomID$
|
|
30425
|
-
this.altInputId = genDomID$
|
|
30426
|
-
this.hrefInputId = genDomID$
|
|
30427
|
-
this.buttonId = genDomID$
|
|
30453
|
+
this.srcInputId = genDomID$2();
|
|
30454
|
+
this.altInputId = genDomID$2();
|
|
30455
|
+
this.hrefInputId = genDomID$2();
|
|
30456
|
+
this.buttonId = genDomID$2();
|
|
30428
30457
|
}
|
|
30429
30458
|
InsertImage.prototype.getValue = function (editor) {
|
|
30430
30459
|
// 插入菜单,不需要 value
|
|
@@ -30548,7 +30577,7 @@ var DeleteImage = /** @class */ (function () {
|
|
|
30548
30577
|
/**
|
|
30549
30578
|
* 生成唯一的 DOM ID
|
|
30550
30579
|
*/
|
|
30551
|
-
function genDomID$
|
|
30580
|
+
function genDomID$1$1() {
|
|
30552
30581
|
return genRandomStr$1('w-e-edit-image');
|
|
30553
30582
|
}
|
|
30554
30583
|
var EditImage = /** @class */ (function () {
|
|
@@ -30559,10 +30588,10 @@ var EditImage = /** @class */ (function () {
|
|
|
30559
30588
|
this.showModal = true; // 点击 button 时显示 modal
|
|
30560
30589
|
this.modalWidth = 300;
|
|
30561
30590
|
this.$content = null;
|
|
30562
|
-
this.srcInputId = genDomID$
|
|
30563
|
-
this.altInputId = genDomID$
|
|
30564
|
-
this.hrefInputId = genDomID$
|
|
30565
|
-
this.buttonId = genDomID$
|
|
30591
|
+
this.srcInputId = genDomID$1$1();
|
|
30592
|
+
this.altInputId = genDomID$1$1();
|
|
30593
|
+
this.hrefInputId = genDomID$1$1();
|
|
30594
|
+
this.buttonId = genDomID$1$1();
|
|
30566
30595
|
}
|
|
30567
30596
|
EditImage.prototype.getValue = function (editor) {
|
|
30568
30597
|
// 编辑图片,用不到 getValue
|
|
@@ -30797,6 +30826,122 @@ var ImageWidth100 = /** @class */ (function (_super) {
|
|
|
30797
30826
|
return ImageWidth100;
|
|
30798
30827
|
}(ImageWidthBaseClass));
|
|
30799
30828
|
|
|
30829
|
+
/**
|
|
30830
|
+
* @description 修改图片尺寸
|
|
30831
|
+
* @author wangfupeng
|
|
30832
|
+
*/
|
|
30833
|
+
/**
|
|
30834
|
+
* 生成唯一的 DOM ID
|
|
30835
|
+
*/
|
|
30836
|
+
function genDomID$5() {
|
|
30837
|
+
return genRandomStr$1('w-e-insert-image');
|
|
30838
|
+
}
|
|
30839
|
+
var EditorImageSizeMenu = /** @class */ (function () {
|
|
30840
|
+
function EditorImageSizeMenu() {
|
|
30841
|
+
this.title = t('image.editSize');
|
|
30842
|
+
this.tag = 'button';
|
|
30843
|
+
this.showModal = true; // 点击 button 时显示 modal
|
|
30844
|
+
this.modalWidth = 320;
|
|
30845
|
+
this.$content = null;
|
|
30846
|
+
this.widthInputId = genDomID$5();
|
|
30847
|
+
this.heightInputId = genDomID$5();
|
|
30848
|
+
this.buttonId = genDomID$5();
|
|
30849
|
+
}
|
|
30850
|
+
EditorImageSizeMenu.prototype.getSelectedImageNode = function (editor) {
|
|
30851
|
+
return DomEditor.getSelectedNodeByType(editor, 'image');
|
|
30852
|
+
};
|
|
30853
|
+
EditorImageSizeMenu.prototype.getValue = function (editor) {
|
|
30854
|
+
// 插入菜单,不需要 value
|
|
30855
|
+
return '';
|
|
30856
|
+
};
|
|
30857
|
+
EditorImageSizeMenu.prototype.isActive = function (editor) {
|
|
30858
|
+
// 任何时候,都不用激活 menu
|
|
30859
|
+
return false;
|
|
30860
|
+
};
|
|
30861
|
+
EditorImageSizeMenu.prototype.exec = function (editor, value) {
|
|
30862
|
+
// 点击菜单时,弹出 modal 之前,不需要执行其他代码
|
|
30863
|
+
// 此处空着即可
|
|
30864
|
+
};
|
|
30865
|
+
EditorImageSizeMenu.prototype.isDisabled = function (editor) {
|
|
30866
|
+
if (editor.selection == null)
|
|
30867
|
+
return true;
|
|
30868
|
+
var imageNode = this.getSelectedImageNode(editor);
|
|
30869
|
+
if (imageNode == null) {
|
|
30870
|
+
// 选区未处于 image node ,则禁用
|
|
30871
|
+
return true;
|
|
30872
|
+
}
|
|
30873
|
+
return false;
|
|
30874
|
+
};
|
|
30875
|
+
EditorImageSizeMenu.prototype.getModalPositionNode = function (editor) {
|
|
30876
|
+
return this.getSelectedImageNode(editor);
|
|
30877
|
+
};
|
|
30878
|
+
EditorImageSizeMenu.prototype.getModalContentElem = function (editor) {
|
|
30879
|
+
// return $('<div><p>修改尺寸</p><p>修改尺寸</p><p>修改尺寸</p><p>修改尺寸</p></div>')[0]
|
|
30880
|
+
var _a = this, widthInputId = _a.widthInputId, heightInputId = _a.heightInputId, buttonId = _a.buttonId;
|
|
30881
|
+
var _b = __read$5(genModalInputElems(t('image.width'), widthInputId, 'auto'), 2), widthContainerElem = _b[0], inputWidthElem = _b[1];
|
|
30882
|
+
var $inputWidth = $(inputWidthElem);
|
|
30883
|
+
var _c = __read$5(genModalInputElems(t('image.height'), heightInputId, 'auto'), 2), heightContainerElem = _c[0], inputHeightElem = _c[1];
|
|
30884
|
+
var $inputHeight = $(inputHeightElem);
|
|
30885
|
+
var _d = __read$5(genModalButtonElems(buttonId, t('image.ok')), 1), buttonContainerElem = _d[0];
|
|
30886
|
+
if (this.$content == null) {
|
|
30887
|
+
// 第一次渲染
|
|
30888
|
+
var $content_1 = $('<div></div>');
|
|
30889
|
+
// 绑定事件(第一次渲染时绑定,不要重复绑定)
|
|
30890
|
+
$content_1.on('click', "#" + buttonId, function (e) {
|
|
30891
|
+
e.preventDefault();
|
|
30892
|
+
var rawWidth = $content_1.find("#" + widthInputId).val().trim();
|
|
30893
|
+
var rawHeight = $content_1.find("#" + heightInputId).val().trim();
|
|
30894
|
+
var isPercentage = function (value) { return /^\d+(\.\d+)?%$/.test(value); }; // 检查是否为合法的百分比字符串
|
|
30895
|
+
var isNumeric = function (value) { return /^\d+(\.\d+)?$/.test(value); }; // 检查是否为合法的数字
|
|
30896
|
+
var width = 'auto';
|
|
30897
|
+
var height = 'auto';
|
|
30898
|
+
if (isPercentage(rawWidth)) {
|
|
30899
|
+
width = rawWidth;
|
|
30900
|
+
}
|
|
30901
|
+
else if (isNumeric(rawWidth)) {
|
|
30902
|
+
width = parseInt(rawWidth) + 'px';
|
|
30903
|
+
}
|
|
30904
|
+
if (isPercentage(rawHeight)) {
|
|
30905
|
+
height = rawHeight;
|
|
30906
|
+
}
|
|
30907
|
+
else if (isNumeric(rawHeight)) {
|
|
30908
|
+
height = parseInt(rawHeight) + 'px';
|
|
30909
|
+
}
|
|
30910
|
+
var _a = imageNode.style, style = _a === void 0 ? {} : _a;
|
|
30911
|
+
editor.restoreSelection();
|
|
30912
|
+
var props = __assign$3(__assign$3({}, style), { style: {
|
|
30913
|
+
width: width,
|
|
30914
|
+
height: height,
|
|
30915
|
+
} });
|
|
30916
|
+
// 修改尺寸
|
|
30917
|
+
Transforms.setNodes(editor, props, {
|
|
30918
|
+
match: function (n) { return DomEditor.checkNodeType(n, 'image'); },
|
|
30919
|
+
});
|
|
30920
|
+
editor.hidePanelOrModal(); // 隐藏 modal
|
|
30921
|
+
});
|
|
30922
|
+
this.$content = $content_1;
|
|
30923
|
+
}
|
|
30924
|
+
var $content = this.$content;
|
|
30925
|
+
// 先清空,再重新添加 DOM 内容
|
|
30926
|
+
$content.empty();
|
|
30927
|
+
$content.append(widthContainerElem);
|
|
30928
|
+
$content.append(heightContainerElem);
|
|
30929
|
+
$content.append(buttonContainerElem);
|
|
30930
|
+
var imageNode = this.getSelectedImageNode(editor);
|
|
30931
|
+
if (imageNode == null)
|
|
30932
|
+
return $content[0];
|
|
30933
|
+
// 初始化 input 值
|
|
30934
|
+
var _e = imageNode.width, width = _e === void 0 ? 'auto' : _e, _f = imageNode.height, height = _f === void 0 ? 'auto' : _f;
|
|
30935
|
+
$inputWidth.val(width);
|
|
30936
|
+
$inputHeight.val(height);
|
|
30937
|
+
setTimeout(function () {
|
|
30938
|
+
$inputWidth.focus();
|
|
30939
|
+
});
|
|
30940
|
+
return $content[0];
|
|
30941
|
+
};
|
|
30942
|
+
return EditorImageSizeMenu;
|
|
30943
|
+
}());
|
|
30944
|
+
|
|
30800
30945
|
/**
|
|
30801
30946
|
* @description 图片菜单配置
|
|
30802
30947
|
* @author wangfupeng
|
|
@@ -30890,6 +31035,12 @@ var imageWidth100MenuConf = {
|
|
|
30890
31035
|
factory: function () {
|
|
30891
31036
|
return new ImageWidth100();
|
|
30892
31037
|
},
|
|
31038
|
+
};
|
|
31039
|
+
var EditorImageSizeMenuConf = {
|
|
31040
|
+
key: 'editorImageSizeMenu',
|
|
31041
|
+
factory: function () {
|
|
31042
|
+
return new EditorImageSizeMenu();
|
|
31043
|
+
},
|
|
30893
31044
|
};
|
|
30894
31045
|
|
|
30895
31046
|
/**
|
|
@@ -30908,6 +31059,7 @@ var image$1 = {
|
|
|
30908
31059
|
imageWidth30MenuConf,
|
|
30909
31060
|
imageWidth50MenuConf,
|
|
30910
31061
|
imageWidth100MenuConf,
|
|
31062
|
+
EditorImageSizeMenuConf,
|
|
30911
31063
|
],
|
|
30912
31064
|
editorPlugin: withImage,
|
|
30913
31065
|
};
|
|
@@ -33300,7 +33452,7 @@ var renderListItemConf = {
|
|
|
33300
33452
|
renderElem: renderListElem,
|
|
33301
33453
|
};
|
|
33302
33454
|
|
|
33303
|
-
|
|
33455
|
+
/******************************************************************************
|
|
33304
33456
|
Copyright (c) Microsoft Corporation.
|
|
33305
33457
|
|
|
33306
33458
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -33314,7 +33466,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
33314
33466
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
33315
33467
|
PERFORMANCE OF THIS SOFTWARE.
|
|
33316
33468
|
***************************************************************************** */
|
|
33317
|
-
/* global Reflect, Promise */
|
|
33469
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
33318
33470
|
|
|
33319
33471
|
var extendStatics = function(d, b) {
|
|
33320
33472
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -33370,7 +33522,12 @@ function __read$4(o, n) {
|
|
|
33370
33522
|
finally { if (e) throw e.error; }
|
|
33371
33523
|
}
|
|
33372
33524
|
return ar;
|
|
33373
|
-
}
|
|
33525
|
+
}
|
|
33526
|
+
|
|
33527
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
33528
|
+
var e = new Error(message);
|
|
33529
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
33530
|
+
};
|
|
33374
33531
|
|
|
33375
33532
|
/**
|
|
33376
33533
|
* @description table menu helpers
|
|
@@ -35819,7 +35976,7 @@ var zhResources$3 = {
|
|
|
35819
35976
|
i18nAddResources('en', enResources$3);
|
|
35820
35977
|
i18nAddResources('zh-CN', zhResources$3);
|
|
35821
35978
|
|
|
35822
|
-
|
|
35979
|
+
/******************************************************************************
|
|
35823
35980
|
Copyright (c) Microsoft Corporation.
|
|
35824
35981
|
|
|
35825
35982
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -35861,7 +36018,12 @@ function __read$3(o, n) {
|
|
|
35861
36018
|
finally { if (e) throw e.error; }
|
|
35862
36019
|
}
|
|
35863
36020
|
return ar;
|
|
35864
|
-
}
|
|
36021
|
+
}
|
|
36022
|
+
|
|
36023
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
36024
|
+
var e = new Error(message);
|
|
36025
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
36026
|
+
};
|
|
35865
36027
|
|
|
35866
36028
|
/**
|
|
35867
36029
|
* @description editor 插件,重写 editor API
|
|
@@ -37163,7 +37325,7 @@ var zhResources$2 = {
|
|
|
37163
37325
|
i18nAddResources('en', enResources$2);
|
|
37164
37326
|
i18nAddResources('zh-CN', zhResources$2);
|
|
37165
37327
|
|
|
37166
|
-
|
|
37328
|
+
/******************************************************************************
|
|
37167
37329
|
Copyright (c) Microsoft Corporation.
|
|
37168
37330
|
|
|
37169
37331
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -37205,7 +37367,7 @@ function __generator$1(thisArg, body) {
|
|
|
37205
37367
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
37206
37368
|
function step(op) {
|
|
37207
37369
|
if (f) throw new TypeError("Generator is already executing.");
|
|
37208
|
-
while (_) try {
|
|
37370
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
37209
37371
|
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;
|
|
37210
37372
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
37211
37373
|
switch (op[0]) {
|
|
@@ -37262,7 +37424,12 @@ function __asyncValues$1(o) {
|
|
|
37262
37424
|
return m ? m.call(o) : (o = typeof __values$2 === "function" ? __values$2(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
37263
37425
|
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); }); }; }
|
|
37264
37426
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
37265
|
-
}
|
|
37427
|
+
}
|
|
37428
|
+
|
|
37429
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
37430
|
+
var e = new Error(message);
|
|
37431
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
37432
|
+
};
|
|
37266
37433
|
|
|
37267
37434
|
/**
|
|
37268
37435
|
* @description editor 插件,重写 editor API
|
|
@@ -37336,12 +37503,20 @@ function getTagName($elem) {
|
|
|
37336
37503
|
* @param height height
|
|
37337
37504
|
* @returns iframe html string with size style
|
|
37338
37505
|
*/
|
|
37339
|
-
function genSizeStyledIframeHtml(iframeHtml, width, height) {
|
|
37506
|
+
function genSizeStyledIframeHtml(iframeHtml, width, height, style) {
|
|
37340
37507
|
if (width === void 0) { width = 'auto'; }
|
|
37341
37508
|
if (height === void 0) { height = 'auto'; }
|
|
37509
|
+
if (style === void 0) { style = {}; }
|
|
37342
37510
|
var $iframe = $(iframeHtml);
|
|
37511
|
+
var _a = style.width, styleWidth = _a === void 0 ? '' : _a, _b = style.height, styleHeight = _b === void 0 ? '' : _b;
|
|
37512
|
+
var styleStr = '';
|
|
37513
|
+
if (styleWidth)
|
|
37514
|
+
styleStr += "width: " + styleWidth + ";";
|
|
37515
|
+
if (styleHeight)
|
|
37516
|
+
styleStr += "height: " + styleHeight + ";";
|
|
37343
37517
|
$iframe.attr('width', width);
|
|
37344
37518
|
$iframe.attr('height', height);
|
|
37519
|
+
$iframe.attr('style', styleStr);
|
|
37345
37520
|
return $iframe[0].outerHTML;
|
|
37346
37521
|
}
|
|
37347
37522
|
|
|
@@ -37350,19 +37525,19 @@ function genSizeStyledIframeHtml(iframeHtml, width, height) {
|
|
|
37350
37525
|
* @author wangfupeng
|
|
37351
37526
|
*/
|
|
37352
37527
|
function renderVideo(elemNode, children, editor) {
|
|
37353
|
-
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;
|
|
37528
|
+
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;
|
|
37354
37529
|
// 是否选中
|
|
37355
37530
|
var selected = DomEditor.isNodeSelected(editor, elemNode);
|
|
37356
37531
|
var vnode;
|
|
37357
37532
|
if (src.trim().indexOf('<iframe ') === 0) {
|
|
37358
37533
|
// 增加尺寸样式
|
|
37359
|
-
var iframeHtml = genSizeStyledIframeHtml(src, width, height);
|
|
37534
|
+
var iframeHtml = genSizeStyledIframeHtml(src, width, height, style);
|
|
37360
37535
|
// iframe 形式,第三方视频
|
|
37361
37536
|
vnode = (jsx("div", { className: "w-e-textarea-video-container", "data-selected": selected ? 'true' : '', innerHTML: iframeHtml }));
|
|
37362
37537
|
}
|
|
37363
37538
|
else {
|
|
37364
37539
|
// 其他,mp4 格式
|
|
37365
|
-
var videoVnode = (jsx("video", { poster: poster, controls: true },
|
|
37540
|
+
var videoVnode = (jsx("video", { poster: poster, controls: true, style: style },
|
|
37366
37541
|
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"));
|
|
37367
37542
|
// @ts-ignore 添加尺寸
|
|
37368
37543
|
if (width !== 'auto')
|
|
@@ -37393,16 +37568,22 @@ var renderVideoConf = {
|
|
|
37393
37568
|
* @author wangfupeng
|
|
37394
37569
|
*/
|
|
37395
37570
|
function videoToHtml(elemNode, childrenHtml) {
|
|
37396
|
-
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;
|
|
37571
|
+
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;
|
|
37397
37572
|
var res = '<div data-w-e-type="video" data-w-e-is-void style="text-align: center;">\n';
|
|
37398
37573
|
if (src.trim().indexOf('<iframe ') === 0) {
|
|
37399
37574
|
// iframe 形式
|
|
37400
|
-
var iframeHtml = genSizeStyledIframeHtml(src, width, height);
|
|
37575
|
+
var iframeHtml = genSizeStyledIframeHtml(src, width, height, style);
|
|
37401
37576
|
res += iframeHtml;
|
|
37402
37577
|
}
|
|
37403
37578
|
else {
|
|
37404
37579
|
// 其他,mp4 等 url 格式
|
|
37405
|
-
|
|
37580
|
+
var _g = style.width, styleWidth = _g === void 0 ? '' : _g, _h = style.height, styleHeight = _h === void 0 ? '' : _h;
|
|
37581
|
+
var styleStr = '';
|
|
37582
|
+
if (styleWidth)
|
|
37583
|
+
styleStr += "width: " + styleWidth + ";";
|
|
37584
|
+
if (styleHeight)
|
|
37585
|
+
styleStr += "height: " + styleHeight + ";";
|
|
37586
|
+
res += "<video poster=\"" + poster + "\" controls=\"true\" width=\"" + width + "\" height=\"" + height + "\" style=\"" + styleStr + "\"><source src=\"" + src + "\" type=\"video/mp4\"/></video>";
|
|
37406
37587
|
}
|
|
37407
37588
|
res += '\n</div>';
|
|
37408
37589
|
return res;
|
|
@@ -37456,16 +37637,18 @@ var preParseHtmlConf = {
|
|
|
37456
37637
|
* @description parse html
|
|
37457
37638
|
* @author wangfupeng
|
|
37458
37639
|
*/
|
|
37459
|
-
function genVideoElem(src, poster, width, height) {
|
|
37640
|
+
function genVideoElem(src, poster, width, height, style) {
|
|
37460
37641
|
if (poster === void 0) { poster = ''; }
|
|
37461
37642
|
if (width === void 0) { width = 'auto'; }
|
|
37462
37643
|
if (height === void 0) { height = 'auto'; }
|
|
37644
|
+
if (style === void 0) { style = {}; }
|
|
37463
37645
|
return {
|
|
37464
37646
|
type: 'video',
|
|
37465
37647
|
src: src,
|
|
37466
37648
|
poster: poster,
|
|
37467
37649
|
width: width,
|
|
37468
37650
|
height: height,
|
|
37651
|
+
style: style,
|
|
37469
37652
|
children: [{ text: '' }], // void 元素有一个空 text
|
|
37470
37653
|
};
|
|
37471
37654
|
}
|
|
@@ -37475,13 +37658,15 @@ function parseHtml(elem, children, editor) {
|
|
|
37475
37658
|
var poster = '';
|
|
37476
37659
|
var width = 'auto';
|
|
37477
37660
|
var height = 'auto';
|
|
37661
|
+
var style = {};
|
|
37478
37662
|
// <iframe> 形式
|
|
37479
37663
|
var $iframe = $elem.find('iframe');
|
|
37480
37664
|
if ($iframe.length > 0) {
|
|
37481
37665
|
width = $iframe.attr('width') || 'auto';
|
|
37482
37666
|
height = $iframe.attr('height') || 'auto';
|
|
37667
|
+
style = $iframe.attr('style') || {};
|
|
37483
37668
|
src = $iframe[0].outerHTML;
|
|
37484
|
-
return genVideoElem(src, poster, width, height);
|
|
37669
|
+
return genVideoElem(src, poster, width, height, style);
|
|
37485
37670
|
}
|
|
37486
37671
|
// <video> 形式
|
|
37487
37672
|
var $video = $elem.find('video');
|
|
@@ -37495,7 +37680,8 @@ function parseHtml(elem, children, editor) {
|
|
|
37495
37680
|
width = $video.attr('width') || 'auto';
|
|
37496
37681
|
height = $video.attr('height') || 'auto';
|
|
37497
37682
|
poster = $video.attr('poster') || '';
|
|
37498
|
-
|
|
37683
|
+
style = $iframe.attr('style') || {};
|
|
37684
|
+
return genVideoElem(src, poster, width, height, style);
|
|
37499
37685
|
}
|
|
37500
37686
|
var parseHtmlConf = {
|
|
37501
37687
|
selector: 'div[data-w-e-type="video"]',
|
|
@@ -37546,8 +37732,10 @@ var UPLOAD_VIDEO_SVG = '<svg viewBox="0 0 1056 1024"><path d="M805.902261 521.81
|
|
|
37546
37732
|
* @param src video src
|
|
37547
37733
|
* @param poster video poster
|
|
37548
37734
|
*/
|
|
37549
|
-
function insertVideo (editor, src, poster) {
|
|
37735
|
+
function insertVideo (editor, src, poster, width, height) {
|
|
37550
37736
|
if (poster === void 0) { poster = ''; }
|
|
37737
|
+
if (width === void 0) { width = ''; }
|
|
37738
|
+
if (height === void 0) { height = ''; }
|
|
37551
37739
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
37552
37740
|
var _a, onInsertedVideo, checkVideo, parseVideoSrc, checkRes, parsedSrc, video;
|
|
37553
37741
|
return __generator$1(this, function (_b) {
|
|
@@ -37580,7 +37768,11 @@ function insertVideo (editor, src, poster) {
|
|
|
37580
37768
|
type: 'video',
|
|
37581
37769
|
src: parsedSrc,
|
|
37582
37770
|
poster: poster,
|
|
37583
|
-
children: [{ text: '' }],
|
|
37771
|
+
children: [{ text: '' }],
|
|
37772
|
+
style: {
|
|
37773
|
+
width: width,
|
|
37774
|
+
height: height,
|
|
37775
|
+
},
|
|
37584
37776
|
};
|
|
37585
37777
|
// 插入视频
|
|
37586
37778
|
// 不使用此方式会比正常的选区选取先执行
|
|
@@ -37983,13 +38175,30 @@ var EditorVideoSizeMenu = /** @class */ (function () {
|
|
|
37983
38175
|
e.preventDefault();
|
|
37984
38176
|
var rawWidth = $content_1.find("#" + widthInputId).val().trim();
|
|
37985
38177
|
var rawHeight = $content_1.find("#" + heightInputId).val().trim();
|
|
37986
|
-
var
|
|
37987
|
-
var
|
|
37988
|
-
var width =
|
|
37989
|
-
var height =
|
|
38178
|
+
var isPercentage = function (value) { return /^\d+(\.\d+)?%$/.test(value); }; // 检查是否为合法的百分比字符串
|
|
38179
|
+
var isNumeric = function (value) { return /^\d+(\.\d+)?$/.test(value); }; // 检查是否为合法的数字
|
|
38180
|
+
var width = 'auto';
|
|
38181
|
+
var height = 'auto';
|
|
38182
|
+
if (isPercentage(rawWidth)) {
|
|
38183
|
+
width = rawWidth;
|
|
38184
|
+
}
|
|
38185
|
+
else if (isNumeric(rawWidth)) {
|
|
38186
|
+
width = parseInt(rawWidth) + 'px';
|
|
38187
|
+
}
|
|
38188
|
+
if (isPercentage(rawHeight)) {
|
|
38189
|
+
height = rawHeight;
|
|
38190
|
+
}
|
|
38191
|
+
else if (isNumeric(rawHeight)) {
|
|
38192
|
+
height = parseInt(rawHeight) + 'px';
|
|
38193
|
+
}
|
|
38194
|
+
var _a = videoNode.style, style = _a === void 0 ? {} : _a;
|
|
37990
38195
|
editor.restoreSelection();
|
|
38196
|
+
var props = __assign$2(__assign$2({}, style), { style: {
|
|
38197
|
+
width: width,
|
|
38198
|
+
height: height,
|
|
38199
|
+
} });
|
|
37991
38200
|
// 修改尺寸
|
|
37992
|
-
Transforms.setNodes(editor,
|
|
38201
|
+
Transforms.setNodes(editor, props, {
|
|
37993
38202
|
match: function (n) { return DomEditor.checkNodeType(n, 'video'); },
|
|
37994
38203
|
});
|
|
37995
38204
|
editor.hidePanelOrModal(); // 隐藏 modal
|
|
@@ -38171,7 +38380,7 @@ var zhResources$1 = {
|
|
|
38171
38380
|
i18nAddResources('en', enResources$1);
|
|
38172
38381
|
i18nAddResources('zh-CN', zhResources$1);
|
|
38173
38382
|
|
|
38174
|
-
|
|
38383
|
+
/******************************************************************************
|
|
38175
38384
|
Copyright (c) Microsoft Corporation.
|
|
38176
38385
|
|
|
38177
38386
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -38213,7 +38422,7 @@ function __generator(thisArg, body) {
|
|
|
38213
38422
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38214
38423
|
function step(op) {
|
|
38215
38424
|
if (f) throw new TypeError("Generator is already executing.");
|
|
38216
|
-
while (_) try {
|
|
38425
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
38217
38426
|
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;
|
|
38218
38427
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
38219
38428
|
switch (op[0]) {
|
|
@@ -38270,7 +38479,12 @@ function __asyncValues(o) {
|
|
|
38270
38479
|
return m ? m.call(o) : (o = typeof __values$1 === "function" ? __values$1(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
38271
38480
|
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); }); }; }
|
|
38272
38481
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
38273
|
-
}
|
|
38482
|
+
}
|
|
38483
|
+
|
|
38484
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
38485
|
+
var e = new Error(message);
|
|
38486
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
38487
|
+
};
|
|
38274
38488
|
|
|
38275
38489
|
/**
|
|
38276
38490
|
* @description 上传文件
|
|
@@ -43389,7 +43603,7 @@ var codeHighlightModule = {
|
|
|
43389
43603
|
elemsToHtml: [codeToHtmlConf],
|
|
43390
43604
|
};
|
|
43391
43605
|
|
|
43392
|
-
|
|
43606
|
+
/******************************************************************************
|
|
43393
43607
|
Copyright (c) Microsoft Corporation.
|
|
43394
43608
|
|
|
43395
43609
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -43431,7 +43645,12 @@ function __read(o, n) {
|
|
|
43431
43645
|
finally { if (e) throw e.error; }
|
|
43432
43646
|
}
|
|
43433
43647
|
return ar;
|
|
43434
|
-
}
|
|
43648
|
+
}
|
|
43649
|
+
|
|
43650
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
43651
|
+
var e = new Error(message);
|
|
43652
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
43653
|
+
};
|
|
43435
43654
|
|
|
43436
43655
|
/**
|
|
43437
43656
|
* @description code-highlight decorate
|
|
@@ -43493,7 +43712,7 @@ var codeHighLightDecorate = function (nodeEntry) {
|
|
|
43493
43712
|
return ranges;
|
|
43494
43713
|
};
|
|
43495
43714
|
|
|
43496
|
-
|
|
43715
|
+
/******************************************************************************
|
|
43497
43716
|
Copyright (c) Microsoft Corporation.
|
|
43498
43717
|
|
|
43499
43718
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -43517,6 +43736,11 @@ var __assign = function() {
|
|
|
43517
43736
|
return t;
|
|
43518
43737
|
};
|
|
43519
43738
|
return __assign.apply(this, arguments);
|
|
43739
|
+
};
|
|
43740
|
+
|
|
43741
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
43742
|
+
var e = new Error(message);
|
|
43743
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
43520
43744
|
};
|
|
43521
43745
|
|
|
43522
43746
|
/**
|
|
@@ -43791,6 +44015,7 @@ var COMMON_HOVERBAR_KEYS = {
|
|
|
43791
44015
|
'imageWidth30',
|
|
43792
44016
|
'imageWidth50',
|
|
43793
44017
|
'imageWidth100',
|
|
44018
|
+
'editorImageSizeMenu',
|
|
43794
44019
|
'editImage',
|
|
43795
44020
|
'viewImageLink',
|
|
43796
44021
|
'deleteImage',
|