create-nextjs-cms 0.5.19 → 0.5.20
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/dist/index.js +7 -0
- package/package.json +4 -4
- package/templates/default/.uploads/.photos/categories/000e56fada378de1a84a4 +0 -0
- package/templates/default/.uploads/.photos/categories/121e7d13ee3b5fa03795b +0 -0
- package/templates/default/.uploads/.photos/categories/17a55c5a53eb62293c69e +0 -0
- package/templates/default/.uploads/.photos/categories/4c86ad8c1f51f1e3a953b +0 -0
- package/templates/default/.uploads/.photos/categories/4d360813741a45744327c +0 -0
- package/templates/default/.uploads/.photos/categories/5238fefaa3cbebf388178 +0 -0
- package/templates/default/.uploads/.photos/categories/541d7cf8c69895bcb15cd +0 -0
- package/templates/default/.uploads/.photos/categories/57a2f689a910a378247ea +0 -0
- package/templates/default/.uploads/.photos/categories/6de4bdb341a3e1f70ddc3 +0 -0
- package/templates/default/.uploads/.photos/categories/6f52739eaa686441a28f4 +0 -0
- package/templates/default/.uploads/.photos/categories/8a21b9fa8ecd88f460a15 +0 -0
- package/templates/default/.uploads/.photos/categories/91948abcb073c9445fdec +0 -0
- package/templates/default/.uploads/.photos/categories/9ae700d1abfd6b85780e8 +0 -0
- package/templates/default/.uploads/.photos/categories/9edee86e932985fc589b5 +0 -0
- package/templates/default/.uploads/.photos/categories/a520e77b082f35b575dba +0 -0
- package/templates/default/.uploads/.photos/categories/b19c449029330f0a74b20 +0 -0
- package/templates/default/.uploads/.photos/categories/b9802010f68afd4edb0e8 +0 -0
- package/templates/default/.uploads/.photos/categories/c1d7c3b986739bf496730 +0 -0
- package/templates/default/.uploads/.photos/categories/c25dc38567384513ffe93 +0 -0
- package/templates/default/.uploads/.photos/categories/cbe3874a3d13afba388df +0 -0
- package/templates/default/.uploads/.photos/categories/d450fdeb04f0d070442d6 +0 -0
- package/templates/default/.uploads/.photos/categories/f80bf3a4515680ead5a5c +0 -0
- package/templates/default/.uploads/.photos/categories/f8639c2d5b0d24cb76fb1 +0 -0
- package/templates/default/.uploads/.photos/categories/f8d997149d10aab046e40 +0 -0
- package/templates/default/.uploads/.photos/categories/fa2c55690ff96e33a16fe +0 -0
- package/templates/default/.uploads/.photos/featured_slider/d00be4edb4c38ca34b5a5 +0 -0
- package/templates/default/.uploads/.thumbs/categories/000e56fada378de1a84a4 +0 -0
- package/templates/default/.uploads/.thumbs/categories/121e7d13ee3b5fa03795b +0 -0
- package/templates/default/.uploads/.thumbs/categories/17a55c5a53eb62293c69e +0 -0
- package/templates/default/.uploads/.thumbs/categories/4c86ad8c1f51f1e3a953b +0 -0
- package/templates/default/.uploads/.thumbs/categories/4d360813741a45744327c +0 -0
- package/templates/default/.uploads/.thumbs/categories/5238fefaa3cbebf388178 +0 -0
- package/templates/default/.uploads/.thumbs/categories/541d7cf8c69895bcb15cd +0 -0
- package/templates/default/.uploads/.thumbs/categories/57a2f689a910a378247ea +0 -0
- package/templates/default/.uploads/.thumbs/categories/6de4bdb341a3e1f70ddc3 +0 -0
- package/templates/default/.uploads/.thumbs/categories/6f52739eaa686441a28f4 +0 -0
- package/templates/default/.uploads/.thumbs/categories/8a21b9fa8ecd88f460a15 +0 -0
- package/templates/default/.uploads/.thumbs/categories/91948abcb073c9445fdec +0 -0
- package/templates/default/.uploads/.thumbs/categories/9ae700d1abfd6b85780e8 +0 -0
- package/templates/default/.uploads/.thumbs/categories/9edee86e932985fc589b5 +0 -0
- package/templates/default/.uploads/.thumbs/categories/a520e77b082f35b575dba +0 -0
- package/templates/default/.uploads/.thumbs/categories/b19c449029330f0a74b20 +0 -0
- package/templates/default/.uploads/.thumbs/categories/b9802010f68afd4edb0e8 +0 -0
- package/templates/default/.uploads/.thumbs/categories/c1d7c3b986739bf496730 +0 -0
- package/templates/default/.uploads/.thumbs/categories/c25dc38567384513ffe93 +0 -0
- package/templates/default/.uploads/.thumbs/categories/cbe3874a3d13afba388df +0 -0
- package/templates/default/.uploads/.thumbs/categories/d450fdeb04f0d070442d6 +0 -0
- package/templates/default/.uploads/.thumbs/categories/f80bf3a4515680ead5a5c +0 -0
- package/templates/default/.uploads/.thumbs/categories/f8639c2d5b0d24cb76fb1 +0 -0
- package/templates/default/.uploads/.thumbs/categories/f8d997149d10aab046e40 +0 -0
- package/templates/default/.uploads/.thumbs/categories/fa2c55690ff96e33a16fe +0 -0
- package/templates/default/_gitignore +57 -0
- package/templates/default/components/form/helpers/_section-hot-reload.ts +11 -0
- package/templates/default/next-env.d.ts +6 -0
- package/templates/default/package.json +2 -2
- package/templates/default/public/tinymce/CHANGELOG.md +3785 -0
- package/templates/default/public/tinymce/README.md +77 -0
- package/templates/default/public/tinymce/bower.json +27 -0
- package/templates/default/public/tinymce/composer.json +52 -0
- package/templates/default/public/tinymce/icons/default/icons.js +231 -0
- package/templates/default/public/tinymce/icons/default/icons.min.js +1 -0
- package/templates/default/public/tinymce/icons/default/index.js +7 -0
- package/templates/default/public/tinymce/license.md +6 -0
- package/templates/default/public/tinymce/models/dom/index.js +7 -0
- package/templates/default/public/tinymce/models/dom/model.js +8994 -0
- package/templates/default/public/tinymce/models/dom/model.min.js +1 -0
- package/templates/default/public/tinymce/notices.txt +21 -0
- package/templates/default/public/tinymce/package.json +32 -0
- package/templates/default/public/tinymce/plugins/accordion/index.js +7 -0
- package/templates/default/public/tinymce/plugins/accordion/plugin.js +1349 -0
- package/templates/default/public/tinymce/plugins/accordion/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/advlist/index.js +7 -0
- package/templates/default/public/tinymce/plugins/advlist/plugin.js +471 -0
- package/templates/default/public/tinymce/plugins/advlist/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/anchor/index.js +7 -0
- package/templates/default/public/tinymce/plugins/anchor/plugin.js +237 -0
- package/templates/default/public/tinymce/plugins/anchor/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/autolink/index.js +7 -0
- package/templates/default/public/tinymce/plugins/autolink/plugin.js +318 -0
- package/templates/default/public/tinymce/plugins/autolink/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/autoresize/index.js +7 -0
- package/templates/default/public/tinymce/plugins/autoresize/plugin.js +223 -0
- package/templates/default/public/tinymce/plugins/autoresize/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/autosave/index.js +7 -0
- package/templates/default/public/tinymce/plugins/autosave/plugin.js +252 -0
- package/templates/default/public/tinymce/plugins/autosave/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/charmap/index.js +7 -0
- package/templates/default/public/tinymce/plugins/charmap/plugin.js +997 -0
- package/templates/default/public/tinymce/plugins/charmap/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/code/index.js +7 -0
- package/templates/default/public/tinymce/plugins/code/plugin.js +97 -0
- package/templates/default/public/tinymce/plugins/code/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/codesample/index.js +7 -0
- package/templates/default/public/tinymce/plugins/codesample/plugin.js +3654 -0
- package/templates/default/public/tinymce/plugins/codesample/plugin.min.js +9 -0
- package/templates/default/public/tinymce/plugins/directionality/index.js +7 -0
- package/templates/default/public/tinymce/plugins/directionality/plugin.js +636 -0
- package/templates/default/public/tinymce/plugins/directionality/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/emoticons/index.js +7 -0
- package/templates/default/public/tinymce/plugins/emoticons/js/emojiimages.js +1 -0
- package/templates/default/public/tinymce/plugins/emoticons/js/emojiimages.min.js +1 -0
- package/templates/default/public/tinymce/plugins/emoticons/js/emojis.js +1 -0
- package/templates/default/public/tinymce/plugins/emoticons/js/emojis.min.js +1 -0
- package/templates/default/public/tinymce/plugins/emoticons/plugin.js +809 -0
- package/templates/default/public/tinymce/plugins/emoticons/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/fullscreen/index.js +7 -0
- package/templates/default/public/tinymce/plugins/fullscreen/plugin.js +1609 -0
- package/templates/default/public/tinymce/plugins/fullscreen/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/help/index.js +7 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ar.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ca.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/cs.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/da.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/de.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/el.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/en.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/es.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/eu.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fa.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fi.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/he_IL.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hi.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hr.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/id.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/it.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ja.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/kk.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ms.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nl.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pl.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ro.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ru.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sk.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/th_TH.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/tr.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/uk.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/vi.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +87 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +93 -0
- package/templates/default/public/tinymce/plugins/help/plugin.js +828 -0
- package/templates/default/public/tinymce/plugins/help/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/image/index.js +7 -0
- package/templates/default/public/tinymce/plugins/image/plugin.js +1689 -0
- package/templates/default/public/tinymce/plugins/image/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/importcss/index.js +7 -0
- package/templates/default/public/tinymce/plugins/importcss/plugin.js +403 -0
- package/templates/default/public/tinymce/plugins/importcss/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/insertdatetime/index.js +7 -0
- package/templates/default/public/tinymce/plugins/insertdatetime/plugin.js +186 -0
- package/templates/default/public/tinymce/plugins/insertdatetime/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/link/index.js +7 -0
- package/templates/default/public/tinymce/plugins/link/plugin.js +1577 -0
- package/templates/default/public/tinymce/plugins/link/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/lists/index.js +7 -0
- package/templates/default/public/tinymce/plugins/lists/plugin.js +2544 -0
- package/templates/default/public/tinymce/plugins/lists/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/media/index.js +7 -0
- package/templates/default/public/tinymce/plugins/media/plugin.js +1450 -0
- package/templates/default/public/tinymce/plugins/media/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/nonbreaking/index.js +7 -0
- package/templates/default/public/tinymce/plugins/nonbreaking/plugin.js +128 -0
- package/templates/default/public/tinymce/plugins/nonbreaking/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/pagebreak/index.js +7 -0
- package/templates/default/public/tinymce/plugins/pagebreak/plugin.js +123 -0
- package/templates/default/public/tinymce/plugins/pagebreak/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/preview/index.js +7 -0
- package/templates/default/public/tinymce/plugins/preview/plugin.js +765 -0
- package/templates/default/public/tinymce/plugins/preview/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/quickbars/index.js +7 -0
- package/templates/default/public/tinymce/plugins/quickbars/plugin.js +654 -0
- package/templates/default/public/tinymce/plugins/quickbars/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/save/index.js +7 -0
- package/templates/default/public/tinymce/plugins/save/plugin.js +136 -0
- package/templates/default/public/tinymce/plugins/save/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/searchreplace/index.js +7 -0
- package/templates/default/public/tinymce/plugins/searchreplace/plugin.js +1370 -0
- package/templates/default/public/tinymce/plugins/searchreplace/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/table/index.js +7 -0
- package/templates/default/public/tinymce/plugins/table/plugin.js +4019 -0
- package/templates/default/public/tinymce/plugins/table/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/visualblocks/index.js +7 -0
- package/templates/default/public/tinymce/plugins/visualblocks/plugin.js +106 -0
- package/templates/default/public/tinymce/plugins/visualblocks/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/visualchars/index.js +7 -0
- package/templates/default/public/tinymce/plugins/visualchars/plugin.js +809 -0
- package/templates/default/public/tinymce/plugins/visualchars/plugin.min.js +1 -0
- package/templates/default/public/tinymce/plugins/wordcount/index.js +7 -0
- package/templates/default/public/tinymce/plugins/wordcount/plugin.js +480 -0
- package/templates/default/public/tinymce/plugins/wordcount/plugin.min.js +1 -0
- package/templates/default/public/tinymce/skins/content/dark/content.css +75 -0
- package/templates/default/public/tinymce/skins/content/dark/content.js +10 -0
- package/templates/default/public/tinymce/skins/content/dark/content.min.css +10 -0
- package/templates/default/public/tinymce/skins/content/default/content.css +70 -0
- package/templates/default/public/tinymce/skins/content/default/content.js +10 -0
- package/templates/default/public/tinymce/skins/content/default/content.min.css +10 -0
- package/templates/default/public/tinymce/skins/content/document/content.css +75 -0
- package/templates/default/public/tinymce/skins/content/document/content.js +10 -0
- package/templates/default/public/tinymce/skins/content/document/content.min.css +10 -0
- package/templates/default/public/tinymce/skins/content/tinymce-5/content.css +70 -0
- package/templates/default/public/tinymce/skins/content/tinymce-5/content.js +10 -0
- package/templates/default/public/tinymce/skins/content/tinymce-5/content.min.css +10 -0
- package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.css +75 -0
- package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.js +10 -0
- package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.min.css +10 -0
- package/templates/default/public/tinymce/skins/content/writer/content.css +71 -0
- package/templates/default/public/tinymce/skins/content/writer/content.js +10 -0
- package/templates/default/public/tinymce/skins/content/writer/content.min.css +10 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.css +893 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.css +887 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.js +10 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.min.css +10 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.js +10 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.min.css +10 -0
- package/templates/default/public/tinymce/skins/ui/oxide/skin.css +5141 -0
- package/templates/default/public/tinymce/skins/ui/oxide/skin.js +1 -0
- package/templates/default/public/tinymce/skins/ui/oxide/skin.min.css +1 -0
- package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.css +30 -0
- package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.js +1 -0
- package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.css +881 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.css +887 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.js +10 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.min.css +10 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.js +10 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.min.css +10 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.css +5144 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.js +1 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.min.css +1 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +30 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +1 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.css +893 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.css +887 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.js +10 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.min.css +10 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.js +10 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.min.css +10 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.css +5260 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.js +1 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.min.css +1 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.css +30 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +1 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.css +881 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.css +887 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.js +10 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +10 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.js +10 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.min.css +10 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.css +5260 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.css +30 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +1 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
- package/templates/default/public/tinymce/themes/silver/index.js +7 -0
- package/templates/default/public/tinymce/themes/silver/theme.js +34798 -0
- package/templates/default/public/tinymce/themes/silver/theme.min.js +1 -0
- package/templates/default/public/tinymce/tinymce.d.ts +3350 -0
- package/templates/default/public/tinymce/tinymce.js +38694 -0
- package/templates/default/public/tinymce/tinymce.min.js +11 -0
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TinyMCE version 7.9.1 (2025-05-29)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
(function () {
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
9
|
+
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-wrapper-object-types */
|
|
11
|
+
const hasProto = (v, constructor, predicate) => {
|
|
12
|
+
var _a;
|
|
13
|
+
if (predicate(v, constructor.prototype)) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
// String-based fallback time
|
|
18
|
+
return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const typeOf = (x) => {
|
|
22
|
+
const t = typeof x;
|
|
23
|
+
if (x === null) {
|
|
24
|
+
return 'null';
|
|
25
|
+
}
|
|
26
|
+
else if (t === 'object' && Array.isArray(x)) {
|
|
27
|
+
return 'array';
|
|
28
|
+
}
|
|
29
|
+
else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
|
|
30
|
+
return 'string';
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return t;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const isType$1 = (type) => (value) => typeOf(value) === type;
|
|
37
|
+
const isSimpleType = (type) => (value) => typeof value === type;
|
|
38
|
+
const isString = isType$1('string');
|
|
39
|
+
const isBoolean = isSimpleType('boolean');
|
|
40
|
+
const isNullable = (a) => a === null || a === undefined;
|
|
41
|
+
const isNonNullable = (a) => !isNullable(a);
|
|
42
|
+
const isFunction = isSimpleType('function');
|
|
43
|
+
const isNumber = isSimpleType('number');
|
|
44
|
+
|
|
45
|
+
/** Compose two unary functions. Similar to compose, but avoids using Function.prototype.apply. */
|
|
46
|
+
const compose1 = (fbc, fab) => (a) => fbc(fab(a));
|
|
47
|
+
const constant = (value) => {
|
|
48
|
+
return () => {
|
|
49
|
+
return value;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const never = constant(false);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The `Optional` type represents a value (of any type) that potentially does
|
|
56
|
+
* not exist. Any `Optional<T>` can either be a `Some<T>` (in which case the
|
|
57
|
+
* value does exist) or a `None` (in which case the value does not exist). This
|
|
58
|
+
* module defines a whole lot of FP-inspired utility functions for dealing with
|
|
59
|
+
* `Optional` objects.
|
|
60
|
+
*
|
|
61
|
+
* Comparison with null or undefined:
|
|
62
|
+
* - We don't get fancy null coalescing operators with `Optional`
|
|
63
|
+
* - We do get fancy helper functions with `Optional`
|
|
64
|
+
* - `Optional` support nesting, and allow for the type to still be nullable (or
|
|
65
|
+
* another `Optional`)
|
|
66
|
+
* - There is no option to turn off strict-optional-checks like there is for
|
|
67
|
+
* strict-null-checks
|
|
68
|
+
*/
|
|
69
|
+
class Optional {
|
|
70
|
+
// The internal representation has a `tag` and a `value`, but both are
|
|
71
|
+
// private: able to be console.logged, but not able to be accessed by code
|
|
72
|
+
constructor(tag, value) {
|
|
73
|
+
this.tag = tag;
|
|
74
|
+
this.value = value;
|
|
75
|
+
}
|
|
76
|
+
// --- Identities ---
|
|
77
|
+
/**
|
|
78
|
+
* Creates a new `Optional<T>` that **does** contain a value.
|
|
79
|
+
*/
|
|
80
|
+
static some(value) {
|
|
81
|
+
return new Optional(true, value);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Create a new `Optional<T>` that **does not** contain a value. `T` can be
|
|
85
|
+
* any type because we don't actually have a `T`.
|
|
86
|
+
*/
|
|
87
|
+
static none() {
|
|
88
|
+
return Optional.singletonNone;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Perform a transform on an `Optional` type. Regardless of whether this
|
|
92
|
+
* `Optional` contains a value or not, `fold` will return a value of type `U`.
|
|
93
|
+
* If this `Optional` does not contain a value, the `U` will be created by
|
|
94
|
+
* calling `onNone`. If this `Optional` does contain a value, the `U` will be
|
|
95
|
+
* created by calling `onSome`.
|
|
96
|
+
*
|
|
97
|
+
* For the FP enthusiasts in the room, this function:
|
|
98
|
+
* 1. Could be used to implement all of the functions below
|
|
99
|
+
* 2. Forms a catamorphism
|
|
100
|
+
*/
|
|
101
|
+
fold(onNone, onSome) {
|
|
102
|
+
if (this.tag) {
|
|
103
|
+
return onSome(this.value);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return onNone();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Determine if this `Optional` object contains a value.
|
|
111
|
+
*/
|
|
112
|
+
isSome() {
|
|
113
|
+
return this.tag;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Determine if this `Optional` object **does not** contain a value.
|
|
117
|
+
*/
|
|
118
|
+
isNone() {
|
|
119
|
+
return !this.tag;
|
|
120
|
+
}
|
|
121
|
+
// --- Functor (name stolen from Haskell / maths) ---
|
|
122
|
+
/**
|
|
123
|
+
* Perform a transform on an `Optional` object, **if** there is a value. If
|
|
124
|
+
* you provide a function to turn a T into a U, this is the function you use
|
|
125
|
+
* to turn an `Optional<T>` into an `Optional<U>`. If this **does** contain
|
|
126
|
+
* a value then the output will also contain a value (that value being the
|
|
127
|
+
* output of `mapper(this.value)`), and if this **does not** contain a value
|
|
128
|
+
* then neither will the output.
|
|
129
|
+
*/
|
|
130
|
+
map(mapper) {
|
|
131
|
+
if (this.tag) {
|
|
132
|
+
return Optional.some(mapper(this.value));
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
return Optional.none();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// --- Monad (name stolen from Haskell / maths) ---
|
|
139
|
+
/**
|
|
140
|
+
* Perform a transform on an `Optional` object, **if** there is a value.
|
|
141
|
+
* Unlike `map`, here the transform itself also returns an `Optional`.
|
|
142
|
+
*/
|
|
143
|
+
bind(binder) {
|
|
144
|
+
if (this.tag) {
|
|
145
|
+
return binder(this.value);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return Optional.none();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// --- Traversable (name stolen from Haskell / maths) ---
|
|
152
|
+
/**
|
|
153
|
+
* For a given predicate, this function finds out if there **exists** a value
|
|
154
|
+
* inside this `Optional` object that meets the predicate. In practice, this
|
|
155
|
+
* means that for `Optional`s that do not contain a value it returns false (as
|
|
156
|
+
* no predicate-meeting value exists).
|
|
157
|
+
*/
|
|
158
|
+
exists(predicate) {
|
|
159
|
+
return this.tag && predicate(this.value);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* For a given predicate, this function finds out if **all** the values inside
|
|
163
|
+
* this `Optional` object meet the predicate. In practice, this means that
|
|
164
|
+
* for `Optional`s that do not contain a value it returns true (as all 0
|
|
165
|
+
* objects do meet the predicate).
|
|
166
|
+
*/
|
|
167
|
+
forall(predicate) {
|
|
168
|
+
return !this.tag || predicate(this.value);
|
|
169
|
+
}
|
|
170
|
+
filter(predicate) {
|
|
171
|
+
if (!this.tag || predicate(this.value)) {
|
|
172
|
+
return this;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
return Optional.none();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// --- Getters ---
|
|
179
|
+
/**
|
|
180
|
+
* Get the value out of the inside of the `Optional` object, using a default
|
|
181
|
+
* `replacement` value if the provided `Optional` object does not contain a
|
|
182
|
+
* value.
|
|
183
|
+
*/
|
|
184
|
+
getOr(replacement) {
|
|
185
|
+
return this.tag ? this.value : replacement;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get the value out of the inside of the `Optional` object, using a default
|
|
189
|
+
* `replacement` value if the provided `Optional` object does not contain a
|
|
190
|
+
* value. Unlike `getOr`, in this method the `replacement` object is also
|
|
191
|
+
* `Optional` - meaning that this method will always return an `Optional`.
|
|
192
|
+
*/
|
|
193
|
+
or(replacement) {
|
|
194
|
+
return this.tag ? this : replacement;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Get the value out of the inside of the `Optional` object, using a default
|
|
198
|
+
* `replacement` value if the provided `Optional` object does not contain a
|
|
199
|
+
* value. Unlike `getOr`, in this method the `replacement` value is
|
|
200
|
+
* "thunked" - that is to say that you don't pass a value to `getOrThunk`, you
|
|
201
|
+
* pass a function which (if called) will **return** the `value` you want to
|
|
202
|
+
* use.
|
|
203
|
+
*/
|
|
204
|
+
getOrThunk(thunk) {
|
|
205
|
+
return this.tag ? this.value : thunk();
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Get the value out of the inside of the `Optional` object, using a default
|
|
209
|
+
* `replacement` value if the provided Optional object does not contain a
|
|
210
|
+
* value.
|
|
211
|
+
*
|
|
212
|
+
* Unlike `or`, in this method the `replacement` value is "thunked" - that is
|
|
213
|
+
* to say that you don't pass a value to `orThunk`, you pass a function which
|
|
214
|
+
* (if called) will **return** the `value` you want to use.
|
|
215
|
+
*
|
|
216
|
+
* Unlike `getOrThunk`, in this method the `replacement` value is also
|
|
217
|
+
* `Optional`, meaning that this method will always return an `Optional`.
|
|
218
|
+
*/
|
|
219
|
+
orThunk(thunk) {
|
|
220
|
+
return this.tag ? this : thunk();
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Get the value out of the inside of the `Optional` object, throwing an
|
|
224
|
+
* exception if the provided `Optional` object does not contain a value.
|
|
225
|
+
*
|
|
226
|
+
* WARNING:
|
|
227
|
+
* You should only be using this function if you know that the `Optional`
|
|
228
|
+
* object **is not** empty (otherwise you're throwing exceptions in production
|
|
229
|
+
* code, which is bad).
|
|
230
|
+
*
|
|
231
|
+
* In tests this is more acceptable.
|
|
232
|
+
*
|
|
233
|
+
* Prefer other methods to this, such as `.each`.
|
|
234
|
+
*/
|
|
235
|
+
getOrDie(message) {
|
|
236
|
+
if (!this.tag) {
|
|
237
|
+
throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
return this.value;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
// --- Interop with null and undefined ---
|
|
244
|
+
/**
|
|
245
|
+
* Creates an `Optional` value from a nullable (or undefined-able) input.
|
|
246
|
+
* Null, or undefined, is converted to `None`, and anything else is converted
|
|
247
|
+
* to `Some`.
|
|
248
|
+
*/
|
|
249
|
+
static from(value) {
|
|
250
|
+
return isNonNullable(value) ? Optional.some(value) : Optional.none();
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Converts an `Optional` to a nullable type, by getting the value if it
|
|
254
|
+
* exists, or returning `null` if it does not.
|
|
255
|
+
*/
|
|
256
|
+
getOrNull() {
|
|
257
|
+
return this.tag ? this.value : null;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Converts an `Optional` to an undefined-able type, by getting the value if
|
|
261
|
+
* it exists, or returning `undefined` if it does not.
|
|
262
|
+
*/
|
|
263
|
+
getOrUndefined() {
|
|
264
|
+
return this.value;
|
|
265
|
+
}
|
|
266
|
+
// --- Utilities ---
|
|
267
|
+
/**
|
|
268
|
+
* If the `Optional` contains a value, perform an action on that value.
|
|
269
|
+
* Unlike the rest of the methods on this type, `.each` has side-effects. If
|
|
270
|
+
* you want to transform an `Optional<T>` **into** something, then this is not
|
|
271
|
+
* the method for you. If you want to use an `Optional<T>` to **do**
|
|
272
|
+
* something, then this is the method for you - provided you're okay with not
|
|
273
|
+
* doing anything in the case where the `Optional` doesn't have a value inside
|
|
274
|
+
* it. If you're not sure whether your use-case fits into transforming
|
|
275
|
+
* **into** something or **doing** something, check whether it has a return
|
|
276
|
+
* value. If it does, you should be performing a transform.
|
|
277
|
+
*/
|
|
278
|
+
each(worker) {
|
|
279
|
+
if (this.tag) {
|
|
280
|
+
worker(this.value);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Turn the `Optional` object into an array that contains all of the values
|
|
285
|
+
* stored inside the `Optional`. In practice, this means the output will have
|
|
286
|
+
* either 0 or 1 elements.
|
|
287
|
+
*/
|
|
288
|
+
toArray() {
|
|
289
|
+
return this.tag ? [this.value] : [];
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Turn the `Optional` object into a string for debugging or printing. Not
|
|
293
|
+
* recommended for production code, but good for debugging. Also note that
|
|
294
|
+
* these days an `Optional` object can be logged to the console directly, and
|
|
295
|
+
* its inner value (if it exists) will be visible.
|
|
296
|
+
*/
|
|
297
|
+
toString() {
|
|
298
|
+
return this.tag ? `some(${this.value})` : 'none()';
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
// Sneaky optimisation: every instance of Optional.none is identical, so just
|
|
302
|
+
// reuse the same object
|
|
303
|
+
Optional.singletonNone = new Optional(false);
|
|
304
|
+
|
|
305
|
+
/* eslint-disable @typescript-eslint/unbound-method */
|
|
306
|
+
const nativeSlice = Array.prototype.slice;
|
|
307
|
+
const map = (xs, f) => {
|
|
308
|
+
// pre-allocating array size when it's guaranteed to be known
|
|
309
|
+
// http://jsperf.com/push-allocated-vs-dynamic/22
|
|
310
|
+
const len = xs.length;
|
|
311
|
+
const r = new Array(len);
|
|
312
|
+
for (let i = 0; i < len; i++) {
|
|
313
|
+
const x = xs[i];
|
|
314
|
+
r[i] = f(x, i);
|
|
315
|
+
}
|
|
316
|
+
return r;
|
|
317
|
+
};
|
|
318
|
+
// Unwound implementing other functions in terms of each.
|
|
319
|
+
// The code size is roughly the same, and it should allow for better optimisation.
|
|
320
|
+
// const each = function<T, U>(xs: T[], f: (x: T, i?: number, xs?: T[]) => void): void {
|
|
321
|
+
const each = (xs, f) => {
|
|
322
|
+
for (let i = 0, len = xs.length; i < len; i++) {
|
|
323
|
+
const x = xs[i];
|
|
324
|
+
f(x, i);
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
const filter = (xs, pred) => {
|
|
328
|
+
const r = [];
|
|
329
|
+
for (let i = 0, len = xs.length; i < len; i++) {
|
|
330
|
+
const x = xs[i];
|
|
331
|
+
if (pred(x, i)) {
|
|
332
|
+
r.push(x);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return r;
|
|
336
|
+
};
|
|
337
|
+
isFunction(Array.from) ? Array.from : (x) => nativeSlice.call(x);
|
|
338
|
+
|
|
339
|
+
const fromHtml = (html, scope) => {
|
|
340
|
+
const doc = scope || document;
|
|
341
|
+
const div = doc.createElement('div');
|
|
342
|
+
div.innerHTML = html;
|
|
343
|
+
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
|
344
|
+
const message = 'HTML does not have a single root node';
|
|
345
|
+
// eslint-disable-next-line no-console
|
|
346
|
+
console.error(message, html);
|
|
347
|
+
throw new Error(message);
|
|
348
|
+
}
|
|
349
|
+
return fromDom(div.childNodes[0]);
|
|
350
|
+
};
|
|
351
|
+
const fromTag = (tag, scope) => {
|
|
352
|
+
const doc = scope || document;
|
|
353
|
+
const node = doc.createElement(tag);
|
|
354
|
+
return fromDom(node);
|
|
355
|
+
};
|
|
356
|
+
const fromText = (text, scope) => {
|
|
357
|
+
const doc = scope || document;
|
|
358
|
+
const node = doc.createTextNode(text);
|
|
359
|
+
return fromDom(node);
|
|
360
|
+
};
|
|
361
|
+
const fromDom = (node) => {
|
|
362
|
+
// TODO: Consider removing this check, but left atm for safety
|
|
363
|
+
if (node === null || node === undefined) {
|
|
364
|
+
throw new Error('Node cannot be null or undefined');
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
dom: node
|
|
368
|
+
};
|
|
369
|
+
};
|
|
370
|
+
const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
|
|
371
|
+
// tslint:disable-next-line:variable-name
|
|
372
|
+
const SugarElement = {
|
|
373
|
+
fromHtml,
|
|
374
|
+
fromTag,
|
|
375
|
+
fromText,
|
|
376
|
+
fromDom,
|
|
377
|
+
fromPoint
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
const DOCUMENT_FRAGMENT = 11;
|
|
381
|
+
const ELEMENT = 1;
|
|
382
|
+
const TEXT = 3;
|
|
383
|
+
|
|
384
|
+
const is = (element, selector) => {
|
|
385
|
+
const dom = element.dom;
|
|
386
|
+
if (dom.nodeType !== ELEMENT) {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
const elem = dom;
|
|
391
|
+
if (elem.matches !== undefined) {
|
|
392
|
+
return elem.matches(selector);
|
|
393
|
+
}
|
|
394
|
+
else if (elem.msMatchesSelector !== undefined) {
|
|
395
|
+
return elem.msMatchesSelector(selector);
|
|
396
|
+
}
|
|
397
|
+
else if (elem.webkitMatchesSelector !== undefined) {
|
|
398
|
+
return elem.webkitMatchesSelector(selector);
|
|
399
|
+
}
|
|
400
|
+
else if (elem.mozMatchesSelector !== undefined) {
|
|
401
|
+
// cast to any as mozMatchesSelector doesn't exist in TS DOM lib
|
|
402
|
+
return elem.mozMatchesSelector(selector);
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
throw new Error('Browser lacks native selectors');
|
|
406
|
+
} // unfortunately we can't throw this on startup :(
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
const name = (element) => {
|
|
411
|
+
const r = element.dom.nodeName;
|
|
412
|
+
return r.toLowerCase();
|
|
413
|
+
};
|
|
414
|
+
const type = (element) => element.dom.nodeType;
|
|
415
|
+
const isType = (t) => (element) => type(element) === t;
|
|
416
|
+
const isElement = isType(ELEMENT);
|
|
417
|
+
const isText = isType(TEXT);
|
|
418
|
+
const isDocumentFragment = isType(DOCUMENT_FRAGMENT);
|
|
419
|
+
const isTag = (tag) => (e) => isElement(e) && name(e) === tag;
|
|
420
|
+
|
|
421
|
+
const parent = (element) => Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
|
|
422
|
+
const children$2 = (element) => map(element.dom.childNodes, SugarElement.fromDom);
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Is the element a ShadowRoot?
|
|
426
|
+
*
|
|
427
|
+
* Note: this is insufficient to test if any element is a shadow root, but it is sufficient to differentiate between
|
|
428
|
+
* a Document and a ShadowRoot.
|
|
429
|
+
*/
|
|
430
|
+
const isShadowRoot = (dos) => isDocumentFragment(dos) && isNonNullable(dos.dom.host);
|
|
431
|
+
const getRootNode = (e) => SugarElement.fromDom(e.dom.getRootNode());
|
|
432
|
+
/** If this element is in a ShadowRoot, return it. */
|
|
433
|
+
const getShadowRoot = (e) => {
|
|
434
|
+
const r = getRootNode(e);
|
|
435
|
+
return isShadowRoot(r) ? Optional.some(r) : Optional.none();
|
|
436
|
+
};
|
|
437
|
+
/** Return the host of a ShadowRoot.
|
|
438
|
+
*
|
|
439
|
+
* This function will throw if Shadow DOM is unsupported in the browser, or if the host is null.
|
|
440
|
+
* If you actually have a ShadowRoot, this shouldn't happen.
|
|
441
|
+
*/
|
|
442
|
+
const getShadowHost = (e) => SugarElement.fromDom(e.dom.host);
|
|
443
|
+
|
|
444
|
+
const rawSet = (dom, key, value) => {
|
|
445
|
+
/*
|
|
446
|
+
* JQuery coerced everything to a string, and silently did nothing on text node/null/undefined.
|
|
447
|
+
*
|
|
448
|
+
* We fail on those invalid cases, only allowing numbers and booleans.
|
|
449
|
+
*/
|
|
450
|
+
if (isString(value) || isBoolean(value) || isNumber(value)) {
|
|
451
|
+
dom.setAttribute(key, value + '');
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
// eslint-disable-next-line no-console
|
|
455
|
+
console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);
|
|
456
|
+
throw new Error('Attribute value was not simple');
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
const set = (element, key, value) => {
|
|
460
|
+
rawSet(element.dom, key, value);
|
|
461
|
+
};
|
|
462
|
+
const remove = (element, key) => {
|
|
463
|
+
element.dom.removeAttribute(key);
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
// some elements, such as mathml, don't have style attributes
|
|
467
|
+
// others, such as angular elements, have style attributes that aren't a CSSStyleDeclaration
|
|
468
|
+
const isSupported = (dom) =>
|
|
469
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
470
|
+
dom.style !== undefined && isFunction(dom.style.getPropertyValue);
|
|
471
|
+
|
|
472
|
+
// Node.contains() is very, very, very good performance
|
|
473
|
+
// http://jsperf.com/closest-vs-contains/5
|
|
474
|
+
const inBody = (element) => {
|
|
475
|
+
// Technically this is only required on IE, where contains() returns false for text nodes.
|
|
476
|
+
// But it's cheap enough to run everywhere and Sugar doesn't have platform detection (yet).
|
|
477
|
+
const dom = isText(element) ? element.dom.parentNode : element.dom;
|
|
478
|
+
// use ownerDocument.body to ensure this works inside iframes.
|
|
479
|
+
// Normally contains is bad because an element "contains" itself, but here we want that.
|
|
480
|
+
if (dom === undefined || dom === null || dom.ownerDocument === null) {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
const doc = dom.ownerDocument;
|
|
484
|
+
return getShadowRoot(SugarElement.fromDom(dom)).fold(() => doc.body.contains(dom), compose1(inBody, getShadowHost));
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
/*
|
|
488
|
+
* NOTE: For certain properties, this returns the "used value" which is subtly different to the "computed value" (despite calling getComputedStyle).
|
|
489
|
+
* Blame CSS 2.0.
|
|
490
|
+
*
|
|
491
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/used_value
|
|
492
|
+
*/
|
|
493
|
+
const get = (element, property) => {
|
|
494
|
+
const dom = element.dom;
|
|
495
|
+
/*
|
|
496
|
+
* IE9 and above per
|
|
497
|
+
* https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle
|
|
498
|
+
*
|
|
499
|
+
* Not in numerosity, because it doesn't memoize and looking this up dynamically in performance critical code would be horrendous.
|
|
500
|
+
*
|
|
501
|
+
* JQuery has some magic here for IE popups, but we don't really need that.
|
|
502
|
+
* It also uses element.ownerDocument.defaultView to handle iframes but that hasn't been required since FF 3.6.
|
|
503
|
+
*/
|
|
504
|
+
const styles = window.getComputedStyle(dom);
|
|
505
|
+
const r = styles.getPropertyValue(property);
|
|
506
|
+
// jquery-ism: If r is an empty string, check that the element is not in a document. If it isn't, return the raw value.
|
|
507
|
+
// Turns out we do this a lot.
|
|
508
|
+
return (r === '' && !inBody(element)) ? getUnsafeProperty(dom, property) : r;
|
|
509
|
+
};
|
|
510
|
+
// removed: support for dom().style[property] where prop is camel case instead of normal property name
|
|
511
|
+
// empty string is what the browsers (IE11 and Chrome) return when the propertyValue doesn't exists.
|
|
512
|
+
const getUnsafeProperty = (dom, property) => isSupported(dom) ? dom.style.getPropertyValue(property) : '';
|
|
513
|
+
|
|
514
|
+
const getDirection = (element) => get(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';
|
|
515
|
+
|
|
516
|
+
const ancestor$1 = (scope, predicate, isRoot) => {
|
|
517
|
+
let element = scope.dom;
|
|
518
|
+
const stop = isFunction(isRoot) ? isRoot : never;
|
|
519
|
+
while (element.parentNode) {
|
|
520
|
+
element = element.parentNode;
|
|
521
|
+
const el = SugarElement.fromDom(element);
|
|
522
|
+
if (predicate(el)) {
|
|
523
|
+
return Optional.some(el);
|
|
524
|
+
}
|
|
525
|
+
else if (stop(el)) {
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return Optional.none();
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
const ancestor = (scope, selector, isRoot) => ancestor$1(scope, (e) => is(e, selector), isRoot);
|
|
533
|
+
|
|
534
|
+
const children$1 = (scope, predicate) => filter(children$2(scope), predicate);
|
|
535
|
+
|
|
536
|
+
const children = (scope, selector) =>
|
|
537
|
+
// It may surprise you to learn this is exactly what JQuery does
|
|
538
|
+
// TODO: Avoid all the wrapping and unwrapping
|
|
539
|
+
children$1(scope, (e) => is(e, selector));
|
|
540
|
+
|
|
541
|
+
const getParentElement = (element) => parent(element).filter(isElement);
|
|
542
|
+
// if the block is a list item, we need to get the parent of the list itself
|
|
543
|
+
const getNormalizedBlock = (element, isListItem) => {
|
|
544
|
+
const normalizedElement = isListItem ? ancestor(element, 'ol,ul') : Optional.some(element);
|
|
545
|
+
return normalizedElement.getOr(element);
|
|
546
|
+
};
|
|
547
|
+
const isListItem = isTag('li');
|
|
548
|
+
const setDirOnElements = (dom, blocks, dir) => {
|
|
549
|
+
each(blocks, (block) => {
|
|
550
|
+
const blockElement = SugarElement.fromDom(block);
|
|
551
|
+
const isBlockElementListItem = isListItem(blockElement);
|
|
552
|
+
const normalizedBlock = getNormalizedBlock(blockElement, isBlockElementListItem);
|
|
553
|
+
const normalizedBlockParent = getParentElement(normalizedBlock);
|
|
554
|
+
normalizedBlockParent.each((parent) => {
|
|
555
|
+
// TINY-9314: Remove any inline direction style to ensure that it is only set when necessary and that
|
|
556
|
+
// the dir attribute is favored
|
|
557
|
+
dom.setStyle(normalizedBlock.dom, 'direction', null);
|
|
558
|
+
const parentDirection = getDirection(parent);
|
|
559
|
+
if (parentDirection === dir) {
|
|
560
|
+
remove(normalizedBlock, 'dir');
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
set(normalizedBlock, 'dir', dir);
|
|
564
|
+
}
|
|
565
|
+
// TINY-9314: Set an inline direction style if computed css direction is still not as desired. This can
|
|
566
|
+
// happen when the direction style is derived from a stylesheet.
|
|
567
|
+
if (getDirection(normalizedBlock) !== dir) {
|
|
568
|
+
dom.setStyle(normalizedBlock.dom, 'direction', dir);
|
|
569
|
+
}
|
|
570
|
+
// Remove dir attr and direction style from list children
|
|
571
|
+
if (isBlockElementListItem) {
|
|
572
|
+
const listItems = children(normalizedBlock, 'li[dir],li[style]');
|
|
573
|
+
each(listItems, (listItem) => {
|
|
574
|
+
remove(listItem, 'dir');
|
|
575
|
+
dom.setStyle(listItem.dom, 'direction', null);
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
});
|
|
580
|
+
};
|
|
581
|
+
const setDir = (editor, dir) => {
|
|
582
|
+
if (editor.selection.isEditable()) {
|
|
583
|
+
setDirOnElements(editor.dom, editor.selection.getSelectedBlocks(), dir);
|
|
584
|
+
editor.nodeChanged();
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
const register$1 = (editor) => {
|
|
589
|
+
editor.addCommand('mceDirectionLTR', () => {
|
|
590
|
+
setDir(editor, 'ltr');
|
|
591
|
+
});
|
|
592
|
+
editor.addCommand('mceDirectionRTL', () => {
|
|
593
|
+
setDir(editor, 'rtl');
|
|
594
|
+
});
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
const getNodeChangeHandler = (editor, dir) => (api) => {
|
|
598
|
+
const nodeChangeHandler = (e) => {
|
|
599
|
+
const element = SugarElement.fromDom(e.element);
|
|
600
|
+
api.setActive(getDirection(element) === dir);
|
|
601
|
+
api.setEnabled(editor.selection.isEditable());
|
|
602
|
+
};
|
|
603
|
+
editor.on('NodeChange', nodeChangeHandler);
|
|
604
|
+
api.setEnabled(editor.selection.isEditable());
|
|
605
|
+
return () => editor.off('NodeChange', nodeChangeHandler);
|
|
606
|
+
};
|
|
607
|
+
const register = (editor) => {
|
|
608
|
+
editor.ui.registry.addToggleButton('ltr', {
|
|
609
|
+
tooltip: 'Left to right',
|
|
610
|
+
icon: 'ltr',
|
|
611
|
+
onAction: () => editor.execCommand('mceDirectionLTR'),
|
|
612
|
+
onSetup: getNodeChangeHandler(editor, 'ltr')
|
|
613
|
+
});
|
|
614
|
+
editor.ui.registry.addToggleButton('rtl', {
|
|
615
|
+
tooltip: 'Right to left',
|
|
616
|
+
icon: 'rtl',
|
|
617
|
+
onAction: () => editor.execCommand('mceDirectionRTL'),
|
|
618
|
+
onSetup: getNodeChangeHandler(editor, 'rtl')
|
|
619
|
+
});
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
var Plugin = () => {
|
|
623
|
+
global.add('directionality', (editor) => {
|
|
624
|
+
register$1(editor);
|
|
625
|
+
register(editor);
|
|
626
|
+
});
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
Plugin();
|
|
630
|
+
/** *****
|
|
631
|
+
* DO NOT EXPORT ANYTHING
|
|
632
|
+
*
|
|
633
|
+
* IF YOU DO ROLLUP WILL LEAVE A GLOBAL ON THE PAGE
|
|
634
|
+
*******/
|
|
635
|
+
|
|
636
|
+
})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>e=>typeof e===t,r=t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(r=o=t,(n=String).prototype.isPrototypeOf(r)||(null===(i=o.constructor)||void 0===i?void 0:i.name)===n.name)?"string":e;var r,o,n,i})(t),o=e("boolean"),n=t=>!(t=>null==t)(t),i=e("function"),s=e("number"),l=()=>false;class a{constructor(t,e){this.tag=t,this.value=e}static some(t){return new a(!0,t)}static none(){return a.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?a.some(t(this.value)):a.none()}bind(t){return this.tag?t(this.value):a.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:a.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 n(t)?a.some(t):a.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()"}}a.singletonNone=new a(!1),Array.prototype.slice;const u=(t,e)=>{for(let r=0,o=t.length;r<o;r++)e(t[r],r)};i(Array.from)&&Array.from;const c=t=>{if(null==t)throw new Error("Node cannot be null or undefined");return{dom:t}},d=c,h=(t,e)=>{const r=t.dom;if(1!==r.nodeType)return!1;{const t=r;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")}},m=t=>e=>(t=>t.dom.nodeType)(e)===t,g=m(1),f=m(3),v=m(11),y=t=>d(t.dom.host),p=(t,e)=>{t.dom.removeAttribute(e)},w=t=>{const e=f(t)?t.dom.parentNode:t.dom;if(null==e||null===e.ownerDocument)return!1;const r=e.ownerDocument;return(t=>{const e=(t=>d(t.dom.getRootNode()))(t);return v(r=e)&&n(r.dom.host)?a.some(e):a.none();var r})(d(e)).fold((()=>r.body.contains(e)),(o=w,i=y,t=>o(i(t))));var o,i},b=t=>"rtl"===((t,e)=>{const r=t.dom,o=window.getComputedStyle(r).getPropertyValue(e);return""!==o||w(t)?o:((t,e)=>(t=>void 0!==t.style&&i(t.style.getPropertyValue))(t)?t.style.getPropertyValue(e):"")(r,e)})(t,"direction")?"rtl":"ltr",S=(t,e)=>(t=>((t,e)=>{const r=[];for(let o=0,n=t.length;o<n;o++){const n=t[o];e(n,o)&&r.push(n)}return r})(((t,e)=>{const r=t.length,o=new Array(r);for(let n=0;n<r;n++){const r=t[n];o[n]=e(r,n)}return o})(t.dom.childNodes,d),(t=>h(t,e))))(t),N=t=>g(t)&&"li"===t.dom.nodeName.toLowerCase();const A=(t,e,n)=>{u(e,(e=>{const c=d(e),m=N(c),f=((t,e)=>{return(e?(r=t,o="ol,ul",((t,e,r)=>{let n=t.dom;const s=i(r)?r:l;for(;n.parentNode;){n=n.parentNode;const t=d(n);if(h(t,o))return a.some(t);if(s(t))break}return a.none()})(r,0,n)):a.some(t)).getOr(t);var r,o,n})(c,m);var v;(v=f,(t=>a.from(t.dom.parentNode).map(d))(v).filter(g)).each((e=>{if(t.setStyle(f.dom,"direction",null),b(e)===n?p(f,"dir"):((t,e,n)=>{((t,e,n)=>{if(!(r(n)||o(n)||s(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+"")})(t.dom,e,n)})(f,"dir",n),b(f)!==n&&t.setStyle(f.dom,"direction",n),m){const e=S(f,"li[dir],li[style]");u(e,(e=>{p(e,"dir"),t.setStyle(e.dom,"direction",null)}))}}))}))},T=(t,e)=>{t.selection.isEditable()&&(A(t.dom,t.selection.getSelectedBlocks(),e),t.nodeChanged())},C=(t,e)=>r=>{const o=o=>{const n=d(o.element);r.setActive(b(n)===e),r.setEnabled(t.selection.isEditable())};return t.on("NodeChange",o),r.setEnabled(t.selection.isEditable()),()=>t.off("NodeChange",o)};t.add("directionality",(t=>{(t=>{t.addCommand("mceDirectionLTR",(()=>{T(t,"ltr")})),t.addCommand("mceDirectionRTL",(()=>{T(t,"rtl")}))})(t),(t=>{t.ui.registry.addToggleButton("ltr",{tooltip:"Left to right",icon:"ltr",onAction:()=>t.execCommand("mceDirectionLTR"),onSetup:C(t,"ltr")}),t.ui.registry.addToggleButton("rtl",{tooltip:"Right to left",icon:"rtl",onAction:()=>t.execCommand("mceDirectionRTL"),onSetup:C(t,"rtl")})})(t)}))}();
|