@sapui5/sap.ui.richtexteditor 1.112.2 → 1.114.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/sap/ui/richtexteditor/.library +2 -2
- package/src/sap/ui/richtexteditor/RTESplitButton.js +1 -1
- package/src/sap/ui/richtexteditor/RichTextEditor.js +5 -1
- package/src/sap/ui/richtexteditor/ToolbarWrapper.js +7 -8
- package/src/sap/ui/richtexteditor/js/tiny_mce6/icons/default/icons.js +4 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/icons/default/icons.min.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/ar.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/bg_BG.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/ca.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/cs.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/cy.js +0 -6
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/da.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/de.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/dv.js +0 -6
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/el.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/es.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/es_MX.js +1 -7
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/et.js +0 -6
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/eu.js +7 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/fa.js +7 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/fi.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/fr_FR.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/he_IL.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/hi.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/hr.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/hu_HU.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/id.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/it.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/ja.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/kk.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/ko_KR.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/lt.js +1 -7
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/lv.js +0 -6
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/ms.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/nb_NO.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/nl.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/pl.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/pt_BR.js +7 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/pt_PT.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/ro.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/ru.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/sk.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/sl_SI.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/sr.js +0 -6
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/sv_SE.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/th_TH.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/tr.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/uk.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/vi.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/zh_CN.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/langs/zh_TW.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/models/dom/model.js +14 -10
- package/src/sap/ui/richtexteditor/js/tiny_mce6/models/dom/model.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/CHANGELOG.md +7 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/codemirror.min.css +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/codemirror.min.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/customeditor.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/customeditor.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/ar.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/bg_BG.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/ca.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/cs.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/da.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/de.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/el.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/es.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/eu.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/fa.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/fi.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/fr_FR.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/he_IL.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/hi.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/hr.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/hu_HU.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/id.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/it.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/ja.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/kk.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/ko_KR.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/ms.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/nb_NO.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/nl.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/pl.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/pt_BR.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/pt_PT.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/ro.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/ru.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/sk.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/sl_SI.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/sv_SE.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/th_TH.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/tr.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/uk.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/vi.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/zh_CN.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/langs/zh_TW.js +10 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/plugin.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/readme.txt +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advcode/version.txt +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advlist/plugin.js +16 -9
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/advlist/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/anchor/plugin.js +7 -6
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/anchor/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/autolink/plugin.js +131 -107
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/autolink/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/autoresize/plugin.js +3 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/autoresize/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/autosave/plugin.js +11 -10
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/autosave/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/charmap/plugin.js +17 -7
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/charmap/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/code/plugin.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/code/plugin.min.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/codesample/plugin.js +23 -10
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/codesample/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/directionality/plugin.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/directionality/plugin.min.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/emoticons/plugin.js +10 -4
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/emoticons/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/fullscreen/plugin.js +11 -5
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/fullscreen/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/help/plugin.js +107 -24
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/help/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/image/plugin.js +50 -37
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/image/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/importcss/plugin.js +8 -6
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/importcss/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/insertdatetime/plugin.js +2 -3
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/insertdatetime/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/link/plugin.js +68 -45
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/link/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/lists/plugin.js +120 -74
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/lists/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/media/plugin.js +39 -24
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/media/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/nonbreaking/plugin.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/nonbreaking/plugin.min.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/pagebreak/plugin.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/pagebreak/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/powerpaste/CHANGELOG.md +13 -5
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/powerpaste/js/wordimport.js +2850 -1729
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/powerpaste/plugin.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/powerpaste/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/powerpaste/readme.txt +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/powerpaste/version.txt +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/preview/plugin.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/preview/plugin.min.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/quickbars/plugin.js +21 -13
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/quickbars/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/save/plugin.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/save/plugin.min.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/searchreplace/plugin.js +13 -13
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/searchreplace/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/table/plugin.js +42 -37
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/table/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/template/plugin.js +7 -4
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/template/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/visualblocks/plugin.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/visualblocks/plugin.min.js +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/visualchars/plugin.js +9 -6
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/visualchars/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/wordcount/plugin.js +6 -5
- package/src/sap/ui/richtexteditor/js/tiny_mce6/plugins/wordcount/plugin.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/readme.txt +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide/content.css +31 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide/content.inline.css +31 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide/content.inline.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide/content.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide/skin.css +155 -46
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide/skin.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide-dark/content.css +31 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide-dark/content.inline.css +31 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide-dark/content.inline.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide-dark/content.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide-dark/skin.css +149 -40
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/oxide-dark/skin.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5/content.css +31 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5/content.inline.css +31 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5/content.inline.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5/content.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5/skin.css +164 -46
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5/skin.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5-dark/content.css +31 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5-dark/content.inline.css +31 -0
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5-dark/content.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5-dark/skin.css +157 -39
- package/src/sap/ui/richtexteditor/js/tiny_mce6/skins/ui/tinymce-5-dark/skin.min.css +1 -1
- package/src/sap/ui/richtexteditor/js/tiny_mce6/themes/silver/theme.js +6039 -3529
- package/src/sap/ui/richtexteditor/js/tiny_mce6/themes/silver/theme.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/tinymce.d.ts +406 -185
- package/src/sap/ui/richtexteditor/js/tiny_mce6/tinymce.js +3915 -3078
- package/src/sap/ui/richtexteditor/js/tiny_mce6/tinymce.min.js +2 -2
- package/src/sap/ui/richtexteditor/js/tiny_mce6/version.txt +1 -1
- package/src/sap/ui/richtexteditor/library.js +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc.
|
|
5
5
|
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
|
|
6
6
|
*
|
|
7
|
-
* Version: 6.1
|
|
7
|
+
* Version: 6.3.1
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function () {
|
|
@@ -277,30 +277,30 @@
|
|
|
277
277
|
console.error(message, html);
|
|
278
278
|
throw new Error(message);
|
|
279
279
|
}
|
|
280
|
-
return fromDom(div.childNodes[0]);
|
|
280
|
+
return fromDom$1(div.childNodes[0]);
|
|
281
281
|
};
|
|
282
282
|
const fromTag = (tag, scope) => {
|
|
283
283
|
const doc = scope || document;
|
|
284
284
|
const node = doc.createElement(tag);
|
|
285
|
-
return fromDom(node);
|
|
285
|
+
return fromDom$1(node);
|
|
286
286
|
};
|
|
287
287
|
const fromText = (text, scope) => {
|
|
288
288
|
const doc = scope || document;
|
|
289
289
|
const node = doc.createTextNode(text);
|
|
290
|
-
return fromDom(node);
|
|
290
|
+
return fromDom$1(node);
|
|
291
291
|
};
|
|
292
|
-
const fromDom = node => {
|
|
292
|
+
const fromDom$1 = node => {
|
|
293
293
|
if (node === null || node === undefined) {
|
|
294
294
|
throw new Error('Node cannot be null or undefined');
|
|
295
295
|
}
|
|
296
296
|
return { dom: node };
|
|
297
297
|
};
|
|
298
|
-
const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
|
|
298
|
+
const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom$1);
|
|
299
299
|
const SugarElement = {
|
|
300
300
|
fromHtml,
|
|
301
301
|
fromTag,
|
|
302
302
|
fromText,
|
|
303
|
-
fromDom,
|
|
303
|
+
fromDom: fromDom$1,
|
|
304
304
|
fromPoint
|
|
305
305
|
};
|
|
306
306
|
|
|
@@ -350,10 +350,11 @@
|
|
|
350
350
|
};
|
|
351
351
|
const type = element => element.dom.nodeType;
|
|
352
352
|
const isType = t => element => type(element) === t;
|
|
353
|
-
const isElement = isType(ELEMENT);
|
|
354
|
-
const isTag = tag => e => isElement(e) && name(e) === tag;
|
|
353
|
+
const isElement$1 = isType(ELEMENT);
|
|
354
|
+
const isTag = tag => e => isElement$1(e) && name(e) === tag;
|
|
355
355
|
|
|
356
356
|
const parent = element => Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
|
|
357
|
+
const parentElement = element => Optional.from(element.dom.parentElement).map(SugarElement.fromDom);
|
|
357
358
|
const nextSibling = element => Optional.from(element.dom.nextSibling).map(SugarElement.fromDom);
|
|
358
359
|
const children = element => map(element.dom.childNodes, SugarElement.fromDom);
|
|
359
360
|
const child = (element, index) => {
|
|
@@ -433,6 +434,8 @@
|
|
|
433
434
|
|
|
434
435
|
var global$3 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
|
435
436
|
|
|
437
|
+
const fromDom = nodes => map(nodes, SugarElement.fromDom);
|
|
438
|
+
|
|
436
439
|
const keys = Object.keys;
|
|
437
440
|
const each = (obj, f) => {
|
|
438
441
|
const props = keys(obj);
|
|
@@ -446,11 +449,9 @@
|
|
|
446
449
|
r[i] = x;
|
|
447
450
|
};
|
|
448
451
|
const internalFilter = (obj, pred, onTrue, onFalse) => {
|
|
449
|
-
const r = {};
|
|
450
452
|
each(obj, (x, i) => {
|
|
451
453
|
(pred(x, i) ? onTrue : onFalse)(x, i);
|
|
452
454
|
});
|
|
453
|
-
return r;
|
|
454
455
|
};
|
|
455
456
|
const filter = (obj, pred) => {
|
|
456
457
|
const t = {};
|
|
@@ -498,9 +499,10 @@
|
|
|
498
499
|
|
|
499
500
|
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
500
501
|
|
|
501
|
-
const matchNodeName = name => node => node && node.nodeName.toLowerCase() === name;
|
|
502
|
-
const matchNodeNames = regex => node => node && regex.test(node.nodeName);
|
|
503
|
-
const isTextNode = node => node && node.nodeType === 3;
|
|
502
|
+
const matchNodeName = name => node => isNonNullable(node) && node.nodeName.toLowerCase() === name;
|
|
503
|
+
const matchNodeNames = regex => node => isNonNullable(node) && regex.test(node.nodeName);
|
|
504
|
+
const isTextNode = node => isNonNullable(node) && node.nodeType === 3;
|
|
505
|
+
const isElement = node => isNonNullable(node) && node.nodeType === 1;
|
|
504
506
|
const isListNode = matchNodeNames(/^(OL|UL|DL)$/);
|
|
505
507
|
const isOlUlNode = matchNodeNames(/^(OL|UL)$/);
|
|
506
508
|
const isOlNode = matchNodeName('ol');
|
|
@@ -508,9 +510,12 @@
|
|
|
508
510
|
const isDlItemNode = matchNodeNames(/^(DT|DD)$/);
|
|
509
511
|
const isTableCellNode = matchNodeNames(/^(TH|TD)$/);
|
|
510
512
|
const isBr = matchNodeName('br');
|
|
511
|
-
const isFirstChild = node =>
|
|
512
|
-
|
|
513
|
-
|
|
513
|
+
const isFirstChild = node => {
|
|
514
|
+
var _a;
|
|
515
|
+
return ((_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.firstChild) === node;
|
|
516
|
+
};
|
|
517
|
+
const isTextBlock = (editor, node) => isNonNullable(node) && node.nodeName in editor.schema.getTextBlockElements();
|
|
518
|
+
const isBlock = (node, blockElements) => isNonNullable(node) && node.nodeName in blockElements;
|
|
514
519
|
const isBogusBr = (dom, node) => {
|
|
515
520
|
if (!isBr(node)) {
|
|
516
521
|
return false;
|
|
@@ -544,7 +549,9 @@
|
|
|
544
549
|
const fragment = dom.createFragment();
|
|
545
550
|
const blockName = getForcedRootBlock(editor);
|
|
546
551
|
const blockAttrs = getForcedRootBlockAttrs(editor);
|
|
547
|
-
let node
|
|
552
|
+
let node;
|
|
553
|
+
let textBlock;
|
|
554
|
+
let hasContentNode = false;
|
|
548
555
|
textBlock = dom.create(blockName, blockAttrs);
|
|
549
556
|
if (!isBlock(contentNode.firstChild, blockElements)) {
|
|
550
557
|
fragment.appendChild(textBlock);
|
|
@@ -565,7 +572,7 @@
|
|
|
565
572
|
textBlock.appendChild(node);
|
|
566
573
|
}
|
|
567
574
|
}
|
|
568
|
-
if (!hasContentNode) {
|
|
575
|
+
if (!hasContentNode && textBlock) {
|
|
569
576
|
textBlock.appendChild(dom.create('br', { 'data-mce-bogus': '1' }));
|
|
570
577
|
}
|
|
571
578
|
return fragment;
|
|
@@ -574,9 +581,12 @@
|
|
|
574
581
|
const DOM$2 = global$2.DOM;
|
|
575
582
|
const splitList = (editor, list, li) => {
|
|
576
583
|
const removeAndKeepBookmarks = targetNode => {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
584
|
+
const parent = targetNode.parentNode;
|
|
585
|
+
if (parent) {
|
|
586
|
+
global$1.each(bookmarks, node => {
|
|
587
|
+
parent.insertBefore(node, li.parentNode);
|
|
588
|
+
});
|
|
589
|
+
}
|
|
580
590
|
DOM$2.remove(targetNode);
|
|
581
591
|
};
|
|
582
592
|
const bookmarks = DOM$2.select('span[data-mce-type="bookmark"]', list);
|
|
@@ -595,8 +605,9 @@
|
|
|
595
605
|
DOM$2.insertAfter(fragment, list);
|
|
596
606
|
}
|
|
597
607
|
DOM$2.insertAfter(newBlock, list);
|
|
598
|
-
|
|
599
|
-
|
|
608
|
+
const parent = li.parentElement;
|
|
609
|
+
if (parent && isEmpty$1(editor.dom, parent)) {
|
|
610
|
+
removeAndKeepBookmarks(parent);
|
|
600
611
|
}
|
|
601
612
|
DOM$2.remove(li);
|
|
602
613
|
if (isEmpty$1(editor.dom, list)) {
|
|
@@ -610,7 +621,7 @@
|
|
|
610
621
|
if (isDescriptionDetail(item)) {
|
|
611
622
|
mutate(item, 'dt');
|
|
612
623
|
} else if (isDescriptionTerm(item)) {
|
|
613
|
-
|
|
624
|
+
parentElement(item).each(dl => splitList(editor, dl.dom, item.dom));
|
|
614
625
|
}
|
|
615
626
|
};
|
|
616
627
|
const indentDlItem = item => {
|
|
@@ -674,7 +685,7 @@
|
|
|
674
685
|
const selectionStart = node || editor.selection.getStart(true);
|
|
675
686
|
return editor.dom.getParent(selectionStart, listSelector, getClosestListHost(editor, selectionStart));
|
|
676
687
|
};
|
|
677
|
-
const isParentListSelected = (parentList, selectedBlocks) => parentList && selectedBlocks.length === 1 && selectedBlocks[0] === parentList;
|
|
688
|
+
const isParentListSelected = (parentList, selectedBlocks) => isNonNullable(parentList) && selectedBlocks.length === 1 && selectedBlocks[0] === parentList;
|
|
678
689
|
const findSubLists = parentList => filter$1(parentList.querySelectorAll(listSelector), isListNode);
|
|
679
690
|
const getSelectedSubLists = editor => {
|
|
680
691
|
const parentList = getParentList(editor);
|
|
@@ -727,6 +738,27 @@
|
|
|
727
738
|
return unique(listRoots);
|
|
728
739
|
};
|
|
729
740
|
|
|
741
|
+
const isCustomList = list => /\btox\-/.test(list.className);
|
|
742
|
+
const inList = (parents, listName) => findUntil(parents, isListNode, isTableCellNode).exists(list => list.nodeName === listName && !isCustomList(list));
|
|
743
|
+
const isWithinNonEditable = (editor, element) => element !== null && editor.dom.getContentEditableParent(element) === 'false';
|
|
744
|
+
const selectionIsWithinNonEditableList = editor => {
|
|
745
|
+
const parentList = getParentList(editor);
|
|
746
|
+
return isWithinNonEditable(editor, parentList);
|
|
747
|
+
};
|
|
748
|
+
const isWithinNonEditableList = (editor, element) => {
|
|
749
|
+
const parentList = editor.dom.getParent(element, 'ol,ul,dl');
|
|
750
|
+
return isWithinNonEditable(editor, parentList);
|
|
751
|
+
};
|
|
752
|
+
const setNodeChangeHandler = (editor, nodeChangeHandler) => {
|
|
753
|
+
const initialNode = editor.selection.getNode();
|
|
754
|
+
nodeChangeHandler({
|
|
755
|
+
parents: editor.dom.getParents(initialNode),
|
|
756
|
+
element: initialNode
|
|
757
|
+
});
|
|
758
|
+
editor.on('NodeChange', nodeChangeHandler);
|
|
759
|
+
return () => editor.off('NodeChange', nodeChangeHandler);
|
|
760
|
+
};
|
|
761
|
+
|
|
730
762
|
const fromElements = (elements, scope) => {
|
|
731
763
|
const doc = scope || document;
|
|
732
764
|
const fragment = doc.createDocumentFragment();
|
|
@@ -848,7 +880,7 @@
|
|
|
848
880
|
const content = hasLastChildList(li) ? children$1.slice(0, -1) : children$1;
|
|
849
881
|
return map(content, deep);
|
|
850
882
|
};
|
|
851
|
-
const createEntry = (li, depth, isSelected) => parent(li).filter(isElement).map(list => ({
|
|
883
|
+
const createEntry = (li, depth, isSelected) => parent(li).filter(isElement$1).map(list => ({
|
|
852
884
|
depth,
|
|
853
885
|
dirty: false,
|
|
854
886
|
isSelected,
|
|
@@ -978,8 +1010,8 @@
|
|
|
978
1010
|
};
|
|
979
1011
|
|
|
980
1012
|
const selectionIndentation = (editor, indentation) => {
|
|
981
|
-
const lists =
|
|
982
|
-
const dlItems =
|
|
1013
|
+
const lists = fromDom(getSelectedListRoots(editor));
|
|
1014
|
+
const dlItems = fromDom(getSelectedDlItems(editor));
|
|
983
1015
|
let isHandled = false;
|
|
984
1016
|
if (lists.length || dlItems.length) {
|
|
985
1017
|
const bookmark = editor.selection.getBookmark();
|
|
@@ -992,9 +1024,10 @@
|
|
|
992
1024
|
}
|
|
993
1025
|
return isHandled;
|
|
994
1026
|
};
|
|
995
|
-
const
|
|
996
|
-
const
|
|
997
|
-
const
|
|
1027
|
+
const handleIndentation = (editor, indentation) => !selectionIsWithinNonEditableList(editor) && selectionIndentation(editor, indentation);
|
|
1028
|
+
const indentListSelection = editor => handleIndentation(editor, 'Indent');
|
|
1029
|
+
const outdentListSelection = editor => handleIndentation(editor, 'Outdent');
|
|
1030
|
+
const flattenListSelection = editor => handleIndentation(editor, 'Flatten');
|
|
998
1031
|
|
|
999
1032
|
var global = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager');
|
|
1000
1033
|
|
|
@@ -1004,7 +1037,7 @@
|
|
|
1004
1037
|
const setupEndPoint = start => {
|
|
1005
1038
|
let container = rng[start ? 'startContainer' : 'endContainer'];
|
|
1006
1039
|
let offset = rng[start ? 'startOffset' : 'endOffset'];
|
|
1007
|
-
if (container
|
|
1040
|
+
if (isElement(container)) {
|
|
1008
1041
|
const offsetNode = DOM$1.create('span', { 'data-mce-type': 'bookmark' });
|
|
1009
1042
|
if (container.hasChildNodes()) {
|
|
1010
1043
|
offset = Math.min(offset, container.childNodes.length - 1);
|
|
@@ -1030,26 +1063,28 @@
|
|
|
1030
1063
|
};
|
|
1031
1064
|
const resolveBookmark = bookmark => {
|
|
1032
1065
|
const restoreEndPoint = start => {
|
|
1033
|
-
let node;
|
|
1034
1066
|
const nodeIndex = container => {
|
|
1035
|
-
|
|
1067
|
+
var _a;
|
|
1068
|
+
let node = (_a = container.parentNode) === null || _a === void 0 ? void 0 : _a.firstChild;
|
|
1069
|
+
let idx = 0;
|
|
1036
1070
|
while (node) {
|
|
1037
1071
|
if (node === container) {
|
|
1038
1072
|
return idx;
|
|
1039
1073
|
}
|
|
1040
|
-
if (node
|
|
1074
|
+
if (!isElement(node) || node.getAttribute('data-mce-type') !== 'bookmark') {
|
|
1041
1075
|
idx++;
|
|
1042
1076
|
}
|
|
1043
1077
|
node = node.nextSibling;
|
|
1044
1078
|
}
|
|
1045
1079
|
return -1;
|
|
1046
1080
|
};
|
|
1047
|
-
let container =
|
|
1081
|
+
let container = bookmark[start ? 'startContainer' : 'endContainer'];
|
|
1048
1082
|
let offset = bookmark[start ? 'startOffset' : 'endOffset'];
|
|
1049
1083
|
if (!container) {
|
|
1050
1084
|
return;
|
|
1051
1085
|
}
|
|
1052
|
-
if (container
|
|
1086
|
+
if (isElement(container) && container.parentNode) {
|
|
1087
|
+
const node = container;
|
|
1053
1088
|
offset = nodeIndex(container);
|
|
1054
1089
|
container = container.parentNode;
|
|
1055
1090
|
DOM$1.remove(node);
|
|
@@ -1081,18 +1116,6 @@
|
|
|
1081
1116
|
}
|
|
1082
1117
|
};
|
|
1083
1118
|
|
|
1084
|
-
const isCustomList = list => /\btox\-/.test(list.className);
|
|
1085
|
-
const listState = (editor, listName, activate) => {
|
|
1086
|
-
const nodeChangeHandler = e => {
|
|
1087
|
-
const inList = findUntil(e.parents, isListNode, isTableCellNode).filter(list => list.nodeName === listName && !isCustomList(list)).isSome();
|
|
1088
|
-
activate(inList);
|
|
1089
|
-
};
|
|
1090
|
-
const parents = editor.dom.getParents(editor.selection.getNode());
|
|
1091
|
-
nodeChangeHandler({ parents });
|
|
1092
|
-
editor.on('NodeChange', nodeChangeHandler);
|
|
1093
|
-
return () => editor.off('NodeChange', nodeChangeHandler);
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
1119
|
const updateListStyle = (dom, el, detail) => {
|
|
1097
1120
|
const type = detail['list-style-type'] ? detail['list-style-type'] : null;
|
|
1098
1121
|
dom.setStyle(el, 'list-style-type', type);
|
|
@@ -1118,20 +1141,21 @@
|
|
|
1118
1141
|
const getEndPointNode = (editor, rng, start, root) => {
|
|
1119
1142
|
let container = rng[start ? 'startContainer' : 'endContainer'];
|
|
1120
1143
|
const offset = rng[start ? 'startOffset' : 'endOffset'];
|
|
1121
|
-
if (container
|
|
1144
|
+
if (isElement(container)) {
|
|
1122
1145
|
container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
|
|
1123
1146
|
}
|
|
1124
1147
|
if (!start && isBr(container.nextSibling)) {
|
|
1125
1148
|
container = container.nextSibling;
|
|
1126
1149
|
}
|
|
1127
1150
|
while (container.parentNode !== root) {
|
|
1151
|
+
const parent = container.parentNode;
|
|
1128
1152
|
if (isTextBlock(editor, container)) {
|
|
1129
1153
|
return container;
|
|
1130
1154
|
}
|
|
1131
|
-
if (/^(TD|TH)$/.test(
|
|
1155
|
+
if (/^(TD|TH)$/.test(parent.nodeName)) {
|
|
1132
1156
|
return container;
|
|
1133
1157
|
}
|
|
1134
|
-
container =
|
|
1158
|
+
container = parent;
|
|
1135
1159
|
}
|
|
1136
1160
|
return container;
|
|
1137
1161
|
};
|
|
@@ -1149,6 +1173,7 @@
|
|
|
1149
1173
|
}
|
|
1150
1174
|
}
|
|
1151
1175
|
global$1.each(siblings, node => {
|
|
1176
|
+
var _a;
|
|
1152
1177
|
if (isTextBlock(editor, node)) {
|
|
1153
1178
|
textBlocks.push(node);
|
|
1154
1179
|
block = null;
|
|
@@ -1170,7 +1195,7 @@
|
|
|
1170
1195
|
}
|
|
1171
1196
|
if (!block) {
|
|
1172
1197
|
block = dom.create('p');
|
|
1173
|
-
node.parentNode.insertBefore(block, node);
|
|
1198
|
+
(_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(block, node);
|
|
1174
1199
|
textBlocks.push(block);
|
|
1175
1200
|
}
|
|
1176
1201
|
block.appendChild(node);
|
|
@@ -1208,7 +1233,7 @@
|
|
|
1208
1233
|
sibling.appendChild(block);
|
|
1209
1234
|
} else {
|
|
1210
1235
|
listBlock = dom.create(listName);
|
|
1211
|
-
|
|
1236
|
+
parent.insertBefore(listBlock, block);
|
|
1212
1237
|
listBlock.appendChild(block);
|
|
1213
1238
|
block = dom.rename(block, listItemName);
|
|
1214
1239
|
}
|
|
@@ -1231,7 +1256,7 @@
|
|
|
1231
1256
|
editor.selection.setRng(resolveBookmark(bookmark));
|
|
1232
1257
|
};
|
|
1233
1258
|
const isValidLists = (list1, list2) => {
|
|
1234
|
-
return
|
|
1259
|
+
return isListNode(list1) && list1.nodeName === (list2 === null || list2 === void 0 ? void 0 : list2.nodeName);
|
|
1235
1260
|
};
|
|
1236
1261
|
const hasSameListStyle = (dom, list1, list2) => {
|
|
1237
1262
|
const targetStyle = dom.getStyle(list1, 'list-style-type', true);
|
|
@@ -1245,20 +1270,22 @@
|
|
|
1245
1270
|
return isValidLists(list1, list2) && hasSameListStyle(dom, list1, list2) && hasSameClasses(list1, list2);
|
|
1246
1271
|
};
|
|
1247
1272
|
const mergeWithAdjacentLists = (dom, listBlock) => {
|
|
1248
|
-
let
|
|
1249
|
-
sibling = listBlock.nextSibling;
|
|
1273
|
+
let node;
|
|
1274
|
+
let sibling = listBlock.nextSibling;
|
|
1250
1275
|
if (shouldMerge(dom, listBlock, sibling)) {
|
|
1251
|
-
|
|
1276
|
+
const liSibling = sibling;
|
|
1277
|
+
while (node = liSibling.firstChild) {
|
|
1252
1278
|
listBlock.appendChild(node);
|
|
1253
1279
|
}
|
|
1254
|
-
dom.remove(
|
|
1280
|
+
dom.remove(liSibling);
|
|
1255
1281
|
}
|
|
1256
1282
|
sibling = listBlock.previousSibling;
|
|
1257
1283
|
if (shouldMerge(dom, listBlock, sibling)) {
|
|
1258
|
-
|
|
1284
|
+
const liSibling = sibling;
|
|
1285
|
+
while (node = liSibling.lastChild) {
|
|
1259
1286
|
listBlock.insertBefore(node, listBlock.firstChild);
|
|
1260
1287
|
}
|
|
1261
|
-
dom.remove(
|
|
1288
|
+
dom.remove(liSibling);
|
|
1262
1289
|
}
|
|
1263
1290
|
};
|
|
1264
1291
|
const updateList$1 = (editor, list, listName, detail) => {
|
|
@@ -1314,6 +1341,9 @@
|
|
|
1314
1341
|
};
|
|
1315
1342
|
const toggleList = (editor, listName, _detail) => {
|
|
1316
1343
|
const parentList = getParentList(editor);
|
|
1344
|
+
if (isWithinNonEditableList(editor, parentList)) {
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1317
1347
|
const selectedSubLists = getSelectedSubLists(editor);
|
|
1318
1348
|
const detail = isObject(_detail) ? _detail : {};
|
|
1319
1349
|
if (selectedSubLists.length > 0) {
|
|
@@ -1325,8 +1355,8 @@
|
|
|
1325
1355
|
|
|
1326
1356
|
const DOM = global$2.DOM;
|
|
1327
1357
|
const normalizeList = (dom, list) => {
|
|
1328
|
-
const parentNode = list.
|
|
1329
|
-
if (parentNode.nodeName === 'LI' && parentNode.firstChild === list) {
|
|
1358
|
+
const parentNode = list.parentElement;
|
|
1359
|
+
if (parentNode && parentNode.nodeName === 'LI' && parentNode.firstChild === list) {
|
|
1330
1360
|
const sibling = parentNode.previousSibling;
|
|
1331
1361
|
if (sibling && sibling.nodeName === 'LI') {
|
|
1332
1362
|
sibling.appendChild(list);
|
|
@@ -1358,7 +1388,7 @@
|
|
|
1358
1388
|
return node;
|
|
1359
1389
|
}
|
|
1360
1390
|
const nonEmptyBlocks = editor.schema.getNonEmptyElements();
|
|
1361
|
-
if (node
|
|
1391
|
+
if (isElement(node)) {
|
|
1362
1392
|
node = global$5.getNode(node, offset);
|
|
1363
1393
|
}
|
|
1364
1394
|
const walker = new global$4(node, root);
|
|
@@ -1379,6 +1409,7 @@
|
|
|
1379
1409
|
return node;
|
|
1380
1410
|
}
|
|
1381
1411
|
}
|
|
1412
|
+
return null;
|
|
1382
1413
|
};
|
|
1383
1414
|
const hasOnlyOneBlockChild = (dom, elm) => {
|
|
1384
1415
|
const childNodes = elm.childNodes;
|
|
@@ -1460,7 +1491,7 @@
|
|
|
1460
1491
|
const root = getClosestEditingHost(editor, selectionStartElm);
|
|
1461
1492
|
const li = dom.getParent(selection.getStart(), 'LI', root);
|
|
1462
1493
|
if (li) {
|
|
1463
|
-
const ul = li.
|
|
1494
|
+
const ul = li.parentElement;
|
|
1464
1495
|
if (ul === editor.getBody() && isEmpty$1(dom, ul)) {
|
|
1465
1496
|
return true;
|
|
1466
1497
|
}
|
|
@@ -1548,7 +1579,8 @@
|
|
|
1548
1579
|
return false;
|
|
1549
1580
|
};
|
|
1550
1581
|
const backspaceDelete = (editor, isForward) => {
|
|
1551
|
-
|
|
1582
|
+
const selection = editor.selection;
|
|
1583
|
+
return !isWithinNonEditableList(editor, selection.getNode()) && (selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor));
|
|
1552
1584
|
};
|
|
1553
1585
|
const setup$1 = editor => {
|
|
1554
1586
|
editor.on('ExecCommand', e => {
|
|
@@ -1578,6 +1610,9 @@
|
|
|
1578
1610
|
|
|
1579
1611
|
const updateList = (editor, update) => {
|
|
1580
1612
|
const parentList = getParentList(editor);
|
|
1613
|
+
if (parentList === null || isWithinNonEditableList(editor, parentList)) {
|
|
1614
|
+
return;
|
|
1615
|
+
}
|
|
1581
1616
|
editor.undoManager.transact(() => {
|
|
1582
1617
|
if (isObject(update.styles)) {
|
|
1583
1618
|
editor.dom.setStyles(parentList, update.styles);
|
|
@@ -1663,7 +1698,7 @@
|
|
|
1663
1698
|
|
|
1664
1699
|
const open = editor => {
|
|
1665
1700
|
const currentList = getParentList(editor);
|
|
1666
|
-
if (!isOlNode(currentList)) {
|
|
1701
|
+
if (!isOlNode(currentList) || isWithinNonEditableList(editor, currentList)) {
|
|
1667
1702
|
return;
|
|
1668
1703
|
}
|
|
1669
1704
|
editor.windowManager.open({
|
|
@@ -1680,7 +1715,7 @@
|
|
|
1680
1715
|
initialData: {
|
|
1681
1716
|
start: parseDetail({
|
|
1682
1717
|
start: editor.dom.getAttrib(currentList, 'start', '1'),
|
|
1683
|
-
listStyleType: Optional.
|
|
1718
|
+
listStyleType: Optional.from(editor.dom.getStyle(currentList, 'list-style-type'))
|
|
1684
1719
|
})
|
|
1685
1720
|
},
|
|
1686
1721
|
buttons: [
|
|
@@ -1711,7 +1746,7 @@
|
|
|
1711
1746
|
|
|
1712
1747
|
const queryListCommandState = (editor, listName) => () => {
|
|
1713
1748
|
const parentList = getParentList(editor);
|
|
1714
|
-
return parentList && parentList.nodeName === listName;
|
|
1749
|
+
return isNonNullable(parentList) && parentList.nodeName === listName;
|
|
1715
1750
|
};
|
|
1716
1751
|
const registerDialog = editor => {
|
|
1717
1752
|
editor.addCommand('mceListProps', () => {
|
|
@@ -1769,6 +1804,13 @@
|
|
|
1769
1804
|
setup$1(editor);
|
|
1770
1805
|
};
|
|
1771
1806
|
|
|
1807
|
+
const setupToggleButtonHandler = (editor, listName) => api => {
|
|
1808
|
+
const toggleButtonHandler = e => {
|
|
1809
|
+
api.setActive(inList(e.parents, listName));
|
|
1810
|
+
api.setEnabled(!isWithinNonEditableList(editor, e.element));
|
|
1811
|
+
};
|
|
1812
|
+
return setNodeChangeHandler(editor, toggleButtonHandler);
|
|
1813
|
+
};
|
|
1772
1814
|
const register$1 = editor => {
|
|
1773
1815
|
const exec = command => () => editor.execCommand(command);
|
|
1774
1816
|
if (!editor.hasPlugin('advlist')) {
|
|
@@ -1777,24 +1819,28 @@
|
|
|
1777
1819
|
active: false,
|
|
1778
1820
|
tooltip: 'Numbered list',
|
|
1779
1821
|
onAction: exec('InsertOrderedList'),
|
|
1780
|
-
onSetup:
|
|
1822
|
+
onSetup: setupToggleButtonHandler(editor, 'OL')
|
|
1781
1823
|
});
|
|
1782
1824
|
editor.ui.registry.addToggleButton('bullist', {
|
|
1783
1825
|
icon: 'unordered-list',
|
|
1784
1826
|
active: false,
|
|
1785
1827
|
tooltip: 'Bullet list',
|
|
1786
1828
|
onAction: exec('InsertUnorderedList'),
|
|
1787
|
-
onSetup:
|
|
1829
|
+
onSetup: setupToggleButtonHandler(editor, 'UL')
|
|
1788
1830
|
});
|
|
1789
1831
|
}
|
|
1790
1832
|
};
|
|
1791
1833
|
|
|
1834
|
+
const setupMenuButtonHandler = (editor, listName) => api => {
|
|
1835
|
+
const menuButtonHandler = e => api.setEnabled(inList(e.parents, listName) && !isWithinNonEditableList(editor, e.element));
|
|
1836
|
+
return setNodeChangeHandler(editor, menuButtonHandler);
|
|
1837
|
+
};
|
|
1792
1838
|
const register = editor => {
|
|
1793
1839
|
const listProperties = {
|
|
1794
1840
|
text: 'List properties...',
|
|
1795
1841
|
icon: 'ordered-list',
|
|
1796
1842
|
onAction: () => editor.execCommand('mceListProps'),
|
|
1797
|
-
onSetup:
|
|
1843
|
+
onSetup: setupMenuButtonHandler(editor, 'OL')
|
|
1798
1844
|
};
|
|
1799
1845
|
editor.ui.registry.addMenuItem('listprops', listProperties);
|
|
1800
1846
|
editor.ui.registry.addContextMenu('lists', {
|
|
@@ -1808,7 +1854,7 @@
|
|
|
1808
1854
|
var Plugin = () => {
|
|
1809
1855
|
global$6.add('lists', editor => {
|
|
1810
1856
|
register$3(editor);
|
|
1811
|
-
if (editor.hasPlugin('rtc', true)
|
|
1857
|
+
if (!editor.hasPlugin('rtc', true)) {
|
|
1812
1858
|
setup(editor);
|
|
1813
1859
|
register$2(editor);
|
|
1814
1860
|
} else {
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc.
|
|
5
5
|
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
|
|
6
6
|
*
|
|
7
|
-
* Version: 6.1
|
|
7
|
+
* Version: 6.3.1
|
|
8
8
|
*/
|
|
9
|
-
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=r=e,(o=String).prototype.isPrototypeOf(n)||(null===(s=r.constructor)||void 0===s?void 0:s.name)===o.name)?"string":t;var n,r,o,s})(t)===e,n=e=>t=>typeof t===e,r=t("string"),o=t("object"),s=t("array"),i=n("boolean"),a=n("function"),l=n("number"),d=()=>{},c=(e,t)=>e===t,u=e=>t=>!e(t),m=(!1,()=>false);class p{constructor(e,t){this.tag=e,this.value=t}static some(e){return new p(!0,e)}static none(){return p.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?p.some(e(this.value)):p.none()}bind(e){return this.tag?e(this.value):p.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:p.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return null==e?p.none():p.some(e)}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}p.singletonNone=new p(!1);const g=Array.prototype.slice,h=Array.prototype.indexOf,f=Array.prototype.push,y=(e,t)=>{return n=e,r=t,h.call(n,r)>-1;var n,r},C=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(t(e[n],n))return!0;return!1},v=(e,t)=>{const n=e.length,r=new Array(n);for(let o=0;o<n;o++){const n=e[o];r[o]=t(n,o)}return r},b=(e,t)=>{for(let n=0,r=e.length;n<r;n++)t(e[n],n)},S=(e,t)=>{const n=[];for(let r=0,o=e.length;r<o;r++){const o=e[r];t(o,r)&&n.push(o)}return n},N=(e,t,n)=>(b(e,((e,r)=>{n=t(n,e,r)})),n),L=(e,t,n)=>{for(let r=0,o=e.length;r<o;r++){const o=e[r];if(t(o,r))return p.some(o);if(n(o,r))break}return p.none()},O=(e,t)=>L(e,t,m),T=(e,t)=>(e=>{const t=[];for(let n=0,r=e.length;n<r;++n){if(!s(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);f.apply(t,e[n])}return t})(v(e,t)),k=e=>{const t=g.call(e,0);return t.reverse(),t},A=(e,t)=>t>=0&&t<e.length?p.some(e[t]):p.none(),w=e=>A(e,0),D=e=>A(e,e.length-1),B=(e,t)=>{const n=[],r=a(t)?e=>C(n,(n=>t(n,e))):e=>y(n,e);for(let t=0,o=e.length;t<o;t++){const o=e[t];r(o)||n.push(o)}return n},x=(e,t,n=c)=>e.exists((e=>n(e,t))),E=(e,t,n)=>e.isSome()&&t.isSome()?p.some(n(e.getOrDie(),t.getOrDie())):p.none(),I=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},M=(e,t)=>{const n=(t||document).createElement(e);return I(n)},P=I,R=(e,t)=>e.dom===t.dom;"undefined"!=typeof window?window:Function("return this;")();const U=e=>e.dom.nodeName.toLowerCase(),$=(1,e=>1===(e=>e.dom.nodeType)(e));const _=e=>t=>$(t)&&U(t)===e,H=e=>p.from(e.dom.parentNode).map(P),j=e=>v(e.dom.childNodes,P),F=(e,t)=>{const n=e.dom.childNodes;return p.from(n[t]).map(P)},K=e=>F(e,0),V=e=>F(e,e.dom.childNodes.length-1),z=(e,t,n)=>{let r=e.dom;const o=a(n)?n:m;for(;r.parentNode;){r=r.parentNode;const e=P(r);if(t(e))return p.some(e);if(o(e))break}return p.none()},Q=(e,t,n)=>((e,t,n,r,o)=>r(n)?p.some(n):a(o)&&o(n)?p.none():t(n,r,o))(0,z,e,t,n),q=(e,t)=>{H(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},W=(e,t)=>{e.dom.appendChild(t.dom)},Z=(e,t)=>{b(t,(t=>{W(e,t)}))},G=e=>{e.dom.textContent="",b(j(e),(e=>{J(e)}))},J=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)};var X=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),Y=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),ee=tinymce.util.Tools.resolve("tinymce.util.VK");const te=Object.keys,ne=(e,t)=>{const n=te(e);for(let r=0,o=n.length;r<o;r++){const o=n[r];t(e[o],o)}},re=(e,t)=>{const n=e.dom;ne(t,((e,t)=>{((e,t,n)=>{if(!(r(n)||i(n)||l(n)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")})(n,t,e)}))},oe=e=>N(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),se=e=>((e,t)=>P(e.dom.cloneNode(!0)))(e),ie=(e,t)=>{const n=((e,t)=>{const n=M(t),r=oe(e);return re(n,r),n})(e,t);((e,t)=>{const n=(e=>p.from(e.dom.nextSibling).map(P))(e);n.fold((()=>{H(e).each((e=>{W(e,t)}))}),(e=>{q(e,t)}))})(e,n);const r=j(e);return Z(n,r),J(e),n};var ae=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),le=tinymce.util.Tools.resolve("tinymce.util.Tools");const de=e=>t=>t&&t.nodeName.toLowerCase()===e,ce=e=>t=>t&&e.test(t.nodeName),ue=e=>e&&3===e.nodeType,me=ce(/^(OL|UL|DL)$/),pe=ce(/^(OL|UL)$/),ge=de("ol"),he=ce(/^(LI|DT|DD)$/),fe=ce(/^(DT|DD)$/),ye=ce(/^(TH|TD)$/),Ce=de("br"),ve=(e,t)=>t&&!!e.schema.getTextBlockElements()[t.nodeName],be=(e,t)=>e&&e.nodeName in t,Se=(e,t,n)=>{const r=e.isEmpty(t);return!(n&&e.select("span[data-mce-type=bookmark]",t).length>0)&&r},Ne=(e,t)=>e.isChildOf(t,e.getRoot()),Le=e=>t=>t.options.get(e),Oe=Le("lists_indent_on_tab"),Te=Le("forced_root_block"),ke=Le("forced_root_block_attrs"),Ae=(e,t)=>{const n=e.dom,r=e.schema.getBlockElements(),o=n.createFragment(),s=Te(e),i=ke(e);let a,l,d;for(l=n.create(s,i),be(t.firstChild,r)||o.appendChild(l);a=t.firstChild;){const e=a.nodeName;d||"SPAN"===e&&"bookmark"===a.getAttribute("data-mce-type")||(d=!0),be(a,r)?(o.appendChild(a),l=null):(l||(l=n.create(s,i),o.appendChild(l)),l.appendChild(a))}return d||l.appendChild(n.create("br",{"data-mce-bogus":"1"})),o},we=ae.DOM,De=_("dd"),Be=_("dt"),xe=e=>{Be(e)&&ie(e,"dd")},Ee=(e,t,n)=>{b(n,"Indent"===t?xe:t=>((e,t)=>{De(t)?ie(t,"dt"):Be(t)&&H(t).each((n=>((e,t,n)=>{const r=we.select('span[data-mce-type="bookmark"]',t),o=Ae(e,n),s=we.createRng();s.setStartAfter(n),s.setEndAfter(t);const i=s.extractContents();for(let t=i.firstChild;t;t=t.firstChild)if("LI"===t.nodeName&&e.dom.isEmpty(t)){we.remove(t);break}var a;e.dom.isEmpty(i)||we.insertAfter(i,t),we.insertAfter(o,t),Se(e.dom,n.parentNode)&&(a=n.parentNode,le.each(r,(e=>{a.parentNode.insertBefore(e,n.parentNode)})),we.remove(a)),we.remove(n),Se(e.dom,t)&&we.remove(t)})(e,n.dom,t.dom)))})(e,t))},Ie=(e,t)=>{if(ue(e))return{container:e,offset:t};const n=X.getNode(e,t);return ue(n)?{container:n,offset:t>=e.childNodes.length?n.data.length:0}:n.previousSibling&&ue(n.previousSibling)?{container:n.previousSibling,offset:n.previousSibling.data.length}:n.nextSibling&&ue(n.nextSibling)?{container:n.nextSibling,offset:0}:{container:e,offset:t}},Me=e=>{const t=e.cloneRange(),n=Ie(e.startContainer,e.startOffset);t.setStart(n.container,n.offset);const r=Ie(e.endContainer,e.endOffset);return t.setEnd(r.container,r.offset),t},Pe=["OL","UL","DL"],Re=Pe.join(","),Ue=(e,t)=>{const n=t||e.selection.getStart(!0);return e.dom.getParent(n,Re,He(e,n))},$e=e=>{const t=e.selection.getSelectedBlocks();return S(((e,t)=>{const n=le.map(t,(t=>e.dom.getParent(t,"li,dd,dt",He(e,t))||t));return B(n)})(e,t),he)},_e=(e,t)=>{const n=e.dom.getParents(t,"TD,TH");return n.length>0?n[0]:e.getBody()},He=(e,t)=>{const n=e.dom.getParents(t,e.dom.isBlock),r=O(n,(t=>{return n=e.schema,!me(r=t)&&!he(r)&&C(Pe,(e=>n.isValidChild(r.nodeName,e)));var n,r}));return r.getOr(e.getBody())},je=(e,t)=>{const n=e.dom.getParents(t,"ol,ul",He(e,t));return D(n)},Fe=(e,t)=>{const n=v(t,(t=>je(e,t).getOr(t)));return B(n)},Ke=(e,t,n)=>e.dispatch("ListMutation",{action:t,element:n}),Ve=(ze=/^\s+|\s+$/g,e=>e.replace(ze,""));var ze;const Qe=(e,t,n)=>{((e,t,n)=>{if(!r(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);(e=>void 0!==e.style&&a(e.style.getPropertyValue))(e)&&e.style.setProperty(t,n)})(e.dom,t,n)},qe=(e,t)=>{W(e.item,t.list)},We=(e,t)=>{const n={list:M(t,e),item:M("li",e)};return W(n.list,n.item),n},Ze=e=>((e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}})(e,"OL,UL"),Ge=e=>K(e).exists(Ze),Je=e=>e.depth>0,Xe=e=>e.isSelected,Ye=e=>{const t=j(e),n=V(e).exists(Ze)?t.slice(0,-1):t;return v(n,se)},et=e=>(b(e,((t,n)=>{((e,t)=>{const n=e[t].depth,r=e=>e.depth===n&&!e.dirty,o=e=>e.depth<n;return L(k(e.slice(0,t)),r,o).orThunk((()=>L(e.slice(t+1),r,o)))})(e,n).fold((()=>{t.dirty&&(e=>{e.listAttributes=((e,t)=>{const n={};var r;return((e,t,n,r)=>{ne(e,((e,o)=>{(t(e,o)?n:r)(e,o)}))})(e,t,(r=n,(e,t)=>{r[t]=e}),d),n})(e.listAttributes,((e,t)=>"start"!==t))})(t)}),(e=>{return r=e,(n=t).listType=r.listType,void(n.listAttributes={...r.listAttributes});var n,r}))})),e),tt=(e,t,n,r)=>K(r).filter(Ze).fold((()=>{t.each((e=>{R(e.start,r)&&n.set(!0)}));const o=((e,t,n)=>H(e).filter($).map((r=>({depth:t,dirty:!1,isSelected:n,content:Ye(e),itemAttributes:oe(e),listAttributes:oe(r),listType:U(r)}))))(r,e,n.get());t.each((e=>{R(e.end,r)&&n.set(!1)}));const s=V(r).filter(Ze).map((r=>nt(e,t,n,r))).getOr([]);return o.toArray().concat(s)}),(r=>nt(e,t,n,r))),nt=(e,t,n,r)=>T(j(r),(r=>(Ze(r)?nt:tt)(e+1,t,n,r))),rt=(e,t)=>{const n=et(t);return((e,t)=>{const n=N(t,((t,n)=>n.depth>t.length?((e,t,n)=>{const r=((e,t,n)=>{const r=[];for(let o=0;o<n;o++)r.push(We(e,t.listType));return r})(e,n,n.depth-t.length);var o;return(e=>{for(let t=1;t<e.length;t++)qe(e[t-1],e[t])})(r),((e,t)=>{for(let t=0;t<e.length-1;t++)Qe(e[t].item,"list-style-type","none");D(e).each((e=>{re(e.list,t.listAttributes),re(e.item,t.itemAttributes),Z(e.item,t.content)}))})(r,n),o=r,E(D(t),w(o),qe),t.concat(r)})(e,t,n):((e,t,n)=>{const r=t.slice(0,n.depth);return D(r).each((t=>{const r=((e,t,n)=>{const r=M("li",e);return re(r,t),Z(r,n),r})(e,n.itemAttributes,n.content);((e,t)=>{W(e.list,t),e.item=t})(t,r),((e,t)=>{U(e.list)!==t.listType&&(e.list=ie(e.list,t.listType)),re(e.list,t.listAttributes)})(t,n)})),r})(e,t,n)),[]);return w(n).map((e=>e.list))})(e.contentDocument,n).toArray()},ot=(e,t,n)=>{const r=((e,t)=>{const n=(e=>{let t=!1;return{get:()=>t,set:e=>{t=e}}})();return v(e,(e=>({sourceList:e,entries:nt(0,t,n,e)})))})(t,(e=>{const t=v($e(e),P);return E(O(t,u(Ge)),O(k(t),u(Ge)),((e,t)=>({start:e,end:t})))})(e));b(r,(t=>{((e,t)=>{b(S(e,Xe),(e=>((e,t)=>{switch(e){case"Indent":t.depth++;break;case"Outdent":t.depth--;break;case"Flatten":t.depth=0}t.dirty=!0})(t,e)))})(t.entries,n);const r=((e,t)=>T(((e,t)=>{if(0===e.length)return[];{let n=t(e[0]);const r=[];let o=[];for(let s=0,i=e.length;s<i;s++){const i=e[s],a=t(i);a!==n&&(r.push(o),o=[]),n=a,o.push(i)}return 0!==o.length&&r.push(o),r}})(t,Je),(t=>w(t).exists(Je)?rt(e,t):((e,t)=>{const n=et(t);return v(n,(t=>{const n=((e,t)=>{const n=document.createDocumentFragment();return b(e,(e=>{n.appendChild(e.dom)})),P(n)})(t.content);return P(Ae(e,n.dom))}))})(e,t))))(e,t.entries);var o;b(r,(t=>{Ke(e,"Indent"===n?"IndentList":"OutdentList",t.dom)})),o=t.sourceList,b(r,(e=>{q(o,e)})),J(t.sourceList)}))},st=(e,t)=>{const n=v((e=>{const t=(e=>{const t=je(e,e.selection.getStart()),n=S(e.selection.getSelectedBlocks(),pe);return t.toArray().concat(n)})(e);return Fe(e,t)})(e),P),r=v((e=>S($e(e),fe))(e),P);let o=!1;if(n.length||r.length){const s=e.selection.getBookmark();ot(e,n,t),Ee(e,t,r),e.selection.moveToBookmark(s),e.selection.setRng(Me(e.selection.getRng())),e.nodeChanged(),o=!0}return o},it=e=>st(e,"Indent"),at=e=>st(e,"Outdent"),lt=e=>st(e,"Flatten");var dt=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager");const ct=ae.DOM,ut=e=>{const t={},n=n=>{let r=e[n?"startContainer":"endContainer"],o=e[n?"startOffset":"endOffset"];if(1===r.nodeType){const e=ct.create("span",{"data-mce-type":"bookmark"});r.hasChildNodes()?(o=Math.min(o,r.childNodes.length-1),n?r.insertBefore(e,r.childNodes[o]):ct.insertAfter(e,r.childNodes[o])):r.appendChild(e),r=e,o=0}t[n?"startContainer":"endContainer"]=r,t[n?"startOffset":"endOffset"]=o};return n(!0),e.collapsed||n(),t},mt=e=>{const t=t=>{let n,r=n=e[t?"startContainer":"endContainer"],o=e[t?"startOffset":"endOffset"];r&&(1===r.nodeType&&(o=(e=>{let t=e.parentNode.firstChild,n=0;for(;t;){if(t===e)return n;1===t.nodeType&&"bookmark"===t.getAttribute("data-mce-type")||n++,t=t.nextSibling}return-1})(r),r=r.parentNode,ct.remove(n),!r.hasChildNodes()&&ct.isBlock(r)&&r.appendChild(ct.create("br"))),e[t?"startContainer":"endContainer"]=r,e[t?"startOffset":"endOffset"]=o)};t(!0),t();const n=ct.createRng();return n.setStart(e.startContainer,e.startOffset),e.endContainer&&n.setEnd(e.endContainer,e.endOffset),Me(n)},pt=e=>{switch(e){case"UL":return"ToggleUlList";case"OL":return"ToggleOlList";case"DL":return"ToggleDLList"}},gt=e=>/\btox\-/.test(e.className),ht=(e,t,n)=>{const r=e=>{const r=L(e.parents,me,ye).filter((e=>e.nodeName===t&&!gt(e))).isSome();n(r)},o=e.dom.getParents(e.selection.getNode());return r({parents:o}),e.on("NodeChange",r),()=>e.off("NodeChange",r)},ft=(e,t)=>{le.each(t,((t,n)=>{e.setAttribute(n,t)}))},yt=(e,t,n)=>{((e,t,n)=>{const r=n["list-style-type"]?n["list-style-type"]:null;e.setStyle(t,"list-style-type",r)})(e,t,n),((e,t,n)=>{ft(t,n["list-attributes"]),le.each(e.select("li",t),(e=>{ft(e,n["list-item-attributes"])}))})(e,t,n)},Ct=(e,t,n,r)=>{let o=t[n?"startContainer":"endContainer"];const s=t[n?"startOffset":"endOffset"];for(1===o.nodeType&&(o=o.childNodes[Math.min(s,o.childNodes.length-1)]||o),!n&&Ce(o.nextSibling)&&(o=o.nextSibling);o.parentNode!==r;){if(ve(e,o))return o;if(/^(TD|TH)$/.test(o.parentNode.nodeName))return o;o=o.parentNode}return o},vt=(e,t,n)=>{const r=e.selection.getRng();let o="LI";const s=He(e,e.selection.getStart(!0)),i=e.dom;if("false"===i.getContentEditable(e.selection.getNode()))return;"DL"===(t=t.toUpperCase())&&(o="DT");const a=ut(r),l=((e,t,n)=>{const r=[],o=e.dom,s=Ct(e,t,!0,n),i=Ct(e,t,!1,n);let a;const l=[];for(let e=s;e&&(l.push(e),e!==i);e=e.nextSibling);return le.each(l,(t=>{if(ve(e,t))return r.push(t),void(a=null);if(o.isBlock(t)||Ce(t))return Ce(t)&&o.remove(t),void(a=null);const s=t.nextSibling;dt.isBookmarkNode(t)&&(me(s)||ve(e,s)||!s&&t.parentNode===n)?a=null:(a||(a=o.create("p"),t.parentNode.insertBefore(a,t),r.push(a)),a.appendChild(t))})),r})(e,r,s);le.each(l,(r=>{let s;const a=r.previousSibling,l=r.parentNode;he(l)||(a&&me(a)&&a.nodeName===t&&((e,t,n)=>{const r=e.getStyle(t,"list-style-type");let o=n?n["list-style-type"]:"";return o=null===o?"":o,r===o})(i,a,n)?(s=a,r=i.rename(r,o),a.appendChild(r)):(s=i.create(t),r.parentNode.insertBefore(s,r),s.appendChild(r),r=i.rename(r,o)),((e,t,n)=>{le.each(["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"],(n=>e.setStyle(t,n,"")))})(i,r),yt(i,s,n),St(e.dom,s))})),e.selection.setRng(mt(a))},bt=(e,t,n)=>{return((e,t)=>e&&t&&me(e)&&e.nodeName===t.nodeName)(t,n)&&((e,t,n)=>e.getStyle(t,"list-style-type",!0)===e.getStyle(n,"list-style-type",!0))(e,t,n)&&(r=n,t.className===r.className);var r},St=(e,t)=>{let n,r;if(n=t.nextSibling,bt(e,t,n)){for(;r=n.firstChild;)t.appendChild(r);e.remove(n)}if(n=t.previousSibling,bt(e,t,n)){for(;r=n.lastChild;)t.insertBefore(r,t.firstChild);e.remove(n)}},Nt=e=>"list-style-type"in e,Lt=(e,t,n)=>{const r=Ue(e),s=(e=>{const t=Ue(e),n=e.selection.getSelectedBlocks();return((e,t)=>e&&1===t.length&&t[0]===e)(t,n)?(e=>S(e.querySelectorAll(Re),me))(t):S(n,(e=>me(e)&&t!==e))})(e),i=o(n)?n:{};s.length>0?((e,t,n,r,o)=>{const s=me(t);if(s&&t.nodeName===r&&!Nt(o))lt(e);else{vt(e,r,o);const i=ut(e.selection.getRng()),a=s?[t,...n]:n;le.each(a,(t=>{((e,t,n,r)=>{if(t.nodeName!==n){const o=e.dom.rename(t,n);yt(e.dom,o,r),Ke(e,pt(n),o)}else yt(e.dom,t,r),Ke(e,pt(n),t)})(e,t,r,o)})),e.selection.setRng(mt(i))}})(e,r,s,t,i):((e,t,n,r)=>{if(t!==e.getBody())if(t)if(t.nodeName!==n||Nt(r)||gt(t)){const o=ut(e.selection.getRng());yt(e.dom,t,r);const s=e.dom.rename(t,n);St(e.dom,s),e.selection.setRng(mt(o)),vt(e,n,r),Ke(e,pt(n),s)}else lt(e);else vt(e,n,r),Ke(e,pt(n),t)})(e,r,t,i)},Ot=ae.DOM,Tt=(e,t)=>{const n=le.grep(e.select("ol,ul",t));le.each(n,(t=>{((e,t)=>{const n=t.parentNode;if("LI"===n.nodeName&&n.firstChild===t){const r=n.previousSibling;r&&"LI"===r.nodeName?(r.appendChild(t),Se(e,n)&&Ot.remove(n)):Ot.setStyle(n,"listStyleType","none")}if(me(n)){const e=n.previousSibling;e&&"LI"===e.nodeName&&e.appendChild(t)}})(e,t)}))},kt=(e,t,n,r)=>{let o=t.startContainer;const s=t.startOffset;if(ue(o)&&(n?s<o.data.length:s>0))return o;const i=e.schema.getNonEmptyElements();1===o.nodeType&&(o=X.getNode(o,s));const a=new Y(o,r);n&&((e,t)=>!!Ce(t)&&e.isBlock(t.nextSibling)&&!Ce(t.previousSibling))(e.dom,o)&&a.next();const l=n?a.next.bind(a):a.prev2.bind(a);for(;o=l();){if("LI"===o.nodeName&&!o.hasChildNodes())return o;if(i[o.nodeName])return o;if(ue(o)&&o.data.length>0)return o}},At=(e,t)=>{const n=t.childNodes;return 1===n.length&&!me(n[0])&&e.isBlock(n[0])},wt=(e,t,n)=>{let r;const o=t.parentNode;if(!Ne(e,t)||!Ne(e,n))return;me(n.lastChild)&&(r=n.lastChild),o===n.lastChild&&Ce(o.previousSibling)&&e.remove(o.previousSibling);const s=n.lastChild;s&&Ce(s)&&t.hasChildNodes()&&e.remove(s),Se(e,n,!0)&&G(P(n)),((e,t,n)=>{let r;const o=At(e,n)?n.firstChild:n;if(((e,t)=>{At(e,t)&&e.remove(t.firstChild,!0)})(e,t),!Se(e,t,!0))for(;r=t.firstChild;)o.appendChild(r)})(e,t,n),r&&n.appendChild(r);const i=((e,t)=>{const n=e.dom,r=t.dom;return n!==r&&n.contains(r)})(P(n),P(t))?e.getParents(t,me,n):[];e.remove(t),b(i,(t=>{Se(e,t)&&t!==e.getRoot()&&e.remove(t)}))},Dt=(e,t)=>{const n=e.dom,r=e.selection,o=r.getStart(),s=_e(e,o),i=n.getParent(r.getStart(),"LI",s);if(i){const o=i.parentNode;if(o===e.getBody()&&Se(n,o))return!0;const a=Me(r.getRng()),l=n.getParent(kt(e,a,t,s),"LI",s);if(l&&l!==i)return e.undoManager.transact((()=>{var n;t?((e,t,n,r)=>{const o=e.dom;if(o.isEmpty(r))((e,t,n)=>{G(P(n)),wt(e.dom,t,n),e.selection.setCursorLocation(n,0)})(e,n,r);else{const s=ut(t);wt(o,n,r),e.selection.setRng(mt(s))}})(e,a,l,i):(n=i).parentNode.firstChild===n?at(e):((e,t,n,r)=>{const o=ut(t);wt(e.dom,n,r);const s=mt(o);e.selection.setRng(s)})(e,a,i,l)})),!0;if(!l&&!t&&0===a.startOffset&&0===a.endOffset)return e.undoManager.transact((()=>{lt(e)})),!0}return!1},Bt=e=>{const t=e.selection.getStart(),n=_e(e,t);return e.dom.getParent(t,"LI,DT,DD",n)||$e(e).length>0},xt=(e,t)=>e.selection.isCollapsed()?((e,t)=>Dt(e,t)||((e,t)=>{const n=e.dom,r=e.selection.getStart(),o=_e(e,r),s=n.getParent(r,n.isBlock,o);if(s&&n.isEmpty(s)){const r=Me(e.selection.getRng()),i=n.getParent(kt(e,r,t,o),"LI",o);if(i){const a=e=>y(["td","th","caption"],U(e)),l=e=>e.dom===o;return!!((e,t,n=c)=>E(e,t,n).getOr(e.isNone()&&t.isNone()))(Q(P(i),a,l),Q(P(r.startContainer),a,l),R)&&(e.undoManager.transact((()=>{((e,t,n)=>{const r=e.getParent(t.parentNode,e.isBlock,n);e.remove(t),r&&e.isEmpty(r)&&e.remove(r)})(n,s,o),St(n,i.parentNode),e.selection.select(i,!0),e.selection.collapse(t)})),!0)}}return!1})(e,t))(e,t):(e=>!!Bt(e)&&(e.undoManager.transact((()=>{e.execCommand("Delete"),Tt(e.dom,e.getBody())})),!0))(e),Et=e=>{const t=k(Ve(e).split("")),n=v(t,((e,t)=>{const n=e.toUpperCase().charCodeAt(0)-"A".charCodeAt(0)+1;return Math.pow(26,t)*n}));return N(n,((e,t)=>e+t),0)},It=e=>{if(--e<0)return"";{const t=e%26,n=Math.floor(e/26);return It(n)+String.fromCharCode("A".charCodeAt(0)+t)}},Mt=e=>{const t=parseInt(e.start,10);return x(e.listStyleType,"upper-alpha")?It(t):x(e.listStyleType,"lower-alpha")?It(t).toLowerCase():e.start},Pt=(e,t)=>()=>{const n=Ue(e);return n&&n.nodeName===t},Rt=e=>{e.addCommand("mceListProps",(()=>{(e=>{const t=Ue(e);ge(t)&&e.windowManager.open({title:"List Properties",body:{type:"panel",items:[{type:"input",name:"start",label:"Start list at number",inputMode:"numeric"}]},initialData:{start:Mt({start:e.dom.getAttrib(t,"start","1"),listStyleType:p.some(e.dom.getStyle(t,"list-style-type"))})},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:t=>{(e=>{switch((e=>/^[0-9]+$/.test(e)?2:/^[A-Z]+$/.test(e)?0:/^[a-z]+$/.test(e)?1:e.length>0?4:3)(e)){case 2:return p.some({listStyleType:p.none(),start:e});case 0:return p.some({listStyleType:p.some("upper-alpha"),start:Et(e).toString()});case 1:return p.some({listStyleType:p.some("lower-alpha"),start:Et(e).toString()});case 3:return p.some({listStyleType:p.none(),start:""});case 4:return p.none()}})(t.getData().start).each((t=>{e.execCommand("mceListUpdate",!1,{attrs:{start:"1"===t.start?"":t.start},styles:{"list-style-type":t.listStyleType.getOr("")}})})),t.close()}})})(e)}))};e.add("lists",(e=>((e=>{(0,e.options.register)("lists_indent_on_tab",{processor:"boolean",default:!0})})(e),!1===e.hasPlugin("rtc",!0)?((e=>{Oe(e)&&(e=>{e.on("keydown",(t=>{t.keyCode!==ee.TAB||ee.metaKeyPressed(t)||e.undoManager.transact((()=>{(t.shiftKey?at(e):it(e))&&t.preventDefault()}))}))})(e),(e=>{e.on("ExecCommand",(t=>{const n=t.command.toLowerCase();"delete"!==n&&"forwarddelete"!==n||!Bt(e)||Tt(e.dom,e.getBody())})),e.on("keydown",(t=>{t.keyCode===ee.BACKSPACE?xt(e,!1)&&t.preventDefault():t.keyCode===ee.DELETE&&xt(e,!0)&&t.preventDefault()}))})(e)})(e),(e=>{e.on("BeforeExecCommand",(t=>{const n=t.command.toLowerCase();"indent"===n?it(e):"outdent"===n&&at(e)})),e.addCommand("InsertUnorderedList",((t,n)=>{Lt(e,"UL",n)})),e.addCommand("InsertOrderedList",((t,n)=>{Lt(e,"OL",n)})),e.addCommand("InsertDefinitionList",((t,n)=>{Lt(e,"DL",n)})),e.addCommand("RemoveList",(()=>{lt(e)})),Rt(e),e.addCommand("mceListUpdate",((t,n)=>{o(n)&&((e,t)=>{const n=Ue(e);e.undoManager.transact((()=>{o(t.styles)&&e.dom.setStyles(n,t.styles),o(t.attrs)&&ne(t.attrs,((t,r)=>e.dom.setAttrib(n,r,t)))}))})(e,n)})),e.addQueryStateHandler("InsertUnorderedList",Pt(e,"UL")),e.addQueryStateHandler("InsertOrderedList",Pt(e,"OL")),e.addQueryStateHandler("InsertDefinitionList",Pt(e,"DL"))})(e)):Rt(e),(e=>{const t=t=>()=>e.execCommand(t);e.hasPlugin("advlist")||(e.ui.registry.addToggleButton("numlist",{icon:"ordered-list",active:!1,tooltip:"Numbered list",onAction:t("InsertOrderedList"),onSetup:t=>ht(e,"OL",t.setActive)}),e.ui.registry.addToggleButton("bullist",{icon:"unordered-list",active:!1,tooltip:"Bullet list",onAction:t("InsertUnorderedList"),onSetup:t=>ht(e,"UL",t.setActive)}))})(e),(e=>{const t={text:"List properties...",icon:"ordered-list",onAction:()=>e.execCommand("mceListProps"),onSetup:t=>ht(e,"OL",t.setEnabled)};e.ui.registry.addMenuItem("listprops",t),e.ui.registry.addContextMenu("lists",{update:t=>{const n=Ue(e,t);return ge(n)?["listprops"]:[]}})})(e),(e=>({backspaceDelete:t=>{xt(e,t)}}))(e))))}();
|
|
9
|
+
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>e=>(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(n=r=t,(o=String).prototype.isPrototypeOf(n)||(null===(s=r.constructor)||void 0===s?void 0:s.name)===o.name)?"string":e;var n,r,o,s})(e)===t,n=t=>e=>typeof e===t,r=e("string"),o=e("object"),s=e("array"),i=n("boolean"),a=t=>!(t=>null==t)(t),l=n("function"),d=n("number"),c=()=>{},u=(t,e)=>t===e,m=t=>e=>!t(e),p=(!1,()=>false);class g{constructor(t,e){this.tag=t,this.value=e}static some(t){return new g(!0,t)}static none(){return g.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?g.some(t(this.value)):g.none()}bind(t){return this.tag?t(this.value):g.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:g.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(null!=t?t:"Called getOrDie on None")}static from(t){return a(t)?g.some(t):g.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}g.singletonNone=new g(!1);const h=Array.prototype.slice,f=Array.prototype.indexOf,y=Array.prototype.push,v=(t,e)=>{return n=t,r=e,f.call(n,r)>-1;var n,r},C=(t,e)=>{for(let n=0,r=t.length;n<r;n++)if(e(t[n],n))return!0;return!1},b=(t,e)=>{const n=t.length,r=new Array(n);for(let o=0;o<n;o++){const n=t[o];r[o]=e(n,o)}return r},S=(t,e)=>{for(let n=0,r=t.length;n<r;n++)e(t[n],n)},N=(t,e)=>{const n=[];for(let r=0,o=t.length;r<o;r++){const o=t[r];e(o,r)&&n.push(o)}return n},L=(t,e,n)=>(S(t,((t,r)=>{n=e(n,t,r)})),n),O=(t,e,n)=>{for(let r=0,o=t.length;r<o;r++){const o=t[r];if(e(o,r))return g.some(o);if(n(o,r))break}return g.none()},k=(t,e)=>O(t,e,p),T=(t,e)=>(t=>{const e=[];for(let n=0,r=t.length;n<r;++n){if(!s(t[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+t);y.apply(e,t[n])}return e})(b(t,e)),A=t=>{const e=h.call(t,0);return e.reverse(),e},w=(t,e)=>e>=0&&e<t.length?g.some(t[e]):g.none(),D=t=>w(t,0),E=t=>w(t,t.length-1),B=(t,e)=>{const n=[],r=l(e)?t=>C(n,(n=>e(n,t))):t=>v(n,t);for(let e=0,o=t.length;e<o;e++){const o=t[e];r(o)||n.push(o)}return n},x=(t,e,n=u)=>t.exists((t=>n(t,e))),I=(t,e,n)=>t.isSome()&&e.isSome()?g.some(n(t.getOrDie(),e.getOrDie())):g.none(),P=t=>{if(null==t)throw new Error("Node cannot be null or undefined");return{dom:t}},M=(t,e)=>{const n=(e||document).createElement(t);return P(n)},R=P,U=(t,e)=>t.dom===e.dom;"undefined"!=typeof window?window:Function("return this;")();const $=t=>t.dom.nodeName.toLowerCase(),_=(1,t=>1===(t=>t.dom.nodeType)(t));const H=t=>e=>_(e)&&$(e)===t,j=t=>g.from(t.dom.parentNode).map(R),F=t=>b(t.dom.childNodes,R),K=(t,e)=>{const n=t.dom.childNodes;return g.from(n[e]).map(R)},V=t=>K(t,0),z=t=>K(t,t.dom.childNodes.length-1),Q=(t,e,n)=>{let r=t.dom;const o=l(n)?n:p;for(;r.parentNode;){r=r.parentNode;const t=R(r);if(e(t))return g.some(t);if(o(t))break}return g.none()},q=(t,e,n)=>((t,e,n,r,o)=>r(n)?g.some(n):l(o)&&o(n)?g.none():e(n,r,o))(0,Q,t,e,n),W=(t,e)=>{j(t).each((n=>{n.dom.insertBefore(e.dom,t.dom)}))},Z=(t,e)=>{t.dom.appendChild(e.dom)},G=(t,e)=>{S(e,(e=>{Z(t,e)}))},J=t=>{t.dom.textContent="",S(F(t),(t=>{X(t)}))},X=t=>{const e=t.dom;null!==e.parentNode&&e.parentNode.removeChild(e)};var Y=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),tt=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),et=tinymce.util.Tools.resolve("tinymce.util.VK");const nt=t=>b(t,R),rt=Object.keys,ot=(t,e)=>{const n=rt(t);for(let r=0,o=n.length;r<o;r++){const o=n[r];e(t[o],o)}},st=(t,e)=>{const n=t.dom;ot(e,((t,e)=>{((t,e,n)=>{if(!(r(n)||i(n)||d(n)))throw console.error("Invalid call to Attribute.set. Key ",e,":: Value ",n,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(e,n+"")})(n,e,t)}))},it=t=>L(t.dom.attributes,((t,e)=>(t[e.name]=e.value,t)),{}),at=t=>((t,e)=>R(t.dom.cloneNode(!0)))(t),lt=(t,e)=>{const n=((t,e)=>{const n=M(e),r=it(t);return st(n,r),n})(t,e);((t,e)=>{const n=(t=>g.from(t.dom.nextSibling).map(R))(t);n.fold((()=>{j(t).each((t=>{Z(t,e)}))}),(t=>{W(t,e)}))})(t,n);const r=F(t);return G(n,r),X(t),n};var dt=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),ct=tinymce.util.Tools.resolve("tinymce.util.Tools");const ut=t=>e=>a(e)&&e.nodeName.toLowerCase()===t,mt=t=>e=>a(e)&&t.test(e.nodeName),pt=t=>a(t)&&3===t.nodeType,gt=t=>a(t)&&1===t.nodeType,ht=mt(/^(OL|UL|DL)$/),ft=mt(/^(OL|UL)$/),yt=ut("ol"),vt=mt(/^(LI|DT|DD)$/),Ct=mt(/^(DT|DD)$/),bt=mt(/^(TH|TD)$/),St=ut("br"),Nt=(t,e)=>a(e)&&e.nodeName in t.schema.getTextBlockElements(),Lt=(t,e)=>a(t)&&t.nodeName in e,Ot=(t,e,n)=>{const r=t.isEmpty(e);return!(n&&t.select("span[data-mce-type=bookmark]",e).length>0)&&r},kt=(t,e)=>t.isChildOf(e,t.getRoot()),Tt=t=>e=>e.options.get(t),At=Tt("lists_indent_on_tab"),wt=Tt("forced_root_block"),Dt=Tt("forced_root_block_attrs"),Et=(t,e)=>{const n=t.dom,r=t.schema.getBlockElements(),o=n.createFragment(),s=wt(t),i=Dt(t);let a,l,d=!1;for(l=n.create(s,i),Lt(e.firstChild,r)||o.appendChild(l);a=e.firstChild;){const t=a.nodeName;d||"SPAN"===t&&"bookmark"===a.getAttribute("data-mce-type")||(d=!0),Lt(a,r)?(o.appendChild(a),l=null):(l||(l=n.create(s,i),o.appendChild(l)),l.appendChild(a))}return!d&&l&&l.appendChild(n.create("br",{"data-mce-bogus":"1"})),o},Bt=dt.DOM,xt=H("dd"),It=H("dt"),Pt=(t,e)=>{var n;xt(e)?lt(e,"dt"):It(e)&&(n=e,g.from(n.dom.parentElement).map(R)).each((n=>((t,e,n)=>{const r=Bt.select('span[data-mce-type="bookmark"]',e),o=Et(t,n),s=Bt.createRng();s.setStartAfter(n),s.setEndAfter(e);const i=s.extractContents();for(let e=i.firstChild;e;e=e.firstChild)if("LI"===e.nodeName&&t.dom.isEmpty(e)){Bt.remove(e);break}t.dom.isEmpty(i)||Bt.insertAfter(i,e),Bt.insertAfter(o,e);const a=n.parentElement;a&&Ot(t.dom,a)&&(t=>{const e=t.parentNode;e&&ct.each(r,(t=>{e.insertBefore(t,n.parentNode)})),Bt.remove(t)})(a),Bt.remove(n),Ot(t.dom,e)&&Bt.remove(e)})(t,n.dom,e.dom)))},Mt=t=>{It(t)&<(t,"dd")},Rt=(t,e)=>{if(pt(t))return{container:t,offset:e};const n=Y.getNode(t,e);return pt(n)?{container:n,offset:e>=t.childNodes.length?n.data.length:0}:n.previousSibling&&pt(n.previousSibling)?{container:n.previousSibling,offset:n.previousSibling.data.length}:n.nextSibling&&pt(n.nextSibling)?{container:n.nextSibling,offset:0}:{container:t,offset:e}},Ut=t=>{const e=t.cloneRange(),n=Rt(t.startContainer,t.startOffset);e.setStart(n.container,n.offset);const r=Rt(t.endContainer,t.endOffset);return e.setEnd(r.container,r.offset),e},$t=["OL","UL","DL"],_t=$t.join(","),Ht=(t,e)=>{const n=e||t.selection.getStart(!0);return t.dom.getParent(n,_t,Kt(t,n))},jt=t=>{const e=t.selection.getSelectedBlocks();return N(((t,e)=>{const n=ct.map(e,(e=>t.dom.getParent(e,"li,dd,dt",Kt(t,e))||e));return B(n)})(t,e),vt)},Ft=(t,e)=>{const n=t.dom.getParents(e,"TD,TH");return n.length>0?n[0]:t.getBody()},Kt=(t,e)=>{const n=t.dom.getParents(e,t.dom.isBlock),r=k(n,(e=>{return n=t.schema,!ht(r=e)&&!vt(r)&&C($t,(t=>n.isValidChild(r.nodeName,t)));var n,r}));return r.getOr(t.getBody())},Vt=(t,e)=>{const n=t.dom.getParents(e,"ol,ul",Kt(t,e));return E(n)},zt=(t,e)=>{const n=b(e,(e=>Vt(t,e).getOr(e)));return B(n)},Qt=t=>/\btox\-/.test(t.className),qt=(t,e)=>O(t,ht,bt).exists((t=>t.nodeName===e&&!Qt(t))),Wt=(t,e)=>null!==e&&"false"===t.dom.getContentEditableParent(e),Zt=(t,e)=>{const n=t.dom.getParent(e,"ol,ul,dl");return Wt(t,n)},Gt=(t,e)=>{const n=t.selection.getNode();return e({parents:t.dom.getParents(n),element:n}),t.on("NodeChange",e),()=>t.off("NodeChange",e)},Jt=(t,e,n)=>t.dispatch("ListMutation",{action:e,element:n}),Xt=(Yt=/^\s+|\s+$/g,t=>t.replace(Yt,""));var Yt;const te=(t,e,n)=>{((t,e,n)=>{if(!r(n))throw console.error("Invalid call to CSS.set. Property ",e,":: Value ",n,":: Element ",t),new Error("CSS value must be a string: "+n);(t=>void 0!==t.style&&l(t.style.getPropertyValue))(t)&&t.style.setProperty(e,n)})(t.dom,e,n)},ee=(t,e)=>{Z(t.item,e.list)},ne=(t,e)=>{const n={list:M(e,t),item:M("li",t)};return Z(n.list,n.item),n},re=t=>((t,e)=>{const n=t.dom;if(1!==n.nodeType)return!1;{const t=n;if(void 0!==t.matches)return t.matches(e);if(void 0!==t.msMatchesSelector)return t.msMatchesSelector(e);if(void 0!==t.webkitMatchesSelector)return t.webkitMatchesSelector(e);if(void 0!==t.mozMatchesSelector)return t.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")}})(t,"OL,UL"),oe=t=>V(t).exists(re),se=t=>t.depth>0,ie=t=>t.isSelected,ae=t=>{const e=F(t),n=z(t).exists(re)?e.slice(0,-1):e;return b(n,at)},le=t=>(S(t,((e,n)=>{((t,e)=>{const n=t[e].depth,r=t=>t.depth===n&&!t.dirty,o=t=>t.depth<n;return O(A(t.slice(0,e)),r,o).orThunk((()=>O(t.slice(e+1),r,o)))})(t,n).fold((()=>{e.dirty&&(t=>{t.listAttributes=((t,e)=>{const n={};var r;return((t,e,n,r)=>{ot(t,((t,o)=>{(e(t,o)?n:r)(t,o)}))})(t,e,(r=n,(t,e)=>{r[e]=t}),c),n})(t.listAttributes,((t,e)=>"start"!==e))})(e)}),(t=>{return r=t,(n=e).listType=r.listType,void(n.listAttributes={...r.listAttributes});var n,r}))})),t),de=(t,e,n,r)=>V(r).filter(re).fold((()=>{e.each((t=>{U(t.start,r)&&n.set(!0)}));const o=((t,e,n)=>j(t).filter(_).map((r=>({depth:e,dirty:!1,isSelected:n,content:ae(t),itemAttributes:it(t),listAttributes:it(r),listType:$(r)}))))(r,t,n.get());e.each((t=>{U(t.end,r)&&n.set(!1)}));const s=z(r).filter(re).map((r=>ce(t,e,n,r))).getOr([]);return o.toArray().concat(s)}),(r=>ce(t,e,n,r))),ce=(t,e,n,r)=>T(F(r),(r=>(re(r)?ce:de)(t+1,e,n,r))),ue=(t,e)=>{const n=le(e);return((t,e)=>{const n=L(e,((e,n)=>n.depth>e.length?((t,e,n)=>{const r=((t,e,n)=>{const r=[];for(let o=0;o<n;o++)r.push(ne(t,e.listType));return r})(t,n,n.depth-e.length);var o;return(t=>{for(let e=1;e<t.length;e++)ee(t[e-1],t[e])})(r),((t,e)=>{for(let e=0;e<t.length-1;e++)te(t[e].item,"list-style-type","none");E(t).each((t=>{st(t.list,e.listAttributes),st(t.item,e.itemAttributes),G(t.item,e.content)}))})(r,n),o=r,I(E(e),D(o),ee),e.concat(r)})(t,e,n):((t,e,n)=>{const r=e.slice(0,n.depth);return E(r).each((e=>{const r=((t,e,n)=>{const r=M("li",t);return st(r,e),G(r,n),r})(t,n.itemAttributes,n.content);((t,e)=>{Z(t.list,e),t.item=e})(e,r),((t,e)=>{$(t.list)!==e.listType&&(t.list=lt(t.list,e.listType)),st(t.list,e.listAttributes)})(e,n)})),r})(t,e,n)),[]);return D(n).map((t=>t.list))})(t.contentDocument,n).toArray()},me=(t,e,n)=>{const r=((t,e)=>{const n=(t=>{let e=!1;return{get:()=>e,set:t=>{e=t}}})();return b(t,(t=>({sourceList:t,entries:ce(0,e,n,t)})))})(e,(t=>{const e=b(jt(t),R);return I(k(e,m(oe)),k(A(e),m(oe)),((t,e)=>({start:t,end:e})))})(t));S(r,(e=>{((t,e)=>{S(N(t,ie),(t=>((t,e)=>{switch(t){case"Indent":e.depth++;break;case"Outdent":e.depth--;break;case"Flatten":e.depth=0}e.dirty=!0})(e,t)))})(e.entries,n);const r=((t,e)=>T(((t,e)=>{if(0===t.length)return[];{let n=e(t[0]);const r=[];let o=[];for(let s=0,i=t.length;s<i;s++){const i=t[s],a=e(i);a!==n&&(r.push(o),o=[]),n=a,o.push(i)}return 0!==o.length&&r.push(o),r}})(e,se),(e=>D(e).exists(se)?ue(t,e):((t,e)=>{const n=le(e);return b(n,(e=>{const n=((t,e)=>{const n=document.createDocumentFragment();return S(t,(t=>{n.appendChild(t.dom)})),R(n)})(e.content);return R(Et(t,n.dom))}))})(t,e))))(t,e.entries);var o;S(r,(e=>{Jt(t,"Indent"===n?"IndentList":"OutdentList",e.dom)})),o=e.sourceList,S(r,(t=>{W(o,t)})),X(e.sourceList)}))},pe=(t,e)=>{const n=nt((t=>{const e=(t=>{const e=Vt(t,t.selection.getStart()),n=N(t.selection.getSelectedBlocks(),ft);return e.toArray().concat(n)})(t);return zt(t,e)})(t)),r=nt((t=>N(jt(t),Ct))(t));let o=!1;if(n.length||r.length){const s=t.selection.getBookmark();me(t,n,e),((t,e,n)=>{S(n,"Indent"===e?Mt:e=>Pt(t,e))})(t,e,r),t.selection.moveToBookmark(s),t.selection.setRng(Ut(t.selection.getRng())),t.nodeChanged(),o=!0}return o},ge=(t,e)=>!(t=>{const e=Ht(t);return Wt(t,e)})(t)&&pe(t,e),he=t=>ge(t,"Indent"),fe=t=>ge(t,"Outdent"),ye=t=>ge(t,"Flatten");var ve=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager");const Ce=dt.DOM,be=t=>{const e={},n=n=>{let r=t[n?"startContainer":"endContainer"],o=t[n?"startOffset":"endOffset"];if(gt(r)){const t=Ce.create("span",{"data-mce-type":"bookmark"});r.hasChildNodes()?(o=Math.min(o,r.childNodes.length-1),n?r.insertBefore(t,r.childNodes[o]):Ce.insertAfter(t,r.childNodes[o])):r.appendChild(t),r=t,o=0}e[n?"startContainer":"endContainer"]=r,e[n?"startOffset":"endOffset"]=o};return n(!0),t.collapsed||n(),e},Se=t=>{const e=e=>{let n=t[e?"startContainer":"endContainer"],r=t[e?"startOffset":"endOffset"];if(n){if(gt(n)&&n.parentNode){const t=n;r=(t=>{var e;let n=null===(e=t.parentNode)||void 0===e?void 0:e.firstChild,r=0;for(;n;){if(n===t)return r;gt(n)&&"bookmark"===n.getAttribute("data-mce-type")||r++,n=n.nextSibling}return-1})(n),n=n.parentNode,Ce.remove(t),!n.hasChildNodes()&&Ce.isBlock(n)&&n.appendChild(Ce.create("br"))}t[e?"startContainer":"endContainer"]=n,t[e?"startOffset":"endOffset"]=r}};e(!0),e();const n=Ce.createRng();return n.setStart(t.startContainer,t.startOffset),t.endContainer&&n.setEnd(t.endContainer,t.endOffset),Ut(n)},Ne=t=>{switch(t){case"UL":return"ToggleUlList";case"OL":return"ToggleOlList";case"DL":return"ToggleDLList"}},Le=(t,e)=>{ct.each(e,((e,n)=>{t.setAttribute(n,e)}))},Oe=(t,e,n)=>{((t,e,n)=>{const r=n["list-style-type"]?n["list-style-type"]:null;t.setStyle(e,"list-style-type",r)})(t,e,n),((t,e,n)=>{Le(e,n["list-attributes"]),ct.each(t.select("li",e),(t=>{Le(t,n["list-item-attributes"])}))})(t,e,n)},ke=(t,e,n,r)=>{let o=e[n?"startContainer":"endContainer"];const s=e[n?"startOffset":"endOffset"];for(gt(o)&&(o=o.childNodes[Math.min(s,o.childNodes.length-1)]||o),!n&&St(o.nextSibling)&&(o=o.nextSibling);o.parentNode!==r;){const e=o.parentNode;if(Nt(t,o))return o;if(/^(TD|TH)$/.test(e.nodeName))return o;o=e}return o},Te=(t,e,n)=>{const r=t.selection.getRng();let o="LI";const s=Kt(t,t.selection.getStart(!0)),i=t.dom;if("false"===i.getContentEditable(t.selection.getNode()))return;"DL"===(e=e.toUpperCase())&&(o="DT");const a=be(r),l=((t,e,n)=>{const r=[],o=t.dom,s=ke(t,e,!0,n),i=ke(t,e,!1,n);let a;const l=[];for(let t=s;t&&(l.push(t),t!==i);t=t.nextSibling);return ct.each(l,(e=>{var s;if(Nt(t,e))return r.push(e),void(a=null);if(o.isBlock(e)||St(e))return St(e)&&o.remove(e),void(a=null);const i=e.nextSibling;ve.isBookmarkNode(e)&&(ht(i)||Nt(t,i)||!i&&e.parentNode===n)?a=null:(a||(a=o.create("p"),null===(s=e.parentNode)||void 0===s||s.insertBefore(a,e),r.push(a)),a.appendChild(e))})),r})(t,r,s);ct.each(l,(r=>{let s;const a=r.previousSibling,l=r.parentNode;vt(l)||(a&&ht(a)&&a.nodeName===e&&((t,e,n)=>{const r=t.getStyle(e,"list-style-type");let o=n?n["list-style-type"]:"";return o=null===o?"":o,r===o})(i,a,n)?(s=a,r=i.rename(r,o),a.appendChild(r)):(s=i.create(e),l.insertBefore(s,r),s.appendChild(r),r=i.rename(r,o)),((t,e,n)=>{ct.each(["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"],(n=>t.setStyle(e,n,"")))})(i,r),Oe(i,s,n),we(t.dom,s))})),t.selection.setRng(Se(a))},Ae=(t,e,n)=>{return((t,e)=>ht(t)&&t.nodeName===(null==e?void 0:e.nodeName))(e,n)&&((t,e,n)=>t.getStyle(e,"list-style-type",!0)===t.getStyle(n,"list-style-type",!0))(t,e,n)&&(r=n,e.className===r.className);var r},we=(t,e)=>{let n,r=e.nextSibling;if(Ae(t,e,r)){const o=r;for(;n=o.firstChild;)e.appendChild(n);t.remove(o)}if(r=e.previousSibling,Ae(t,e,r)){const o=r;for(;n=o.lastChild;)e.insertBefore(n,e.firstChild);t.remove(o)}},De=t=>"list-style-type"in t,Ee=(t,e,n)=>{const r=Ht(t);if(Zt(t,r))return;const s=(t=>{const e=Ht(t),n=t.selection.getSelectedBlocks();return((t,e)=>a(t)&&1===e.length&&e[0]===t)(e,n)?(t=>N(t.querySelectorAll(_t),ht))(e):N(n,(t=>ht(t)&&e!==t))})(t),i=o(n)?n:{};s.length>0?((t,e,n,r,o)=>{const s=ht(e);if(s&&e.nodeName===r&&!De(o))ye(t);else{Te(t,r,o);const i=be(t.selection.getRng()),a=s?[e,...n]:n;ct.each(a,(e=>{((t,e,n,r)=>{if(e.nodeName!==n){const o=t.dom.rename(e,n);Oe(t.dom,o,r),Jt(t,Ne(n),o)}else Oe(t.dom,e,r),Jt(t,Ne(n),e)})(t,e,r,o)})),t.selection.setRng(Se(i))}})(t,r,s,e,i):((t,e,n,r)=>{if(e!==t.getBody())if(e)if(e.nodeName!==n||De(r)||Qt(e)){const o=be(t.selection.getRng());Oe(t.dom,e,r);const s=t.dom.rename(e,n);we(t.dom,s),t.selection.setRng(Se(o)),Te(t,n,r),Jt(t,Ne(n),s)}else ye(t);else Te(t,n,r),Jt(t,Ne(n),e)})(t,r,e,i)},Be=dt.DOM,xe=(t,e)=>{const n=ct.grep(t.select("ol,ul",e));ct.each(n,(e=>{((t,e)=>{const n=e.parentElement;if(n&&"LI"===n.nodeName&&n.firstChild===e){const r=n.previousSibling;r&&"LI"===r.nodeName?(r.appendChild(e),Ot(t,n)&&Be.remove(n)):Be.setStyle(n,"listStyleType","none")}if(ht(n)){const t=n.previousSibling;t&&"LI"===t.nodeName&&t.appendChild(e)}})(t,e)}))},Ie=(t,e,n,r)=>{let o=e.startContainer;const s=e.startOffset;if(pt(o)&&(n?s<o.data.length:s>0))return o;const i=t.schema.getNonEmptyElements();gt(o)&&(o=Y.getNode(o,s));const a=new tt(o,r);n&&((t,e)=>!!St(e)&&t.isBlock(e.nextSibling)&&!St(e.previousSibling))(t.dom,o)&&a.next();const l=n?a.next.bind(a):a.prev2.bind(a);for(;o=l();){if("LI"===o.nodeName&&!o.hasChildNodes())return o;if(i[o.nodeName])return o;if(pt(o)&&o.data.length>0)return o}return null},Pe=(t,e)=>{const n=e.childNodes;return 1===n.length&&!ht(n[0])&&t.isBlock(n[0])},Me=(t,e,n)=>{let r;const o=e.parentNode;if(!kt(t,e)||!kt(t,n))return;ht(n.lastChild)&&(r=n.lastChild),o===n.lastChild&&St(o.previousSibling)&&t.remove(o.previousSibling);const s=n.lastChild;s&&St(s)&&e.hasChildNodes()&&t.remove(s),Ot(t,n,!0)&&J(R(n)),((t,e,n)=>{let r;const o=Pe(t,n)?n.firstChild:n;if(((t,e)=>{Pe(t,e)&&t.remove(e.firstChild,!0)})(t,e),!Ot(t,e,!0))for(;r=e.firstChild;)o.appendChild(r)})(t,e,n),r&&n.appendChild(r);const i=((t,e)=>{const n=t.dom,r=e.dom;return n!==r&&n.contains(r)})(R(n),R(e))?t.getParents(e,ht,n):[];t.remove(e),S(i,(e=>{Ot(t,e)&&e!==t.getRoot()&&t.remove(e)}))},Re=(t,e)=>{const n=t.dom,r=t.selection,o=r.getStart(),s=Ft(t,o),i=n.getParent(r.getStart(),"LI",s);if(i){const o=i.parentElement;if(o===t.getBody()&&Ot(n,o))return!0;const a=Ut(r.getRng()),l=n.getParent(Ie(t,a,e,s),"LI",s);if(l&&l!==i)return t.undoManager.transact((()=>{var n,r;e?((t,e,n,r)=>{const o=t.dom;if(o.isEmpty(r))((t,e,n)=>{J(R(n)),Me(t.dom,e,n),t.selection.setCursorLocation(n,0)})(t,n,r);else{const s=be(e);Me(o,n,r),t.selection.setRng(Se(s))}})(t,a,l,i):(null===(r=(n=i).parentNode)||void 0===r?void 0:r.firstChild)===n?fe(t):((t,e,n,r)=>{const o=be(e);Me(t.dom,n,r);const s=Se(o);t.selection.setRng(s)})(t,a,i,l)})),!0;if(!l&&!e&&0===a.startOffset&&0===a.endOffset)return t.undoManager.transact((()=>{ye(t)})),!0}return!1},Ue=t=>{const e=t.selection.getStart(),n=Ft(t,e);return t.dom.getParent(e,"LI,DT,DD",n)||jt(t).length>0},$e=(t,e)=>{const n=t.selection;return!Zt(t,n.getNode())&&(n.isCollapsed()?((t,e)=>Re(t,e)||((t,e)=>{const n=t.dom,r=t.selection.getStart(),o=Ft(t,r),s=n.getParent(r,n.isBlock,o);if(s&&n.isEmpty(s)){const r=Ut(t.selection.getRng()),i=n.getParent(Ie(t,r,e,o),"LI",o);if(i){const a=t=>v(["td","th","caption"],$(t)),l=t=>t.dom===o;return!!((t,e,n=u)=>I(t,e,n).getOr(t.isNone()&&e.isNone()))(q(R(i),a,l),q(R(r.startContainer),a,l),U)&&(t.undoManager.transact((()=>{((t,e,n)=>{const r=t.getParent(e.parentNode,t.isBlock,n);t.remove(e),r&&t.isEmpty(r)&&t.remove(r)})(n,s,o),we(n,i.parentNode),t.selection.select(i,!0),t.selection.collapse(e)})),!0)}}return!1})(t,e))(t,e):(t=>!!Ue(t)&&(t.undoManager.transact((()=>{t.execCommand("Delete"),xe(t.dom,t.getBody())})),!0))(t))},_e=t=>{const e=A(Xt(t).split("")),n=b(e,((t,e)=>{const n=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0)+1;return Math.pow(26,e)*n}));return L(n,((t,e)=>t+e),0)},He=t=>{if(--t<0)return"";{const e=t%26,n=Math.floor(t/26);return He(n)+String.fromCharCode("A".charCodeAt(0)+e)}},je=t=>{const e=parseInt(t.start,10);return x(t.listStyleType,"upper-alpha")?He(e):x(t.listStyleType,"lower-alpha")?He(e).toLowerCase():t.start},Fe=(t,e)=>()=>{const n=Ht(t);return a(n)&&n.nodeName===e},Ke=t=>{t.addCommand("mceListProps",(()=>{(t=>{const e=Ht(t);yt(e)&&!Zt(t,e)&&t.windowManager.open({title:"List Properties",body:{type:"panel",items:[{type:"input",name:"start",label:"Start list at number",inputMode:"numeric"}]},initialData:{start:je({start:t.dom.getAttrib(e,"start","1"),listStyleType:g.from(t.dom.getStyle(e,"list-style-type"))})},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:e=>{(t=>{switch((t=>/^[0-9]+$/.test(t)?2:/^[A-Z]+$/.test(t)?0:/^[a-z]+$/.test(t)?1:t.length>0?4:3)(t)){case 2:return g.some({listStyleType:g.none(),start:t});case 0:return g.some({listStyleType:g.some("upper-alpha"),start:_e(t).toString()});case 1:return g.some({listStyleType:g.some("lower-alpha"),start:_e(t).toString()});case 3:return g.some({listStyleType:g.none(),start:""});case 4:return g.none()}})(e.getData().start).each((e=>{t.execCommand("mceListUpdate",!1,{attrs:{start:"1"===e.start?"":e.start},styles:{"list-style-type":e.listStyleType.getOr("")}})})),e.close()}})})(t)}))},Ve=(t,e)=>n=>Gt(t,(r=>{n.setActive(qt(r.parents,e)),n.setEnabled(!Zt(t,r.element))})),ze=(t,e)=>n=>Gt(t,(r=>n.setEnabled(qt(r.parents,e)&&!Zt(t,r.element))));t.add("lists",(t=>((t=>{(0,t.options.register)("lists_indent_on_tab",{processor:"boolean",default:!0})})(t),t.hasPlugin("rtc",!0)?Ke(t):((t=>{At(t)&&(t=>{t.on("keydown",(e=>{e.keyCode!==et.TAB||et.metaKeyPressed(e)||t.undoManager.transact((()=>{(e.shiftKey?fe(t):he(t))&&e.preventDefault()}))}))})(t),(t=>{t.on("ExecCommand",(e=>{const n=e.command.toLowerCase();"delete"!==n&&"forwarddelete"!==n||!Ue(t)||xe(t.dom,t.getBody())})),t.on("keydown",(e=>{e.keyCode===et.BACKSPACE?$e(t,!1)&&e.preventDefault():e.keyCode===et.DELETE&&$e(t,!0)&&e.preventDefault()}))})(t)})(t),(t=>{t.on("BeforeExecCommand",(e=>{const n=e.command.toLowerCase();"indent"===n?he(t):"outdent"===n&&fe(t)})),t.addCommand("InsertUnorderedList",((e,n)=>{Ee(t,"UL",n)})),t.addCommand("InsertOrderedList",((e,n)=>{Ee(t,"OL",n)})),t.addCommand("InsertDefinitionList",((e,n)=>{Ee(t,"DL",n)})),t.addCommand("RemoveList",(()=>{ye(t)})),Ke(t),t.addCommand("mceListUpdate",((e,n)=>{o(n)&&((t,e)=>{const n=Ht(t);null===n||Zt(t,n)||t.undoManager.transact((()=>{o(e.styles)&&t.dom.setStyles(n,e.styles),o(e.attrs)&&ot(e.attrs,((e,r)=>t.dom.setAttrib(n,r,e)))}))})(t,n)})),t.addQueryStateHandler("InsertUnorderedList",Fe(t,"UL")),t.addQueryStateHandler("InsertOrderedList",Fe(t,"OL")),t.addQueryStateHandler("InsertDefinitionList",Fe(t,"DL"))})(t)),(t=>{const e=e=>()=>t.execCommand(e);t.hasPlugin("advlist")||(t.ui.registry.addToggleButton("numlist",{icon:"ordered-list",active:!1,tooltip:"Numbered list",onAction:e("InsertOrderedList"),onSetup:Ve(t,"OL")}),t.ui.registry.addToggleButton("bullist",{icon:"unordered-list",active:!1,tooltip:"Bullet list",onAction:e("InsertUnorderedList"),onSetup:Ve(t,"UL")}))})(t),(t=>{const e={text:"List properties...",icon:"ordered-list",onAction:()=>t.execCommand("mceListProps"),onSetup:ze(t,"OL")};t.ui.registry.addMenuItem("listprops",e),t.ui.registry.addContextMenu("lists",{update:e=>{const n=Ht(t,e);return yt(n)?["listprops"]:[]}})})(t),(t=>({backspaceDelete:e=>{$e(t,e)}}))(t))))}();
|