@dangl/angular-material-shared 2.5.1-beta0006 → 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 +6 -25
- package/esm2022/lib/components/footer/footer.component.mjs +12 -7
- package/esm2022/lib/components/header/header.component.mjs +18 -10
- package/esm2022/lib/components/tiny-mce/tiny-mce.component.mjs +18 -21
- package/fesm2022/dangl-angular-material-shared.mjs +45 -55
- package/fesm2022/dangl-angular-material-shared.mjs.map +1 -1
- package/lib/angular-material-shared.module.d.ts +5 -9
- package/lib/components/footer/footer.component.d.ts +1 -1
- package/lib/components/header/header.component.d.ts +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,1803 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
|
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)
|
|
8
|
-
*/
|
|
9
|
-
(function () {
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
var Cell = function (initial) {
|
|
13
|
-
var value = initial;
|
|
14
|
-
var get = function () {
|
|
15
|
-
return value;
|
|
16
|
-
};
|
|
17
|
-
var set = function (v) {
|
|
18
|
-
value = v;
|
|
19
|
-
};
|
|
20
|
-
return {
|
|
21
|
-
get: get,
|
|
22
|
-
set: set
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
var global$b = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
27
|
-
|
|
28
|
-
var hasProPlugin = function (editor) {
|
|
29
|
-
if (editor.hasPlugin('powerpaste', true)) {
|
|
30
|
-
if (typeof window.console !== 'undefined' && window.console.log) {
|
|
31
|
-
window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.');
|
|
32
|
-
}
|
|
33
|
-
return true;
|
|
34
|
-
} else {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
var get = function (clipboard) {
|
|
40
|
-
return { clipboard: clipboard };
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
var typeOf = function (x) {
|
|
44
|
-
var t = typeof x;
|
|
45
|
-
if (x === null) {
|
|
46
|
-
return 'null';
|
|
47
|
-
} else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
|
|
48
|
-
return 'array';
|
|
49
|
-
} else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
|
|
50
|
-
return 'string';
|
|
51
|
-
} else {
|
|
52
|
-
return t;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
var isType = function (type) {
|
|
56
|
-
return function (value) {
|
|
57
|
-
return typeOf(value) === type;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
var isSimpleType = function (type) {
|
|
61
|
-
return function (value) {
|
|
62
|
-
return typeof value === type;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
var isArray = isType('array');
|
|
66
|
-
var isNullable = function (a) {
|
|
67
|
-
return a === null || a === undefined;
|
|
68
|
-
};
|
|
69
|
-
var isNonNullable = function (a) {
|
|
70
|
-
return !isNullable(a);
|
|
71
|
-
};
|
|
72
|
-
var isFunction = isSimpleType('function');
|
|
73
|
-
|
|
74
|
-
var noop = function () {
|
|
75
|
-
};
|
|
76
|
-
var constant = function (value) {
|
|
77
|
-
return function () {
|
|
78
|
-
return value;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
var identity = function (x) {
|
|
82
|
-
return x;
|
|
83
|
-
};
|
|
84
|
-
var never = constant(false);
|
|
85
|
-
var always = constant(true);
|
|
86
|
-
|
|
87
|
-
var none = function () {
|
|
88
|
-
return NONE;
|
|
89
|
-
};
|
|
90
|
-
var NONE = function () {
|
|
91
|
-
var call = function (thunk) {
|
|
92
|
-
return thunk();
|
|
93
|
-
};
|
|
94
|
-
var id = identity;
|
|
95
|
-
var me = {
|
|
96
|
-
fold: function (n, _s) {
|
|
97
|
-
return n();
|
|
98
|
-
},
|
|
99
|
-
isSome: never,
|
|
100
|
-
isNone: always,
|
|
101
|
-
getOr: id,
|
|
102
|
-
getOrThunk: call,
|
|
103
|
-
getOrDie: function (msg) {
|
|
104
|
-
throw new Error(msg || 'error: getOrDie called on none.');
|
|
105
|
-
},
|
|
106
|
-
getOrNull: constant(null),
|
|
107
|
-
getOrUndefined: constant(undefined),
|
|
108
|
-
or: id,
|
|
109
|
-
orThunk: call,
|
|
110
|
-
map: none,
|
|
111
|
-
each: noop,
|
|
112
|
-
bind: none,
|
|
113
|
-
exists: never,
|
|
114
|
-
forall: always,
|
|
115
|
-
filter: function () {
|
|
116
|
-
return none();
|
|
117
|
-
},
|
|
118
|
-
toArray: function () {
|
|
119
|
-
return [];
|
|
120
|
-
},
|
|
121
|
-
toString: constant('none()')
|
|
122
|
-
};
|
|
123
|
-
return me;
|
|
124
|
-
}();
|
|
125
|
-
var some = function (a) {
|
|
126
|
-
var constant_a = constant(a);
|
|
127
|
-
var self = function () {
|
|
128
|
-
return me;
|
|
129
|
-
};
|
|
130
|
-
var bind = function (f) {
|
|
131
|
-
return f(a);
|
|
132
|
-
};
|
|
133
|
-
var me = {
|
|
134
|
-
fold: function (n, s) {
|
|
135
|
-
return s(a);
|
|
136
|
-
},
|
|
137
|
-
isSome: always,
|
|
138
|
-
isNone: never,
|
|
139
|
-
getOr: constant_a,
|
|
140
|
-
getOrThunk: constant_a,
|
|
141
|
-
getOrDie: constant_a,
|
|
142
|
-
getOrNull: constant_a,
|
|
143
|
-
getOrUndefined: constant_a,
|
|
144
|
-
or: self,
|
|
145
|
-
orThunk: self,
|
|
146
|
-
map: function (f) {
|
|
147
|
-
return some(f(a));
|
|
148
|
-
},
|
|
149
|
-
each: function (f) {
|
|
150
|
-
f(a);
|
|
151
|
-
},
|
|
152
|
-
bind: bind,
|
|
153
|
-
exists: bind,
|
|
154
|
-
forall: bind,
|
|
155
|
-
filter: function (f) {
|
|
156
|
-
return f(a) ? me : NONE;
|
|
157
|
-
},
|
|
158
|
-
toArray: function () {
|
|
159
|
-
return [a];
|
|
160
|
-
},
|
|
161
|
-
toString: function () {
|
|
162
|
-
return 'some(' + a + ')';
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
return me;
|
|
166
|
-
};
|
|
167
|
-
var from$1 = function (value) {
|
|
168
|
-
return value === null || value === undefined ? NONE : some(value);
|
|
169
|
-
};
|
|
170
|
-
var Optional = {
|
|
171
|
-
some: some,
|
|
172
|
-
none: none,
|
|
173
|
-
from: from$1
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
var nativeSlice = Array.prototype.slice;
|
|
177
|
-
var nativePush = Array.prototype.push;
|
|
178
|
-
var exists = function (xs, pred) {
|
|
179
|
-
for (var i = 0, len = xs.length; i < len; i++) {
|
|
180
|
-
var x = xs[i];
|
|
181
|
-
if (pred(x, i)) {
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return false;
|
|
186
|
-
};
|
|
187
|
-
var map = function (xs, f) {
|
|
188
|
-
var len = xs.length;
|
|
189
|
-
var r = new Array(len);
|
|
190
|
-
for (var i = 0; i < len; i++) {
|
|
191
|
-
var x = xs[i];
|
|
192
|
-
r[i] = f(x, i);
|
|
193
|
-
}
|
|
194
|
-
return r;
|
|
195
|
-
};
|
|
196
|
-
var each = function (xs, f) {
|
|
197
|
-
for (var i = 0, len = xs.length; i < len; i++) {
|
|
198
|
-
var x = xs[i];
|
|
199
|
-
f(x, i);
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
var filter$1 = function (xs, pred) {
|
|
203
|
-
var r = [];
|
|
204
|
-
for (var i = 0, len = xs.length; i < len; i++) {
|
|
205
|
-
var x = xs[i];
|
|
206
|
-
if (pred(x, i)) {
|
|
207
|
-
r.push(x);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
return r;
|
|
211
|
-
};
|
|
212
|
-
var foldl = function (xs, f, acc) {
|
|
213
|
-
each(xs, function (x, i) {
|
|
214
|
-
acc = f(acc, x, i);
|
|
215
|
-
});
|
|
216
|
-
return acc;
|
|
217
|
-
};
|
|
218
|
-
var flatten = function (xs) {
|
|
219
|
-
var r = [];
|
|
220
|
-
for (var i = 0, len = xs.length; i < len; ++i) {
|
|
221
|
-
if (!isArray(xs[i])) {
|
|
222
|
-
throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
|
|
223
|
-
}
|
|
224
|
-
nativePush.apply(r, xs[i]);
|
|
225
|
-
}
|
|
226
|
-
return r;
|
|
227
|
-
};
|
|
228
|
-
var bind = function (xs, f) {
|
|
229
|
-
return flatten(map(xs, f));
|
|
230
|
-
};
|
|
231
|
-
var from = isFunction(Array.from) ? Array.from : function (x) {
|
|
232
|
-
return nativeSlice.call(x);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
var __assign = function () {
|
|
236
|
-
__assign = Object.assign || function __assign(t) {
|
|
237
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
238
|
-
s = arguments[i];
|
|
239
|
-
for (var p in s)
|
|
240
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
241
|
-
t[p] = s[p];
|
|
242
|
-
}
|
|
243
|
-
return t;
|
|
244
|
-
};
|
|
245
|
-
return __assign.apply(this, arguments);
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
var singleton = function (doRevoke) {
|
|
249
|
-
var subject = Cell(Optional.none());
|
|
250
|
-
var revoke = function () {
|
|
251
|
-
return subject.get().each(doRevoke);
|
|
252
|
-
};
|
|
253
|
-
var clear = function () {
|
|
254
|
-
revoke();
|
|
255
|
-
subject.set(Optional.none());
|
|
256
|
-
};
|
|
257
|
-
var isSet = function () {
|
|
258
|
-
return subject.get().isSome();
|
|
259
|
-
};
|
|
260
|
-
var get = function () {
|
|
261
|
-
return subject.get();
|
|
262
|
-
};
|
|
263
|
-
var set = function (s) {
|
|
264
|
-
revoke();
|
|
265
|
-
subject.set(Optional.some(s));
|
|
266
|
-
};
|
|
267
|
-
return {
|
|
268
|
-
clear: clear,
|
|
269
|
-
isSet: isSet,
|
|
270
|
-
get: get,
|
|
271
|
-
set: set
|
|
272
|
-
};
|
|
273
|
-
};
|
|
274
|
-
var value = function () {
|
|
275
|
-
var subject = singleton(noop);
|
|
276
|
-
var on = function (f) {
|
|
277
|
-
return subject.get().each(f);
|
|
278
|
-
};
|
|
279
|
-
return __assign(__assign({}, subject), { on: on });
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
var checkRange = function (str, substr, start) {
|
|
283
|
-
return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;
|
|
284
|
-
};
|
|
285
|
-
var startsWith = function (str, prefix) {
|
|
286
|
-
return checkRange(str, prefix, 0);
|
|
287
|
-
};
|
|
288
|
-
var endsWith = function (str, suffix) {
|
|
289
|
-
return checkRange(str, suffix, str.length - suffix.length);
|
|
290
|
-
};
|
|
291
|
-
var repeat = function (s, count) {
|
|
292
|
-
return count <= 0 ? '' : new Array(count + 1).join(s);
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
var global$a = tinymce.util.Tools.resolve('tinymce.Env');
|
|
296
|
-
|
|
297
|
-
var global$9 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
|
298
|
-
|
|
299
|
-
var global$8 = tinymce.util.Tools.resolve('tinymce.util.Promise');
|
|
300
|
-
|
|
301
|
-
var global$7 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
|
302
|
-
|
|
303
|
-
var firePastePreProcess = function (editor, html, internal, isWordHtml) {
|
|
304
|
-
return editor.fire('PastePreProcess', {
|
|
305
|
-
content: html,
|
|
306
|
-
internal: internal,
|
|
307
|
-
wordContent: isWordHtml
|
|
308
|
-
});
|
|
309
|
-
};
|
|
310
|
-
var firePastePostProcess = function (editor, node, internal, isWordHtml) {
|
|
311
|
-
return editor.fire('PastePostProcess', {
|
|
312
|
-
node: node,
|
|
313
|
-
internal: internal,
|
|
314
|
-
wordContent: isWordHtml
|
|
315
|
-
});
|
|
316
|
-
};
|
|
317
|
-
var firePastePlainTextToggle = function (editor, state) {
|
|
318
|
-
return editor.fire('PastePlainTextToggle', { state: state });
|
|
319
|
-
};
|
|
320
|
-
var firePaste = function (editor, ieFake) {
|
|
321
|
-
return editor.fire('paste', { ieFake: ieFake });
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
var global$6 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
325
|
-
|
|
326
|
-
var shouldBlockDrop = function (editor) {
|
|
327
|
-
return editor.getParam('paste_block_drop', false);
|
|
328
|
-
};
|
|
329
|
-
var shouldPasteDataImages = function (editor) {
|
|
330
|
-
return editor.getParam('paste_data_images', false);
|
|
331
|
-
};
|
|
332
|
-
var shouldFilterDrop = function (editor) {
|
|
333
|
-
return editor.getParam('paste_filter_drop', true);
|
|
334
|
-
};
|
|
335
|
-
var getPreProcess = function (editor) {
|
|
336
|
-
return editor.getParam('paste_preprocess');
|
|
337
|
-
};
|
|
338
|
-
var getPostProcess = function (editor) {
|
|
339
|
-
return editor.getParam('paste_postprocess');
|
|
340
|
-
};
|
|
341
|
-
var getWebkitStyles = function (editor) {
|
|
342
|
-
return editor.getParam('paste_webkit_styles');
|
|
343
|
-
};
|
|
344
|
-
var shouldRemoveWebKitStyles = function (editor) {
|
|
345
|
-
return editor.getParam('paste_remove_styles_if_webkit', true);
|
|
346
|
-
};
|
|
347
|
-
var shouldMergeFormats = function (editor) {
|
|
348
|
-
return editor.getParam('paste_merge_formats', true);
|
|
349
|
-
};
|
|
350
|
-
var isSmartPasteEnabled = function (editor) {
|
|
351
|
-
return editor.getParam('smart_paste', true);
|
|
352
|
-
};
|
|
353
|
-
var isPasteAsTextEnabled = function (editor) {
|
|
354
|
-
return editor.getParam('paste_as_text', false);
|
|
355
|
-
};
|
|
356
|
-
var getRetainStyleProps = function (editor) {
|
|
357
|
-
return editor.getParam('paste_retain_style_properties');
|
|
358
|
-
};
|
|
359
|
-
var getWordValidElements = function (editor) {
|
|
360
|
-
var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody';
|
|
361
|
-
return editor.getParam('paste_word_valid_elements', defaultValidElements);
|
|
362
|
-
};
|
|
363
|
-
var shouldConvertWordFakeLists = function (editor) {
|
|
364
|
-
return editor.getParam('paste_convert_word_fake_lists', true);
|
|
365
|
-
};
|
|
366
|
-
var shouldUseDefaultFilters = function (editor) {
|
|
367
|
-
return editor.getParam('paste_enable_default_filters', true);
|
|
368
|
-
};
|
|
369
|
-
var getValidate = function (editor) {
|
|
370
|
-
return editor.getParam('validate');
|
|
371
|
-
};
|
|
372
|
-
var getAllowHtmlDataUrls = function (editor) {
|
|
373
|
-
return editor.getParam('allow_html_data_urls', false, 'boolean');
|
|
374
|
-
};
|
|
375
|
-
var getPasteDataImages = function (editor) {
|
|
376
|
-
return editor.getParam('paste_data_images', false, 'boolean');
|
|
377
|
-
};
|
|
378
|
-
var getImagesDataImgFilter = function (editor) {
|
|
379
|
-
return editor.getParam('images_dataimg_filter');
|
|
380
|
-
};
|
|
381
|
-
var getImagesReuseFilename = function (editor) {
|
|
382
|
-
return editor.getParam('images_reuse_filename');
|
|
383
|
-
};
|
|
384
|
-
var getForcedRootBlock = function (editor) {
|
|
385
|
-
return editor.getParam('forced_root_block');
|
|
386
|
-
};
|
|
387
|
-
var getForcedRootBlockAttrs = function (editor) {
|
|
388
|
-
return editor.getParam('forced_root_block_attrs');
|
|
389
|
-
};
|
|
390
|
-
var getTabSpaces = function (editor) {
|
|
391
|
-
return editor.getParam('paste_tab_spaces', 4, 'number');
|
|
392
|
-
};
|
|
393
|
-
var getAllowedImageFileTypes = function (editor) {
|
|
394
|
-
var defaultImageFileTypes = 'jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp';
|
|
395
|
-
return global$6.explode(editor.getParam('images_file_types', defaultImageFileTypes, 'string'));
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
var internalMimeType = 'x-tinymce/html';
|
|
399
|
-
var internalMark = '<!-- ' + internalMimeType + ' -->';
|
|
400
|
-
var mark = function (html) {
|
|
401
|
-
return internalMark + html;
|
|
402
|
-
};
|
|
403
|
-
var unmark = function (html) {
|
|
404
|
-
return html.replace(internalMark, '');
|
|
405
|
-
};
|
|
406
|
-
var isMarked = function (html) {
|
|
407
|
-
return html.indexOf(internalMark) !== -1;
|
|
408
|
-
};
|
|
409
|
-
var internalHtmlMime = constant(internalMimeType);
|
|
410
|
-
|
|
411
|
-
var hasOwnProperty = Object.hasOwnProperty;
|
|
412
|
-
var has = function (obj, key) {
|
|
413
|
-
return hasOwnProperty.call(obj, key);
|
|
414
|
-
};
|
|
415
|
-
|
|
416
|
-
var global$5 = tinymce.util.Tools.resolve('tinymce.html.Entities');
|
|
417
|
-
|
|
418
|
-
var isPlainText = function (text) {
|
|
419
|
-
return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text);
|
|
420
|
-
};
|
|
421
|
-
var toBRs = function (text) {
|
|
422
|
-
return text.replace(/\r?\n/g, '<br>');
|
|
423
|
-
};
|
|
424
|
-
var openContainer = function (rootTag, rootAttrs) {
|
|
425
|
-
var attrs = [];
|
|
426
|
-
var tag = '<' + rootTag;
|
|
427
|
-
if (typeof rootAttrs === 'object') {
|
|
428
|
-
for (var key in rootAttrs) {
|
|
429
|
-
if (has(rootAttrs, key)) {
|
|
430
|
-
attrs.push(key + '="' + global$5.encodeAllRaw(rootAttrs[key]) + '"');
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
if (attrs.length) {
|
|
434
|
-
tag += ' ' + attrs.join(' ');
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
return tag + '>';
|
|
438
|
-
};
|
|
439
|
-
var toBlockElements = function (text, rootTag, rootAttrs) {
|
|
440
|
-
var blocks = text.split(/\n\n/);
|
|
441
|
-
var tagOpen = openContainer(rootTag, rootAttrs);
|
|
442
|
-
var tagClose = '</' + rootTag + '>';
|
|
443
|
-
var paragraphs = global$6.map(blocks, function (p) {
|
|
444
|
-
return p.split(/\n/).join('<br />');
|
|
445
|
-
});
|
|
446
|
-
var stitch = function (p) {
|
|
447
|
-
return tagOpen + p + tagClose;
|
|
448
|
-
};
|
|
449
|
-
return paragraphs.length === 1 ? paragraphs[0] : global$6.map(paragraphs, stitch).join('');
|
|
450
|
-
};
|
|
451
|
-
var convert = function (text, rootTag, rootAttrs) {
|
|
452
|
-
return rootTag ? toBlockElements(text, rootTag === true ? 'p' : rootTag, rootAttrs) : toBRs(text);
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
var global$4 = tinymce.util.Tools.resolve('tinymce.html.DomParser');
|
|
456
|
-
|
|
457
|
-
var global$3 = tinymce.util.Tools.resolve('tinymce.html.Serializer');
|
|
458
|
-
|
|
459
|
-
var nbsp = '\xA0';
|
|
460
|
-
|
|
461
|
-
var global$2 = tinymce.util.Tools.resolve('tinymce.html.Node');
|
|
462
|
-
|
|
463
|
-
var global$1 = tinymce.util.Tools.resolve('tinymce.html.Schema');
|
|
464
|
-
|
|
465
|
-
var isRegExp = function (val) {
|
|
466
|
-
return val.constructor === RegExp;
|
|
467
|
-
};
|
|
468
|
-
var filter = function (content, items) {
|
|
469
|
-
global$6.each(items, function (v) {
|
|
470
|
-
if (isRegExp(v)) {
|
|
471
|
-
content = content.replace(v, '');
|
|
472
|
-
} else {
|
|
473
|
-
content = content.replace(v[0], v[1]);
|
|
474
|
-
}
|
|
475
|
-
});
|
|
476
|
-
return content;
|
|
477
|
-
};
|
|
478
|
-
var innerText = function (html) {
|
|
479
|
-
var schema = global$1();
|
|
480
|
-
var domParser = global$4({}, schema);
|
|
481
|
-
var text = '';
|
|
482
|
-
var shortEndedElements = schema.getShortEndedElements();
|
|
483
|
-
var ignoreElements = global$6.makeMap('script noscript style textarea video audio iframe object', ' ');
|
|
484
|
-
var blockElements = schema.getBlockElements();
|
|
485
|
-
var walk = function (node) {
|
|
486
|
-
var name = node.name, currentNode = node;
|
|
487
|
-
if (name === 'br') {
|
|
488
|
-
text += '\n';
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
|
-
if (name === 'wbr') {
|
|
492
|
-
return;
|
|
493
|
-
}
|
|
494
|
-
if (shortEndedElements[name]) {
|
|
495
|
-
text += ' ';
|
|
496
|
-
}
|
|
497
|
-
if (ignoreElements[name]) {
|
|
498
|
-
text += ' ';
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
if (node.type === 3) {
|
|
502
|
-
text += node.value;
|
|
503
|
-
}
|
|
504
|
-
if (!node.shortEnded) {
|
|
505
|
-
if (node = node.firstChild) {
|
|
506
|
-
do {
|
|
507
|
-
walk(node);
|
|
508
|
-
} while (node = node.next);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
if (blockElements[name] && currentNode.next) {
|
|
512
|
-
text += '\n';
|
|
513
|
-
if (name === 'p') {
|
|
514
|
-
text += '\n';
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
html = filter(html, [/<!\[[^\]]+\]>/g]);
|
|
519
|
-
walk(domParser.parse(html));
|
|
520
|
-
return text;
|
|
521
|
-
};
|
|
522
|
-
var trimHtml = function (html) {
|
|
523
|
-
var trimSpaces = function (all, s1, s2) {
|
|
524
|
-
if (!s1 && !s2) {
|
|
525
|
-
return ' ';
|
|
526
|
-
}
|
|
527
|
-
return nbsp;
|
|
528
|
-
};
|
|
529
|
-
html = filter(html, [
|
|
530
|
-
/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,
|
|
531
|
-
/<!--StartFragment-->|<!--EndFragment-->/g,
|
|
532
|
-
[
|
|
533
|
-
/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,
|
|
534
|
-
trimSpaces
|
|
535
|
-
],
|
|
536
|
-
/<br class="Apple-interchange-newline">/g,
|
|
537
|
-
/<br>$/i
|
|
538
|
-
]);
|
|
539
|
-
return html;
|
|
540
|
-
};
|
|
541
|
-
var createIdGenerator = function (prefix) {
|
|
542
|
-
var count = 0;
|
|
543
|
-
return function () {
|
|
544
|
-
return prefix + count++;
|
|
545
|
-
};
|
|
546
|
-
};
|
|
547
|
-
var getImageMimeType = function (ext) {
|
|
548
|
-
var lowerExt = ext.toLowerCase();
|
|
549
|
-
var mimeOverrides = {
|
|
550
|
-
jpg: 'jpeg',
|
|
551
|
-
jpe: 'jpeg',
|
|
552
|
-
jfi: 'jpeg',
|
|
553
|
-
jif: 'jpeg',
|
|
554
|
-
jfif: 'jpeg',
|
|
555
|
-
pjpeg: 'jpeg',
|
|
556
|
-
pjp: 'jpeg',
|
|
557
|
-
svg: 'svg+xml'
|
|
558
|
-
};
|
|
559
|
-
return global$6.hasOwn(mimeOverrides, lowerExt) ? 'image/' + mimeOverrides[lowerExt] : 'image/' + lowerExt;
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
var isWordContent = function (content) {
|
|
563
|
-
return /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument/i.test(content) || /class="OutlineElement/.test(content) || /id="?docs\-internal\-guid\-/.test(content);
|
|
564
|
-
};
|
|
565
|
-
var isNumericList = function (text) {
|
|
566
|
-
var found = false;
|
|
567
|
-
var patterns = [
|
|
568
|
-
/^[IVXLMCD]+\.[ \u00a0]/,
|
|
569
|
-
/^[ivxlmcd]+\.[ \u00a0]/,
|
|
570
|
-
/^[a-z]{1,2}[\.\)][ \u00a0]/,
|
|
571
|
-
/^[A-Z]{1,2}[\.\)][ \u00a0]/,
|
|
572
|
-
/^[0-9]+\.[ \u00a0]/,
|
|
573
|
-
/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,
|
|
574
|
-
/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/
|
|
575
|
-
];
|
|
576
|
-
text = text.replace(/^[\u00a0 ]+/, '');
|
|
577
|
-
global$6.each(patterns, function (pattern) {
|
|
578
|
-
if (pattern.test(text)) {
|
|
579
|
-
found = true;
|
|
580
|
-
return false;
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
return found;
|
|
584
|
-
};
|
|
585
|
-
var isBulletList = function (text) {
|
|
586
|
-
return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(text);
|
|
587
|
-
};
|
|
588
|
-
var convertFakeListsToProperLists = function (node) {
|
|
589
|
-
var currentListNode, prevListNode, lastLevel = 1;
|
|
590
|
-
var getText = function (node) {
|
|
591
|
-
var txt = '';
|
|
592
|
-
if (node.type === 3) {
|
|
593
|
-
return node.value;
|
|
594
|
-
}
|
|
595
|
-
if (node = node.firstChild) {
|
|
596
|
-
do {
|
|
597
|
-
txt += getText(node);
|
|
598
|
-
} while (node = node.next);
|
|
599
|
-
}
|
|
600
|
-
return txt;
|
|
601
|
-
};
|
|
602
|
-
var trimListStart = function (node, regExp) {
|
|
603
|
-
if (node.type === 3) {
|
|
604
|
-
if (regExp.test(node.value)) {
|
|
605
|
-
node.value = node.value.replace(regExp, '');
|
|
606
|
-
return false;
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
if (node = node.firstChild) {
|
|
610
|
-
do {
|
|
611
|
-
if (!trimListStart(node, regExp)) {
|
|
612
|
-
return false;
|
|
613
|
-
}
|
|
614
|
-
} while (node = node.next);
|
|
615
|
-
}
|
|
616
|
-
return true;
|
|
617
|
-
};
|
|
618
|
-
var removeIgnoredNodes = function (node) {
|
|
619
|
-
if (node._listIgnore) {
|
|
620
|
-
node.remove();
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
if (node = node.firstChild) {
|
|
624
|
-
do {
|
|
625
|
-
removeIgnoredNodes(node);
|
|
626
|
-
} while (node = node.next);
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
var convertParagraphToLi = function (paragraphNode, listName, start) {
|
|
630
|
-
var level = paragraphNode._listLevel || lastLevel;
|
|
631
|
-
if (level !== lastLevel) {
|
|
632
|
-
if (level < lastLevel) {
|
|
633
|
-
if (currentListNode) {
|
|
634
|
-
currentListNode = currentListNode.parent.parent;
|
|
635
|
-
}
|
|
636
|
-
} else {
|
|
637
|
-
prevListNode = currentListNode;
|
|
638
|
-
currentListNode = null;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
if (!currentListNode || currentListNode.name !== listName) {
|
|
642
|
-
prevListNode = prevListNode || currentListNode;
|
|
643
|
-
currentListNode = new global$2(listName, 1);
|
|
644
|
-
if (start > 1) {
|
|
645
|
-
currentListNode.attr('start', '' + start);
|
|
646
|
-
}
|
|
647
|
-
paragraphNode.wrap(currentListNode);
|
|
648
|
-
} else {
|
|
649
|
-
currentListNode.append(paragraphNode);
|
|
650
|
-
}
|
|
651
|
-
paragraphNode.name = 'li';
|
|
652
|
-
if (level > lastLevel && prevListNode) {
|
|
653
|
-
prevListNode.lastChild.append(currentListNode);
|
|
654
|
-
}
|
|
655
|
-
lastLevel = level;
|
|
656
|
-
removeIgnoredNodes(paragraphNode);
|
|
657
|
-
trimListStart(paragraphNode, /^\u00a0+/);
|
|
658
|
-
trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);
|
|
659
|
-
trimListStart(paragraphNode, /^\u00a0+/);
|
|
660
|
-
};
|
|
661
|
-
var elements = [];
|
|
662
|
-
var child = node.firstChild;
|
|
663
|
-
while (typeof child !== 'undefined' && child !== null) {
|
|
664
|
-
elements.push(child);
|
|
665
|
-
child = child.walk();
|
|
666
|
-
if (child !== null) {
|
|
667
|
-
while (typeof child !== 'undefined' && child.parent !== node) {
|
|
668
|
-
child = child.walk();
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
for (var i = 0; i < elements.length; i++) {
|
|
673
|
-
node = elements[i];
|
|
674
|
-
if (node.name === 'p' && node.firstChild) {
|
|
675
|
-
var nodeText = getText(node);
|
|
676
|
-
if (isBulletList(nodeText)) {
|
|
677
|
-
convertParagraphToLi(node, 'ul');
|
|
678
|
-
continue;
|
|
679
|
-
}
|
|
680
|
-
if (isNumericList(nodeText)) {
|
|
681
|
-
var matches = /([0-9]+)\./.exec(nodeText);
|
|
682
|
-
var start = 1;
|
|
683
|
-
if (matches) {
|
|
684
|
-
start = parseInt(matches[1], 10);
|
|
685
|
-
}
|
|
686
|
-
convertParagraphToLi(node, 'ol', start);
|
|
687
|
-
continue;
|
|
688
|
-
}
|
|
689
|
-
if (node._listLevel) {
|
|
690
|
-
convertParagraphToLi(node, 'ul', 1);
|
|
691
|
-
continue;
|
|
692
|
-
}
|
|
693
|
-
currentListNode = null;
|
|
694
|
-
} else {
|
|
695
|
-
prevListNode = currentListNode;
|
|
696
|
-
currentListNode = null;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
};
|
|
700
|
-
var filterStyles = function (editor, validStyles, node, styleValue) {
|
|
701
|
-
var outputStyles = {};
|
|
702
|
-
var styles = editor.dom.parseStyle(styleValue);
|
|
703
|
-
global$6.each(styles, function (value, name) {
|
|
704
|
-
switch (name) {
|
|
705
|
-
case 'mso-list':
|
|
706
|
-
var matches = /\w+ \w+([0-9]+)/i.exec(styleValue);
|
|
707
|
-
if (matches) {
|
|
708
|
-
node._listLevel = parseInt(matches[1], 10);
|
|
709
|
-
}
|
|
710
|
-
if (/Ignore/i.test(value) && node.firstChild) {
|
|
711
|
-
node._listIgnore = true;
|
|
712
|
-
node.firstChild._listIgnore = true;
|
|
713
|
-
}
|
|
714
|
-
break;
|
|
715
|
-
case 'horiz-align':
|
|
716
|
-
name = 'text-align';
|
|
717
|
-
break;
|
|
718
|
-
case 'vert-align':
|
|
719
|
-
name = 'vertical-align';
|
|
720
|
-
break;
|
|
721
|
-
case 'font-color':
|
|
722
|
-
case 'mso-foreground':
|
|
723
|
-
name = 'color';
|
|
724
|
-
break;
|
|
725
|
-
case 'mso-background':
|
|
726
|
-
case 'mso-highlight':
|
|
727
|
-
name = 'background';
|
|
728
|
-
break;
|
|
729
|
-
case 'font-weight':
|
|
730
|
-
case 'font-style':
|
|
731
|
-
if (value !== 'normal') {
|
|
732
|
-
outputStyles[name] = value;
|
|
733
|
-
}
|
|
734
|
-
return;
|
|
735
|
-
case 'mso-element':
|
|
736
|
-
if (/^(comment|comment-list)$/i.test(value)) {
|
|
737
|
-
node.remove();
|
|
738
|
-
return;
|
|
739
|
-
}
|
|
740
|
-
break;
|
|
741
|
-
}
|
|
742
|
-
if (name.indexOf('mso-comment') === 0) {
|
|
743
|
-
node.remove();
|
|
744
|
-
return;
|
|
745
|
-
}
|
|
746
|
-
if (name.indexOf('mso-') === 0) {
|
|
747
|
-
return;
|
|
748
|
-
}
|
|
749
|
-
if (getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) {
|
|
750
|
-
outputStyles[name] = value;
|
|
751
|
-
}
|
|
752
|
-
});
|
|
753
|
-
if (/(bold)/i.test(outputStyles['font-weight'])) {
|
|
754
|
-
delete outputStyles['font-weight'];
|
|
755
|
-
node.wrap(new global$2('b', 1));
|
|
756
|
-
}
|
|
757
|
-
if (/(italic)/i.test(outputStyles['font-style'])) {
|
|
758
|
-
delete outputStyles['font-style'];
|
|
759
|
-
node.wrap(new global$2('i', 1));
|
|
760
|
-
}
|
|
761
|
-
var outputStyle = editor.dom.serializeStyle(outputStyles, node.name);
|
|
762
|
-
if (outputStyle) {
|
|
763
|
-
return outputStyle;
|
|
764
|
-
}
|
|
765
|
-
return null;
|
|
766
|
-
};
|
|
767
|
-
var filterWordContent = function (editor, content) {
|
|
768
|
-
var validStyles;
|
|
769
|
-
var retainStyleProperties = getRetainStyleProps(editor);
|
|
770
|
-
if (retainStyleProperties) {
|
|
771
|
-
validStyles = global$6.makeMap(retainStyleProperties.split(/[, ]/));
|
|
772
|
-
}
|
|
773
|
-
content = filter(content, [
|
|
774
|
-
/<br class="?Apple-interchange-newline"?>/gi,
|
|
775
|
-
/<b[^>]+id="?docs-internal-[^>]*>/gi,
|
|
776
|
-
/<!--[\s\S]+?-->/gi,
|
|
777
|
-
/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
|
|
778
|
-
[
|
|
779
|
-
/<(\/?)s>/gi,
|
|
780
|
-
'<$1strike>'
|
|
781
|
-
],
|
|
782
|
-
[
|
|
783
|
-
/ /gi,
|
|
784
|
-
nbsp
|
|
785
|
-
],
|
|
786
|
-
[
|
|
787
|
-
/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
|
|
788
|
-
function (str, spaces) {
|
|
789
|
-
return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join(nbsp) : '';
|
|
790
|
-
}
|
|
791
|
-
]
|
|
792
|
-
]);
|
|
793
|
-
var validElements = getWordValidElements(editor);
|
|
794
|
-
var schema = global$1({
|
|
795
|
-
valid_elements: validElements,
|
|
796
|
-
valid_children: '-li[p]'
|
|
797
|
-
});
|
|
798
|
-
global$6.each(schema.elements, function (rule) {
|
|
799
|
-
if (!rule.attributes.class) {
|
|
800
|
-
rule.attributes.class = {};
|
|
801
|
-
rule.attributesOrder.push('class');
|
|
802
|
-
}
|
|
803
|
-
if (!rule.attributes.style) {
|
|
804
|
-
rule.attributes.style = {};
|
|
805
|
-
rule.attributesOrder.push('style');
|
|
806
|
-
}
|
|
807
|
-
});
|
|
808
|
-
var domParser = global$4({}, schema);
|
|
809
|
-
domParser.addAttributeFilter('style', function (nodes) {
|
|
810
|
-
var i = nodes.length, node;
|
|
811
|
-
while (i--) {
|
|
812
|
-
node = nodes[i];
|
|
813
|
-
node.attr('style', filterStyles(editor, validStyles, node, node.attr('style')));
|
|
814
|
-
if (node.name === 'span' && node.parent && !node.attributes.length) {
|
|
815
|
-
node.unwrap();
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
});
|
|
819
|
-
domParser.addAttributeFilter('class', function (nodes) {
|
|
820
|
-
var i = nodes.length, node, className;
|
|
821
|
-
while (i--) {
|
|
822
|
-
node = nodes[i];
|
|
823
|
-
className = node.attr('class');
|
|
824
|
-
if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) {
|
|
825
|
-
node.remove();
|
|
826
|
-
}
|
|
827
|
-
node.attr('class', null);
|
|
828
|
-
}
|
|
829
|
-
});
|
|
830
|
-
domParser.addNodeFilter('del', function (nodes) {
|
|
831
|
-
var i = nodes.length;
|
|
832
|
-
while (i--) {
|
|
833
|
-
nodes[i].remove();
|
|
834
|
-
}
|
|
835
|
-
});
|
|
836
|
-
domParser.addNodeFilter('a', function (nodes) {
|
|
837
|
-
var i = nodes.length, node, href, name;
|
|
838
|
-
while (i--) {
|
|
839
|
-
node = nodes[i];
|
|
840
|
-
href = node.attr('href');
|
|
841
|
-
name = node.attr('name');
|
|
842
|
-
if (href && href.indexOf('#_msocom_') !== -1) {
|
|
843
|
-
node.remove();
|
|
844
|
-
continue;
|
|
845
|
-
}
|
|
846
|
-
if (href && href.indexOf('file://') === 0) {
|
|
847
|
-
href = href.split('#')[1];
|
|
848
|
-
if (href) {
|
|
849
|
-
href = '#' + href;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
if (!href && !name) {
|
|
853
|
-
node.unwrap();
|
|
854
|
-
} else {
|
|
855
|
-
if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {
|
|
856
|
-
node.unwrap();
|
|
857
|
-
continue;
|
|
858
|
-
}
|
|
859
|
-
node.attr({
|
|
860
|
-
href: href,
|
|
861
|
-
name: name
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
});
|
|
866
|
-
var rootNode = domParser.parse(content);
|
|
867
|
-
if (shouldConvertWordFakeLists(editor)) {
|
|
868
|
-
convertFakeListsToProperLists(rootNode);
|
|
869
|
-
}
|
|
870
|
-
content = global$3({ validate: getValidate(editor) }, schema).serialize(rootNode);
|
|
871
|
-
return content;
|
|
872
|
-
};
|
|
873
|
-
var preProcess$1 = function (editor, content) {
|
|
874
|
-
return shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content;
|
|
875
|
-
};
|
|
876
|
-
|
|
877
|
-
var preProcess = function (editor, html) {
|
|
878
|
-
var parser = global$4({}, editor.schema);
|
|
879
|
-
parser.addNodeFilter('meta', function (nodes) {
|
|
880
|
-
global$6.each(nodes, function (node) {
|
|
881
|
-
node.remove();
|
|
882
|
-
});
|
|
883
|
-
});
|
|
884
|
-
var fragment = parser.parse(html, {
|
|
885
|
-
forced_root_block: false,
|
|
886
|
-
isRootContent: true
|
|
887
|
-
});
|
|
888
|
-
return global$3({ validate: getValidate(editor) }, editor.schema).serialize(fragment);
|
|
889
|
-
};
|
|
890
|
-
var processResult = function (content, cancelled) {
|
|
891
|
-
return {
|
|
892
|
-
content: content,
|
|
893
|
-
cancelled: cancelled
|
|
894
|
-
};
|
|
895
|
-
};
|
|
896
|
-
var postProcessFilter = function (editor, html, internal, isWordHtml) {
|
|
897
|
-
var tempBody = editor.dom.create('div', { style: 'display:none' }, html);
|
|
898
|
-
var postProcessArgs = firePastePostProcess(editor, tempBody, internal, isWordHtml);
|
|
899
|
-
return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented());
|
|
900
|
-
};
|
|
901
|
-
var filterContent = function (editor, content, internal, isWordHtml) {
|
|
902
|
-
var preProcessArgs = firePastePreProcess(editor, content, internal, isWordHtml);
|
|
903
|
-
var filteredContent = preProcess(editor, preProcessArgs.content);
|
|
904
|
-
if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) {
|
|
905
|
-
return postProcessFilter(editor, filteredContent, internal, isWordHtml);
|
|
906
|
-
} else {
|
|
907
|
-
return processResult(filteredContent, preProcessArgs.isDefaultPrevented());
|
|
908
|
-
}
|
|
909
|
-
};
|
|
910
|
-
var process = function (editor, html, internal) {
|
|
911
|
-
var isWordHtml = isWordContent(html);
|
|
912
|
-
var content = isWordHtml ? preProcess$1(editor, html) : html;
|
|
913
|
-
return filterContent(editor, content, internal, isWordHtml);
|
|
914
|
-
};
|
|
915
|
-
|
|
916
|
-
var pasteHtml$1 = function (editor, html) {
|
|
917
|
-
editor.insertContent(html, {
|
|
918
|
-
merge: shouldMergeFormats(editor),
|
|
919
|
-
paste: true
|
|
920
|
-
});
|
|
921
|
-
return true;
|
|
922
|
-
};
|
|
923
|
-
var isAbsoluteUrl = function (url) {
|
|
924
|
-
return /^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(url);
|
|
925
|
-
};
|
|
926
|
-
var isImageUrl = function (editor, url) {
|
|
927
|
-
return isAbsoluteUrl(url) && exists(getAllowedImageFileTypes(editor), function (type) {
|
|
928
|
-
return endsWith(url.toLowerCase(), '.' + type.toLowerCase());
|
|
929
|
-
});
|
|
930
|
-
};
|
|
931
|
-
var createImage = function (editor, url, pasteHtmlFn) {
|
|
932
|
-
editor.undoManager.extra(function () {
|
|
933
|
-
pasteHtmlFn(editor, url);
|
|
934
|
-
}, function () {
|
|
935
|
-
editor.insertContent('<img src="' + url + '">');
|
|
936
|
-
});
|
|
937
|
-
return true;
|
|
938
|
-
};
|
|
939
|
-
var createLink = function (editor, url, pasteHtmlFn) {
|
|
940
|
-
editor.undoManager.extra(function () {
|
|
941
|
-
pasteHtmlFn(editor, url);
|
|
942
|
-
}, function () {
|
|
943
|
-
editor.execCommand('mceInsertLink', false, url);
|
|
944
|
-
});
|
|
945
|
-
return true;
|
|
946
|
-
};
|
|
947
|
-
var linkSelection = function (editor, html, pasteHtmlFn) {
|
|
948
|
-
return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false;
|
|
949
|
-
};
|
|
950
|
-
var insertImage = function (editor, html, pasteHtmlFn) {
|
|
951
|
-
return isImageUrl(editor, html) ? createImage(editor, html, pasteHtmlFn) : false;
|
|
952
|
-
};
|
|
953
|
-
var smartInsertContent = function (editor, html) {
|
|
954
|
-
global$6.each([
|
|
955
|
-
linkSelection,
|
|
956
|
-
insertImage,
|
|
957
|
-
pasteHtml$1
|
|
958
|
-
], function (action) {
|
|
959
|
-
return action(editor, html, pasteHtml$1) !== true;
|
|
960
|
-
});
|
|
961
|
-
};
|
|
962
|
-
var insertContent = function (editor, html, pasteAsText) {
|
|
963
|
-
if (pasteAsText || isSmartPasteEnabled(editor) === false) {
|
|
964
|
-
pasteHtml$1(editor, html);
|
|
965
|
-
} else {
|
|
966
|
-
smartInsertContent(editor, html);
|
|
967
|
-
}
|
|
968
|
-
};
|
|
969
|
-
|
|
970
|
-
var isCollapsibleWhitespace = function (c) {
|
|
971
|
-
return ' \f\t\x0B'.indexOf(c) !== -1;
|
|
972
|
-
};
|
|
973
|
-
var isNewLineChar = function (c) {
|
|
974
|
-
return c === '\n' || c === '\r';
|
|
975
|
-
};
|
|
976
|
-
var isNewline = function (text, idx) {
|
|
977
|
-
return idx < text.length && idx >= 0 ? isNewLineChar(text[idx]) : false;
|
|
978
|
-
};
|
|
979
|
-
var normalizeWhitespace = function (editor, text) {
|
|
980
|
-
var tabSpace = repeat(' ', getTabSpaces(editor));
|
|
981
|
-
var normalizedText = text.replace(/\t/g, tabSpace);
|
|
982
|
-
var result = foldl(normalizedText, function (acc, c) {
|
|
983
|
-
if (isCollapsibleWhitespace(c) || c === nbsp) {
|
|
984
|
-
if (acc.pcIsSpace || acc.str === '' || acc.str.length === normalizedText.length - 1 || isNewline(normalizedText, acc.str.length + 1)) {
|
|
985
|
-
return {
|
|
986
|
-
pcIsSpace: false,
|
|
987
|
-
str: acc.str + nbsp
|
|
988
|
-
};
|
|
989
|
-
} else {
|
|
990
|
-
return {
|
|
991
|
-
pcIsSpace: true,
|
|
992
|
-
str: acc.str + ' '
|
|
993
|
-
};
|
|
994
|
-
}
|
|
995
|
-
} else {
|
|
996
|
-
return {
|
|
997
|
-
pcIsSpace: isNewLineChar(c),
|
|
998
|
-
str: acc.str + c
|
|
999
|
-
};
|
|
1000
|
-
}
|
|
1001
|
-
}, {
|
|
1002
|
-
pcIsSpace: false,
|
|
1003
|
-
str: ''
|
|
1004
|
-
});
|
|
1005
|
-
return result.str;
|
|
1006
|
-
};
|
|
1007
|
-
|
|
1008
|
-
var doPaste = function (editor, content, internal, pasteAsText) {
|
|
1009
|
-
var args = process(editor, content, internal);
|
|
1010
|
-
if (args.cancelled === false) {
|
|
1011
|
-
insertContent(editor, args.content, pasteAsText);
|
|
1012
|
-
}
|
|
1013
|
-
};
|
|
1014
|
-
var pasteHtml = function (editor, html, internalFlag) {
|
|
1015
|
-
var internal = internalFlag ? internalFlag : isMarked(html);
|
|
1016
|
-
doPaste(editor, unmark(html), internal, false);
|
|
1017
|
-
};
|
|
1018
|
-
var pasteText = function (editor, text) {
|
|
1019
|
-
var encodedText = editor.dom.encode(text).replace(/\r\n/g, '\n');
|
|
1020
|
-
var normalizedText = normalizeWhitespace(editor, encodedText);
|
|
1021
|
-
var html = convert(normalizedText, getForcedRootBlock(editor), getForcedRootBlockAttrs(editor));
|
|
1022
|
-
doPaste(editor, html, false, true);
|
|
1023
|
-
};
|
|
1024
|
-
var getDataTransferItems = function (dataTransfer) {
|
|
1025
|
-
var items = {};
|
|
1026
|
-
var mceInternalUrlPrefix = 'data:text/mce-internal,';
|
|
1027
|
-
if (dataTransfer) {
|
|
1028
|
-
if (dataTransfer.getData) {
|
|
1029
|
-
var legacyText = dataTransfer.getData('Text');
|
|
1030
|
-
if (legacyText && legacyText.length > 0) {
|
|
1031
|
-
if (legacyText.indexOf(mceInternalUrlPrefix) === -1) {
|
|
1032
|
-
items['text/plain'] = legacyText;
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
if (dataTransfer.types) {
|
|
1037
|
-
for (var i = 0; i < dataTransfer.types.length; i++) {
|
|
1038
|
-
var contentType = dataTransfer.types[i];
|
|
1039
|
-
try {
|
|
1040
|
-
items[contentType] = dataTransfer.getData(contentType);
|
|
1041
|
-
} catch (ex) {
|
|
1042
|
-
items[contentType] = '';
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
return items;
|
|
1048
|
-
};
|
|
1049
|
-
var getClipboardContent = function (editor, clipboardEvent) {
|
|
1050
|
-
return getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);
|
|
1051
|
-
};
|
|
1052
|
-
var hasContentType = function (clipboardContent, mimeType) {
|
|
1053
|
-
return mimeType in clipboardContent && clipboardContent[mimeType].length > 0;
|
|
1054
|
-
};
|
|
1055
|
-
var hasHtmlOrText = function (content) {
|
|
1056
|
-
return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain');
|
|
1057
|
-
};
|
|
1058
|
-
var parseDataUri = function (uri) {
|
|
1059
|
-
var matches = /data:([^;]+);base64,([a-z0-9\+\/=]+)/i.exec(uri);
|
|
1060
|
-
if (matches) {
|
|
1061
|
-
return {
|
|
1062
|
-
type: matches[1],
|
|
1063
|
-
data: decodeURIComponent(matches[2])
|
|
1064
|
-
};
|
|
1065
|
-
} else {
|
|
1066
|
-
return {
|
|
1067
|
-
type: null,
|
|
1068
|
-
data: null
|
|
1069
|
-
};
|
|
1070
|
-
}
|
|
1071
|
-
};
|
|
1072
|
-
var isValidDataUriImage = function (editor, imgElm) {
|
|
1073
|
-
var filter = getImagesDataImgFilter(editor);
|
|
1074
|
-
return filter ? filter(imgElm) : true;
|
|
1075
|
-
};
|
|
1076
|
-
var extractFilename = function (editor, str) {
|
|
1077
|
-
var m = str.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);
|
|
1078
|
-
return isNonNullable(m) ? editor.dom.encode(m[1]) : null;
|
|
1079
|
-
};
|
|
1080
|
-
var uniqueId = createIdGenerator('mceclip');
|
|
1081
|
-
var pasteImage = function (editor, imageItem) {
|
|
1082
|
-
var _a = parseDataUri(imageItem.uri), base64 = _a.data, type = _a.type;
|
|
1083
|
-
var id = uniqueId();
|
|
1084
|
-
var file = imageItem.blob;
|
|
1085
|
-
var img = new Image();
|
|
1086
|
-
img.src = imageItem.uri;
|
|
1087
|
-
if (isValidDataUriImage(editor, img)) {
|
|
1088
|
-
var blobCache = editor.editorUpload.blobCache;
|
|
1089
|
-
var blobInfo = void 0;
|
|
1090
|
-
var existingBlobInfo = blobCache.getByData(base64, type);
|
|
1091
|
-
if (!existingBlobInfo) {
|
|
1092
|
-
var useFileName = getImagesReuseFilename(editor) && isNonNullable(file.name);
|
|
1093
|
-
var name_1 = useFileName ? extractFilename(editor, file.name) : id;
|
|
1094
|
-
var filename = useFileName ? file.name : undefined;
|
|
1095
|
-
blobInfo = blobCache.create(id, file, base64, name_1, filename);
|
|
1096
|
-
blobCache.add(blobInfo);
|
|
1097
|
-
} else {
|
|
1098
|
-
blobInfo = existingBlobInfo;
|
|
1099
|
-
}
|
|
1100
|
-
pasteHtml(editor, '<img src="' + blobInfo.blobUri() + '">', false);
|
|
1101
|
-
} else {
|
|
1102
|
-
pasteHtml(editor, '<img src="' + imageItem.uri + '">', false);
|
|
1103
|
-
}
|
|
1104
|
-
};
|
|
1105
|
-
var isClipboardEvent = function (event) {
|
|
1106
|
-
return event.type === 'paste';
|
|
1107
|
-
};
|
|
1108
|
-
var isDataTransferItem = function (item) {
|
|
1109
|
-
return isNonNullable(item.getAsFile);
|
|
1110
|
-
};
|
|
1111
|
-
var readFilesAsDataUris = function (items) {
|
|
1112
|
-
return global$8.all(map(items, function (item) {
|
|
1113
|
-
return new global$8(function (resolve) {
|
|
1114
|
-
var blob = isDataTransferItem(item) ? item.getAsFile() : item;
|
|
1115
|
-
var reader = new window.FileReader();
|
|
1116
|
-
reader.onload = function () {
|
|
1117
|
-
resolve({
|
|
1118
|
-
blob: blob,
|
|
1119
|
-
uri: reader.result
|
|
1120
|
-
});
|
|
1121
|
-
};
|
|
1122
|
-
reader.readAsDataURL(blob);
|
|
1123
|
-
});
|
|
1124
|
-
}));
|
|
1125
|
-
};
|
|
1126
|
-
var isImage = function (editor) {
|
|
1127
|
-
var allowedExtensions = getAllowedImageFileTypes(editor);
|
|
1128
|
-
return function (file) {
|
|
1129
|
-
return startsWith(file.type, 'image/') && exists(allowedExtensions, function (extension) {
|
|
1130
|
-
return getImageMimeType(extension) === file.type;
|
|
1131
|
-
});
|
|
1132
|
-
};
|
|
1133
|
-
};
|
|
1134
|
-
var getImagesFromDataTransfer = function (editor, dataTransfer) {
|
|
1135
|
-
var items = dataTransfer.items ? bind(from(dataTransfer.items), function (item) {
|
|
1136
|
-
return item.kind === 'file' ? [item.getAsFile()] : [];
|
|
1137
|
-
}) : [];
|
|
1138
|
-
var files = dataTransfer.files ? from(dataTransfer.files) : [];
|
|
1139
|
-
return filter$1(items.length > 0 ? items : files, isImage(editor));
|
|
1140
|
-
};
|
|
1141
|
-
var pasteImageData = function (editor, e, rng) {
|
|
1142
|
-
var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer;
|
|
1143
|
-
if (getPasteDataImages(editor) && dataTransfer) {
|
|
1144
|
-
var images = getImagesFromDataTransfer(editor, dataTransfer);
|
|
1145
|
-
if (images.length > 0) {
|
|
1146
|
-
e.preventDefault();
|
|
1147
|
-
readFilesAsDataUris(images).then(function (fileResults) {
|
|
1148
|
-
if (rng) {
|
|
1149
|
-
editor.selection.setRng(rng);
|
|
1150
|
-
}
|
|
1151
|
-
each(fileResults, function (result) {
|
|
1152
|
-
pasteImage(editor, result);
|
|
1153
|
-
});
|
|
1154
|
-
});
|
|
1155
|
-
return true;
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
return false;
|
|
1159
|
-
};
|
|
1160
|
-
var isBrokenAndroidClipboardEvent = function (e) {
|
|
1161
|
-
var clipboardData = e.clipboardData;
|
|
1162
|
-
return navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0;
|
|
1163
|
-
};
|
|
1164
|
-
var isKeyboardPasteEvent = function (e) {
|
|
1165
|
-
return global$7.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45;
|
|
1166
|
-
};
|
|
1167
|
-
var registerEventHandlers = function (editor, pasteBin, pasteFormat) {
|
|
1168
|
-
var keyboardPasteEvent = value();
|
|
1169
|
-
var keyboardPastePressed = value();
|
|
1170
|
-
var keyboardPastePlainTextState;
|
|
1171
|
-
editor.on('keyup', keyboardPastePressed.clear);
|
|
1172
|
-
editor.on('keydown', function (e) {
|
|
1173
|
-
var removePasteBinOnKeyUp = function (e) {
|
|
1174
|
-
if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
|
|
1175
|
-
pasteBin.remove();
|
|
1176
|
-
}
|
|
1177
|
-
};
|
|
1178
|
-
if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
|
|
1179
|
-
keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86;
|
|
1180
|
-
if (keyboardPastePlainTextState && global$a.webkit && navigator.userAgent.indexOf('Version/') !== -1) {
|
|
1181
|
-
return;
|
|
1182
|
-
}
|
|
1183
|
-
e.stopImmediatePropagation();
|
|
1184
|
-
keyboardPasteEvent.set(e);
|
|
1185
|
-
keyboardPastePressed.set(true);
|
|
1186
|
-
if (global$a.ie && keyboardPastePlainTextState) {
|
|
1187
|
-
e.preventDefault();
|
|
1188
|
-
firePaste(editor, true);
|
|
1189
|
-
return;
|
|
1190
|
-
}
|
|
1191
|
-
pasteBin.remove();
|
|
1192
|
-
pasteBin.create();
|
|
1193
|
-
editor.once('keyup', removePasteBinOnKeyUp);
|
|
1194
|
-
editor.once('paste', function () {
|
|
1195
|
-
editor.off('keyup', removePasteBinOnKeyUp);
|
|
1196
|
-
});
|
|
1197
|
-
}
|
|
1198
|
-
});
|
|
1199
|
-
var insertClipboardContent = function (editor, clipboardContent, isKeyBoardPaste, plainTextMode, internal) {
|
|
1200
|
-
var content;
|
|
1201
|
-
if (hasContentType(clipboardContent, 'text/html')) {
|
|
1202
|
-
content = clipboardContent['text/html'];
|
|
1203
|
-
} else {
|
|
1204
|
-
content = pasteBin.getHtml();
|
|
1205
|
-
internal = internal ? internal : isMarked(content);
|
|
1206
|
-
if (pasteBin.isDefaultContent(content)) {
|
|
1207
|
-
plainTextMode = true;
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
content = trimHtml(content);
|
|
1211
|
-
pasteBin.remove();
|
|
1212
|
-
var isPlainTextHtml = internal === false && isPlainText(content);
|
|
1213
|
-
var isAbsoluteUrl$1 = isAbsoluteUrl(content);
|
|
1214
|
-
if (!content.length || isPlainTextHtml && !isAbsoluteUrl$1) {
|
|
1215
|
-
plainTextMode = true;
|
|
1216
|
-
}
|
|
1217
|
-
if (plainTextMode || isAbsoluteUrl$1) {
|
|
1218
|
-
if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) {
|
|
1219
|
-
content = clipboardContent['text/plain'];
|
|
1220
|
-
} else {
|
|
1221
|
-
content = innerText(content);
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
if (pasteBin.isDefaultContent(content)) {
|
|
1225
|
-
if (!isKeyBoardPaste) {
|
|
1226
|
-
editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');
|
|
1227
|
-
}
|
|
1228
|
-
return;
|
|
1229
|
-
}
|
|
1230
|
-
if (plainTextMode) {
|
|
1231
|
-
pasteText(editor, content);
|
|
1232
|
-
} else {
|
|
1233
|
-
pasteHtml(editor, content, internal);
|
|
1234
|
-
}
|
|
1235
|
-
};
|
|
1236
|
-
var getLastRng = function () {
|
|
1237
|
-
return pasteBin.getLastRng() || editor.selection.getRng();
|
|
1238
|
-
};
|
|
1239
|
-
editor.on('paste', function (e) {
|
|
1240
|
-
var isKeyboardPaste = keyboardPasteEvent.isSet() || keyboardPastePressed.isSet();
|
|
1241
|
-
if (isKeyboardPaste) {
|
|
1242
|
-
keyboardPasteEvent.clear();
|
|
1243
|
-
}
|
|
1244
|
-
var clipboardContent = getClipboardContent(editor, e);
|
|
1245
|
-
var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState;
|
|
1246
|
-
var internal = hasContentType(clipboardContent, internalHtmlMime());
|
|
1247
|
-
keyboardPastePlainTextState = false;
|
|
1248
|
-
if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {
|
|
1249
|
-
pasteBin.remove();
|
|
1250
|
-
return;
|
|
1251
|
-
}
|
|
1252
|
-
if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) {
|
|
1253
|
-
pasteBin.remove();
|
|
1254
|
-
return;
|
|
1255
|
-
}
|
|
1256
|
-
if (!isKeyboardPaste) {
|
|
1257
|
-
e.preventDefault();
|
|
1258
|
-
}
|
|
1259
|
-
if (global$a.ie && (!isKeyboardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) {
|
|
1260
|
-
pasteBin.create();
|
|
1261
|
-
editor.dom.bind(pasteBin.getEl(), 'paste', function (e) {
|
|
1262
|
-
e.stopPropagation();
|
|
1263
|
-
});
|
|
1264
|
-
editor.getDoc().execCommand('Paste', false, null);
|
|
1265
|
-
clipboardContent['text/html'] = pasteBin.getHtml();
|
|
1266
|
-
}
|
|
1267
|
-
if (hasContentType(clipboardContent, 'text/html')) {
|
|
1268
|
-
e.preventDefault();
|
|
1269
|
-
if (!internal) {
|
|
1270
|
-
internal = isMarked(clipboardContent['text/html']);
|
|
1271
|
-
}
|
|
1272
|
-
insertClipboardContent(editor, clipboardContent, isKeyboardPaste, plainTextMode, internal);
|
|
1273
|
-
} else {
|
|
1274
|
-
global$9.setEditorTimeout(editor, function () {
|
|
1275
|
-
insertClipboardContent(editor, clipboardContent, isKeyboardPaste, plainTextMode, internal);
|
|
1276
|
-
}, 0);
|
|
1277
|
-
}
|
|
1278
|
-
});
|
|
1279
|
-
};
|
|
1280
|
-
var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) {
|
|
1281
|
-
registerEventHandlers(editor, pasteBin, pasteFormat);
|
|
1282
|
-
var src;
|
|
1283
|
-
editor.parser.addNodeFilter('img', function (nodes, name, args) {
|
|
1284
|
-
var isPasteInsert = function (args) {
|
|
1285
|
-
return args.data && args.data.paste === true;
|
|
1286
|
-
};
|
|
1287
|
-
var remove = function (node) {
|
|
1288
|
-
if (!node.attr('data-mce-object') && src !== global$a.transparentSrc) {
|
|
1289
|
-
node.remove();
|
|
1290
|
-
}
|
|
1291
|
-
};
|
|
1292
|
-
var isWebKitFakeUrl = function (src) {
|
|
1293
|
-
return src.indexOf('webkit-fake-url') === 0;
|
|
1294
|
-
};
|
|
1295
|
-
var isDataUri = function (src) {
|
|
1296
|
-
return src.indexOf('data:') === 0;
|
|
1297
|
-
};
|
|
1298
|
-
if (!getPasteDataImages(editor) && isPasteInsert(args)) {
|
|
1299
|
-
var i = nodes.length;
|
|
1300
|
-
while (i--) {
|
|
1301
|
-
src = nodes[i].attr('src');
|
|
1302
|
-
if (!src) {
|
|
1303
|
-
continue;
|
|
1304
|
-
}
|
|
1305
|
-
if (isWebKitFakeUrl(src)) {
|
|
1306
|
-
remove(nodes[i]);
|
|
1307
|
-
} else if (!getAllowHtmlDataUrls(editor) && isDataUri(src)) {
|
|
1308
|
-
remove(nodes[i]);
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
});
|
|
1313
|
-
};
|
|
1314
|
-
|
|
1315
|
-
var getPasteBinParent = function (editor) {
|
|
1316
|
-
return global$a.ie && editor.inline ? document.body : editor.getBody();
|
|
1317
|
-
};
|
|
1318
|
-
var isExternalPasteBin = function (editor) {
|
|
1319
|
-
return getPasteBinParent(editor) !== editor.getBody();
|
|
1320
|
-
};
|
|
1321
|
-
var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) {
|
|
1322
|
-
if (isExternalPasteBin(editor)) {
|
|
1323
|
-
editor.dom.bind(pasteBinElm, 'paste keyup', function (_e) {
|
|
1324
|
-
if (!isDefault(editor, pasteBinDefaultContent)) {
|
|
1325
|
-
editor.fire('paste');
|
|
1326
|
-
}
|
|
1327
|
-
});
|
|
1328
|
-
}
|
|
1329
|
-
};
|
|
1330
|
-
var create = function (editor, lastRngCell, pasteBinDefaultContent) {
|
|
1331
|
-
var dom = editor.dom, body = editor.getBody();
|
|
1332
|
-
lastRngCell.set(editor.selection.getRng());
|
|
1333
|
-
var pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', {
|
|
1334
|
-
'id': 'mcepastebin',
|
|
1335
|
-
'class': 'mce-pastebin',
|
|
1336
|
-
'contentEditable': true,
|
|
1337
|
-
'data-mce-bogus': 'all',
|
|
1338
|
-
'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0'
|
|
1339
|
-
}, pasteBinDefaultContent);
|
|
1340
|
-
if (global$a.ie || global$a.gecko) {
|
|
1341
|
-
dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535);
|
|
1342
|
-
}
|
|
1343
|
-
dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {
|
|
1344
|
-
e.stopPropagation();
|
|
1345
|
-
});
|
|
1346
|
-
delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent);
|
|
1347
|
-
pasteBinElm.focus();
|
|
1348
|
-
editor.selection.select(pasteBinElm, true);
|
|
1349
|
-
};
|
|
1350
|
-
var remove = function (editor, lastRngCell) {
|
|
1351
|
-
if (getEl(editor)) {
|
|
1352
|
-
var pasteBinClone = void 0;
|
|
1353
|
-
var lastRng = lastRngCell.get();
|
|
1354
|
-
while (pasteBinClone = editor.dom.get('mcepastebin')) {
|
|
1355
|
-
editor.dom.remove(pasteBinClone);
|
|
1356
|
-
editor.dom.unbind(pasteBinClone);
|
|
1357
|
-
}
|
|
1358
|
-
if (lastRng) {
|
|
1359
|
-
editor.selection.setRng(lastRng);
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
lastRngCell.set(null);
|
|
1363
|
-
};
|
|
1364
|
-
var getEl = function (editor) {
|
|
1365
|
-
return editor.dom.get('mcepastebin');
|
|
1366
|
-
};
|
|
1367
|
-
var getHtml = function (editor) {
|
|
1368
|
-
var copyAndRemove = function (toElm, fromElm) {
|
|
1369
|
-
toElm.appendChild(fromElm);
|
|
1370
|
-
editor.dom.remove(fromElm, true);
|
|
1371
|
-
};
|
|
1372
|
-
var pasteBinClones = global$6.grep(getPasteBinParent(editor).childNodes, function (elm) {
|
|
1373
|
-
return elm.id === 'mcepastebin';
|
|
1374
|
-
});
|
|
1375
|
-
var pasteBinElm = pasteBinClones.shift();
|
|
1376
|
-
global$6.each(pasteBinClones, function (pasteBinClone) {
|
|
1377
|
-
copyAndRemove(pasteBinElm, pasteBinClone);
|
|
1378
|
-
});
|
|
1379
|
-
var dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm);
|
|
1380
|
-
for (var i = dirtyWrappers.length - 1; i >= 0; i--) {
|
|
1381
|
-
var cleanWrapper = editor.dom.create('div');
|
|
1382
|
-
pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]);
|
|
1383
|
-
copyAndRemove(cleanWrapper, dirtyWrappers[i]);
|
|
1384
|
-
}
|
|
1385
|
-
return pasteBinElm ? pasteBinElm.innerHTML : '';
|
|
1386
|
-
};
|
|
1387
|
-
var isDefaultContent = function (pasteBinDefaultContent, content) {
|
|
1388
|
-
return content === pasteBinDefaultContent;
|
|
1389
|
-
};
|
|
1390
|
-
var isPasteBin = function (elm) {
|
|
1391
|
-
return elm && elm.id === 'mcepastebin';
|
|
1392
|
-
};
|
|
1393
|
-
var isDefault = function (editor, pasteBinDefaultContent) {
|
|
1394
|
-
var pasteBinElm = getEl(editor);
|
|
1395
|
-
return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML);
|
|
1396
|
-
};
|
|
1397
|
-
var PasteBin = function (editor) {
|
|
1398
|
-
var lastRng = Cell(null);
|
|
1399
|
-
var pasteBinDefaultContent = '%MCEPASTEBIN%';
|
|
1400
|
-
return {
|
|
1401
|
-
create: function () {
|
|
1402
|
-
return create(editor, lastRng, pasteBinDefaultContent);
|
|
1403
|
-
},
|
|
1404
|
-
remove: function () {
|
|
1405
|
-
return remove(editor, lastRng);
|
|
1406
|
-
},
|
|
1407
|
-
getEl: function () {
|
|
1408
|
-
return getEl(editor);
|
|
1409
|
-
},
|
|
1410
|
-
getHtml: function () {
|
|
1411
|
-
return getHtml(editor);
|
|
1412
|
-
},
|
|
1413
|
-
getLastRng: lastRng.get,
|
|
1414
|
-
isDefault: function () {
|
|
1415
|
-
return isDefault(editor, pasteBinDefaultContent);
|
|
1416
|
-
},
|
|
1417
|
-
isDefaultContent: function (content) {
|
|
1418
|
-
return isDefaultContent(pasteBinDefaultContent, content);
|
|
1419
|
-
}
|
|
1420
|
-
};
|
|
1421
|
-
};
|
|
1422
|
-
|
|
1423
|
-
var Clipboard = function (editor, pasteFormat) {
|
|
1424
|
-
var pasteBin = PasteBin(editor);
|
|
1425
|
-
editor.on('PreInit', function () {
|
|
1426
|
-
return registerEventsAndFilters(editor, pasteBin, pasteFormat);
|
|
1427
|
-
});
|
|
1428
|
-
return {
|
|
1429
|
-
pasteFormat: pasteFormat,
|
|
1430
|
-
pasteHtml: function (html, internalFlag) {
|
|
1431
|
-
return pasteHtml(editor, html, internalFlag);
|
|
1432
|
-
},
|
|
1433
|
-
pasteText: function (text) {
|
|
1434
|
-
return pasteText(editor, text);
|
|
1435
|
-
},
|
|
1436
|
-
pasteImageData: function (e, rng) {
|
|
1437
|
-
return pasteImageData(editor, e, rng);
|
|
1438
|
-
},
|
|
1439
|
-
getDataTransferItems: getDataTransferItems,
|
|
1440
|
-
hasHtmlOrText: hasHtmlOrText,
|
|
1441
|
-
hasContentType: hasContentType
|
|
1442
|
-
};
|
|
1443
|
-
};
|
|
1444
|
-
|
|
1445
|
-
var togglePlainTextPaste = function (editor, clipboard) {
|
|
1446
|
-
if (clipboard.pasteFormat.get() === 'text') {
|
|
1447
|
-
clipboard.pasteFormat.set('html');
|
|
1448
|
-
firePastePlainTextToggle(editor, false);
|
|
1449
|
-
} else {
|
|
1450
|
-
clipboard.pasteFormat.set('text');
|
|
1451
|
-
firePastePlainTextToggle(editor, true);
|
|
1452
|
-
}
|
|
1453
|
-
editor.focus();
|
|
1454
|
-
};
|
|
1455
|
-
|
|
1456
|
-
var register$2 = function (editor, clipboard) {
|
|
1457
|
-
editor.addCommand('mceTogglePlainTextPaste', function () {
|
|
1458
|
-
togglePlainTextPaste(editor, clipboard);
|
|
1459
|
-
});
|
|
1460
|
-
editor.addCommand('mceInsertClipboardContent', function (ui, value) {
|
|
1461
|
-
if (value.content) {
|
|
1462
|
-
clipboard.pasteHtml(value.content, value.internal);
|
|
1463
|
-
}
|
|
1464
|
-
if (value.text) {
|
|
1465
|
-
clipboard.pasteText(value.text);
|
|
1466
|
-
}
|
|
1467
|
-
});
|
|
1468
|
-
};
|
|
1469
|
-
|
|
1470
|
-
var hasWorkingClipboardApi = function (clipboardData) {
|
|
1471
|
-
return global$a.iOS === false && typeof (clipboardData === null || clipboardData === void 0 ? void 0 : clipboardData.setData) === 'function';
|
|
1472
|
-
};
|
|
1473
|
-
var setHtml5Clipboard = function (clipboardData, html, text) {
|
|
1474
|
-
if (hasWorkingClipboardApi(clipboardData)) {
|
|
1475
|
-
try {
|
|
1476
|
-
clipboardData.clearData();
|
|
1477
|
-
clipboardData.setData('text/html', html);
|
|
1478
|
-
clipboardData.setData('text/plain', text);
|
|
1479
|
-
clipboardData.setData(internalHtmlMime(), html);
|
|
1480
|
-
return true;
|
|
1481
|
-
} catch (e) {
|
|
1482
|
-
return false;
|
|
1483
|
-
}
|
|
1484
|
-
} else {
|
|
1485
|
-
return false;
|
|
1486
|
-
}
|
|
1487
|
-
};
|
|
1488
|
-
var setClipboardData = function (evt, data, fallback, done) {
|
|
1489
|
-
if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) {
|
|
1490
|
-
evt.preventDefault();
|
|
1491
|
-
done();
|
|
1492
|
-
} else {
|
|
1493
|
-
fallback(data.html, done);
|
|
1494
|
-
}
|
|
1495
|
-
};
|
|
1496
|
-
var fallback = function (editor) {
|
|
1497
|
-
return function (html, done) {
|
|
1498
|
-
var markedHtml = mark(html);
|
|
1499
|
-
var outer = editor.dom.create('div', {
|
|
1500
|
-
'contenteditable': 'false',
|
|
1501
|
-
'data-mce-bogus': 'all'
|
|
1502
|
-
});
|
|
1503
|
-
var inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml);
|
|
1504
|
-
editor.dom.setStyles(outer, {
|
|
1505
|
-
position: 'fixed',
|
|
1506
|
-
top: '0',
|
|
1507
|
-
left: '-3000px',
|
|
1508
|
-
width: '1000px',
|
|
1509
|
-
overflow: 'hidden'
|
|
1510
|
-
});
|
|
1511
|
-
outer.appendChild(inner);
|
|
1512
|
-
editor.dom.add(editor.getBody(), outer);
|
|
1513
|
-
var range = editor.selection.getRng();
|
|
1514
|
-
inner.focus();
|
|
1515
|
-
var offscreenRange = editor.dom.createRng();
|
|
1516
|
-
offscreenRange.selectNodeContents(inner);
|
|
1517
|
-
editor.selection.setRng(offscreenRange);
|
|
1518
|
-
global$9.setTimeout(function () {
|
|
1519
|
-
editor.selection.setRng(range);
|
|
1520
|
-
outer.parentNode.removeChild(outer);
|
|
1521
|
-
done();
|
|
1522
|
-
}, 0);
|
|
1523
|
-
};
|
|
1524
|
-
};
|
|
1525
|
-
var getData = function (editor) {
|
|
1526
|
-
return {
|
|
1527
|
-
html: editor.selection.getContent({ contextual: true }),
|
|
1528
|
-
text: editor.selection.getContent({ format: 'text' })
|
|
1529
|
-
};
|
|
1530
|
-
};
|
|
1531
|
-
var isTableSelection = function (editor) {
|
|
1532
|
-
return !!editor.dom.getParent(editor.selection.getStart(), 'td[data-mce-selected],th[data-mce-selected]', editor.getBody());
|
|
1533
|
-
};
|
|
1534
|
-
var hasSelectedContent = function (editor) {
|
|
1535
|
-
return !editor.selection.isCollapsed() || isTableSelection(editor);
|
|
1536
|
-
};
|
|
1537
|
-
var cut = function (editor) {
|
|
1538
|
-
return function (evt) {
|
|
1539
|
-
if (hasSelectedContent(editor)) {
|
|
1540
|
-
setClipboardData(evt, getData(editor), fallback(editor), function () {
|
|
1541
|
-
if (global$a.browser.isChrome() || global$a.browser.isFirefox()) {
|
|
1542
|
-
var rng_1 = editor.selection.getRng();
|
|
1543
|
-
global$9.setEditorTimeout(editor, function () {
|
|
1544
|
-
editor.selection.setRng(rng_1);
|
|
1545
|
-
editor.execCommand('Delete');
|
|
1546
|
-
}, 0);
|
|
1547
|
-
} else {
|
|
1548
|
-
editor.execCommand('Delete');
|
|
1549
|
-
}
|
|
1550
|
-
});
|
|
1551
|
-
}
|
|
1552
|
-
};
|
|
1553
|
-
};
|
|
1554
|
-
var copy = function (editor) {
|
|
1555
|
-
return function (evt) {
|
|
1556
|
-
if (hasSelectedContent(editor)) {
|
|
1557
|
-
setClipboardData(evt, getData(editor), fallback(editor), noop);
|
|
1558
|
-
}
|
|
1559
|
-
};
|
|
1560
|
-
};
|
|
1561
|
-
var register$1 = function (editor) {
|
|
1562
|
-
editor.on('cut', cut(editor));
|
|
1563
|
-
editor.on('copy', copy(editor));
|
|
1564
|
-
};
|
|
1565
|
-
|
|
1566
|
-
var global = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
|
|
1567
|
-
|
|
1568
|
-
var getCaretRangeFromEvent = function (editor, e) {
|
|
1569
|
-
return global.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc());
|
|
1570
|
-
};
|
|
1571
|
-
var isPlainTextFileUrl = function (content) {
|
|
1572
|
-
var plainTextContent = content['text/plain'];
|
|
1573
|
-
return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false;
|
|
1574
|
-
};
|
|
1575
|
-
var setFocusedRange = function (editor, rng) {
|
|
1576
|
-
editor.focus();
|
|
1577
|
-
editor.selection.setRng(rng);
|
|
1578
|
-
};
|
|
1579
|
-
var setup$2 = function (editor, clipboard, draggingInternallyState) {
|
|
1580
|
-
if (shouldBlockDrop(editor)) {
|
|
1581
|
-
editor.on('dragend dragover draggesture dragdrop drop drag', function (e) {
|
|
1582
|
-
e.preventDefault();
|
|
1583
|
-
e.stopPropagation();
|
|
1584
|
-
});
|
|
1585
|
-
}
|
|
1586
|
-
if (!shouldPasteDataImages(editor)) {
|
|
1587
|
-
editor.on('drop', function (e) {
|
|
1588
|
-
var dataTransfer = e.dataTransfer;
|
|
1589
|
-
if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
|
|
1590
|
-
e.preventDefault();
|
|
1591
|
-
}
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
editor.on('drop', function (e) {
|
|
1595
|
-
var rng = getCaretRangeFromEvent(editor, e);
|
|
1596
|
-
if (e.isDefaultPrevented() || draggingInternallyState.get()) {
|
|
1597
|
-
return;
|
|
1598
|
-
}
|
|
1599
|
-
var dropContent = clipboard.getDataTransferItems(e.dataTransfer);
|
|
1600
|
-
var internal = clipboard.hasContentType(dropContent, internalHtmlMime());
|
|
1601
|
-
if ((!clipboard.hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && clipboard.pasteImageData(e, rng)) {
|
|
1602
|
-
return;
|
|
1603
|
-
}
|
|
1604
|
-
if (rng && shouldFilterDrop(editor)) {
|
|
1605
|
-
var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];
|
|
1606
|
-
if (content_1) {
|
|
1607
|
-
e.preventDefault();
|
|
1608
|
-
global$9.setEditorTimeout(editor, function () {
|
|
1609
|
-
editor.undoManager.transact(function () {
|
|
1610
|
-
if (dropContent['mce-internal']) {
|
|
1611
|
-
editor.execCommand('Delete');
|
|
1612
|
-
}
|
|
1613
|
-
setFocusedRange(editor, rng);
|
|
1614
|
-
content_1 = trimHtml(content_1);
|
|
1615
|
-
if (!dropContent['text/html']) {
|
|
1616
|
-
clipboard.pasteText(content_1);
|
|
1617
|
-
} else {
|
|
1618
|
-
clipboard.pasteHtml(content_1, internal);
|
|
1619
|
-
}
|
|
1620
|
-
});
|
|
1621
|
-
});
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
});
|
|
1625
|
-
editor.on('dragstart', function (_e) {
|
|
1626
|
-
draggingInternallyState.set(true);
|
|
1627
|
-
});
|
|
1628
|
-
editor.on('dragover dragend', function (e) {
|
|
1629
|
-
if (shouldPasteDataImages(editor) && draggingInternallyState.get() === false) {
|
|
1630
|
-
e.preventDefault();
|
|
1631
|
-
setFocusedRange(editor, getCaretRangeFromEvent(editor, e));
|
|
1632
|
-
}
|
|
1633
|
-
if (e.type === 'dragend') {
|
|
1634
|
-
draggingInternallyState.set(false);
|
|
1635
|
-
}
|
|
1636
|
-
});
|
|
1637
|
-
};
|
|
1638
|
-
|
|
1639
|
-
var setup$1 = function (editor) {
|
|
1640
|
-
var plugin = editor.plugins.paste;
|
|
1641
|
-
var preProcess = getPreProcess(editor);
|
|
1642
|
-
if (preProcess) {
|
|
1643
|
-
editor.on('PastePreProcess', function (e) {
|
|
1644
|
-
preProcess.call(plugin, plugin, e);
|
|
1645
|
-
});
|
|
1646
|
-
}
|
|
1647
|
-
var postProcess = getPostProcess(editor);
|
|
1648
|
-
if (postProcess) {
|
|
1649
|
-
editor.on('PastePostProcess', function (e) {
|
|
1650
|
-
postProcess.call(plugin, plugin, e);
|
|
1651
|
-
});
|
|
1652
|
-
}
|
|
1653
|
-
};
|
|
1654
|
-
|
|
1655
|
-
var addPreProcessFilter = function (editor, filterFunc) {
|
|
1656
|
-
editor.on('PastePreProcess', function (e) {
|
|
1657
|
-
e.content = filterFunc(editor, e.content, e.internal, e.wordContent);
|
|
1658
|
-
});
|
|
1659
|
-
};
|
|
1660
|
-
var addPostProcessFilter = function (editor, filterFunc) {
|
|
1661
|
-
editor.on('PastePostProcess', function (e) {
|
|
1662
|
-
filterFunc(editor, e.node);
|
|
1663
|
-
});
|
|
1664
|
-
};
|
|
1665
|
-
var removeExplorerBrElementsAfterBlocks = function (editor, html) {
|
|
1666
|
-
if (!isWordContent(html)) {
|
|
1667
|
-
return html;
|
|
1668
|
-
}
|
|
1669
|
-
var blockElements = [];
|
|
1670
|
-
global$6.each(editor.schema.getBlockElements(), function (block, blockName) {
|
|
1671
|
-
blockElements.push(blockName);
|
|
1672
|
-
});
|
|
1673
|
-
var explorerBlocksRegExp = new RegExp('(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*', 'g');
|
|
1674
|
-
html = filter(html, [[
|
|
1675
|
-
explorerBlocksRegExp,
|
|
1676
|
-
'$1'
|
|
1677
|
-
]]);
|
|
1678
|
-
html = filter(html, [
|
|
1679
|
-
[
|
|
1680
|
-
/<br><br>/g,
|
|
1681
|
-
'<BR><BR>'
|
|
1682
|
-
],
|
|
1683
|
-
[
|
|
1684
|
-
/<br>/g,
|
|
1685
|
-
' '
|
|
1686
|
-
],
|
|
1687
|
-
[
|
|
1688
|
-
/<BR><BR>/g,
|
|
1689
|
-
'<br>'
|
|
1690
|
-
]
|
|
1691
|
-
]);
|
|
1692
|
-
return html;
|
|
1693
|
-
};
|
|
1694
|
-
var removeWebKitStyles = function (editor, content, internal, isWordHtml) {
|
|
1695
|
-
if (isWordHtml || internal) {
|
|
1696
|
-
return content;
|
|
1697
|
-
}
|
|
1698
|
-
var webKitStylesSetting = getWebkitStyles(editor);
|
|
1699
|
-
var webKitStyles;
|
|
1700
|
-
if (shouldRemoveWebKitStyles(editor) === false || webKitStylesSetting === 'all') {
|
|
1701
|
-
return content;
|
|
1702
|
-
}
|
|
1703
|
-
if (webKitStylesSetting) {
|
|
1704
|
-
webKitStyles = webKitStylesSetting.split(/[, ]/);
|
|
1705
|
-
}
|
|
1706
|
-
if (webKitStyles) {
|
|
1707
|
-
var dom_1 = editor.dom, node_1 = editor.selection.getNode();
|
|
1708
|
-
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function (all, before, value, after) {
|
|
1709
|
-
var inputStyles = dom_1.parseStyle(dom_1.decode(value));
|
|
1710
|
-
var outputStyles = {};
|
|
1711
|
-
if (webKitStyles === 'none') {
|
|
1712
|
-
return before + after;
|
|
1713
|
-
}
|
|
1714
|
-
for (var i = 0; i < webKitStyles.length; i++) {
|
|
1715
|
-
var inputValue = inputStyles[webKitStyles[i]], currentValue = dom_1.getStyle(node_1, webKitStyles[i], true);
|
|
1716
|
-
if (/color/.test(webKitStyles[i])) {
|
|
1717
|
-
inputValue = dom_1.toHex(inputValue);
|
|
1718
|
-
currentValue = dom_1.toHex(currentValue);
|
|
1719
|
-
}
|
|
1720
|
-
if (currentValue !== inputValue) {
|
|
1721
|
-
outputStyles[webKitStyles[i]] = inputValue;
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
var outputStyle = dom_1.serializeStyle(outputStyles, 'span');
|
|
1725
|
-
if (outputStyle) {
|
|
1726
|
-
return before + ' style="' + outputStyle + '"' + after;
|
|
1727
|
-
}
|
|
1728
|
-
return before + after;
|
|
1729
|
-
});
|
|
1730
|
-
} else {
|
|
1731
|
-
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');
|
|
1732
|
-
}
|
|
1733
|
-
content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function (all, before, value, after) {
|
|
1734
|
-
return before + ' style="' + value + '"' + after;
|
|
1735
|
-
});
|
|
1736
|
-
return content;
|
|
1737
|
-
};
|
|
1738
|
-
var removeUnderlineAndFontInAnchor = function (editor, root) {
|
|
1739
|
-
editor.$('a', root).find('font,u').each(function (i, node) {
|
|
1740
|
-
editor.dom.remove(node, true);
|
|
1741
|
-
});
|
|
1742
|
-
};
|
|
1743
|
-
var setup = function (editor) {
|
|
1744
|
-
if (global$a.webkit) {
|
|
1745
|
-
addPreProcessFilter(editor, removeWebKitStyles);
|
|
1746
|
-
}
|
|
1747
|
-
if (global$a.ie) {
|
|
1748
|
-
addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks);
|
|
1749
|
-
addPostProcessFilter(editor, removeUnderlineAndFontInAnchor);
|
|
1750
|
-
}
|
|
1751
|
-
};
|
|
1752
|
-
|
|
1753
|
-
var makeSetupHandler = function (editor, clipboard) {
|
|
1754
|
-
return function (api) {
|
|
1755
|
-
api.setActive(clipboard.pasteFormat.get() === 'text');
|
|
1756
|
-
var pastePlainTextToggleHandler = function (e) {
|
|
1757
|
-
return api.setActive(e.state);
|
|
1758
|
-
};
|
|
1759
|
-
editor.on('PastePlainTextToggle', pastePlainTextToggleHandler);
|
|
1760
|
-
return function () {
|
|
1761
|
-
return editor.off('PastePlainTextToggle', pastePlainTextToggleHandler);
|
|
1762
|
-
};
|
|
1763
|
-
};
|
|
1764
|
-
};
|
|
1765
|
-
var register = function (editor, clipboard) {
|
|
1766
|
-
var onAction = function () {
|
|
1767
|
-
return editor.execCommand('mceTogglePlainTextPaste');
|
|
1768
|
-
};
|
|
1769
|
-
editor.ui.registry.addToggleButton('pastetext', {
|
|
1770
|
-
active: false,
|
|
1771
|
-
icon: 'paste-text',
|
|
1772
|
-
tooltip: 'Paste as text',
|
|
1773
|
-
onAction: onAction,
|
|
1774
|
-
onSetup: makeSetupHandler(editor, clipboard)
|
|
1775
|
-
});
|
|
1776
|
-
editor.ui.registry.addToggleMenuItem('pastetext', {
|
|
1777
|
-
text: 'Paste as text',
|
|
1778
|
-
icon: 'paste-text',
|
|
1779
|
-
onAction: onAction,
|
|
1780
|
-
onSetup: makeSetupHandler(editor, clipboard)
|
|
1781
|
-
});
|
|
1782
|
-
};
|
|
1783
|
-
|
|
1784
|
-
function Plugin () {
|
|
1785
|
-
global$b.add('paste', function (editor) {
|
|
1786
|
-
if (hasProPlugin(editor) === false) {
|
|
1787
|
-
var draggingInternallyState = Cell(false);
|
|
1788
|
-
var pasteFormat = Cell(isPasteAsTextEnabled(editor) ? 'text' : 'html');
|
|
1789
|
-
var clipboard = Clipboard(editor, pasteFormat);
|
|
1790
|
-
setup(editor);
|
|
1791
|
-
register(editor, clipboard);
|
|
1792
|
-
register$2(editor, clipboard);
|
|
1793
|
-
setup$1(editor);
|
|
1794
|
-
register$1(editor);
|
|
1795
|
-
setup$2(editor, clipboard, draggingInternallyState);
|
|
1796
|
-
return get(clipboard);
|
|
1797
|
-
}
|
|
1798
|
-
});
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
Plugin();
|
|
1802
|
-
|
|
1803
|
-
}());
|