@dangl/angular-material-shared 2.5.1-beta0012 → 2.5.1-beta0018
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/README.md +1 -7
- package/esm2022/lib/angular-material-shared.module.mjs +2 -2
- package/esm2022/lib/components/tiny-mce/tiny-mce.component.mjs +16 -19
- package/fesm2022/dangl-angular-material-shared.mjs +16 -19
- package/fesm2022/dangl-angular-material-shared.mjs.map +1 -1
- package/lib/components/tiny-mce/tiny-mce.component.d.ts +7 -8
- package/package.json +1 -1
- package/tinymce-assets/icons/default/icons.js +187 -171
- package/tinymce-assets/icons/default/icons.min.js +1 -1
- package/tinymce-assets/langs/it.js +1 -1
- package/tinymce-assets/plugins/accordion/index.js +7 -0
- package/tinymce-assets/plugins/accordion/plugin.js +1054 -0
- package/tinymce-assets/plugins/accordion/plugin.min.js +4 -0
- package/tinymce-assets/plugins/advlist/plugin.js +185 -187
- package/tinymce-assets/plugins/advlist/plugin.min.js +2 -7
- package/tinymce-assets/plugins/anchor/plugin.js +79 -81
- package/tinymce-assets/plugins/anchor/plugin.min.js +2 -7
- package/tinymce-assets/plugins/autolink/plugin.js +209 -194
- package/tinymce-assets/plugins/autolink/plugin.min.js +2 -7
- package/tinymce-assets/plugins/autoresize/plugin.js +110 -102
- package/tinymce-assets/plugins/autoresize/plugin.min.js +2 -7
- package/tinymce-assets/plugins/autosave/plugin.js +125 -104
- package/tinymce-assets/plugins/autosave/plugin.min.js +2 -7
- package/tinymce-assets/plugins/charmap/plugin.js +275 -313
- package/tinymce-assets/plugins/charmap/plugin.min.js +2 -7
- package/tinymce-assets/plugins/code/plugin.js +18 -24
- package/tinymce-assets/plugins/code/plugin.min.js +2 -7
- package/tinymce-assets/plugins/codesample/plugin.js +2075 -2074
- package/tinymce-assets/plugins/codesample/plugin.min.js +2 -7
- package/tinymce-assets/plugins/directionality/plugin.js +247 -305
- package/tinymce-assets/plugins/directionality/plugin.min.js +2 -7
- package/tinymce-assets/plugins/emoticons/js/emojiimages.js +1 -9424
- package/tinymce-assets/plugins/emoticons/js/emojiimages.min.js +1 -1
- package/tinymce-assets/plugins/emoticons/js/emojis.js +1 -9423
- package/tinymce-assets/plugins/emoticons/js/emojis.min.js +1 -1
- package/tinymce-assets/plugins/emoticons/plugin.js +334 -374
- package/tinymce-assets/plugins/emoticons/plugin.min.js +2 -7
- package/tinymce-assets/plugins/fullscreen/plugin.js +740 -837
- package/tinymce-assets/plugins/fullscreen/plugin.min.js +2 -7
- package/tinymce-assets/plugins/help/js/i18n/keynav/ar.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/bg_BG.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ca.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/cs.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/da.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/de.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/el.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/en.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/es.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/eu.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/fa.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/fi.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/fr_FR.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/he_IL.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/hi.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/hr.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/hu_HU.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/id.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/it.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ja.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/kk.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ko_KR.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ms.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/nb_NO.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/nl.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/pl.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/pt_BR.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/pt_PT.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ro.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ru.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/sk.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/sl_SI.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/sv_SE.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/th_TH.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/tr.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/uk.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/vi.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/zh_CN.js +84 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/zh_TW.js +90 -0
- package/tinymce-assets/plugins/help/plugin.js +411 -355
- package/tinymce-assets/plugins/help/plugin.min.js +2 -7
- package/tinymce-assets/plugins/image/plugin.js +876 -1037
- package/tinymce-assets/plugins/image/plugin.min.js +2 -7
- package/tinymce-assets/plugins/importcss/plugin.js +146 -144
- package/tinymce-assets/plugins/importcss/plugin.min.js +2 -7
- package/tinymce-assets/plugins/insertdatetime/plugin.js +93 -88
- package/tinymce-assets/plugins/insertdatetime/plugin.min.js +2 -7
- package/tinymce-assets/plugins/link/plugin.js +718 -768
- package/tinymce-assets/plugins/link/plugin.min.js +2 -7
- package/tinymce-assets/plugins/lists/plugin.js +1235 -1375
- package/tinymce-assets/plugins/lists/plugin.min.js +2 -7
- package/tinymce-assets/plugins/media/plugin.js +614 -756
- package/tinymce-assets/plugins/media/plugin.min.js +2 -7
- package/tinymce-assets/plugins/nonbreaking/plugin.js +71 -48
- package/tinymce-assets/plugins/nonbreaking/plugin.min.js +2 -7
- package/tinymce-assets/plugins/pagebreak/plugin.js +53 -40
- package/tinymce-assets/plugins/pagebreak/plugin.min.js +2 -7
- package/tinymce-assets/plugins/preview/plugin.js +36 -65
- package/tinymce-assets/plugins/preview/plugin.min.js +2 -7
- package/tinymce-assets/plugins/quickbars/plugin.js +304 -331
- package/tinymce-assets/plugins/quickbars/plugin.min.js +2 -7
- package/tinymce-assets/plugins/save/plugin.js +49 -50
- package/tinymce-assets/plugins/save/plugin.min.js +2 -7
- package/tinymce-assets/plugins/searchreplace/plugin.js +499 -571
- package/tinymce-assets/plugins/searchreplace/plugin.min.js +2 -7
- package/tinymce-assets/plugins/table/plugin.js +2572 -10617
- package/tinymce-assets/plugins/table/plugin.min.js +2 -7
- package/tinymce-assets/plugins/visualblocks/plugin.js +41 -46
- package/tinymce-assets/plugins/visualblocks/plugin.min.js +2 -7
- package/tinymce-assets/plugins/visualchars/plugin.js +346 -312
- package/tinymce-assets/plugins/visualchars/plugin.min.js +2 -7
- package/tinymce-assets/plugins/wordcount/plugin.js +159 -179
- package/tinymce-assets/plugins/wordcount/plugin.min.js +2 -7
- package/tinymce-assets/skins/content/dark/content.css +2 -8
- package/tinymce-assets/skins/content/dark/content.js +2 -0
- package/tinymce-assets/skins/content/dark/content.min.css +1 -7
- package/tinymce-assets/skins/content/default/content.css +0 -6
- package/tinymce-assets/skins/content/default/content.js +2 -0
- package/tinymce-assets/skins/content/default/content.min.css +0 -6
- package/tinymce-assets/skins/content/document/content.css +0 -6
- package/tinymce-assets/skins/content/document/content.js +2 -0
- package/tinymce-assets/skins/content/document/content.min.css +0 -6
- package/tinymce-assets/skins/content/tinymce-5/content.css +61 -0
- package/tinymce-assets/skins/content/tinymce-5/content.js +2 -0
- package/tinymce-assets/skins/content/tinymce-5/content.min.css +1 -0
- package/tinymce-assets/skins/content/tinymce-5-dark/content.css +66 -0
- package/tinymce-assets/skins/content/tinymce-5-dark/content.js +2 -0
- package/tinymce-assets/skins/content/tinymce-5-dark/content.min.css +1 -0
- package/tinymce-assets/skins/content/writer/content.css +0 -6
- package/tinymce-assets/skins/content/writer/content.js +2 -0
- package/tinymce-assets/skins/content/writer/content.min.css +0 -6
- package/tinymce-assets/skins/ui/oxide/content.css +73 -20
- package/tinymce-assets/skins/ui/oxide/content.inline.css +73 -20
- package/tinymce-assets/skins/ui/oxide/content.inline.js +2 -0
- package/tinymce-assets/skins/ui/oxide/content.inline.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide/content.js +2 -0
- package/tinymce-assets/skins/ui/oxide/content.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide/skin.css +1480 -435
- package/tinymce-assets/skins/ui/oxide/skin.js +2 -0
- package/tinymce-assets/skins/ui/oxide/skin.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide/skin.shadowdom.css +1 -8
- package/tinymce-assets/skins/ui/oxide/skin.shadowdom.js +2 -0
- package/tinymce-assets/skins/ui/oxide/skin.shadowdom.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide-dark/content.css +71 -19
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.css +73 -20
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.js +2 -0
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide-dark/content.js +2 -0
- package/tinymce-assets/skins/ui/oxide-dark/content.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide-dark/skin.css +1498 -450
- package/tinymce-assets/skins/ui/oxide-dark/skin.js +2 -0
- package/tinymce-assets/skins/ui/oxide-dark/skin.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.css +1 -8
- package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.js +2 -0
- package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -7
- package/tinymce-assets/skins/ui/tinymce-5/content.css +785 -0
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.css +779 -0
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5/content.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5/content.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.css +4185 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.css +30 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.css +766 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.css +779 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.css +4185 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.css +30 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
- package/tinymce-assets/themes/silver/theme.js +25226 -28188
- package/tinymce-assets/themes/silver/theme.min.js +2 -7
- package/tinymce-assets/plugins/bbcode/index.js +0 -7
- package/tinymce-assets/plugins/bbcode/plugin.js +0 -99
- package/tinymce-assets/plugins/bbcode/plugin.min.js +0 -9
- package/tinymce-assets/plugins/colorpicker/index.js +0 -7
- package/tinymce-assets/plugins/colorpicker/plugin.js +0 -21
- package/tinymce-assets/plugins/colorpicker/plugin.min.js +0 -9
- package/tinymce-assets/plugins/contextmenu/index.js +0 -7
- package/tinymce-assets/plugins/contextmenu/plugin.js +0 -21
- package/tinymce-assets/plugins/contextmenu/plugin.min.js +0 -9
- package/tinymce-assets/plugins/fullpage/index.js +0 -7
- package/tinymce-assets/plugins/fullpage/plugin.js +0 -544
- package/tinymce-assets/plugins/fullpage/plugin.min.js +0 -9
- package/tinymce-assets/plugins/hr/index.js +0 -7
- package/tinymce-assets/plugins/hr/plugin.js +0 -45
- package/tinymce-assets/plugins/hr/plugin.min.js +0 -9
- package/tinymce-assets/plugins/imagetools/index.js +0 -7
- package/tinymce-assets/plugins/imagetools/plugin.js +0 -1531
- package/tinymce-assets/plugins/imagetools/plugin.min.js +0 -9
- package/tinymce-assets/plugins/legacyoutput/index.js +0 -7
- package/tinymce-assets/plugins/legacyoutput/plugin.js +0 -199
- package/tinymce-assets/plugins/legacyoutput/plugin.min.js +0 -9
- package/tinymce-assets/plugins/noneditable/index.js +0 -7
- package/tinymce-assets/plugins/noneditable/plugin.js +0 -117
- package/tinymce-assets/plugins/noneditable/plugin.min.js +0 -9
- package/tinymce-assets/plugins/paste/index.js +0 -7
- package/tinymce-assets/plugins/paste/plugin.js +0 -1803
- package/tinymce-assets/plugins/paste/plugin.min.js +0 -9
- package/tinymce-assets/plugins/print/index.js +0 -7
- package/tinymce-assets/plugins/print/plugin.js +0 -52
- package/tinymce-assets/plugins/print/plugin.min.js +0 -9
- package/tinymce-assets/plugins/spellchecker/index.js +0 -7
- package/tinymce-assets/plugins/spellchecker/plugin.js +0 -730
- package/tinymce-assets/plugins/spellchecker/plugin.min.js +0 -9
- package/tinymce-assets/plugins/tabfocus/index.js +0 -7
- package/tinymce-assets/plugins/tabfocus/plugin.js +0 -130
- package/tinymce-assets/plugins/tabfocus/plugin.min.js +0 -9
- package/tinymce-assets/plugins/template/index.js +0 -7
- package/tinymce-assets/plugins/template/plugin.js +0 -591
- package/tinymce-assets/plugins/template/plugin.min.js +0 -9
- package/tinymce-assets/plugins/textcolor/index.js +0 -7
- package/tinymce-assets/plugins/textcolor/plugin.js +0 -21
- package/tinymce-assets/plugins/textcolor/plugin.min.js +0 -9
- package/tinymce-assets/plugins/textpattern/index.js +0 -7
- package/tinymce-assets/plugins/textpattern/plugin.js +0 -1374
- package/tinymce-assets/plugins/textpattern/plugin.min.js +0 -9
- package/tinymce-assets/plugins/toc/index.js +0 -7
- package/tinymce-assets/plugins/toc/plugin.js +0 -238
- package/tinymce-assets/plugins/toc/plugin.min.js +0 -9
- package/tinymce-assets/skins/ui/oxide/content.mobile.css +0 -29
- package/tinymce-assets/skins/ui/oxide/content.mobile.min.css +0 -7
- package/tinymce-assets/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
- package/tinymce-assets/skins/ui/oxide/skin.mobile.css +0 -673
- package/tinymce-assets/skins/ui/oxide/skin.mobile.min.css +0 -7
- package/tinymce-assets/skins/ui/oxide-dark/content.mobile.css +0 -29
- package/tinymce-assets/skins/ui/oxide-dark/content.mobile.min.css +0 -7
- package/tinymce-assets/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
- package/tinymce-assets/skins/ui/oxide-dark/skin.mobile.css +0 -673
- package/tinymce-assets/skins/ui/oxide-dark/skin.mobile.min.css +0 -7
- package/tinymce-assets/themes/mobile/index.js +0 -7
- package/tinymce-assets/themes/mobile/theme.js +0 -13130
- package/tinymce-assets/themes/mobile/theme.min.js +0 -9
|
@@ -1,168 +1,142 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Licensed under the LGPL or a commercial license.
|
|
4
|
-
* For LGPL see License.txt in the project root for license information.
|
|
5
|
-
* For commercial licenses see https://www.tiny.cloud/
|
|
6
|
-
*
|
|
7
|
-
* Version: 5.10.9 (2023-11-15)
|
|
2
|
+
* TinyMCE version 7.0.1 (2024-04-10)
|
|
8
3
|
*/
|
|
4
|
+
|
|
9
5
|
(function () {
|
|
10
6
|
'use strict';
|
|
11
7
|
|
|
12
|
-
var global$
|
|
8
|
+
var global$6 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
13
9
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
return __assign.apply(this, arguments);
|
|
10
|
+
const hasProto = (v, constructor, predicate) => {
|
|
11
|
+
var _a;
|
|
12
|
+
if (predicate(v, constructor.prototype)) {
|
|
13
|
+
return true;
|
|
14
|
+
} else {
|
|
15
|
+
return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
|
|
16
|
+
}
|
|
25
17
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var t = typeof x;
|
|
18
|
+
const typeOf = x => {
|
|
19
|
+
const t = typeof x;
|
|
29
20
|
if (x === null) {
|
|
30
21
|
return 'null';
|
|
31
|
-
} else if (t === 'object' &&
|
|
22
|
+
} else if (t === 'object' && Array.isArray(x)) {
|
|
32
23
|
return 'array';
|
|
33
|
-
} else if (t === 'object' && (String
|
|
24
|
+
} else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
|
|
34
25
|
return 'string';
|
|
35
26
|
} else {
|
|
36
27
|
return t;
|
|
37
28
|
}
|
|
38
29
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var isObject = isType('object');
|
|
46
|
-
var isArray = isType('array');
|
|
47
|
-
var isNullable = function (a) {
|
|
48
|
-
return a === null || a === undefined;
|
|
49
|
-
};
|
|
50
|
-
var isNonNullable = function (a) {
|
|
51
|
-
return !isNullable(a);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
var noop = function () {
|
|
55
|
-
};
|
|
56
|
-
var constant = function (value) {
|
|
57
|
-
return function () {
|
|
58
|
-
return value;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
var identity = function (x) {
|
|
62
|
-
return x;
|
|
63
|
-
};
|
|
64
|
-
var never = constant(false);
|
|
65
|
-
var always = constant(true);
|
|
30
|
+
const isType = type => value => typeOf(value) === type;
|
|
31
|
+
const isString = isType('string');
|
|
32
|
+
const isObject = isType('object');
|
|
33
|
+
const isArray = isType('array');
|
|
34
|
+
const isNullable = a => a === null || a === undefined;
|
|
35
|
+
const isNonNullable = a => !isNullable(a);
|
|
66
36
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
getOrDie: function (msg) {
|
|
84
|
-
throw new Error(msg || 'error: getOrDie called on none.');
|
|
85
|
-
},
|
|
86
|
-
getOrNull: constant(null),
|
|
87
|
-
getOrUndefined: constant(undefined),
|
|
88
|
-
or: id,
|
|
89
|
-
orThunk: call,
|
|
90
|
-
map: none,
|
|
91
|
-
each: noop,
|
|
92
|
-
bind: none,
|
|
93
|
-
exists: never,
|
|
94
|
-
forall: always,
|
|
95
|
-
filter: function () {
|
|
96
|
-
return none();
|
|
97
|
-
},
|
|
98
|
-
toArray: function () {
|
|
99
|
-
return [];
|
|
100
|
-
},
|
|
101
|
-
toString: constant('none()')
|
|
102
|
-
};
|
|
103
|
-
return me;
|
|
104
|
-
}();
|
|
105
|
-
var some = function (a) {
|
|
106
|
-
var constant_a = constant(a);
|
|
107
|
-
var self = function () {
|
|
108
|
-
return me;
|
|
109
|
-
};
|
|
110
|
-
var bind = function (f) {
|
|
111
|
-
return f(a);
|
|
112
|
-
};
|
|
113
|
-
var me = {
|
|
114
|
-
fold: function (n, s) {
|
|
115
|
-
return s(a);
|
|
116
|
-
},
|
|
117
|
-
isSome: always,
|
|
118
|
-
isNone: never,
|
|
119
|
-
getOr: constant_a,
|
|
120
|
-
getOrThunk: constant_a,
|
|
121
|
-
getOrDie: constant_a,
|
|
122
|
-
getOrNull: constant_a,
|
|
123
|
-
getOrUndefined: constant_a,
|
|
124
|
-
or: self,
|
|
125
|
-
orThunk: self,
|
|
126
|
-
map: function (f) {
|
|
127
|
-
return some(f(a));
|
|
128
|
-
},
|
|
129
|
-
each: function (f) {
|
|
130
|
-
f(a);
|
|
131
|
-
},
|
|
132
|
-
bind: bind,
|
|
133
|
-
exists: bind,
|
|
134
|
-
forall: bind,
|
|
135
|
-
filter: function (f) {
|
|
136
|
-
return f(a) ? me : NONE;
|
|
137
|
-
},
|
|
138
|
-
toArray: function () {
|
|
139
|
-
return [a];
|
|
140
|
-
},
|
|
141
|
-
toString: function () {
|
|
142
|
-
return 'some(' + a + ')';
|
|
37
|
+
class Optional {
|
|
38
|
+
constructor(tag, value) {
|
|
39
|
+
this.tag = tag;
|
|
40
|
+
this.value = value;
|
|
41
|
+
}
|
|
42
|
+
static some(value) {
|
|
43
|
+
return new Optional(true, value);
|
|
44
|
+
}
|
|
45
|
+
static none() {
|
|
46
|
+
return Optional.singletonNone;
|
|
47
|
+
}
|
|
48
|
+
fold(onNone, onSome) {
|
|
49
|
+
if (this.tag) {
|
|
50
|
+
return onSome(this.value);
|
|
51
|
+
} else {
|
|
52
|
+
return onNone();
|
|
143
53
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
54
|
+
}
|
|
55
|
+
isSome() {
|
|
56
|
+
return this.tag;
|
|
57
|
+
}
|
|
58
|
+
isNone() {
|
|
59
|
+
return !this.tag;
|
|
60
|
+
}
|
|
61
|
+
map(mapper) {
|
|
62
|
+
if (this.tag) {
|
|
63
|
+
return Optional.some(mapper(this.value));
|
|
64
|
+
} else {
|
|
65
|
+
return Optional.none();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
bind(binder) {
|
|
69
|
+
if (this.tag) {
|
|
70
|
+
return binder(this.value);
|
|
71
|
+
} else {
|
|
72
|
+
return Optional.none();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exists(predicate) {
|
|
76
|
+
return this.tag && predicate(this.value);
|
|
77
|
+
}
|
|
78
|
+
forall(predicate) {
|
|
79
|
+
return !this.tag || predicate(this.value);
|
|
80
|
+
}
|
|
81
|
+
filter(predicate) {
|
|
82
|
+
if (!this.tag || predicate(this.value)) {
|
|
83
|
+
return this;
|
|
84
|
+
} else {
|
|
85
|
+
return Optional.none();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
getOr(replacement) {
|
|
89
|
+
return this.tag ? this.value : replacement;
|
|
90
|
+
}
|
|
91
|
+
or(replacement) {
|
|
92
|
+
return this.tag ? this : replacement;
|
|
93
|
+
}
|
|
94
|
+
getOrThunk(thunk) {
|
|
95
|
+
return this.tag ? this.value : thunk();
|
|
96
|
+
}
|
|
97
|
+
orThunk(thunk) {
|
|
98
|
+
return this.tag ? this : thunk();
|
|
99
|
+
}
|
|
100
|
+
getOrDie(message) {
|
|
101
|
+
if (!this.tag) {
|
|
102
|
+
throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
|
|
103
|
+
} else {
|
|
104
|
+
return this.value;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
static from(value) {
|
|
108
|
+
return isNonNullable(value) ? Optional.some(value) : Optional.none();
|
|
109
|
+
}
|
|
110
|
+
getOrNull() {
|
|
111
|
+
return this.tag ? this.value : null;
|
|
112
|
+
}
|
|
113
|
+
getOrUndefined() {
|
|
114
|
+
return this.value;
|
|
115
|
+
}
|
|
116
|
+
each(worker) {
|
|
117
|
+
if (this.tag) {
|
|
118
|
+
worker(this.value);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
toArray() {
|
|
122
|
+
return this.tag ? [this.value] : [];
|
|
123
|
+
}
|
|
124
|
+
toString() {
|
|
125
|
+
return this.tag ? `some(${ this.value })` : 'none()';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
Optional.singletonNone = new Optional(false);
|
|
155
129
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
for (
|
|
159
|
-
|
|
130
|
+
const nativePush = Array.prototype.push;
|
|
131
|
+
const each$1 = (xs, f) => {
|
|
132
|
+
for (let i = 0, len = xs.length; i < len; i++) {
|
|
133
|
+
const x = xs[i];
|
|
160
134
|
f(x, i);
|
|
161
135
|
}
|
|
162
136
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
for (
|
|
137
|
+
const flatten = xs => {
|
|
138
|
+
const r = [];
|
|
139
|
+
for (let i = 0, len = xs.length; i < len; ++i) {
|
|
166
140
|
if (!isArray(xs[i])) {
|
|
167
141
|
throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
|
|
168
142
|
}
|
|
@@ -171,150 +145,138 @@
|
|
|
171
145
|
return r;
|
|
172
146
|
};
|
|
173
147
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
148
|
+
const Cell = initial => {
|
|
149
|
+
let value = initial;
|
|
150
|
+
const get = () => {
|
|
177
151
|
return value;
|
|
178
152
|
};
|
|
179
|
-
|
|
153
|
+
const set = v => {
|
|
180
154
|
value = v;
|
|
181
155
|
};
|
|
182
156
|
return {
|
|
183
|
-
get
|
|
184
|
-
set
|
|
157
|
+
get,
|
|
158
|
+
set
|
|
185
159
|
};
|
|
186
160
|
};
|
|
187
161
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
for (
|
|
193
|
-
|
|
194
|
-
|
|
162
|
+
const keys = Object.keys;
|
|
163
|
+
const hasOwnProperty = Object.hasOwnProperty;
|
|
164
|
+
const each = (obj, f) => {
|
|
165
|
+
const props = keys(obj);
|
|
166
|
+
for (let k = 0, len = props.length; k < len; k++) {
|
|
167
|
+
const i = props[k];
|
|
168
|
+
const x = obj[i];
|
|
195
169
|
f(x, i);
|
|
196
170
|
}
|
|
197
171
|
};
|
|
198
|
-
|
|
172
|
+
const get$1 = (obj, key) => {
|
|
199
173
|
return has(obj, key) ? Optional.from(obj[key]) : Optional.none();
|
|
200
174
|
};
|
|
201
|
-
|
|
202
|
-
return hasOwnProperty.call(obj, key);
|
|
203
|
-
};
|
|
175
|
+
const has = (obj, key) => hasOwnProperty.call(obj, key);
|
|
204
176
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
177
|
+
const option = name => editor => editor.options.get(name);
|
|
178
|
+
const register$2 = editor => {
|
|
179
|
+
const registerOption = editor.options.register;
|
|
180
|
+
registerOption('audio_template_callback', { processor: 'function' });
|
|
181
|
+
registerOption('video_template_callback', { processor: 'function' });
|
|
182
|
+
registerOption('iframe_template_callback', { processor: 'function' });
|
|
183
|
+
registerOption('media_live_embeds', {
|
|
184
|
+
processor: 'boolean',
|
|
185
|
+
default: true
|
|
186
|
+
});
|
|
187
|
+
registerOption('media_filter_html', {
|
|
188
|
+
processor: 'boolean',
|
|
189
|
+
default: true
|
|
190
|
+
});
|
|
191
|
+
registerOption('media_url_resolver', { processor: 'function' });
|
|
192
|
+
registerOption('media_alt_source', {
|
|
193
|
+
processor: 'boolean',
|
|
194
|
+
default: true
|
|
195
|
+
});
|
|
196
|
+
registerOption('media_poster', {
|
|
197
|
+
processor: 'boolean',
|
|
198
|
+
default: true
|
|
199
|
+
});
|
|
200
|
+
registerOption('media_dimensions', {
|
|
201
|
+
processor: 'boolean',
|
|
202
|
+
default: true
|
|
203
|
+
});
|
|
231
204
|
};
|
|
205
|
+
const getAudioTemplateCallback = option('audio_template_callback');
|
|
206
|
+
const getVideoTemplateCallback = option('video_template_callback');
|
|
207
|
+
const getIframeTemplateCallback = option('iframe_template_callback');
|
|
208
|
+
const hasLiveEmbeds = option('media_live_embeds');
|
|
209
|
+
const shouldFilterHtml = option('media_filter_html');
|
|
210
|
+
const getUrlResolver = option('media_url_resolver');
|
|
211
|
+
const hasAltSource = option('media_alt_source');
|
|
212
|
+
const hasPoster = option('media_poster');
|
|
213
|
+
const hasDimensions = option('media_dimensions');
|
|
232
214
|
|
|
233
|
-
var global$
|
|
215
|
+
var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
234
216
|
|
|
235
|
-
var global$
|
|
217
|
+
var global$4 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
|
236
218
|
|
|
237
|
-
var global$
|
|
219
|
+
var global$3 = tinymce.util.Tools.resolve('tinymce.html.DomParser');
|
|
238
220
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
var DOM$1 = global$7.DOM;
|
|
250
|
-
var trimPx = function (value) {
|
|
251
|
-
return value.replace(/px$/, '');
|
|
252
|
-
};
|
|
253
|
-
var getEphoxEmbedData = function (attrs) {
|
|
254
|
-
var style = attrs.map.style;
|
|
255
|
-
var styles = style ? DOM$1.parseStyle(style) : {};
|
|
221
|
+
const DOM$1 = global$4.DOM;
|
|
222
|
+
const trimPx = value => value.replace(/px$/, '');
|
|
223
|
+
const getEphoxEmbedData = node => {
|
|
224
|
+
const style = node.attr('style');
|
|
225
|
+
const styles = style ? DOM$1.parseStyle(style) : {};
|
|
256
226
|
return {
|
|
257
227
|
type: 'ephox-embed-iri',
|
|
258
|
-
source:
|
|
228
|
+
source: node.attr('data-ephox-embed-iri'),
|
|
259
229
|
altsource: '',
|
|
260
230
|
poster: '',
|
|
261
231
|
width: get$1(styles, 'max-width').map(trimPx).getOr(''),
|
|
262
232
|
height: get$1(styles, 'max-height').map(trimPx).getOr('')
|
|
263
233
|
};
|
|
264
234
|
};
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
global$6({
|
|
235
|
+
const htmlToData = (html, schema) => {
|
|
236
|
+
let data = {};
|
|
237
|
+
const parser = global$3({
|
|
269
238
|
validate: false,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
239
|
+
forced_root_block: false
|
|
240
|
+
}, schema);
|
|
241
|
+
const rootNode = parser.parse(html);
|
|
242
|
+
for (let node = rootNode; node; node = node.walk()) {
|
|
243
|
+
if (node.type === 1) {
|
|
244
|
+
const name = node.name;
|
|
245
|
+
if (node.attr('data-ephox-embed-iri')) {
|
|
246
|
+
data = getEphoxEmbedData(node);
|
|
247
|
+
break;
|
|
275
248
|
} else {
|
|
276
249
|
if (!data.source && name === 'param') {
|
|
277
|
-
data.source =
|
|
250
|
+
data.source = node.attr('movie');
|
|
278
251
|
}
|
|
279
252
|
if (name === 'iframe' || name === 'object' || name === 'embed' || name === 'video' || name === 'audio') {
|
|
280
253
|
if (!data.type) {
|
|
281
254
|
data.type = name;
|
|
282
255
|
}
|
|
283
|
-
data = global$
|
|
284
|
-
}
|
|
285
|
-
if (name === 'script') {
|
|
286
|
-
var videoScript = getVideoScriptMatch(prefixes, attrs.map.src);
|
|
287
|
-
if (!videoScript) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
data = {
|
|
291
|
-
type: 'script',
|
|
292
|
-
source: attrs.map.src,
|
|
293
|
-
width: String(videoScript.width),
|
|
294
|
-
height: String(videoScript.height)
|
|
295
|
-
};
|
|
256
|
+
data = global$5.extend(node.attributes.map, data);
|
|
296
257
|
}
|
|
297
258
|
if (name === 'source') {
|
|
298
259
|
if (!data.source) {
|
|
299
|
-
data.source =
|
|
260
|
+
data.source = node.attr('src');
|
|
300
261
|
} else if (!data.altsource) {
|
|
301
|
-
data.altsource =
|
|
262
|
+
data.altsource = node.attr('src');
|
|
302
263
|
}
|
|
303
264
|
}
|
|
304
265
|
if (name === 'img' && !data.poster) {
|
|
305
|
-
data.poster =
|
|
266
|
+
data.poster = node.attr('src');
|
|
306
267
|
}
|
|
307
268
|
}
|
|
308
269
|
}
|
|
309
|
-
}
|
|
310
|
-
data.source = data.source || data.src ||
|
|
270
|
+
}
|
|
271
|
+
data.source = data.source || data.src || '';
|
|
311
272
|
data.altsource = data.altsource || '';
|
|
312
273
|
data.poster = data.poster || '';
|
|
313
274
|
return data;
|
|
314
275
|
};
|
|
315
276
|
|
|
316
|
-
|
|
317
|
-
var
|
|
277
|
+
const guess = url => {
|
|
278
|
+
var _a;
|
|
279
|
+
const mimes = {
|
|
318
280
|
mp3: 'audio/mpeg',
|
|
319
281
|
m4a: 'audio/x-m4a',
|
|
320
282
|
wav: 'audio/wav',
|
|
@@ -323,77 +285,50 @@
|
|
|
323
285
|
ogg: 'video/ogg',
|
|
324
286
|
swf: 'application/x-shockwave-flash'
|
|
325
287
|
};
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
return mime ? mime : '';
|
|
288
|
+
const fileEnd = (_a = url.toLowerCase().split('.').pop()) !== null && _a !== void 0 ? _a : '';
|
|
289
|
+
return get$1(mimes, fileEnd).getOr('');
|
|
329
290
|
};
|
|
330
291
|
|
|
331
|
-
var global$
|
|
292
|
+
var global$2 = tinymce.util.Tools.resolve('tinymce.html.Node');
|
|
332
293
|
|
|
333
|
-
var global$
|
|
294
|
+
var global$1 = tinymce.util.Tools.resolve('tinymce.html.Serializer');
|
|
334
295
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
} else if (value) {
|
|
357
|
-
attrs.push({
|
|
358
|
-
name: name,
|
|
359
|
-
value: value
|
|
360
|
-
});
|
|
361
|
-
attrs.map[name] = value;
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
};
|
|
365
|
-
var updateEphoxEmbed = function (data, attrs) {
|
|
366
|
-
var style = attrs.map.style;
|
|
367
|
-
var styleMap = style ? DOM.parseStyle(style) : {};
|
|
368
|
-
styleMap['max-width'] = addPx(data.width);
|
|
369
|
-
styleMap['max-height'] = addPx(data.height);
|
|
370
|
-
setAttributes(attrs, { style: DOM.serializeStyle(styleMap) });
|
|
296
|
+
const Parser = (schema, settings = {}) => global$3({
|
|
297
|
+
forced_root_block: false,
|
|
298
|
+
validate: false,
|
|
299
|
+
allow_conditional_comments: true,
|
|
300
|
+
...settings
|
|
301
|
+
}, schema);
|
|
302
|
+
|
|
303
|
+
const DOM = global$4.DOM;
|
|
304
|
+
const addPx = value => /^[0-9.]+$/.test(value) ? value + 'px' : value;
|
|
305
|
+
const updateEphoxEmbed = (data, node) => {
|
|
306
|
+
const style = node.attr('style');
|
|
307
|
+
const styleMap = style ? DOM.parseStyle(style) : {};
|
|
308
|
+
if (isNonNullable(data.width)) {
|
|
309
|
+
styleMap['max-width'] = addPx(data.width);
|
|
310
|
+
}
|
|
311
|
+
if (isNonNullable(data.height)) {
|
|
312
|
+
styleMap['max-height'] = addPx(data.height);
|
|
313
|
+
}
|
|
314
|
+
node.attr('style', DOM.serializeStyle(styleMap));
|
|
371
315
|
};
|
|
372
|
-
|
|
316
|
+
const sources = [
|
|
373
317
|
'source',
|
|
374
318
|
'altsource'
|
|
375
319
|
];
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
writer.cdata(text);
|
|
389
|
-
},
|
|
390
|
-
text: function (text, raw) {
|
|
391
|
-
writer.text(text, raw);
|
|
392
|
-
},
|
|
393
|
-
start: function (name, attrs, empty) {
|
|
394
|
-
if (isEphoxEmbed.get()) ; else if (has(attrs.map, 'data-ephox-embed-iri')) {
|
|
395
|
-
isEphoxEmbed.set(true);
|
|
396
|
-
updateEphoxEmbed(data, attrs);
|
|
320
|
+
const updateHtml = (html, data, updateAll, schema) => {
|
|
321
|
+
let numSources = 0;
|
|
322
|
+
let sourceCount = 0;
|
|
323
|
+
const parser = Parser(schema);
|
|
324
|
+
parser.addNodeFilter('source', nodes => numSources = nodes.length);
|
|
325
|
+
const rootNode = parser.parse(html);
|
|
326
|
+
for (let node = rootNode; node; node = node.walk()) {
|
|
327
|
+
if (node.type === 1) {
|
|
328
|
+
const name = node.name;
|
|
329
|
+
if (node.attr('data-ephox-embed-iri')) {
|
|
330
|
+
updateEphoxEmbed(data, node);
|
|
331
|
+
break;
|
|
397
332
|
} else {
|
|
398
333
|
switch (name) {
|
|
399
334
|
case 'video':
|
|
@@ -402,85 +337,64 @@
|
|
|
402
337
|
case 'img':
|
|
403
338
|
case 'iframe':
|
|
404
339
|
if (data.height !== undefined && data.width !== undefined) {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
height: data.height
|
|
408
|
-
});
|
|
340
|
+
node.attr('width', data.width);
|
|
341
|
+
node.attr('height', data.height);
|
|
409
342
|
}
|
|
410
343
|
break;
|
|
411
344
|
}
|
|
412
345
|
if (updateAll) {
|
|
413
346
|
switch (name) {
|
|
414
347
|
case 'video':
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
348
|
+
node.attr('poster', data.poster);
|
|
349
|
+
node.attr('src', null);
|
|
350
|
+
for (let index = numSources; index < 2; index++) {
|
|
351
|
+
if (data[sources[index]]) {
|
|
352
|
+
const source = new global$2('source', 1);
|
|
353
|
+
source.attr('src', data[sources[index]]);
|
|
354
|
+
source.attr('type', data[sources[index] + 'mime'] || null);
|
|
355
|
+
node.append(source);
|
|
356
|
+
}
|
|
421
357
|
}
|
|
422
358
|
break;
|
|
423
359
|
case 'iframe':
|
|
424
|
-
|
|
360
|
+
node.attr('src', data.source);
|
|
361
|
+
break;
|
|
362
|
+
case 'object':
|
|
363
|
+
const hasImage = node.getAll('img').length > 0;
|
|
364
|
+
if (data.poster && !hasImage) {
|
|
365
|
+
node.attr('src', data.poster);
|
|
366
|
+
const img = new global$2('img', 1);
|
|
367
|
+
img.attr('src', data.poster);
|
|
368
|
+
img.attr('width', data.width);
|
|
369
|
+
img.attr('height', data.height);
|
|
370
|
+
node.append(img);
|
|
371
|
+
}
|
|
425
372
|
break;
|
|
426
373
|
case 'source':
|
|
427
374
|
if (sourceCount < 2) {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
type: data[sources[sourceCount] + 'mime']
|
|
431
|
-
});
|
|
375
|
+
node.attr('src', data[sources[sourceCount]]);
|
|
376
|
+
node.attr('type', data[sources[sourceCount] + 'mime'] || null);
|
|
432
377
|
if (!data[sources[sourceCount]]) {
|
|
433
|
-
|
|
378
|
+
node.remove();
|
|
379
|
+
continue;
|
|
434
380
|
}
|
|
435
381
|
}
|
|
436
382
|
sourceCount++;
|
|
437
383
|
break;
|
|
438
384
|
case 'img':
|
|
439
385
|
if (!data.poster) {
|
|
440
|
-
|
|
386
|
+
node.remove();
|
|
441
387
|
}
|
|
442
|
-
hasImage = true;
|
|
443
388
|
break;
|
|
444
389
|
}
|
|
445
390
|
}
|
|
446
391
|
}
|
|
447
|
-
writer.start(name, attrs, empty);
|
|
448
|
-
},
|
|
449
|
-
end: function (name) {
|
|
450
|
-
if (!isEphoxEmbed.get()) {
|
|
451
|
-
if (name === 'video' && updateAll) {
|
|
452
|
-
for (var index = 0; index < 2; index++) {
|
|
453
|
-
if (data[sources[index]]) {
|
|
454
|
-
var attrs = [];
|
|
455
|
-
attrs.map = {};
|
|
456
|
-
if (sourceCount <= index) {
|
|
457
|
-
setAttributes(attrs, {
|
|
458
|
-
src: data[sources[index]],
|
|
459
|
-
type: data[sources[index] + 'mime']
|
|
460
|
-
});
|
|
461
|
-
writer.start('source', attrs, true);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
if (data.poster && name === 'object' && updateAll && !hasImage) {
|
|
467
|
-
var imgAttrs = [];
|
|
468
|
-
imgAttrs.map = {};
|
|
469
|
-
setAttributes(imgAttrs, {
|
|
470
|
-
src: data.poster,
|
|
471
|
-
width: data.width,
|
|
472
|
-
height: data.height
|
|
473
|
-
});
|
|
474
|
-
writer.start('img', imgAttrs, true);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
writer.end(name);
|
|
478
392
|
}
|
|
479
|
-
}
|
|
480
|
-
return
|
|
393
|
+
}
|
|
394
|
+
return global$1({}, schema).serialize(rootNode);
|
|
481
395
|
};
|
|
482
396
|
|
|
483
|
-
|
|
397
|
+
const urlPatterns = [
|
|
484
398
|
{
|
|
485
399
|
regex: /youtu\.be\/([\w\-_\?&=.]+)/i,
|
|
486
400
|
type: 'iframe',
|
|
@@ -505,6 +419,22 @@
|
|
|
505
419
|
url: 'www.youtube.com/embed/$1',
|
|
506
420
|
allowFullscreen: true
|
|
507
421
|
},
|
|
422
|
+
{
|
|
423
|
+
regex: /vimeo\.com\/([0-9]+)\?h=(\w+)/,
|
|
424
|
+
type: 'iframe',
|
|
425
|
+
w: 425,
|
|
426
|
+
h: 350,
|
|
427
|
+
url: 'player.vimeo.com/video/$1?h=$2&title=0&byline=0&portrait=0&color=8dc7dc',
|
|
428
|
+
allowFullscreen: true
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
regex: /vimeo\.com\/(.*)\/([0-9]+)\?h=(\w+)/,
|
|
432
|
+
type: 'iframe',
|
|
433
|
+
w: 425,
|
|
434
|
+
h: 350,
|
|
435
|
+
url: 'player.vimeo.com/video/$2?h=$3&title=0&byline=0',
|
|
436
|
+
allowFullscreen: true
|
|
437
|
+
},
|
|
508
438
|
{
|
|
509
439
|
regex: /vimeo\.com\/([0-9]+)/,
|
|
510
440
|
type: 'iframe',
|
|
@@ -546,72 +476,69 @@
|
|
|
546
476
|
allowFullscreen: true
|
|
547
477
|
}
|
|
548
478
|
];
|
|
549
|
-
|
|
550
|
-
|
|
479
|
+
const getProtocol = url => {
|
|
480
|
+
const protocolMatches = url.match(/^(https?:\/\/|www\.)(.+)$/i);
|
|
551
481
|
if (protocolMatches && protocolMatches.length > 1) {
|
|
552
482
|
return protocolMatches[1] === 'www.' ? 'https://' : protocolMatches[1];
|
|
553
483
|
} else {
|
|
554
484
|
return 'https://';
|
|
555
485
|
}
|
|
556
486
|
};
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
}
|
|
565
|
-
};
|
|
566
|
-
for (var i = 0; i < match.length; i++) {
|
|
567
|
-
_loop_1(i);
|
|
487
|
+
const getUrl = (pattern, url) => {
|
|
488
|
+
const protocol = getProtocol(url);
|
|
489
|
+
const match = pattern.regex.exec(url);
|
|
490
|
+
let newUrl = protocol + pattern.url;
|
|
491
|
+
if (isNonNullable(match)) {
|
|
492
|
+
for (let i = 0; i < match.length; i++) {
|
|
493
|
+
newUrl = newUrl.replace('$' + i, () => match[i] ? match[i] : '');
|
|
494
|
+
}
|
|
568
495
|
}
|
|
569
496
|
return newUrl.replace(/\?$/, '');
|
|
570
497
|
};
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
return pattern.regex.test(url);
|
|
574
|
-
});
|
|
498
|
+
const matchPattern = url => {
|
|
499
|
+
const patterns = urlPatterns.filter(pattern => pattern.regex.test(url));
|
|
575
500
|
if (patterns.length > 0) {
|
|
576
|
-
return global$
|
|
501
|
+
return global$5.extend({}, patterns[0], { url: getUrl(patterns[0], url) });
|
|
577
502
|
} else {
|
|
578
503
|
return null;
|
|
579
504
|
}
|
|
580
505
|
};
|
|
581
506
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
507
|
+
const getIframeHtml = (data, iframeTemplateCallback) => {
|
|
508
|
+
if (iframeTemplateCallback) {
|
|
509
|
+
return iframeTemplateCallback(data);
|
|
510
|
+
} else {
|
|
511
|
+
const allowFullscreen = data.allowfullscreen ? ' allowFullscreen="1"' : '';
|
|
512
|
+
return '<iframe src="' + data.source + '" width="' + data.width + '" height="' + data.height + '"' + allowFullscreen + '></iframe>';
|
|
513
|
+
}
|
|
585
514
|
};
|
|
586
|
-
|
|
587
|
-
|
|
515
|
+
const getFlashHtml = data => {
|
|
516
|
+
let html = '<object data="' + data.source + '" width="' + data.width + '" height="' + data.height + '" type="application/x-shockwave-flash">';
|
|
588
517
|
if (data.poster) {
|
|
589
518
|
html += '<img src="' + data.poster + '" width="' + data.width + '" height="' + data.height + '" />';
|
|
590
519
|
}
|
|
591
520
|
html += '</object>';
|
|
592
521
|
return html;
|
|
593
522
|
};
|
|
594
|
-
|
|
523
|
+
const getAudioHtml = (data, audioTemplateCallback) => {
|
|
595
524
|
if (audioTemplateCallback) {
|
|
596
525
|
return audioTemplateCallback(data);
|
|
597
526
|
} else {
|
|
598
527
|
return '<audio controls="controls" src="' + data.source + '">' + (data.altsource ? '\n<source src="' + data.altsource + '"' + (data.altsourcemime ? ' type="' + data.altsourcemime + '"' : '') + ' />\n' : '') + '</audio>';
|
|
599
528
|
}
|
|
600
529
|
};
|
|
601
|
-
|
|
530
|
+
const getVideoHtml = (data, videoTemplateCallback) => {
|
|
602
531
|
if (videoTemplateCallback) {
|
|
603
532
|
return videoTemplateCallback(data);
|
|
604
533
|
} else {
|
|
605
534
|
return '<video width="' + data.width + '" height="' + data.height + '"' + (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">\n' + '<source src="' + data.source + '"' + (data.sourcemime ? ' type="' + data.sourcemime + '"' : '') + ' />\n' + (data.altsource ? '<source src="' + data.altsource + '"' + (data.altsourcemime ? ' type="' + data.altsourcemime + '"' : '') + ' />\n' : '') + '</video>';
|
|
606
535
|
}
|
|
607
536
|
};
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
var dataToHtml = function (editor, dataIn) {
|
|
612
|
-
var data = global$8.extend({}, dataIn);
|
|
537
|
+
const dataToHtml = (editor, dataIn) => {
|
|
538
|
+
var _a;
|
|
539
|
+
const data = global$5.extend({}, dataIn);
|
|
613
540
|
if (!data.source) {
|
|
614
|
-
global$
|
|
541
|
+
global$5.extend(data, htmlToData((_a = data.embed) !== null && _a !== void 0 ? _a : '', editor.schema));
|
|
615
542
|
if (!data.source) {
|
|
616
543
|
return '';
|
|
617
544
|
}
|
|
@@ -627,7 +554,7 @@
|
|
|
627
554
|
data.sourcemime = guess(data.source);
|
|
628
555
|
data.altsourcemime = guess(data.altsource);
|
|
629
556
|
data.poster = editor.convertURL(data.poster, 'poster');
|
|
630
|
-
|
|
557
|
+
const pattern = matchPattern(data.source);
|
|
631
558
|
if (pattern) {
|
|
632
559
|
data.source = pattern.url;
|
|
633
560
|
data.type = pattern.type;
|
|
@@ -636,74 +563,57 @@
|
|
|
636
563
|
data.height = data.height || String(pattern.h);
|
|
637
564
|
}
|
|
638
565
|
if (data.embed) {
|
|
639
|
-
return updateHtml(data.embed, data, true);
|
|
566
|
+
return updateHtml(data.embed, data, true, editor.schema);
|
|
640
567
|
} else {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
data.width = String(videoScript.width);
|
|
645
|
-
data.height = String(videoScript.height);
|
|
646
|
-
}
|
|
647
|
-
var audioTemplateCallback = getAudioTemplateCallback(editor);
|
|
648
|
-
var videoTemplateCallback = getVideoTemplateCallback(editor);
|
|
568
|
+
const audioTemplateCallback = getAudioTemplateCallback(editor);
|
|
569
|
+
const videoTemplateCallback = getVideoTemplateCallback(editor);
|
|
570
|
+
const iframeTemplateCallback = getIframeTemplateCallback(editor);
|
|
649
571
|
data.width = data.width || '300';
|
|
650
572
|
data.height = data.height || '150';
|
|
651
|
-
global$
|
|
573
|
+
global$5.each(data, (value, key) => {
|
|
652
574
|
data[key] = editor.dom.encode('' + value);
|
|
653
575
|
});
|
|
654
576
|
if (data.type === 'iframe') {
|
|
655
|
-
return getIframeHtml(data);
|
|
577
|
+
return getIframeHtml(data, iframeTemplateCallback);
|
|
656
578
|
} else if (data.sourcemime === 'application/x-shockwave-flash') {
|
|
657
579
|
return getFlashHtml(data);
|
|
658
580
|
} else if (data.sourcemime.indexOf('audio') !== -1) {
|
|
659
581
|
return getAudioHtml(data, audioTemplateCallback);
|
|
660
|
-
} else if (data.type === 'script') {
|
|
661
|
-
return getScriptHtml(data);
|
|
662
582
|
} else {
|
|
663
583
|
return getVideoHtml(data, videoTemplateCallback);
|
|
664
584
|
}
|
|
665
585
|
}
|
|
666
586
|
};
|
|
667
587
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
editor.on('click keyup touchend', function () {
|
|
673
|
-
var selectedNode = editor.selection.getNode();
|
|
588
|
+
const isMediaElement = element => element.hasAttribute('data-mce-object') || element.hasAttribute('data-ephox-embed-iri');
|
|
589
|
+
const setup$2 = editor => {
|
|
590
|
+
editor.on('click keyup touchend', () => {
|
|
591
|
+
const selectedNode = editor.selection.getNode();
|
|
674
592
|
if (selectedNode && editor.dom.hasClass(selectedNode, 'mce-preview-object')) {
|
|
675
593
|
if (editor.dom.getAttrib(selectedNode, 'data-mce-selected')) {
|
|
676
594
|
selectedNode.setAttribute('data-mce-selected', '2');
|
|
677
595
|
}
|
|
678
596
|
}
|
|
679
597
|
});
|
|
680
|
-
editor.on('
|
|
681
|
-
|
|
682
|
-
if (objectType === 'script') {
|
|
683
|
-
e.preventDefault();
|
|
684
|
-
}
|
|
685
|
-
});
|
|
686
|
-
editor.on('ObjectResized', function (e) {
|
|
687
|
-
var target = e.target;
|
|
598
|
+
editor.on('ObjectResized', e => {
|
|
599
|
+
const target = e.target;
|
|
688
600
|
if (target.getAttribute('data-mce-object')) {
|
|
689
|
-
|
|
601
|
+
let html = target.getAttribute('data-mce-html');
|
|
690
602
|
if (html) {
|
|
691
603
|
html = unescape(html);
|
|
692
604
|
target.setAttribute('data-mce-html', escape(updateHtml(html, {
|
|
693
605
|
width: String(e.width),
|
|
694
606
|
height: String(e.height)
|
|
695
|
-
})));
|
|
607
|
+
}, false, editor.schema)));
|
|
696
608
|
}
|
|
697
609
|
}
|
|
698
610
|
});
|
|
699
611
|
};
|
|
700
612
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
return new global$3(function (res, rej) {
|
|
706
|
-
var wrappedResolve = function (response) {
|
|
613
|
+
const cache = {};
|
|
614
|
+
const embedPromise = (data, dataToHtml, handler) => {
|
|
615
|
+
return new Promise((res, rej) => {
|
|
616
|
+
const wrappedResolve = response => {
|
|
707
617
|
if (response.html) {
|
|
708
618
|
cache[data.source] = response;
|
|
709
619
|
}
|
|
@@ -715,138 +625,117 @@
|
|
|
715
625
|
if (cache[data.source]) {
|
|
716
626
|
wrappedResolve(cache[data.source]);
|
|
717
627
|
} else {
|
|
718
|
-
handler({ url: data.source }
|
|
628
|
+
handler({ url: data.source }).then(wrappedResolve).catch(rej);
|
|
719
629
|
}
|
|
720
630
|
});
|
|
721
631
|
};
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
return function (data) {
|
|
730
|
-
return dataToHtml(editor, data);
|
|
731
|
-
};
|
|
732
|
-
};
|
|
733
|
-
var getEmbedHtml = function (editor, data) {
|
|
734
|
-
var embedHandler = getUrlResolver(editor);
|
|
632
|
+
const defaultPromise = (data, dataToHtml) => Promise.resolve({
|
|
633
|
+
html: dataToHtml(data),
|
|
634
|
+
url: data.source
|
|
635
|
+
});
|
|
636
|
+
const loadedData = editor => data => dataToHtml(editor, data);
|
|
637
|
+
const getEmbedHtml = (editor, data) => {
|
|
638
|
+
const embedHandler = getUrlResolver(editor);
|
|
735
639
|
return embedHandler ? embedPromise(data, loadedData(editor), embedHandler) : defaultPromise(data, loadedData(editor));
|
|
736
640
|
};
|
|
737
|
-
|
|
738
|
-
return has(cache, url);
|
|
739
|
-
};
|
|
641
|
+
const isCached = url => has(cache, url);
|
|
740
642
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
return get$1(metaData, prop);
|
|
754
|
-
};
|
|
755
|
-
var getNonEmptyValue = function (c) {
|
|
756
|
-
return get$1(c, 'value').bind(function (v) {
|
|
757
|
-
return v.length > 0 ? Optional.some(v) : Optional.none();
|
|
758
|
-
});
|
|
759
|
-
};
|
|
760
|
-
var getFromValueFirst = function () {
|
|
761
|
-
return getFromData().bind(function (child) {
|
|
762
|
-
return isObject(child) ? getNonEmptyValue(child).orThunk(getFromMetaData) : getFromMetaData().orThunk(function () {
|
|
763
|
-
return Optional.from(child);
|
|
764
|
-
});
|
|
765
|
-
});
|
|
766
|
-
};
|
|
767
|
-
var getFromMetaFirst = function () {
|
|
768
|
-
return getFromMetaData().orThunk(function () {
|
|
769
|
-
return getFromData().bind(function (child) {
|
|
770
|
-
return isObject(child) ? getNonEmptyValue(child) : Optional.from(child);
|
|
771
|
-
});
|
|
772
|
-
});
|
|
773
|
-
};
|
|
774
|
-
return _a = {}, _a[prop] = (prop === sourceInput ? getFromValueFirst() : getFromMetaFirst()).getOr(''), _a;
|
|
775
|
-
};
|
|
776
|
-
};
|
|
777
|
-
var getDimensions = function (data, metaData) {
|
|
778
|
-
var dimensions = {};
|
|
779
|
-
get$1(data, 'dimensions').each(function (dims) {
|
|
643
|
+
const extractMeta = (sourceInput, data) => get$1(data, sourceInput).bind(mainData => get$1(mainData, 'meta'));
|
|
644
|
+
const getValue = (data, metaData, sourceInput) => prop => {
|
|
645
|
+
const getFromData = () => get$1(data, prop);
|
|
646
|
+
const getFromMetaData = () => get$1(metaData, prop);
|
|
647
|
+
const getNonEmptyValue = c => get$1(c, 'value').bind(v => v.length > 0 ? Optional.some(v) : Optional.none());
|
|
648
|
+
const getFromValueFirst = () => getFromData().bind(child => isObject(child) ? getNonEmptyValue(child).orThunk(getFromMetaData) : getFromMetaData().orThunk(() => Optional.from(child)));
|
|
649
|
+
const getFromMetaFirst = () => getFromMetaData().orThunk(() => getFromData().bind(child => isObject(child) ? getNonEmptyValue(child) : Optional.from(child)));
|
|
650
|
+
return { [prop]: (prop === sourceInput ? getFromValueFirst() : getFromMetaFirst()).getOr('') };
|
|
651
|
+
};
|
|
652
|
+
const getDimensions = (data, metaData) => {
|
|
653
|
+
const dimensions = {};
|
|
654
|
+
get$1(data, 'dimensions').each(dims => {
|
|
780
655
|
each$1([
|
|
781
656
|
'width',
|
|
782
657
|
'height'
|
|
783
|
-
],
|
|
784
|
-
get$1(metaData, prop).orThunk(
|
|
785
|
-
return get$1(dims, prop);
|
|
786
|
-
}).each(function (value) {
|
|
787
|
-
return dimensions[prop] = value;
|
|
788
|
-
});
|
|
658
|
+
], prop => {
|
|
659
|
+
get$1(metaData, prop).orThunk(() => get$1(dims, prop)).each(value => dimensions[prop] = value);
|
|
789
660
|
});
|
|
790
661
|
});
|
|
791
662
|
return dimensions;
|
|
792
663
|
};
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
return
|
|
664
|
+
const unwrap = (data, sourceInput) => {
|
|
665
|
+
const metaData = sourceInput && sourceInput !== 'dimensions' ? extractMeta(sourceInput, data).getOr({}) : {};
|
|
666
|
+
const get = getValue(data, metaData, sourceInput);
|
|
667
|
+
return {
|
|
668
|
+
...get('source'),
|
|
669
|
+
...get('altsource'),
|
|
670
|
+
...get('poster'),
|
|
671
|
+
...get('embed'),
|
|
672
|
+
...getDimensions(data, metaData)
|
|
673
|
+
};
|
|
797
674
|
};
|
|
798
|
-
|
|
799
|
-
|
|
675
|
+
const wrap = data => {
|
|
676
|
+
const wrapped = {
|
|
677
|
+
...data,
|
|
800
678
|
source: { value: get$1(data, 'source').getOr('') },
|
|
801
679
|
altsource: { value: get$1(data, 'altsource').getOr('') },
|
|
802
680
|
poster: { value: get$1(data, 'poster').getOr('') }
|
|
803
|
-
}
|
|
681
|
+
};
|
|
804
682
|
each$1([
|
|
805
683
|
'width',
|
|
806
684
|
'height'
|
|
807
|
-
],
|
|
808
|
-
get$1(data, prop).each(
|
|
809
|
-
|
|
685
|
+
], prop => {
|
|
686
|
+
get$1(data, prop).each(value => {
|
|
687
|
+
const dimensions = wrapped.dimensions || {};
|
|
810
688
|
dimensions[prop] = value;
|
|
811
689
|
wrapped.dimensions = dimensions;
|
|
812
690
|
});
|
|
813
691
|
});
|
|
814
692
|
return wrapped;
|
|
815
693
|
};
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
});
|
|
823
|
-
};
|
|
824
|
-
};
|
|
825
|
-
var snippetToData = function (editor, embedSnippet) {
|
|
826
|
-
return htmlToData(getScripts(editor), embedSnippet);
|
|
827
|
-
};
|
|
828
|
-
var getEditorData = function (editor) {
|
|
829
|
-
var element = editor.selection.getNode();
|
|
830
|
-
var snippet = isMediaElement(element) ? editor.serializer.serialize(element, { selection: true }) : '';
|
|
831
|
-
return __assign({ embed: snippet }, htmlToData(getScripts(editor), snippet));
|
|
694
|
+
const handleError = editor => error => {
|
|
695
|
+
const errorMessage = error && error.msg ? 'Media embed handler error: ' + error.msg : 'Media embed handler threw unknown error.';
|
|
696
|
+
editor.notificationManager.open({
|
|
697
|
+
type: 'error',
|
|
698
|
+
text: errorMessage
|
|
699
|
+
});
|
|
832
700
|
};
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
701
|
+
const getEditorData = editor => {
|
|
702
|
+
const element = editor.selection.getNode();
|
|
703
|
+
const snippet = isMediaElement(element) ? editor.serializer.serialize(element, { selection: true }) : '';
|
|
704
|
+
const data = htmlToData(snippet, editor.schema);
|
|
705
|
+
const getDimensionsOfElement = () => {
|
|
706
|
+
if (isEmbedIframe(data.source, data.type)) {
|
|
707
|
+
const rect = editor.dom.getRect(element);
|
|
708
|
+
return {
|
|
709
|
+
width: rect.w.toString().replace(/px$/, ''),
|
|
710
|
+
height: rect.h.toString().replace(/px$/, '')
|
|
711
|
+
};
|
|
712
|
+
} else {
|
|
713
|
+
return {};
|
|
843
714
|
}
|
|
844
715
|
};
|
|
716
|
+
const dimensions = getDimensionsOfElement();
|
|
717
|
+
return {
|
|
718
|
+
embed: snippet,
|
|
719
|
+
...data,
|
|
720
|
+
...dimensions
|
|
721
|
+
};
|
|
845
722
|
};
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
723
|
+
const addEmbedHtml = (api, editor) => response => {
|
|
724
|
+
if (isString(response.url) && response.url.trim().length > 0) {
|
|
725
|
+
const html = response.html;
|
|
726
|
+
const snippetData = htmlToData(html, editor.schema);
|
|
727
|
+
const nuData = {
|
|
728
|
+
...snippetData,
|
|
729
|
+
source: response.url,
|
|
730
|
+
embed: html
|
|
731
|
+
};
|
|
732
|
+
api.setData(wrap(nuData));
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
const selectPlaceholder = (editor, beforeObjects) => {
|
|
736
|
+
const afterObjects = editor.dom.select('*[data-mce-object]');
|
|
737
|
+
for (let i = 0; i < beforeObjects.length; i++) {
|
|
738
|
+
for (let y = afterObjects.length - 1; y >= 0; y--) {
|
|
850
739
|
if (beforeObjects[i] === afterObjects[y]) {
|
|
851
740
|
afterObjects.splice(y, 1);
|
|
852
741
|
}
|
|
@@ -854,28 +743,37 @@
|
|
|
854
743
|
}
|
|
855
744
|
editor.selection.select(afterObjects[0]);
|
|
856
745
|
};
|
|
857
|
-
|
|
858
|
-
|
|
746
|
+
const handleInsert = (editor, html) => {
|
|
747
|
+
const beforeObjects = editor.dom.select('*[data-mce-object]');
|
|
859
748
|
editor.insertContent(html);
|
|
860
749
|
selectPlaceholder(editor, beforeObjects);
|
|
861
750
|
editor.nodeChanged();
|
|
862
751
|
};
|
|
863
|
-
|
|
864
|
-
|
|
752
|
+
const isEmbedIframe = (url, mediaDataType) => isNonNullable(mediaDataType) && mediaDataType === 'ephox-embed-iri' && isNonNullable(matchPattern(url));
|
|
753
|
+
const shouldInsertAsNewIframe = (prevData, newData) => {
|
|
754
|
+
const hasDimensionsChanged = (prevData, newData) => prevData.width !== newData.width || prevData.height !== newData.height;
|
|
755
|
+
return hasDimensionsChanged(prevData, newData) && isEmbedIframe(newData.source, prevData.type);
|
|
756
|
+
};
|
|
757
|
+
const submitForm = (prevData, newData, editor) => {
|
|
758
|
+
var _a;
|
|
759
|
+
newData.embed = shouldInsertAsNewIframe(prevData, newData) && hasDimensions(editor) ? dataToHtml(editor, {
|
|
760
|
+
...newData,
|
|
761
|
+
embed: ''
|
|
762
|
+
}) : updateHtml((_a = newData.embed) !== null && _a !== void 0 ? _a : '', newData, false, editor.schema);
|
|
865
763
|
if (newData.embed && (prevData.source === newData.source || isCached(newData.source))) {
|
|
866
764
|
handleInsert(editor, newData.embed);
|
|
867
765
|
} else {
|
|
868
|
-
getEmbedHtml(editor, newData).then(
|
|
766
|
+
getEmbedHtml(editor, newData).then(response => {
|
|
869
767
|
handleInsert(editor, response.html);
|
|
870
768
|
}).catch(handleError(editor));
|
|
871
769
|
}
|
|
872
770
|
};
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
771
|
+
const showDialog = editor => {
|
|
772
|
+
const editorData = getEditorData(editor);
|
|
773
|
+
const currentData = Cell(editorData);
|
|
774
|
+
const initialData = wrap(editorData);
|
|
775
|
+
const handleSource = (prevData, api) => {
|
|
776
|
+
const serviceData = unwrap(api.getData(), 'source');
|
|
879
777
|
if (prevData.source !== serviceData.source) {
|
|
880
778
|
addEmbedHtml(win, editor)({
|
|
881
779
|
url: serviceData.source,
|
|
@@ -884,29 +782,38 @@
|
|
|
884
782
|
getEmbedHtml(editor, serviceData).then(addEmbedHtml(win, editor)).catch(handleError(editor));
|
|
885
783
|
}
|
|
886
784
|
};
|
|
887
|
-
|
|
888
|
-
var
|
|
889
|
-
|
|
785
|
+
const handleEmbed = api => {
|
|
786
|
+
var _a;
|
|
787
|
+
const data = unwrap(api.getData());
|
|
788
|
+
const dataFromEmbed = htmlToData((_a = data.embed) !== null && _a !== void 0 ? _a : '', editor.schema);
|
|
890
789
|
api.setData(wrap(dataFromEmbed));
|
|
891
790
|
};
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
791
|
+
const handleUpdate = (api, sourceInput, prevData) => {
|
|
792
|
+
const dialogData = unwrap(api.getData(), sourceInput);
|
|
793
|
+
const data = shouldInsertAsNewIframe(prevData, dialogData) && hasDimensions(editor) ? {
|
|
794
|
+
...dialogData,
|
|
795
|
+
embed: ''
|
|
796
|
+
} : dialogData;
|
|
797
|
+
const embed = dataToHtml(editor, data);
|
|
798
|
+
api.setData(wrap({
|
|
799
|
+
...data,
|
|
800
|
+
embed
|
|
801
|
+
}));
|
|
896
802
|
};
|
|
897
|
-
|
|
803
|
+
const mediaInput = [{
|
|
898
804
|
name: 'source',
|
|
899
805
|
type: 'urlinput',
|
|
900
806
|
filetype: 'media',
|
|
901
|
-
label: 'Source'
|
|
807
|
+
label: 'Source',
|
|
808
|
+
picker_text: 'Browse files'
|
|
902
809
|
}];
|
|
903
|
-
|
|
810
|
+
const sizeInput = !hasDimensions(editor) ? [] : [{
|
|
904
811
|
type: 'sizeinput',
|
|
905
812
|
name: 'dimensions',
|
|
906
813
|
label: 'Constrain proportions',
|
|
907
814
|
constrain: true
|
|
908
815
|
}];
|
|
909
|
-
|
|
816
|
+
const generalTab = {
|
|
910
817
|
title: 'General',
|
|
911
818
|
name: 'general',
|
|
912
819
|
items: flatten([
|
|
@@ -914,16 +821,16 @@
|
|
|
914
821
|
sizeInput
|
|
915
822
|
])
|
|
916
823
|
};
|
|
917
|
-
|
|
824
|
+
const embedTextarea = {
|
|
918
825
|
type: 'textarea',
|
|
919
826
|
name: 'embed',
|
|
920
827
|
label: 'Paste your embed code below:'
|
|
921
828
|
};
|
|
922
|
-
|
|
829
|
+
const embedTab = {
|
|
923
830
|
title: 'Embed',
|
|
924
831
|
items: [embedTextarea]
|
|
925
832
|
};
|
|
926
|
-
|
|
833
|
+
const advancedFormItems = [];
|
|
927
834
|
if (hasAltSource(editor)) {
|
|
928
835
|
advancedFormItems.push({
|
|
929
836
|
name: 'altsource',
|
|
@@ -940,26 +847,26 @@
|
|
|
940
847
|
label: 'Media poster (Image URL)'
|
|
941
848
|
});
|
|
942
849
|
}
|
|
943
|
-
|
|
850
|
+
const advancedTab = {
|
|
944
851
|
title: 'Advanced',
|
|
945
852
|
name: 'advanced',
|
|
946
853
|
items: advancedFormItems
|
|
947
854
|
};
|
|
948
|
-
|
|
855
|
+
const tabs = [
|
|
949
856
|
generalTab,
|
|
950
857
|
embedTab
|
|
951
858
|
];
|
|
952
859
|
if (advancedFormItems.length > 0) {
|
|
953
860
|
tabs.push(advancedTab);
|
|
954
861
|
}
|
|
955
|
-
|
|
862
|
+
const body = {
|
|
956
863
|
type: 'tabpanel',
|
|
957
|
-
tabs
|
|
864
|
+
tabs
|
|
958
865
|
};
|
|
959
|
-
|
|
866
|
+
const win = editor.windowManager.open({
|
|
960
867
|
title: 'Insert/Edit Media',
|
|
961
868
|
size: 'normal',
|
|
962
|
-
body
|
|
869
|
+
body,
|
|
963
870
|
buttons: [
|
|
964
871
|
{
|
|
965
872
|
type: 'cancel',
|
|
@@ -973,12 +880,12 @@
|
|
|
973
880
|
primary: true
|
|
974
881
|
}
|
|
975
882
|
],
|
|
976
|
-
onSubmit:
|
|
977
|
-
|
|
883
|
+
onSubmit: api => {
|
|
884
|
+
const serviceData = unwrap(api.getData());
|
|
978
885
|
submitForm(currentData.get(), serviceData, editor);
|
|
979
886
|
api.close();
|
|
980
887
|
},
|
|
981
|
-
onChange:
|
|
888
|
+
onChange: (api, detail) => {
|
|
982
889
|
switch (detail.name) {
|
|
983
890
|
case 'source':
|
|
984
891
|
handleSource(currentData.get(), api);
|
|
@@ -989,96 +896,42 @@
|
|
|
989
896
|
case 'dimensions':
|
|
990
897
|
case 'altsource':
|
|
991
898
|
case 'poster':
|
|
992
|
-
handleUpdate(api, detail.name);
|
|
899
|
+
handleUpdate(api, detail.name, currentData.get());
|
|
993
900
|
break;
|
|
994
901
|
}
|
|
995
902
|
currentData.set(unwrap(api.getData()));
|
|
996
903
|
},
|
|
997
|
-
initialData
|
|
904
|
+
initialData
|
|
998
905
|
});
|
|
999
906
|
};
|
|
1000
907
|
|
|
1001
|
-
|
|
1002
|
-
|
|
908
|
+
const get = editor => {
|
|
909
|
+
const showDialog$1 = () => {
|
|
1003
910
|
showDialog(editor);
|
|
1004
911
|
};
|
|
1005
912
|
return { showDialog: showDialog$1 };
|
|
1006
913
|
};
|
|
1007
914
|
|
|
1008
|
-
|
|
1009
|
-
|
|
915
|
+
const register$1 = editor => {
|
|
916
|
+
const showDialog$1 = () => {
|
|
1010
917
|
showDialog(editor);
|
|
1011
918
|
};
|
|
1012
919
|
editor.addCommand('mceMedia', showDialog$1);
|
|
1013
920
|
};
|
|
1014
921
|
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
var global = tinymce.util.Tools.resolve('tinymce.html.DomParser');
|
|
1020
|
-
|
|
1021
|
-
var sanitize = function (editor, html) {
|
|
1022
|
-
if (shouldFilterHtml(editor) === false) {
|
|
1023
|
-
return html;
|
|
1024
|
-
}
|
|
1025
|
-
var writer = global$4();
|
|
1026
|
-
var blocked;
|
|
1027
|
-
global$6({
|
|
1028
|
-
validate: false,
|
|
1029
|
-
allow_conditional_comments: false,
|
|
1030
|
-
comment: function (text) {
|
|
1031
|
-
if (!blocked) {
|
|
1032
|
-
writer.comment(text);
|
|
1033
|
-
}
|
|
1034
|
-
},
|
|
1035
|
-
cdata: function (text) {
|
|
1036
|
-
if (!blocked) {
|
|
1037
|
-
writer.cdata(text);
|
|
1038
|
-
}
|
|
1039
|
-
},
|
|
1040
|
-
text: function (text, raw) {
|
|
1041
|
-
if (!blocked) {
|
|
1042
|
-
writer.text(text, raw);
|
|
1043
|
-
}
|
|
1044
|
-
},
|
|
1045
|
-
start: function (name, attrs, empty) {
|
|
1046
|
-
blocked = true;
|
|
1047
|
-
if (name === 'script' || name === 'noscript' || name === 'svg') {
|
|
1048
|
-
return;
|
|
1049
|
-
}
|
|
1050
|
-
for (var i = attrs.length - 1; i >= 0; i--) {
|
|
1051
|
-
var attrName = attrs[i].name;
|
|
1052
|
-
if (attrName.indexOf('on') === 0) {
|
|
1053
|
-
delete attrs.map[attrName];
|
|
1054
|
-
attrs.splice(i, 1);
|
|
1055
|
-
}
|
|
1056
|
-
if (attrName === 'style') {
|
|
1057
|
-
attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name);
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
writer.start(name, attrs, empty);
|
|
1061
|
-
blocked = false;
|
|
1062
|
-
},
|
|
1063
|
-
end: function (name) {
|
|
1064
|
-
if (blocked) {
|
|
1065
|
-
return;
|
|
1066
|
-
}
|
|
1067
|
-
writer.end(name);
|
|
1068
|
-
}
|
|
1069
|
-
}, global$5({})).parse(html);
|
|
1070
|
-
return writer.getContent();
|
|
922
|
+
const checkRange = (str, substr, start) => substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;
|
|
923
|
+
const startsWith = (str, prefix) => {
|
|
924
|
+
return checkRange(str, prefix, 0);
|
|
1071
925
|
};
|
|
1072
926
|
|
|
1073
|
-
var
|
|
1074
|
-
|
|
927
|
+
var global = tinymce.util.Tools.resolve('tinymce.Env');
|
|
928
|
+
|
|
929
|
+
const isLiveEmbedNode = node => {
|
|
930
|
+
const name = node.name;
|
|
1075
931
|
return name === 'iframe' || name === 'video' || name === 'audio';
|
|
1076
932
|
};
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
defaultValue = null;
|
|
1080
|
-
}
|
|
1081
|
-
var value = node.attr(dimension);
|
|
933
|
+
const getDimension = (node, styles, dimension, defaultValue = null) => {
|
|
934
|
+
const value = node.attr(dimension);
|
|
1082
935
|
if (isNonNullable(value)) {
|
|
1083
936
|
return value;
|
|
1084
937
|
} else if (!has(styles, dimension)) {
|
|
@@ -1087,42 +940,39 @@
|
|
|
1087
940
|
return null;
|
|
1088
941
|
}
|
|
1089
942
|
};
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
943
|
+
const setDimensions = (node, previewNode, styles) => {
|
|
944
|
+
const useDefaults = previewNode.name === 'img' || node.name === 'video';
|
|
945
|
+
const defaultWidth = useDefaults ? '300' : null;
|
|
946
|
+
const fallbackHeight = node.name === 'audio' ? '30' : '150';
|
|
947
|
+
const defaultHeight = useDefaults ? fallbackHeight : null;
|
|
1095
948
|
previewNode.attr({
|
|
1096
949
|
width: getDimension(node, styles, 'width', defaultWidth),
|
|
1097
950
|
height: getDimension(node, styles, 'height', defaultHeight)
|
|
1098
951
|
});
|
|
1099
952
|
};
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
forced_root_block: false,
|
|
1103
|
-
validate: false
|
|
1104
|
-
}, editor.schema).parse(html, { context: nodeName });
|
|
953
|
+
const appendNodeContent = (editor, nodeName, previewNode, html) => {
|
|
954
|
+
const newNode = Parser(editor.schema).parse(html, { context: nodeName });
|
|
1105
955
|
while (newNode.firstChild) {
|
|
1106
956
|
previewNode.append(newNode.firstChild);
|
|
1107
957
|
}
|
|
1108
958
|
};
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
placeHolder.shortEnded = true;
|
|
959
|
+
const createPlaceholderNode = (editor, node) => {
|
|
960
|
+
const name = node.name;
|
|
961
|
+
const placeHolder = new global$2('img', 1);
|
|
1113
962
|
retainAttributesAndInnerHtml(editor, node, placeHolder);
|
|
1114
963
|
setDimensions(node, placeHolder, {});
|
|
1115
964
|
placeHolder.attr({
|
|
1116
965
|
'style': node.attr('style'),
|
|
1117
|
-
'src': global
|
|
966
|
+
'src': global.transparentSrc,
|
|
1118
967
|
'data-mce-object': name,
|
|
1119
968
|
'class': 'mce-object mce-object-' + name
|
|
1120
969
|
});
|
|
1121
970
|
return placeHolder;
|
|
1122
971
|
};
|
|
1123
|
-
|
|
1124
|
-
var
|
|
1125
|
-
|
|
972
|
+
const createPreviewNode = (editor, node) => {
|
|
973
|
+
var _a;
|
|
974
|
+
const name = node.name;
|
|
975
|
+
const previewWrapper = new global$2('span', 1);
|
|
1126
976
|
previewWrapper.attr({
|
|
1127
977
|
'contentEditable': 'false',
|
|
1128
978
|
'style': node.attr('style'),
|
|
@@ -1130,8 +980,8 @@
|
|
|
1130
980
|
'class': 'mce-preview-object mce-object-' + name
|
|
1131
981
|
});
|
|
1132
982
|
retainAttributesAndInnerHtml(editor, node, previewWrapper);
|
|
1133
|
-
|
|
1134
|
-
|
|
983
|
+
const styles = editor.dom.parseStyle((_a = node.attr('style')) !== null && _a !== void 0 ? _a : '');
|
|
984
|
+
const previewNode = new global$2(name, 1);
|
|
1135
985
|
setDimensions(node, previewNode, styles);
|
|
1136
986
|
previewNode.attr({
|
|
1137
987
|
src: node.attr('src'),
|
|
@@ -1141,10 +991,11 @@
|
|
|
1141
991
|
if (name === 'iframe') {
|
|
1142
992
|
previewNode.attr({
|
|
1143
993
|
allowfullscreen: node.attr('allowfullscreen'),
|
|
1144
|
-
frameborder: '0'
|
|
994
|
+
frameborder: '0',
|
|
995
|
+
sandbox: node.attr('sandbox')
|
|
1145
996
|
});
|
|
1146
997
|
} else {
|
|
1147
|
-
|
|
998
|
+
const attrs = [
|
|
1148
999
|
'controls',
|
|
1149
1000
|
'crossorigin',
|
|
1150
1001
|
'currentTime',
|
|
@@ -1153,122 +1004,119 @@
|
|
|
1153
1004
|
'poster',
|
|
1154
1005
|
'preload'
|
|
1155
1006
|
];
|
|
1156
|
-
each$1(attrs,
|
|
1007
|
+
each$1(attrs, attrName => {
|
|
1157
1008
|
previewNode.attr(attrName, node.attr(attrName));
|
|
1158
1009
|
});
|
|
1159
|
-
|
|
1010
|
+
const sanitizedHtml = previewWrapper.attr('data-mce-html');
|
|
1160
1011
|
if (isNonNullable(sanitizedHtml)) {
|
|
1161
1012
|
appendNodeContent(editor, name, previewNode, unescape(sanitizedHtml));
|
|
1162
1013
|
}
|
|
1163
1014
|
}
|
|
1164
|
-
|
|
1015
|
+
const shimNode = new global$2('span', 1);
|
|
1165
1016
|
shimNode.attr('class', 'mce-shim');
|
|
1166
1017
|
previewWrapper.append(previewNode);
|
|
1167
1018
|
previewWrapper.append(shimNode);
|
|
1168
1019
|
return previewWrapper;
|
|
1169
1020
|
};
|
|
1170
|
-
|
|
1171
|
-
var
|
|
1172
|
-
|
|
1021
|
+
const retainAttributesAndInnerHtml = (editor, sourceNode, targetNode) => {
|
|
1022
|
+
var _a;
|
|
1023
|
+
const attribs = (_a = sourceNode.attributes) !== null && _a !== void 0 ? _a : [];
|
|
1024
|
+
let ai = attribs.length;
|
|
1173
1025
|
while (ai--) {
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
if (attrName !== 'width' && attrName !== 'height' && attrName !== 'style') {
|
|
1026
|
+
const attrName = attribs[ai].name;
|
|
1027
|
+
let attrValue = attribs[ai].value;
|
|
1028
|
+
if (attrName !== 'width' && attrName !== 'height' && attrName !== 'style' && !startsWith(attrName, 'data-mce-')) {
|
|
1177
1029
|
if (attrName === 'data' || attrName === 'src') {
|
|
1178
1030
|
attrValue = editor.convertURL(attrValue, attrName);
|
|
1179
1031
|
}
|
|
1180
1032
|
targetNode.attr('data-mce-p-' + attrName, attrValue);
|
|
1181
1033
|
}
|
|
1182
1034
|
}
|
|
1183
|
-
|
|
1035
|
+
const serializer = global$1({ inner: true }, editor.schema);
|
|
1036
|
+
const tempNode = new global$2('div', 1);
|
|
1037
|
+
each$1(sourceNode.children(), child => tempNode.append(child));
|
|
1038
|
+
const innerHtml = serializer.serialize(tempNode);
|
|
1184
1039
|
if (innerHtml) {
|
|
1185
|
-
targetNode.attr('data-mce-html', escape(
|
|
1186
|
-
targetNode.
|
|
1040
|
+
targetNode.attr('data-mce-html', escape(innerHtml));
|
|
1041
|
+
targetNode.empty();
|
|
1187
1042
|
}
|
|
1188
1043
|
};
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
return nodeClass && /\btiny-pageembed\b/.test(nodeClass);
|
|
1044
|
+
const isPageEmbedWrapper = node => {
|
|
1045
|
+
const nodeClass = node.attr('class');
|
|
1046
|
+
return isString(nodeClass) && /\btiny-pageembed\b/.test(nodeClass);
|
|
1192
1047
|
};
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1048
|
+
const isWithinEmbedWrapper = node => {
|
|
1049
|
+
let tempNode = node;
|
|
1050
|
+
while (tempNode = tempNode.parent) {
|
|
1051
|
+
if (tempNode.attr('data-ephox-embed-iri') || isPageEmbedWrapper(tempNode)) {
|
|
1196
1052
|
return true;
|
|
1197
1053
|
}
|
|
1198
1054
|
}
|
|
1199
1055
|
return false;
|
|
1200
1056
|
};
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
videoScript = getVideoScriptMatch(getScripts(editor), node.attr('src'));
|
|
1216
|
-
if (!videoScript) {
|
|
1217
|
-
continue;
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
if (videoScript) {
|
|
1221
|
-
if (videoScript.width) {
|
|
1222
|
-
node.attr('width', videoScript.width.toString());
|
|
1223
|
-
}
|
|
1224
|
-
if (videoScript.height) {
|
|
1225
|
-
node.attr('height', videoScript.height.toString());
|
|
1226
|
-
}
|
|
1057
|
+
const placeHolderConverter = editor => nodes => {
|
|
1058
|
+
let i = nodes.length;
|
|
1059
|
+
let node;
|
|
1060
|
+
while (i--) {
|
|
1061
|
+
node = nodes[i];
|
|
1062
|
+
if (!node.parent) {
|
|
1063
|
+
continue;
|
|
1064
|
+
}
|
|
1065
|
+
if (node.parent.attr('data-mce-object')) {
|
|
1066
|
+
continue;
|
|
1067
|
+
}
|
|
1068
|
+
if (isLiveEmbedNode(node) && hasLiveEmbeds(editor)) {
|
|
1069
|
+
if (!isWithinEmbedWrapper(node)) {
|
|
1070
|
+
node.replace(createPreviewNode(editor, node));
|
|
1227
1071
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
}
|
|
1232
|
-
} else {
|
|
1233
|
-
if (!isWithinEmbedWrapper(node)) {
|
|
1234
|
-
node.replace(createPlaceholderNode(editor, node));
|
|
1235
|
-
}
|
|
1072
|
+
} else {
|
|
1073
|
+
if (!isWithinEmbedWrapper(node)) {
|
|
1074
|
+
node.replace(createPlaceholderNode(editor, node));
|
|
1236
1075
|
}
|
|
1237
1076
|
}
|
|
1238
|
-
}
|
|
1077
|
+
}
|
|
1239
1078
|
};
|
|
1240
1079
|
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1080
|
+
const parseAndSanitize = (editor, context, html) => {
|
|
1081
|
+
const getEditorOption = editor.options.get;
|
|
1082
|
+
const sanitize = getEditorOption('xss_sanitization');
|
|
1083
|
+
const validate = shouldFilterHtml(editor);
|
|
1084
|
+
return Parser(editor.schema, {
|
|
1085
|
+
sanitize,
|
|
1086
|
+
validate
|
|
1087
|
+
}).parse(html, { context });
|
|
1088
|
+
};
|
|
1089
|
+
|
|
1090
|
+
const setup$1 = editor => {
|
|
1091
|
+
editor.on('PreInit', () => {
|
|
1092
|
+
const {schema, serializer, parser} = editor;
|
|
1093
|
+
const boolAttrs = schema.getBoolAttrs();
|
|
1094
|
+
each$1('webkitallowfullscreen mozallowfullscreen'.split(' '), name => {
|
|
1249
1095
|
boolAttrs[name] = {};
|
|
1250
1096
|
});
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1097
|
+
each({ embed: ['wmode'] }, (attrs, name) => {
|
|
1098
|
+
const rule = schema.getElementRule(name);
|
|
1099
|
+
if (rule) {
|
|
1100
|
+
each$1(attrs, attr => {
|
|
1101
|
+
rule.attributes[attr] = {};
|
|
1102
|
+
rule.attributesOrder.push(attr);
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
});
|
|
1106
|
+
parser.addNodeFilter('iframe,video,audio,object,embed', placeHolderConverter(editor));
|
|
1107
|
+
serializer.addAttributeFilter('data-mce-object', (nodes, name) => {
|
|
1108
|
+
var _a;
|
|
1109
|
+
let i = nodes.length;
|
|
1262
1110
|
while (i--) {
|
|
1263
|
-
node = nodes[i];
|
|
1111
|
+
const node = nodes[i];
|
|
1264
1112
|
if (!node.parent) {
|
|
1265
1113
|
continue;
|
|
1266
1114
|
}
|
|
1267
|
-
realElmName = node.attr(name);
|
|
1268
|
-
realElm = new global$2(realElmName, 1);
|
|
1269
|
-
if (realElmName !== 'audio'
|
|
1270
|
-
className = node.attr('class');
|
|
1271
|
-
if (className && className.indexOf('mce-preview-object') !== -1) {
|
|
1115
|
+
const realElmName = node.attr(name);
|
|
1116
|
+
const realElm = new global$2(realElmName, 1);
|
|
1117
|
+
if (realElmName !== 'audio') {
|
|
1118
|
+
const className = node.attr('class');
|
|
1119
|
+
if (className && className.indexOf('mce-preview-object') !== -1 && node.firstChild) {
|
|
1272
1120
|
realElm.attr({
|
|
1273
1121
|
width: node.firstChild.attr('width'),
|
|
1274
1122
|
height: node.firstChild.attr('height')
|
|
@@ -1281,70 +1129,80 @@
|
|
|
1281
1129
|
}
|
|
1282
1130
|
}
|
|
1283
1131
|
realElm.attr({ style: node.attr('style') });
|
|
1284
|
-
attribs = node.attributes;
|
|
1285
|
-
ai = attribs.length;
|
|
1132
|
+
const attribs = (_a = node.attributes) !== null && _a !== void 0 ? _a : [];
|
|
1133
|
+
let ai = attribs.length;
|
|
1286
1134
|
while (ai--) {
|
|
1287
|
-
|
|
1135
|
+
const attrName = attribs[ai].name;
|
|
1288
1136
|
if (attrName.indexOf('data-mce-p-') === 0) {
|
|
1289
1137
|
realElm.attr(attrName.substr(11), attribs[ai].value);
|
|
1290
1138
|
}
|
|
1291
1139
|
}
|
|
1292
|
-
|
|
1293
|
-
realElm.attr('type', 'text/javascript');
|
|
1294
|
-
}
|
|
1295
|
-
innerHtml = node.attr('data-mce-html');
|
|
1140
|
+
const innerHtml = node.attr('data-mce-html');
|
|
1296
1141
|
if (innerHtml) {
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
innerNode.value = sanitize(editor, unescape(innerHtml));
|
|
1300
|
-
realElm.append(innerNode);
|
|
1142
|
+
const fragment = parseAndSanitize(editor, realElmName, unescape(innerHtml));
|
|
1143
|
+
each$1(fragment.children(), child => realElm.append(child));
|
|
1301
1144
|
}
|
|
1302
1145
|
node.replace(realElm);
|
|
1303
1146
|
}
|
|
1304
1147
|
});
|
|
1305
1148
|
});
|
|
1306
|
-
editor.on('SetContent',
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
if (
|
|
1310
|
-
|
|
1149
|
+
editor.on('SetContent', () => {
|
|
1150
|
+
const dom = editor.dom;
|
|
1151
|
+
each$1(dom.select('span.mce-preview-object'), elm => {
|
|
1152
|
+
if (dom.select('span.mce-shim', elm).length === 0) {
|
|
1153
|
+
dom.add(elm, 'span', { class: 'mce-shim' });
|
|
1311
1154
|
}
|
|
1312
1155
|
});
|
|
1313
1156
|
});
|
|
1314
1157
|
};
|
|
1315
1158
|
|
|
1316
|
-
|
|
1317
|
-
editor.on('ResolveName',
|
|
1318
|
-
|
|
1159
|
+
const setup = editor => {
|
|
1160
|
+
editor.on('ResolveName', e => {
|
|
1161
|
+
let name;
|
|
1319
1162
|
if (e.target.nodeType === 1 && (name = e.target.getAttribute('data-mce-object'))) {
|
|
1320
1163
|
e.name = name;
|
|
1321
1164
|
}
|
|
1322
1165
|
});
|
|
1323
1166
|
};
|
|
1324
1167
|
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1168
|
+
const onSetupEditable = editor => api => {
|
|
1169
|
+
const nodeChanged = () => {
|
|
1170
|
+
api.setEnabled(editor.selection.isEditable());
|
|
1171
|
+
};
|
|
1172
|
+
editor.on('NodeChange', nodeChanged);
|
|
1173
|
+
nodeChanged();
|
|
1174
|
+
return () => {
|
|
1175
|
+
editor.off('NodeChange', nodeChanged);
|
|
1328
1176
|
};
|
|
1177
|
+
};
|
|
1178
|
+
const register = editor => {
|
|
1179
|
+
const onAction = () => editor.execCommand('mceMedia');
|
|
1329
1180
|
editor.ui.registry.addToggleButton('media', {
|
|
1330
1181
|
tooltip: 'Insert/edit media',
|
|
1331
1182
|
icon: 'embed',
|
|
1332
|
-
onAction
|
|
1333
|
-
onSetup:
|
|
1334
|
-
|
|
1183
|
+
onAction,
|
|
1184
|
+
onSetup: buttonApi => {
|
|
1185
|
+
const selection = editor.selection;
|
|
1335
1186
|
buttonApi.setActive(isMediaElement(selection.getNode()));
|
|
1336
|
-
|
|
1187
|
+
const unbindSelectorChanged = selection.selectorChangedWithUnbind('img[data-mce-object],span[data-mce-object],div[data-ephox-embed-iri]', buttonApi.setActive).unbind;
|
|
1188
|
+
const unbindEditable = onSetupEditable(editor)(buttonApi);
|
|
1189
|
+
return () => {
|
|
1190
|
+
unbindSelectorChanged();
|
|
1191
|
+
unbindEditable();
|
|
1192
|
+
};
|
|
1337
1193
|
}
|
|
1338
1194
|
});
|
|
1339
1195
|
editor.ui.registry.addMenuItem('media', {
|
|
1340
1196
|
icon: 'embed',
|
|
1341
1197
|
text: 'Media...',
|
|
1342
|
-
onAction
|
|
1198
|
+
onAction,
|
|
1199
|
+
onSetup: onSetupEditable(editor)
|
|
1343
1200
|
});
|
|
1344
1201
|
};
|
|
1345
1202
|
|
|
1346
|
-
|
|
1347
|
-
global$
|
|
1203
|
+
var Plugin = () => {
|
|
1204
|
+
global$6.add('media', editor => {
|
|
1205
|
+
register$2(editor);
|
|
1348
1206
|
register$1(editor);
|
|
1349
1207
|
register(editor);
|
|
1350
1208
|
setup(editor);
|
|
@@ -1352,8 +1210,8 @@
|
|
|
1352
1210
|
setup$2(editor);
|
|
1353
1211
|
return get(editor);
|
|
1354
1212
|
});
|
|
1355
|
-
}
|
|
1213
|
+
};
|
|
1356
1214
|
|
|
1357
1215
|
Plugin();
|
|
1358
1216
|
|
|
1359
|
-
}()
|
|
1217
|
+
})();
|