@sapui5/sap.ui.richtexteditor 1.111.2 → 1.111.3
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/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 +4874 -2361
- 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: 3.0
|
|
7
|
+
* Version: 3.1.0-57
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const r=e-t;return 0===r?0:r>0?1:-1},r=(e,t,r)=>({major:e,minor:t,patch:r}),o=t=>{const o=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return o?r(e(o[1]),e(o[2]),e(o[3])):r(0,0,0)},n=e=>t=>t.options.get(e),i=n("codemirror_script"),s=n("codemirror_css"),c=n("codemirror_linewrapping"),a=n("codemirror_linenumbers"),u=n("codemirror_foldgutter"),d=n("codemirror_gutter"),l=n("codemirror_theme"),m=e=>"rtl"===e.getBody().dir?"rtl":"ltr",h=("function",e=>"function"==typeof e);const g=(!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 f=Object.hasOwnProperty,v=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},w=(e,t)=>{const r=(t||document).createElement("div");if(r.innerHTML=e,!r.hasChildNodes()||r.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return v(r.childNodes[0])},b=v;"undefined"!=typeof window?window:Function("return this;")();const y=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},_=(e,t,r)=>{let o=e.dom;const n=h(r)?r:g;for(;o.parentNode;){o=o.parentNode;const e=b(o);if(t(e))return p.some(e);if(n(e))break}return p.none()},N="\x3c!--mce_cursor--\x3e",C=(e,t)=>{const r=e.dom,o=e.selection,n=o.getBookmark(),i=(e=>{return t=e,f.call(t,"name");var t})(n)?r.select(n.name)[n.index]:r.select(`#${n.id}_start`)[0],s=p.from(i).map((t=>{const r=b(e.getBody());return((e,t)=>{const o=w(N),n=b(e),i=((e,t,r)=>((e,t,r,o,n)=>o(r)?p.some(r):h(n)&&n(r)?p.none():t(r,o,n))(0,_,e,t,r))(n,(e=>((e,t)=>{const r=e.dom;return!(!r||!r.hasAttribute)&&r.hasAttribute("data-mce-bogus")})(e)),(e=>{return t=r,e.dom===t.dom;var t})).getOr(n);return((e,t)=>{const r=(e=>p.from(e.dom.parentNode).map(b))(e);r.each((r=>{r.dom.insertBefore(t.dom,e.dom)}))})(i,o),o})(t)})),c=t();return s.each(y),o.moveToBookmark(n),c},O=e=>({name:"codeview",type:"customeditor",tag:"div",scriptId:"tinymce.plugins.advcode.customeditor",scriptUrl:e.customEditorScriptUrl,settings:e}),S=(e,t)=>{const r=(e=>{const t=(e=>{const t=e.split(/\r?\n/);return((e,t)=>{for(let r=0;r<e.length;r++){const o=t(e[r],r);if(o.isSome())return o}return p.none()})(t,((e,r)=>{const o=e.indexOf(N);return(n=-1!==o,i=o,n?p.some(i):p.none()).map((o=>e===N?0===r?{line:r,ch:0}:{line:r-1,ch:t[r-1].length}:{line:r,ch:o}));var n,i})).getOr({line:0,ch:0})})(C(e,(()=>e.getContent({source_view:!0}))));return{content:e.getContent({source_view:!0}),cursor:t}})(e),o={...t,cursor:r.cursor},n={title:"Source Code",size:"large",body:{type:"panel",items:[O(o)]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{codeview:r.content},onSubmit:t=>{((e,t)=>{e.focus(),e.undoManager.transact((()=>{e.setContent(t)})),e.selection.setCursorLocation(),e.nodeChanged()})(e,t.getData().codeview),t.close()}};e.windowManager.open(n)};tinymce.PluginManager.add("advcode",((e,r)=>{((e,r)=>!!e&&-1===((e,r)=>{const o=t(e.major,r.major);if(0!==o)return o;const n=t(e.minor,r.minor);if(0!==n)return n;const i=t(e.patch,r.patch);return 0!==i?i:0})((e=>o((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),o(r)))(tinymce,"6.0.0")?console.error("The advcode plugin requires at least version 6.0.0 of TinyMCE."):((e,t)=>{((e,t)=>{const r=e.options.register;r("codemirror_script",{processor:"string",default:t+"/codemirror.min.js"}),r("codemirror_css",{processor:"string",default:t+"/codemirror.min.css"}),r("codemirror_linewrapping",{processor:"boolean",default:!0}),r("codemirror_linenumbers",{processor:"boolean",default:!0}),r("codemirror_foldgutter",{processor:"boolean",default:!0}),r("codemirror_gutter",{processor:"boolean",default:!0}),r("codemirror_theme",{processor:"string",default:"default"})})(e,t);const r="sourcecode",o=((e,t,r)=>()=>{const o=((e,t)=>({customEditorScriptUrl:t+"/customeditor.min.js",codeMirrorScriptUrl:i(e),codeMirrorCssUrl:s(e),lineWrapping:c(e),lineNumbers:a(e),foldGutter:u(e),theme:l(e),direction:m(e),gutter:d(e),editorId:e.id}))(t,r);e(t,o)})(S,e,t);e.addCommand("mceCodeEditor",o),e.ui.registry.addButton("code",{icon:r,tooltip:"Source code",onAction:o}),e.ui.registry.addMenuItem("code",{icon:r,text:"Source code",onAction:o})})(e,r)}))}();
|
|
10
|
+
!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const o=e-t;return 0===o?0:o>0?1:-1},o=(e,t,o)=>({major:e,minor:t,patch:o}),r=t=>{const r=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return r?o(e(r[1]),e(r[2]),e(r[3])):o(0,0,0)},n=e=>t=>t.options.get(e),s=n("codemirror_script"),i=n("codemirror_css"),c=n("codemirror_linewrapping"),d=n("codemirror_linenumbers"),a=n("codemirror_foldgutter"),l=n("codemirror_gutter"),u=n("codemirror_theme"),m=e=>"rtl"===e.getBody().dir?"rtl":"ltr",g=n("advcode_headless"),h=n("advcode_inline"),p=(e,t)=>({customEditorScriptUrl:t+"/customeditor.min.js",codeMirrorScriptUrl:s(e),codeMirrorCssUrl:i(e),lineWrapping:c(e),lineNumbers:d(e),foldGutter:a(e),theme:u(e),direction:m(e),gutter:l(e),editorId:e.id}),v=e=>t=>typeof t===e,f=e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,(n=String).prototype.isPrototypeOf(o)||(null===(s=r.constructor)||void 0===s?void 0:s.name)===n.name)?"string":t;var o,r,n,s})(e),y=v("boolean"),b=e=>!(e=>null==e)(e),C=v("function"),w=v("number"),_=()=>{},T=()=>!1;class S{constructor(e,t){this.tag=e,this.value=t}static some(e){return new S(!0,e)}static none(){return S.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?S.some(e(this.value)):S.none()}bind(e){return this.tag?e(this.value):S.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:S.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 b(e)?S.some(e):S.none()}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()"}}S.singletonNone=new S(!1);const E=Object.hasOwnProperty,N=(e,t)=>E.call(e,t);"undefined"!=typeof window?window:Function("return this;")();const k=e=>t=>(e=>e.dom.nodeType)(t)===e,A=k(1),M=k(9),x=k(11),O=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},L=(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return O(o.childNodes[0])},I=(e,t)=>{const o=(t||document).createElement(e);return O(o)},V=O,P=e=>M(e)?e:V(e.dom.ownerDocument),j=(e,t)=>{e.dom.appendChild(t.dom)},B=C(Element.prototype.attachShadow)&&C(Node.prototype.getRootNode)?e=>V(e.dom.getRootNode()):P,R=()=>D(V(document)),D=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return V(t)},U=(e,t,o)=>{let r=e.dom;const n=C(o)?o:T;for(;r.parentNode;){r=r.parentNode;const e=V(r);if(t(e))return S.some(e);if(n(e))break}return S.none()},G=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},H="\x3c!--mce_cursor--\x3e",W=(e,t)=>{const o=e.dom,r=e.selection,n=r.getBookmark(),s=(e=>N(e,"name"))(n)?o.select(n.name)[n.index]:o.select(`#${n.id}_start`)[0],i=S.from(s).map((t=>{const o=V(e.getBody());return((e,t)=>{const r=L(H),n=V(e),s=((e,t,o)=>((e,t,o,r,n)=>r(o)?S.some(o):C(n)&&n(o)?S.none():t(o,r,n))(0,U,e,t,o))(n,(e=>((e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute("data-mce-bogus")})(e)),(e=>{return t=o,e.dom===t.dom;var t})).getOr(n);return((e,t)=>{const o=(e=>S.from(e.dom.parentNode).map(V))(e);o.each((o=>{o.dom.insertBefore(t.dom,e.dom)}))})(s,r),r})(t)})),c=t();return i.each(G),r.moveToBookmark(n),c},q=e=>{const t=(e=>{const t=e.split(/\r?\n/);return((e,t)=>{for(let o=0;o<e.length;o++){const r=t(e[o],o);if(r.isSome())return r}return S.none()})(t,((e,o)=>{const r=e.indexOf(H);return(n=-1!==r,s=r,n?S.some(s):S.none()).map((r=>e===H?0===o?{line:o,ch:0}:{line:o-1,ch:t[o-1].length}:{line:o,ch:r}));var n,s})).getOr({line:0,ch:0})})(W(e,(()=>e.getContent({source_view:!0}))));return{content:e.getContent({source_view:!0}),cursor:t}},z=(e,t)=>{e.focus(),e.undoManager.transact((()=>{e.setContent(t)})),e.selection.setCursorLocation(),e.nodeChanged()},F=e=>{return(t=tinymce,"get",N(t,"get")?S.from(t.get):S.none()).bind((t=>S.from(t.call(tinymce,e))));var t},K=(e,t)=>((e,t,o)=>{const r=((e,t)=>{const o=((e,t)=>{const o=e.dom.getAttribute("class");return null===o?void 0:o})(e);return void 0===o||""===o?[]:o.split(" ")})(e);return((e,t,o)=>{((e,t,o)=>{if(!(f(o)||y(o)||w(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")})(e.dom,t,o)})(e,t,r.concat([o]).join(" ")),!0})(e,"class",t),$=(e,t)=>{(e=>void 0!==e.dom.classList)(e)?e.dom.classList.add(t):K(e,t)},J=(e,t,o,r="")=>{const n=(e=>{const t=F(e).map((e=>{const t=B(V(e.getElement()));return(e=>x(e)&&b(e.dom.host))(o=t)?o:V(P(o).dom.body);var o})).getOrThunk(R);if(A(t))return{element:t,destroy:_};{const e=I("div");return j(t,e),{element:e,destroy:()=>G(e)}}})(o.editorId),s=((e,t)=>{const o=(o,r)=>(r&&!r()||setTimeout((()=>{o.state.completionActive||o.showHint({completeSingle:!1,container:t})}),100),e.Pass);return{completeAfter:o,completeIfAfterLt:t=>o(t,(()=>{const o=t.getCursor();return"<"===t.getRange(e.Pos(o.line,o.ch-1),o)})),completeIfInTag:t=>o(t,(()=>{const o=t.getTokenAt(t.getCursor());return!!("string"!==o.type||/['"]/.test(o.string.charAt(o.string.length-1))&&1!==o.string.length)&&e.innerMode(t.getMode(),o.state).state.tagName}))}})(e,n.element.dom),i={lineWrapping:o.lineWrapping,lineNumbers:o.lineNumbers,foldGutter:o.foldGutter,theme:o.theme,direction:o.direction,matchTags:{bothTags:!0},keyMap:"sublime",gutters:o.gutter?["CodeMirror-linenumbers","CodeMirror-foldgutter"]:[],extraKeys:{"Alt-F":"findPersistent","Ctrl-J":"toMatchingTag","Ctrl-B":"selectNextOccurrence","'<'":s.completeAfter,"'/'":s.completeIfAfterLt,"' '":s.completeIfInTag,"'='":s.completeIfInTag,"Ctrl-Q":e=>{e.foldCode(e.getCursor())}},mode:"text/html",value:r},c=e(t,i),d=e=>{27!==e.keyCode&&e.stopPropagation()};t.addEventListener("keyup",d),t.addEventListener("keydown",d),t.addEventListener("keypress",d),setTimeout((()=>{c.focus(),o.cursor&&c.doc.setCursor(o.cursor)}),0),setTimeout((()=>c.refresh()),200);const a={getValue:()=>c.doc.getValue(),setValue:e=>c.doc.setValue(e),destroy:()=>{t.removeEventListener("keyup",d),t.removeEventListener("keydown",d),t.removeEventListener("keypress",d),n.destroy()}};return a},Q={},X=(e,t)=>{if(Q[t])return Promise.resolve();{const n=F(t),s=n.bind((e=>{var t;return S.from(null===(t=e.ui)||void 0===t?void 0:t.styleSheetLoader)})).getOr(tinymce.DOM.styleSheetLoader);return n.each((o=>{o.on("remove",(()=>{s.unload(e),delete Q[t]}))})),Q[t]=!0,o=e,(null!=(r=s)?r:tinymce.DOM.styleSheetLoader).load(o)}var o,r},Y=e=>({name:"codeview",type:"customeditor",tag:"div",scriptId:"tinymce.plugins.advcode.customeditor",scriptUrl:e.customEditorScriptUrl,settings:e}),Z=(e,t)=>{e.addCommand("mceCodeEditor",(()=>{h(e)&&!e.inline?"code"===e.mode.get()?e.mode.set("design"):e.mode.set("code"):(()=>{const o=p(e,t);((e,t)=>{const o=q(e),r={...t,cursor:o.cursor},n={title:"Source Code",size:"large",body:{type:"panel",items:[Y(r)]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{codeview:o.content},onSubmit:t=>{z(e,t.getData().codeview),t.close()}};e.windowManager.open(n)})(e,o)})()}))},ee=(e,t,o,r,n)=>{const s=q(o),i={...n,cursor:s.cursor},c=I("div");var d;d=c,((e,t)=>{for(let t=0,o=e.length;t<o;t++)$(d,e[t])})([0===t?"tox-inline-headless-codemirror":"tox-inline-codemirror","mce-codemirror"]),j(V(e),c);const{getValue:a,destroy:l}=r(c.dom,i,s.content);var u,m;1===t&&(u=V(c.dom),m=".CodeMirror",((e,t)=>{const o=void 0===t?document:t.dom;return 1!==(r=o).nodeType&&9!==r.nodeType&&11!==r.nodeType||0===r.childElementCount?S.none():S.from(o.querySelector(e)).map(V);var r})(m,u)).each((e=>$(e,"tox-view__pane_panel")));const g=()=>z(o,a());return 0===t&&o.on("BeforeGetContent",g),{syncWithEditor:g,destroy:()=>{0===t&&(o.off("BeforeGetContent",g),g()),G(c),l()}}},te=(e,t,o)=>{const r=(()=>{const e=(e=>{const t=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})(S.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(S.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(S.some(e))}}})(_);return{...e,on:t=>e.get().each(t)}})(),n=()=>{r.get().each((({destroy:e})=>{e()})),r.clear()};e.ui.registry.addView("code",{buttons:1===o?[{type:"button",text:"Cancel",onAction:()=>{r.get().each((()=>{n(),e.mode.set("design")}))}},{type:"button",text:"Save code",buttonType:"primary",onAction:()=>{r.get().each((({syncWithEditor:t})=>{t(),n(),e.mode.set("design")}))}}]:[],onShow:n=>{const c=n.getContainer(),d=p(e,t);e.setProgressState(!0),((e,t,o)=>{return Promise.all([X(t,o),("tinymce.plugins.advcode.CodeMirror",r=e,tinymce.Resource.load("tinymce.plugins.advcode.CodeMirror",r))]).then((([e,t])=>(e,o,r)=>J(t(),e,o,r)));var r})(s(e),i(e),e.id).then((t=>{e.setProgressState(!1),r.set(ee(c,o,e,t,d))}))},onHide:n})};tinymce.PluginManager.requireLangPack("advcode","ar,bg_BG,ca,cs,da,de,el,es,eu,fa,fi,fr_FR,he_IL,hi,hr,hu_HU,id,it,ja,kk,ko_KR,ms,nb_NO,nl,pl,pt_BR,pt_PT,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,vi,zh_CN,zh_TW"),tinymce.PluginManager.add("advcode",((e,o)=>{((e,o)=>!!e&&-1===((e,o)=>{const r=t(e.major,o.major);if(0!==r)return r;const n=t(e.minor,o.minor);if(0!==n)return n;const s=t(e.patch,o.patch);return 0!==s?s:0})((e=>r((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),r(o)))(tinymce,"6.3.0")?console.error("The advcode plugin requires at least version 6.3.0 of TinyMCE."):((e,t)=>{((e,t)=>{const o=e.options.register;o("codemirror_script",{processor:"string",default:t+"/codemirror.min.js"}),o("codemirror_css",{processor:"string",default:t+"/codemirror.min.css"}),o("codemirror_linewrapping",{processor:"boolean",default:!0}),o("codemirror_linenumbers",{processor:"boolean",default:!0}),o("codemirror_foldgutter",{processor:"boolean",default:!0}),o("codemirror_gutter",{processor:"boolean",default:!0}),o("codemirror_theme",{processor:"string",default:"default"}),o("advcode_headless",{processor:"boolean",default:!1}),o("advcode_inline",{processor:"boolean",default:!1})})(e,t),Z(e,t),(e=>{const t="sourcecode",o=()=>e.execCommand("mceCodeEditor");e.ui.registry.addButton("code",{icon:t,tooltip:"Source code",onAction:o}),e.ui.registry.addMenuItem("code",{icon:t,text:"Source code",onAction:o})})(e),((e,t)=>{te(e,t,g(e)?0:1)})(e,t),(e=>{e.mode.register("code",{activate:()=>{"code"!==e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"code")},deactivate:()=>{"code"===e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"code")},editorReadOnly:!1})})(e)})(e,o)}))}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
3.0
|
|
1
|
+
3.1.0-57
|
|
@@ -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 () {
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
const getNumberStyles = option('advlist_number_styles');
|
|
42
42
|
const getBulletStyles = option('advlist_bullet_styles');
|
|
43
43
|
|
|
44
|
-
var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
45
|
-
|
|
46
44
|
const isNullable = a => a === null || a === undefined;
|
|
47
45
|
const isNonNullable = a => !isNullable(a);
|
|
48
46
|
|
|
47
|
+
var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
48
|
+
|
|
49
49
|
class Optional {
|
|
50
50
|
constructor(tag, value) {
|
|
51
51
|
this.tag = tag;
|
|
@@ -143,16 +143,21 @@
|
|
|
143
143
|
return editor.dom.isChildOf(elm, editor.getBody());
|
|
144
144
|
};
|
|
145
145
|
const isTableCellNode = node => {
|
|
146
|
-
return node && /^(TH|TD)$/.test(node.nodeName);
|
|
146
|
+
return isNonNullable(node) && /^(TH|TD)$/.test(node.nodeName);
|
|
147
147
|
};
|
|
148
148
|
const isListNode = editor => node => {
|
|
149
|
-
return node && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node);
|
|
149
|
+
return isNonNullable(node) && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node);
|
|
150
150
|
};
|
|
151
151
|
const getSelectedStyleType = editor => {
|
|
152
152
|
const listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul');
|
|
153
153
|
const style = editor.dom.getStyle(listElm, 'listStyleType');
|
|
154
154
|
return Optional.from(style);
|
|
155
155
|
};
|
|
156
|
+
const isWithinNonEditable = (editor, element) => element !== null && editor.dom.getContentEditableParent(element) === 'false';
|
|
157
|
+
const isWithinNonEditableList = (editor, element) => {
|
|
158
|
+
const parentList = editor.dom.getParent(element, 'ol,ul,dl');
|
|
159
|
+
return isWithinNonEditable(editor, parentList);
|
|
160
|
+
};
|
|
156
161
|
|
|
157
162
|
const findIndex = (list, predicate) => {
|
|
158
163
|
for (let index = 0; index < list.length; index++) {
|
|
@@ -168,6 +173,7 @@
|
|
|
168
173
|
return chr.toUpperCase();
|
|
169
174
|
});
|
|
170
175
|
};
|
|
176
|
+
const normalizeStyleValue = styleValue => isNullable(styleValue) || styleValue === 'default' ? '' : styleValue;
|
|
171
177
|
const isWithinList = (editor, e, nodeName) => {
|
|
172
178
|
const tableCellIndex = findIndex(e.parents, isTableCellNode);
|
|
173
179
|
const parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
|
|
@@ -177,6 +183,7 @@
|
|
|
177
183
|
const makeSetupHandler = (editor, nodeName) => api => {
|
|
178
184
|
const nodeChangeHandler = e => {
|
|
179
185
|
api.setActive(isWithinList(editor, e, nodeName));
|
|
186
|
+
api.setEnabled(!isWithinNonEditableList(editor, e.element));
|
|
180
187
|
};
|
|
181
188
|
editor.on('NodeChange', nodeChangeHandler);
|
|
182
189
|
return () => editor.off('NodeChange', nodeChangeHandler);
|
|
@@ -191,7 +198,7 @@
|
|
|
191
198
|
const items = global.map(styles, styleValue => {
|
|
192
199
|
const iconStyle = nodeName === 'OL' ? 'num' : 'bull';
|
|
193
200
|
const iconName = styleValue === 'disc' || styleValue === 'decimal' ? 'default' : styleValue;
|
|
194
|
-
const itemValue = styleValue
|
|
201
|
+
const itemValue = normalizeStyleValue(styleValue);
|
|
195
202
|
const displayText = styleValueToText(styleValue);
|
|
196
203
|
return {
|
|
197
204
|
type: 'choiceitem',
|
|
@@ -213,20 +220,20 @@
|
|
|
213
220
|
onSetup: makeSetupHandler(editor, nodeName)
|
|
214
221
|
});
|
|
215
222
|
};
|
|
216
|
-
const addButton = (editor, id, tooltip, cmd, nodeName,
|
|
223
|
+
const addButton = (editor, id, tooltip, cmd, nodeName, styleValue) => {
|
|
217
224
|
editor.ui.registry.addToggleButton(id, {
|
|
218
225
|
active: false,
|
|
219
226
|
tooltip,
|
|
220
227
|
icon: nodeName === 'OL' ? 'ordered-list' : 'unordered-list',
|
|
221
228
|
onSetup: makeSetupHandler(editor, nodeName),
|
|
222
|
-
onAction: () => editor.execCommand(cmd)
|
|
229
|
+
onAction: () => editor.queryCommandState(cmd) || styleValue === '' ? editor.execCommand(cmd) : applyListFormat(editor, nodeName, styleValue)
|
|
223
230
|
});
|
|
224
231
|
};
|
|
225
232
|
const addControl = (editor, id, tooltip, cmd, nodeName, styles) => {
|
|
226
233
|
if (styles.length > 1) {
|
|
227
234
|
addSplitButton(editor, id, tooltip, cmd, nodeName, styles);
|
|
228
235
|
} else {
|
|
229
|
-
addButton(editor, id, tooltip, cmd, nodeName);
|
|
236
|
+
addButton(editor, id, tooltip, cmd, nodeName, normalizeStyleValue(styles[0]));
|
|
230
237
|
}
|
|
231
238
|
};
|
|
232
239
|
const register = editor => {
|
|
@@ -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 t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=(t,e,r)=>{const s="UL"===e?"InsertUnorderedList":"InsertOrderedList";t.execCommand(s,!1,!1===r?null:{"list-style-type":r})},r=t=>e=>e.options.get(t),s=r("advlist_number_styles"),n=r("advlist_bullet_styles");var
|
|
9
|
+
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=(t,e,r)=>{const s="UL"===e?"InsertUnorderedList":"InsertOrderedList";t.execCommand(s,!1,!1===r?null:{"list-style-type":r})},r=t=>e=>e.options.get(t),s=r("advlist_number_styles"),n=r("advlist_bullet_styles"),l=t=>null==t,i=t=>!l(t);var o=tinymce.util.Tools.resolve("tinymce.util.Tools");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 i(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);const u=t=>i(t)&&/^(TH|TD)$/.test(t.nodeName),d=t=>l(t)||"default"===t?"":t,g=(t,e)=>r=>{const s=s=>{r.setActive(((t,e,r)=>{const s=((t,e)=>{for(let r=0;r<t.length;r++)if(e(t[r]))return r;return-1})(e.parents,u),n=-1!==s?e.parents.slice(0,s):e.parents,l=o.grep(n,(t=>e=>i(e)&&/^(OL|UL|DL)$/.test(e.nodeName)&&((t,e)=>t.dom.isChildOf(e,t.getBody()))(t,e))(t));return l.length>0&&l[0].nodeName===r})(t,s,e)),r.setEnabled(!((t,e)=>{const r=t.dom.getParent(e,"ol,ul,dl");return((t,e)=>null!==e&&"false"===t.dom.getContentEditableParent(e))(t,r)})(t,s.element))};return t.on("NodeChange",s),()=>t.off("NodeChange",s)},h=(t,r,s,n,l,i)=>{i.length>1?((t,r,s,n,l,i)=>{t.ui.registry.addSplitButton(r,{tooltip:s,icon:"OL"===l?"ordered-list":"unordered-list",presets:"listpreview",columns:3,fetch:t=>{t(o.map(i,(t=>{const e="OL"===l?"num":"bull",r="disc"===t||"decimal"===t?"default":t,s=d(t),n=(t=>t.replace(/\-/g," ").replace(/\b\w/g,(t=>t.toUpperCase())))(t);return{type:"choiceitem",value:s,icon:"list-"+e+"-"+r,text:n}})))},onAction:()=>t.execCommand(n),onItemAction:(r,s)=>{e(t,l,s)},select:e=>{const r=(t=>{const e=t.dom.getParent(t.selection.getNode(),"ol,ul"),r=t.dom.getStyle(e,"listStyleType");return a.from(r)})(t);return r.map((t=>e===t)).getOr(!1)},onSetup:g(t,l)})})(t,r,s,n,l,i):((t,r,s,n,l,i)=>{t.ui.registry.addToggleButton(r,{active:!1,tooltip:s,icon:"OL"===l?"ordered-list":"unordered-list",onSetup:g(t,l),onAction:()=>t.queryCommandState(n)||""===i?t.execCommand(n):e(t,l,i)})})(t,r,s,n,l,d(i[0]))};t.add("advlist",(t=>{t.hasPlugin("lists")?((t=>{const e=t.options.register;e("advlist_number_styles",{processor:"string[]",default:"default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman".split(",")}),e("advlist_bullet_styles",{processor:"string[]",default:"default,circle,square".split(",")})})(t),(t=>{h(t,"numlist","Numbered list","InsertOrderedList","OL",s(t)),h(t,"bullist","Bullet list","InsertUnorderedList","UL",n(t))})(t),(t=>{t.addCommand("ApplyUnorderedListStyle",((r,s)=>{e(t,"UL",s["list-style-type"])})),t.addCommand("ApplyOrderedListStyle",((r,s)=>{e(t,"OL",s["list-style-type"])}))})(t)):console.error("Please use the Lists plugin together with the Advanced List plugin.")}))}();
|
|
@@ -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 () {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
const id = elm.getAttribute('id') || elm.getAttribute('name');
|
|
33
33
|
return id || '';
|
|
34
34
|
};
|
|
35
|
-
const isAnchor = elm => elm
|
|
35
|
+
const isAnchor = elm => elm.nodeName.toLowerCase() === 'a';
|
|
36
36
|
const isNamedAnchor = elm => isAnchor(elm) && !elm.getAttribute('href') && getIdFromAnchor(elm) !== '';
|
|
37
37
|
const isEmptyNamedAnchor = elm => isNamedAnchor(elm) && !elm.firstChild;
|
|
38
38
|
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
editor.insertContent(editor.dom.createHTML('a', { id }));
|
|
66
66
|
} else {
|
|
67
67
|
removeEmptyNamedAnchorsInSelection(editor);
|
|
68
|
-
editor.formatter.remove('namedAnchor',
|
|
68
|
+
editor.formatter.remove('namedAnchor', undefined, undefined, true);
|
|
69
69
|
editor.formatter.apply('namedAnchor', { value: id });
|
|
70
70
|
editor.addVisual();
|
|
71
71
|
}
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
});
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
const isNamedAnchorNode = node =>
|
|
141
|
+
const isNamedAnchorNode = node => isEmptyString(node.attr('href')) && !isEmptyString(node.attr('id') || node.attr('name'));
|
|
142
142
|
const isEmptyNamedAnchorNode = node => isNamedAnchorNode(node) && !node.firstChild;
|
|
143
143
|
const setContentEditable = state => nodes => {
|
|
144
144
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -170,16 +170,17 @@
|
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
const register = editor => {
|
|
173
|
+
const onAction = () => editor.execCommand('mceAnchor');
|
|
173
174
|
editor.ui.registry.addToggleButton('anchor', {
|
|
174
175
|
icon: 'bookmark',
|
|
175
176
|
tooltip: 'Anchor',
|
|
176
|
-
onAction
|
|
177
|
+
onAction,
|
|
177
178
|
onSetup: buttonApi => editor.selection.selectorChangedWithUnbind('a:not([href])', buttonApi.setActive).unbind
|
|
178
179
|
});
|
|
179
180
|
editor.ui.registry.addMenuItem('anchor', {
|
|
180
181
|
icon: 'bookmark',
|
|
181
182
|
text: 'Anchor...',
|
|
182
|
-
onAction
|
|
183
|
+
onAction
|
|
183
184
|
});
|
|
184
185
|
};
|
|
185
186
|
|
|
@@ -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"),t=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),
|
|
9
|
+
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),o=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=("allow_html_in_named_anchor",e=>e.options.get("allow_html_in_named_anchor"));const a="a:not([href])",r=e=>!e,i=e=>e.getAttribute("id")||e.getAttribute("name")||"",l=e=>(e=>"a"===e.nodeName.toLowerCase())(e)&&!e.getAttribute("href")&&""!==i(e),s=e=>e.dom.getParent(e.selection.getStart(),a),d=(e,a)=>{const r=s(e);r?((e,t,o)=>{o.removeAttribute("name"),o.id=t,e.addVisual(),e.undoManager.add()})(e,a,r):((e,a)=>{e.undoManager.transact((()=>{n(e)||e.selection.collapse(!0),e.selection.isCollapsed()?e.insertContent(e.dom.createHTML("a",{id:a})):((e=>{const n=e.dom;t(n).walk(e.selection.getRng(),(e=>{o.each(e,(e=>{var t;l(t=e)&&!t.firstChild&&n.remove(e,!1)}))}))})(e),e.formatter.remove("namedAnchor",void 0,void 0,!0),e.formatter.apply("namedAnchor",{value:a}),e.addVisual())}))})(e,a),e.focus()},c=e=>(e=>r(e.attr("href"))&&!r(e.attr("id")||e.attr("name")))(e)&&!e.firstChild,m=e=>t=>{for(let o=0;o<t.length;o++){const n=t[o];c(n)&&n.attr("contenteditable",e)}};e.add("anchor",(e=>{(e=>{(0,e.options.register)("allow_html_in_named_anchor",{processor:"boolean",default:!1})})(e),(e=>{e.on("PreInit",(()=>{e.parser.addNodeFilter("a",m("false")),e.serializer.addNodeFilter("a",m(null))}))})(e),(e=>{e.addCommand("mceAnchor",(()=>{(e=>{const t=(e=>{const t=s(e);return t?i(t):""})(e);e.windowManager.open({title:"Anchor",size:"normal",body:{type:"panel",items:[{name:"id",type:"input",label:"ID",placeholder:"example"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{id:t},onSubmit:t=>{((e,t)=>/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)?(d(e,t),!0):(e.windowManager.alert("ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),!1))(e,t.getData().id)&&t.close()}})})(e)}))})(e),(e=>{const t=()=>e.execCommand("mceAnchor");e.ui.registry.addToggleButton("anchor",{icon:"bookmark",tooltip:"Anchor",onAction:t,onSetup:t=>e.selection.selectorChangedWithUnbind("a:not([href])",t.setActive).unbind}),e.ui.registry.addMenuItem("anchor",{icon:"bookmark",text:"Anchor...",onAction:t})})(e),e.on("PreInit",(()=>{(e=>{e.formatter.register("namedAnchor",{inline:"a",selector:a,remove:"all",split:!0,deep:!0,attributes:{id:"%value"},onmatch:(e,t,o)=>l(e)})})(e)}))}))}();
|
|
@@ -4,13 +4,13 @@
|
|
|
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 () {
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
13
|
+
var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
14
14
|
|
|
15
15
|
const link = () => /(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g;
|
|
16
16
|
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
const getAutoLinkPattern = option('autolink_pattern');
|
|
31
31
|
const getDefaultLinkTarget = option('link_default_target');
|
|
32
32
|
const getDefaultLinkProtocol = option('link_default_protocol');
|
|
33
|
+
const allowUnsafeLinkTarget = option('allow_unsafe_link_target');
|
|
33
34
|
|
|
34
35
|
const hasProto = (v, constructor, predicate) => {
|
|
35
36
|
var _a;
|
|
@@ -52,153 +53,176 @@
|
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
55
|
const isType = type => value => typeOf(value) === type;
|
|
56
|
+
const eq = t => a => t === a;
|
|
55
57
|
const isString = isType('string');
|
|
58
|
+
const isUndefined = eq(undefined);
|
|
59
|
+
const isNullable = a => a === null || a === undefined;
|
|
60
|
+
const isNonNullable = a => !isNullable(a);
|
|
61
|
+
|
|
62
|
+
const not = f => t => !f(t);
|
|
63
|
+
|
|
64
|
+
const hasOwnProperty = Object.hasOwnProperty;
|
|
65
|
+
const has = (obj, key) => hasOwnProperty.call(obj, key);
|
|
56
66
|
|
|
57
67
|
const checkRange = (str, substr, start) => substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;
|
|
58
|
-
const contains = (str, substr) => {
|
|
59
|
-
|
|
68
|
+
const contains = (str, substr, start = 0, end) => {
|
|
69
|
+
const idx = str.indexOf(substr, start);
|
|
70
|
+
if (idx !== -1) {
|
|
71
|
+
return isUndefined(end) ? true : idx + substr.length <= end;
|
|
72
|
+
} else {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
60
75
|
};
|
|
61
76
|
const startsWith = (str, prefix) => {
|
|
62
77
|
return checkRange(str, prefix, 0);
|
|
63
78
|
};
|
|
64
79
|
|
|
65
|
-
const
|
|
80
|
+
const zeroWidth = '\uFEFF';
|
|
81
|
+
const isZwsp = char => char === zeroWidth;
|
|
82
|
+
const removeZwsp = s => s.replace(/\uFEFF/g, '');
|
|
83
|
+
|
|
84
|
+
var global = tinymce.util.Tools.resolve('tinymce.dom.TextSeeker');
|
|
85
|
+
|
|
66
86
|
const isTextNode = node => node.nodeType === 3;
|
|
67
87
|
const isElement = node => node.nodeType === 1;
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const len = container.data.length;
|
|
77
|
-
if (index > len) {
|
|
78
|
-
index = len;
|
|
88
|
+
const isBracketOrSpace = char => /^[(\[{ \u00a0]$/.test(char);
|
|
89
|
+
const hasProtocol = url => /^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(url);
|
|
90
|
+
const isPunctuation = char => /[?!,.;:]/.test(char);
|
|
91
|
+
const findChar = (text, index, predicate) => {
|
|
92
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
93
|
+
const char = text.charAt(i);
|
|
94
|
+
if (!isZwsp(char) && predicate(char)) {
|
|
95
|
+
return i;
|
|
79
96
|
}
|
|
80
97
|
}
|
|
81
|
-
return
|
|
98
|
+
return -1;
|
|
82
99
|
};
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
100
|
+
const freefallRtl = (container, offset) => {
|
|
101
|
+
let tempNode = container;
|
|
102
|
+
let tempOffset = offset;
|
|
103
|
+
while (isElement(tempNode) && tempNode.childNodes[tempOffset]) {
|
|
104
|
+
tempNode = tempNode.childNodes[tempOffset];
|
|
105
|
+
tempOffset = isTextNode(tempNode) ? tempNode.data.length : tempNode.childNodes.length;
|
|
88
106
|
}
|
|
107
|
+
return {
|
|
108
|
+
container: tempNode,
|
|
109
|
+
offset: tempOffset
|
|
110
|
+
};
|
|
89
111
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
rng.setEndAfter(container);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const hasProtocol = url => /^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(url);
|
|
98
|
-
const isPunctuation = char => /[?!,.;:]/.test(char);
|
|
99
|
-
const parseCurrentLine = (editor, endOffset) => {
|
|
100
|
-
let end, endContainer, bookmark, text, prev, len, rngText;
|
|
112
|
+
|
|
113
|
+
const parseCurrentLine = (editor, offset) => {
|
|
114
|
+
var _a;
|
|
115
|
+
const voidElements = editor.schema.getVoidElements();
|
|
101
116
|
const autoLinkPattern = getAutoLinkPattern(editor);
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
return;
|
|
117
|
+
const {dom, selection} = editor;
|
|
118
|
+
if (dom.getParent(selection.getNode(), 'a[href]') !== null) {
|
|
119
|
+
return null;
|
|
105
120
|
}
|
|
106
|
-
const rng =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
endContainer = prev;
|
|
123
|
-
} else {
|
|
124
|
-
endContainer = rng.endContainer;
|
|
125
|
-
if (!isTextNode(endContainer) && endContainer.firstChild) {
|
|
126
|
-
while (!isTextNode(endContainer) && endContainer.firstChild) {
|
|
127
|
-
endContainer = endContainer.firstChild;
|
|
128
|
-
}
|
|
129
|
-
if (isTextNode(endContainer)) {
|
|
130
|
-
setStart(rng, endContainer, 0);
|
|
131
|
-
setEnd(rng, endContainer, endContainer.nodeValue.length);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (rng.endOffset === 1) {
|
|
135
|
-
end = 2;
|
|
136
|
-
} else {
|
|
137
|
-
end = rng.endOffset - 1 - endOffset;
|
|
138
|
-
}
|
|
121
|
+
const rng = selection.getRng();
|
|
122
|
+
const textSeeker = global(dom, node => {
|
|
123
|
+
return dom.isBlock(node) || has(voidElements, node.nodeName.toLowerCase()) || dom.getContentEditable(node) === 'false';
|
|
124
|
+
});
|
|
125
|
+
const {
|
|
126
|
+
container: endContainer,
|
|
127
|
+
offset: endOffset
|
|
128
|
+
} = freefallRtl(rng.endContainer, rng.endOffset);
|
|
129
|
+
const root = (_a = dom.getParent(endContainer, dom.isBlock)) !== null && _a !== void 0 ? _a : dom.getRoot();
|
|
130
|
+
const endSpot = textSeeker.backwards(endContainer, endOffset + offset, (node, offset) => {
|
|
131
|
+
const text = node.data;
|
|
132
|
+
const idx = findChar(text, offset, not(isBracketOrSpace));
|
|
133
|
+
return idx === -1 || isPunctuation(text[idx]) ? idx : idx + 1;
|
|
134
|
+
}, root);
|
|
135
|
+
if (!endSpot) {
|
|
136
|
+
return null;
|
|
139
137
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (
|
|
148
|
-
setStart(
|
|
149
|
-
setEnd(rng, endContainer, start);
|
|
150
|
-
end += 1;
|
|
151
|
-
} else if (rng.startOffset === 0) {
|
|
152
|
-
setStart(rng, endContainer, 0);
|
|
153
|
-
setEnd(rng, endContainer, start);
|
|
138
|
+
let lastTextNode = endSpot.container;
|
|
139
|
+
const startSpot = textSeeker.backwards(endSpot.container, endSpot.offset, (node, offset) => {
|
|
140
|
+
lastTextNode = node;
|
|
141
|
+
const idx = findChar(node.data, offset, isBracketOrSpace);
|
|
142
|
+
return idx === -1 ? idx : idx + 1;
|
|
143
|
+
}, root);
|
|
144
|
+
const newRng = dom.createRng();
|
|
145
|
+
if (!startSpot) {
|
|
146
|
+
newRng.setStart(lastTextNode, 0);
|
|
154
147
|
} else {
|
|
155
|
-
setStart(
|
|
156
|
-
setEnd(rng, endContainer, start);
|
|
148
|
+
newRng.setStart(startSpot.container, startSpot.offset);
|
|
157
149
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
text = rng.toString().trim();
|
|
163
|
-
const matches = text.match(autoLinkPattern);
|
|
164
|
-
const protocol = getDefaultLinkProtocol(editor);
|
|
150
|
+
newRng.setEnd(endSpot.container, endSpot.offset);
|
|
151
|
+
const rngText = removeZwsp(newRng.toString());
|
|
152
|
+
const matches = rngText.match(autoLinkPattern);
|
|
165
153
|
if (matches) {
|
|
166
154
|
let url = matches[0];
|
|
167
155
|
if (startsWith(url, 'www.')) {
|
|
156
|
+
const protocol = getDefaultLinkProtocol(editor);
|
|
168
157
|
url = protocol + '://' + url;
|
|
169
158
|
} else if (contains(url, '@') && !hasProtocol(url)) {
|
|
170
159
|
url = 'mailto:' + url;
|
|
171
160
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
161
|
+
return {
|
|
162
|
+
rng: newRng,
|
|
163
|
+
url
|
|
164
|
+
};
|
|
165
|
+
} else {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const convertToLink = (editor, result) => {
|
|
170
|
+
const {dom, selection} = editor;
|
|
171
|
+
const {rng, url} = result;
|
|
172
|
+
const bookmark = selection.getBookmark();
|
|
173
|
+
selection.setRng(rng);
|
|
174
|
+
const command = 'createlink';
|
|
175
|
+
const args = {
|
|
176
|
+
command,
|
|
177
|
+
ui: false,
|
|
178
|
+
value: url
|
|
179
|
+
};
|
|
180
|
+
const beforeExecEvent = editor.dispatch('BeforeExecCommand', args);
|
|
181
|
+
if (!beforeExecEvent.isDefaultPrevented()) {
|
|
182
|
+
editor.getDoc().execCommand(command, false, url);
|
|
183
|
+
editor.dispatch('ExecCommand', args);
|
|
184
|
+
const defaultLinkTarget = getDefaultLinkTarget(editor);
|
|
175
185
|
if (isString(defaultLinkTarget)) {
|
|
176
|
-
|
|
186
|
+
const anchor = selection.getNode();
|
|
187
|
+
dom.setAttrib(anchor, 'target', defaultLinkTarget);
|
|
188
|
+
if (defaultLinkTarget === '_blank' && !allowUnsafeLinkTarget(editor)) {
|
|
189
|
+
dom.setAttrib(anchor, 'rel', 'noopener');
|
|
190
|
+
}
|
|
177
191
|
}
|
|
178
|
-
|
|
179
|
-
|
|
192
|
+
}
|
|
193
|
+
selection.moveToBookmark(bookmark);
|
|
194
|
+
editor.nodeChanged();
|
|
195
|
+
};
|
|
196
|
+
const handleSpacebar = editor => {
|
|
197
|
+
const result = parseCurrentLine(editor, -1);
|
|
198
|
+
if (isNonNullable(result)) {
|
|
199
|
+
convertToLink(editor, result);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const handleBracket = handleSpacebar;
|
|
203
|
+
const handleEnter = editor => {
|
|
204
|
+
const result = parseCurrentLine(editor, 0);
|
|
205
|
+
if (isNonNullable(result)) {
|
|
206
|
+
convertToLink(editor, result);
|
|
180
207
|
}
|
|
181
208
|
};
|
|
182
209
|
const setup = editor => {
|
|
183
210
|
editor.on('keydown', e => {
|
|
184
|
-
if (e.keyCode === 13) {
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
editor.on('keypress', e => {
|
|
189
|
-
if (e.keyCode === 41 || e.keyCode === 93 || e.keyCode === 125) {
|
|
190
|
-
return handleBracket(editor);
|
|
211
|
+
if (e.keyCode === 13 && !e.isDefaultPrevented()) {
|
|
212
|
+
handleEnter(editor);
|
|
191
213
|
}
|
|
192
214
|
});
|
|
193
215
|
editor.on('keyup', e => {
|
|
194
216
|
if (e.keyCode === 32) {
|
|
195
|
-
|
|
217
|
+
handleSpacebar(editor);
|
|
218
|
+
} else if (e.keyCode === 48 && e.shiftKey || e.keyCode === 221) {
|
|
219
|
+
handleBracket(editor);
|
|
196
220
|
}
|
|
197
221
|
});
|
|
198
222
|
};
|
|
199
223
|
|
|
200
224
|
var Plugin = () => {
|
|
201
|
-
global.add('autolink', editor => {
|
|
225
|
+
global$1.add('autolink', editor => {
|
|
202
226
|
register(editor);
|
|
203
227
|
setup(editor);
|
|
204
228
|
});
|
|
@@ -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
|
|
9
|
+
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>t.options.get(e),n=t("autolink_pattern"),o=t("link_default_target"),r=t("link_default_protocol"),a=t("allow_unsafe_link_target"),s=("string",e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=o=e,(r=String).prototype.isPrototypeOf(n)||(null===(a=o.constructor)||void 0===a?void 0:a.name)===r.name)?"string":t;var n,o,r,a})(e));const l=(void 0,e=>undefined===e);const i=e=>!(e=>null==e)(e),c=Object.hasOwnProperty,d=e=>"\ufeff"===e;var u=tinymce.util.Tools.resolve("tinymce.dom.TextSeeker");const f=e=>/^[(\[{ \u00a0]$/.test(e),g=(e,t,n)=>{for(let o=t-1;o>=0;o--){const t=e.charAt(o);if(!d(t)&&n(t))return o}return-1},m=(e,t)=>{var o;const a=e.schema.getVoidElements(),s=n(e),{dom:i,selection:d}=e;if(null!==i.getParent(d.getNode(),"a[href]"))return null;const m=d.getRng(),k=u(i,(e=>{return i.isBlock(e)||(t=a,n=e.nodeName.toLowerCase(),c.call(t,n))||"false"===i.getContentEditable(e);var t,n})),{container:p,offset:y}=((e,t)=>{let n=e,o=t;for(;1===n.nodeType&&n.childNodes[o];)n=n.childNodes[o],o=3===n.nodeType?n.data.length:n.childNodes.length;return{container:n,offset:o}})(m.endContainer,m.endOffset),h=null!==(o=i.getParent(p,i.isBlock))&&void 0!==o?o:i.getRoot(),w=k.backwards(p,y+t,((e,t)=>{const n=e.data,o=g(n,t,(r=f,e=>!r(e)));var r,a;return-1===o||(a=n[o],/[?!,.;:]/.test(a))?o:o+1}),h);if(!w)return null;let v=w.container;const _=k.backwards(w.container,w.offset,((e,t)=>{v=e;const n=g(e.data,t,f);return-1===n?n:n+1}),h),A=i.createRng();_?A.setStart(_.container,_.offset):A.setStart(v,0),A.setEnd(w.container,w.offset);const C=A.toString().replace(/\uFEFF/g,"").match(s);if(C){let t=C[0];return $="www.",(b=t).length>=$.length&&b.substr(0,0+$.length)===$?t=r(e)+"://"+t:((e,t,n=0,o)=>{const r=e.indexOf(t,n);return-1!==r&&(!!l(o)||r+t.length<=o)})(t,"@")&&!(e=>/^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(e))(t)&&(t="mailto:"+t),{rng:A,url:t}}var b,$;return null},k=(e,t)=>{const{dom:n,selection:r}=e,{rng:l,url:i}=t,c=r.getBookmark();r.setRng(l);const d="createlink",u={command:d,ui:!1,value:i};if(!e.dispatch("BeforeExecCommand",u).isDefaultPrevented()){e.getDoc().execCommand(d,!1,i),e.dispatch("ExecCommand",u);const t=o(e);if(s(t)){const o=r.getNode();n.setAttrib(o,"target",t),"_blank"!==t||a(e)||n.setAttrib(o,"rel","noopener")}}r.moveToBookmark(c),e.nodeChanged()},p=e=>{const t=m(e,-1);i(t)&&k(e,t)},y=p;e.add("autolink",(e=>{(e=>{const t=e.options.register;t("autolink_pattern",{processor:"regexp",default:new RegExp("^"+/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source+"$","i")}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"})})(e),(e=>{e.on("keydown",(t=>{13!==t.keyCode||t.isDefaultPrevented()||(e=>{const t=m(e,0);i(t)&&k(e,t)})(e)})),e.on("keyup",(t=>{32===t.keyCode?p(e):(48===t.keyCode&&t.shiftKey||221===t.keyCode)&&y(e)}))})(e)}))}();
|
|
@@ -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 () {
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
const parseCssValueToInt = (dom, elm, name, computed) => {
|
|
61
|
-
|
|
61
|
+
var _a;
|
|
62
|
+
const value = parseInt((_a = dom.getStyle(elm, name, computed)) !== null && _a !== void 0 ? _a : '', 10);
|
|
62
63
|
return isNaN(value) ? 0 : value;
|
|
63
64
|
};
|
|
64
65
|
const shouldScrollIntoView = trigger => {
|