argous 1.2.132 → 1.2.136
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/api/index.d.ts +1 -0
- package/dist/api/index.js +18 -1
- package/dist/components/AutoCompleteFavorites/AutoCompleteFavorites.d.ts +21 -0
- package/dist/components/AutoCompleteFavorites/AutoCompleteFavorites.js +331 -0
- package/dist/components/Compartilhar/Compartilhar.js +1 -1
- package/lib/actions/index.ts +57 -0
- package/lib/api/WebSocket.js +148 -0
- package/lib/api/index.js +402 -0
- package/lib/api/ws.js +27 -0
- package/lib/components/Alert/Alert.d.ts +8 -0
- package/lib/components/Alert/Alert.js +49 -0
- package/lib/components/Alert/index.d.ts +2 -0
- package/lib/components/Alert/index.js +1 -0
- package/lib/components/ArgousAction/ArgousAction.d.ts +8 -0
- package/lib/components/ArgousAction/ArgousAction.js +78 -0
- package/lib/components/ArgousAction/index.d.ts +2 -0
- package/lib/components/ArgousAction/index.js +1 -0
- package/lib/components/ArgousAvatar/ArgousAvatar.d.ts +14 -0
- package/lib/components/ArgousAvatar/ArgousAvatar.js +79 -0
- package/lib/components/ArgousAvatar/index.d.ts +2 -0
- package/lib/components/ArgousAvatar/index.js +1 -0
- package/lib/components/ArgousComplexPagination/ArgousComplexPagination.d.ts +76 -0
- package/lib/components/ArgousComplexPagination/ArgousComplexPagination.js +182 -0
- package/lib/components/ArgousComplexPagination/index.d.ts +2 -0
- package/lib/components/ArgousComplexPagination/index.js +1 -0
- package/lib/components/ArgousComplexTable/ArgousComplexTable.d.ts +131 -0
- package/lib/components/ArgousComplexTable/ArgousComplexTable.js +360 -0
- package/lib/components/ArgousComplexTable/index.d.ts +2 -0
- package/lib/components/ArgousComplexTable/index.js +1 -0
- package/lib/components/ArgousComplexTableBody/ArgousComplexTableBody.d.ts +177 -0
- package/lib/components/ArgousComplexTableBody/ArgousComplexTableBody.js +162 -0
- package/lib/components/ArgousComplexTableBody/index.d.ts +2 -0
- package/lib/components/ArgousComplexTableBody/index.js +1 -0
- package/lib/components/ArgousComplexTableHead/ArgousComplexTableHead.d.ts +73 -0
- package/lib/components/ArgousComplexTableHead/ArgousComplexTableHead.js +98 -0
- package/lib/components/ArgousComplexTableHead/index.d.ts +2 -0
- package/lib/components/ArgousComplexTableHead/index.js +1 -0
- package/lib/components/ArgousComplexTableToolbar/ArgousComplexTableToolBar.d.ts +58 -0
- package/lib/components/ArgousComplexTableToolbar/ArgousComplexTableToolBar.js +66 -0
- package/lib/components/ArgousComplexTableToolbar/index.d.ts +2 -0
- package/lib/components/ArgousComplexTableToolbar/index.js +1 -0
- package/lib/components/ArgousInput/ArgousInput.d.ts +8 -0
- package/lib/components/ArgousInput/ArgousInput.js +616 -0
- package/lib/components/ArgousInput/index.d.ts +2 -0
- package/lib/components/ArgousInput/index.js +1 -0
- package/lib/components/ArgousPagination/ArgousPagination.d.ts +8 -0
- package/lib/components/ArgousPagination/ArgousPagination.js +43 -0
- package/lib/components/ArgousPagination/index.d.ts +2 -0
- package/lib/components/ArgousPagination/index.js +1 -0
- package/lib/components/ArgousProgressBar/ArgousProgressBar.d.ts +22 -0
- package/lib/components/ArgousProgressBar/ArgousProgressBar.js +167 -0
- package/lib/components/ArgousProgressBar/index.d.ts +2 -0
- package/lib/components/ArgousProgressBar/index.js +1 -0
- package/lib/components/ArgousSimpleTable/ArgousSimpleTable.d.ts +8 -0
- package/lib/components/ArgousSimpleTable/ArgousSimpleTable.js +241 -0
- package/lib/components/ArgousSimpleTable/index.d.ts +2 -0
- package/lib/components/ArgousSimpleTable/index.js +1 -0
- package/lib/components/AutoComplete/AutoComplete.d.ts +8 -0
- package/lib/components/AutoComplete/AutoComplete.js +189 -0
- package/lib/components/AutoComplete/index.d.ts +2 -0
- package/lib/components/AutoComplete/index.js +1 -0
- package/lib/components/AutoCompleteFavorites/AutoCompleteFavorites.js +298 -0
- package/lib/components/BarChart/BarChart.d.ts +8 -0
- package/lib/components/BarChart/BarChart.js +92 -0
- package/lib/components/BarChart/index.d.ts +2 -0
- package/lib/components/BarChart/index.js +1 -0
- package/lib/components/BarraFerramentas/BarraFerramentas.d.ts +21 -0
- package/lib/components/BarraFerramentas/BarraFerramentas.js +277 -0
- package/lib/components/BarraFerramentas/index.d.ts +2 -0
- package/lib/components/BarraFerramentas/index.js +1 -0
- package/lib/components/Button/Button.d.ts +8 -0
- package/lib/components/Button/Button.js +135 -0
- package/lib/components/Button/index.d.ts +2 -0
- package/lib/components/Button/index.js +1 -0
- package/lib/components/Cabecalho/Cabecalho.d.ts +8 -0
- package/lib/components/Cabecalho/Cabecalho.js +245 -0
- package/lib/components/Cabecalho/index.d.ts +2 -0
- package/lib/components/Cabecalho/index.js +1 -0
- package/lib/components/Calendar/Calendar.d.ts +8 -0
- package/lib/components/Calendar/Calendar.js +156 -0
- package/lib/components/Calendar/index.d.ts +2 -0
- package/lib/components/Calendar/index.js +1 -0
- package/lib/components/CartaoUsuario/CartaoUsuario.d.ts +9 -0
- package/lib/components/CartaoUsuario/CartaoUsuario.js +108 -0
- package/lib/components/CartaoUsuario/index.d.ts +2 -0
- package/lib/components/CartaoUsuario/index.js +1 -0
- package/lib/components/Collapse/Collapse.d.ts +60 -0
- package/lib/components/Collapse/Collapse.js +317 -0
- package/lib/components/Collapse/index.d.ts +3 -0
- package/lib/components/Collapse/index.js +1 -0
- package/lib/components/Compartilhar/Compartilhar.d.ts +7 -0
- package/lib/components/Compartilhar/Compartilhar.js +314 -0
- package/lib/components/Compartilhar/index.d.ts +2 -0
- package/lib/components/Compartilhar/index.js +1 -0
- package/lib/components/ConfirmModal/BasicModal.tsx +63 -0
- package/lib/components/ConfirmModal/ModalProvider.tsx +81 -0
- package/lib/components/ConfirmModal/WrapperModal.tsx +33 -0
- package/lib/components/ConfirmModal/index.d.ts +20 -0
- package/lib/components/ConfirmModal/index.js +8 -0
- package/lib/components/DropArea/DropArea.d.ts +21 -0
- package/lib/components/DropArea/DropArea.js +90 -0
- package/lib/components/DropArea/Html5FileSelector.js +164 -0
- package/lib/components/DropArea/index.d.ts +2 -0
- package/lib/components/DropArea/index.js +1 -0
- package/lib/components/Editor/Events.ts +83 -0
- package/lib/components/Editor/ScriptLoader.ts +96 -0
- package/lib/components/Editor/TinyMCE.ts +19 -0
- package/lib/components/Editor/Utils.ts +95 -0
- package/lib/components/Editor/components/Editor.tsx +375 -0
- package/lib/components/Editor/components/EditorPropTypes.ts +106 -0
- package/lib/components/Editor/index.tsx +11 -0
- package/lib/components/Editor/skins/content/dark/content.css +72 -0
- package/lib/components/Editor/skins/content/dark/content.min.css +8 -0
- package/lib/components/Editor/skins/content/dark/content.min.css.map +1 -0
- package/lib/components/Editor/skins/content/default/content.css +67 -0
- package/lib/components/Editor/skins/content/default/content.min.css +8 -0
- package/lib/components/Editor/skins/content/default/content.min.css.map +1 -0
- package/lib/components/Editor/skins/content/document/content.css +72 -0
- package/lib/components/Editor/skins/content/document/content.min.css +8 -0
- package/lib/components/Editor/skins/content/document/content.min.css.map +1 -0
- package/lib/components/Editor/skins/content/writer/content.css +68 -0
- package/lib/components/Editor/skins/content/writer/content.min.css +8 -0
- package/lib/components/Editor/skins/content/writer/content.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/dark/content.css +714 -0
- package/lib/components/Editor/skins/ui/dark/content.inline.css +726 -0
- package/lib/components/Editor/skins/ui/dark/content.inline.min.css +8 -0
- package/lib/components/Editor/skins/ui/dark/content.inline.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/dark/content.min.css +8 -0
- package/lib/components/Editor/skins/ui/dark/content.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/dark/content.mobile.css +29 -0
- package/lib/components/Editor/skins/ui/dark/content.mobile.min.css +8 -0
- package/lib/components/Editor/skins/ui/dark/content.mobile.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/dark/fonts/tinymce-mobile.woff +0 -0
- package/lib/components/Editor/skins/ui/dark/skin.css +3034 -0
- package/lib/components/Editor/skins/ui/dark/skin.min.css +8 -0
- package/lib/components/Editor/skins/ui/dark/skin.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/dark/skin.mobile.css +673 -0
- package/lib/components/Editor/skins/ui/dark/skin.mobile.min.css +8 -0
- package/lib/components/Editor/skins/ui/dark/skin.mobile.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/dark/skin.shadowdom.css +37 -0
- package/lib/components/Editor/skins/ui/dark/skin.shadowdom.min.css +8 -0
- package/lib/components/Editor/skins/ui/dark/skin.shadowdom.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/default/content.css +732 -0
- package/lib/components/Editor/skins/ui/default/content.inline.css +726 -0
- package/lib/components/Editor/skins/ui/default/content.inline.min.css +8 -0
- package/lib/components/Editor/skins/ui/default/content.inline.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/default/content.min.css +8 -0
- package/lib/components/Editor/skins/ui/default/content.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/default/content.mobile.css +29 -0
- package/lib/components/Editor/skins/ui/default/content.mobile.min.css +8 -0
- package/lib/components/Editor/skins/ui/default/content.mobile.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/default/fonts/tinymce-mobile.woff +0 -0
- package/lib/components/Editor/skins/ui/default/skin.css +3034 -0
- package/lib/components/Editor/skins/ui/default/skin.min.css +8 -0
- package/lib/components/Editor/skins/ui/default/skin.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/default/skin.mobile.css +673 -0
- package/lib/components/Editor/skins/ui/default/skin.mobile.min.css +8 -0
- package/lib/components/Editor/skins/ui/default/skin.mobile.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/default/skin.shadowdom.css +37 -0
- package/lib/components/Editor/skins/ui/default/skin.shadowdom.min.css +8 -0
- package/lib/components/Editor/skins/ui/default/skin.shadowdom.min.css.map +1 -0
- package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/fonts/tinymce-mobile.woff +0 -0
- package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/plugin-tinycomments-tinymce4.css +1641 -0
- package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/plugin-tinycomments-tinymce4.min.css +8 -0
- package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/plugin-tinycomments-tinymce4.min.css.map +1 -0
- package/lib/components/Editor/tinymce/README.md +63 -0
- package/lib/components/Editor/tinymce/icons/default/icons.js +172 -0
- package/lib/components/Editor/tinymce/icons/default/icons.min.js +1 -0
- package/lib/components/Editor/tinymce/jquery.tinymce.min.js +92 -0
- package/lib/components/Editor/tinymce/langs/README.md +3 -0
- package/lib/components/Editor/tinymce/langs/pt_BR.js +419 -0
- package/lib/components/Editor/tinymce/license.txt +504 -0
- package/lib/components/Editor/tinymce/plugins/advlist/plugin.js +280 -0
- package/lib/components/Editor/tinymce/plugins/advlist/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/anchor/plugin.js +216 -0
- package/lib/components/Editor/tinymce/plugins/anchor/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/autolink/plugin.js +185 -0
- package/lib/components/Editor/tinymce/plugins/autolink/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/autoresize/plugin.js +171 -0
- package/lib/components/Editor/tinymce/plugins/autoresize/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/autosave/plugin.js +212 -0
- package/lib/components/Editor/tinymce/plugins/autosave/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/bbcode/plugin.js +99 -0
- package/lib/components/Editor/tinymce/plugins/bbcode/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/charmap/plugin.js +1706 -0
- package/lib/components/Editor/tinymce/plugins/charmap/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/code/plugin.js +92 -0
- package/lib/components/Editor/tinymce/plugins/code/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/codesample/plugin.js +2332 -0
- package/lib/components/Editor/tinymce/plugins/codesample/plugin.min.js +9 -0
- package/{dist/components/Editor/tinymce/plugins/textcolor → lib/components/Editor/tinymce/plugins/colorpicker}/plugin.js +8 -5
- package/lib/components/Editor/tinymce/plugins/colorpicker/plugin.min.js +9 -0
- package/{dist/components/Editor/tinymce/plugins/colorpicker → lib/components/Editor/tinymce/plugins/contextmenu}/plugin.js +8 -5
- package/lib/components/Editor/tinymce/plugins/contextmenu/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/directionality/plugin.js +320 -0
- package/lib/components/Editor/tinymce/plugins/directionality/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/emoticons/js/emojiimages.js +9424 -0
- package/lib/components/Editor/tinymce/plugins/emoticons/js/emojiimages.min.js +3 -0
- package/lib/components/Editor/tinymce/plugins/emoticons/js/emojis.js +9423 -0
- package/lib/components/Editor/tinymce/plugins/emoticons/js/emojis.min.js +2 -0
- package/lib/components/Editor/tinymce/plugins/emoticons/plugin.js +605 -0
- package/lib/components/Editor/tinymce/plugins/emoticons/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/fullpage/plugin.js +544 -0
- package/lib/components/Editor/tinymce/plugins/fullpage/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/fullscreen/plugin.js +979 -0
- package/lib/components/Editor/tinymce/plugins/fullscreen/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/help/plugin.js +873 -0
- package/lib/components/Editor/tinymce/plugins/help/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/hr/plugin.js +46 -0
- package/lib/components/Editor/tinymce/plugins/hr/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/image/plugin.js +1661 -0
- package/lib/components/Editor/tinymce/plugins/image/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/imagetools/plugin.js +1354 -0
- package/lib/components/Editor/tinymce/plugins/imagetools/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/importcss/plugin.js +343 -0
- package/lib/components/Editor/tinymce/plugins/importcss/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/insertdatetime/plugin.js +177 -0
- package/lib/components/Editor/tinymce/plugins/insertdatetime/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/legacyoutput/plugin.js +199 -0
- package/lib/components/Editor/tinymce/plugins/legacyoutput/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/link/plugin.js +1287 -0
- package/lib/components/Editor/tinymce/plugins/link/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/lists/plugin.js +2286 -0
- package/lib/components/Editor/tinymce/plugins/lists/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/media/plugin.js +1382 -0
- package/lib/components/Editor/tinymce/plugins/media/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/nonbreaking/plugin.js +101 -0
- package/lib/components/Editor/tinymce/plugins/nonbreaking/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/noneditable/plugin.js +117 -0
- package/lib/components/Editor/tinymce/plugins/noneditable/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/pagebreak/plugin.js +105 -0
- package/lib/components/Editor/tinymce/plugins/pagebreak/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/paste/plugin.js +1764 -0
- package/lib/components/Editor/tinymce/plugins/paste/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/preview/plugin.js +127 -0
- package/lib/components/Editor/tinymce/plugins/preview/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/print/plugin.js +53 -0
- package/lib/components/Editor/tinymce/plugins/print/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/quickbars/plugin.js +489 -0
- package/lib/components/Editor/tinymce/plugins/quickbars/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/save/plugin.js +119 -0
- package/lib/components/Editor/tinymce/plugins/save/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/searchreplace/plugin.js +1163 -0
- package/lib/components/Editor/tinymce/plugins/searchreplace/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/spellchecker/plugin.js +731 -0
- package/lib/components/Editor/tinymce/plugins/spellchecker/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/tabfocus/plugin.js +129 -0
- package/lib/components/Editor/tinymce/plugins/tabfocus/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/table/plugin.js +10938 -0
- package/lib/components/Editor/tinymce/plugins/table/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/template/plugin.js +577 -0
- package/lib/components/Editor/tinymce/plugins/template/plugin.min.js +9 -0
- package/{dist/components/Editor/tinymce/plugins/contextmenu → lib/components/Editor/tinymce/plugins/textcolor}/plugin.js +8 -5
- package/lib/components/Editor/tinymce/plugins/textcolor/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/textpattern/plugin.js +1394 -0
- package/lib/components/Editor/tinymce/plugins/textpattern/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/toc/plugin.js +236 -0
- package/lib/components/Editor/tinymce/plugins/toc/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/visualblocks/plugin.js +104 -0
- package/lib/components/Editor/tinymce/plugins/visualblocks/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/visualchars/plugin.js +541 -0
- package/lib/components/Editor/tinymce/plugins/visualchars/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/plugins/wordcount/plugin.js +416 -0
- package/lib/components/Editor/tinymce/plugins/wordcount/plugin.min.js +9 -0
- package/lib/components/Editor/tinymce/skins/content/dark/content.css +72 -0
- package/lib/components/Editor/tinymce/skins/content/dark/content.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/content/dark/content.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/content/default/content.css +67 -0
- package/lib/components/Editor/tinymce/skins/content/default/content.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/content/default/content.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/content/document/content.css +72 -0
- package/lib/components/Editor/tinymce/skins/content/document/content.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/content/document/content.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/content/writer/content.css +68 -0
- package/lib/components/Editor/tinymce/skins/content/writer/content.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/content/writer/content.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/content.css +732 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.css +726 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/content.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/content.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/content.mobile.css +29 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/content.mobile.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/content.mobile.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/skin.css +3034 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/skin.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/skin.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/skin.mobile.css +673 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/skin.mobile.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/skin.mobile.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.css +37 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.css +714 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.css +726 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.mobile.css +29 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.mobile.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.mobile.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.css +3034 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.mobile.css +673 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.mobile.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.mobile.min.css.map +1 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +37 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +8 -0
- package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css.map +1 -0
- package/lib/components/Editor/tinymce/themes/mobile/theme.js +13587 -0
- package/lib/components/Editor/tinymce/themes/mobile/theme.min.js +9 -0
- package/lib/components/Editor/tinymce/themes/silver/theme.js +32480 -0
- package/lib/components/Editor/tinymce/themes/silver/theme.min.js +9 -0
- package/lib/components/Editor/tinymce/tinymce.d.ts +2963 -0
- package/lib/components/Editor/tinymce/tinymce.js +30106 -0
- package/lib/components/Editor/tinymce/tinymce.min.js +30106 -0
- package/lib/components/FilePreparer/FilePreparer.d.ts +26 -0
- package/lib/components/FilePreparer/FilePreparer.js +247 -0
- package/lib/components/FilePreparer/index.d.ts +2 -0
- package/lib/components/FilePreparer/index.js +1 -0
- package/lib/components/FileUploader/FileUploader.d.ts +9 -0
- package/lib/components/FileUploader/FileUploader.js +318 -0
- package/lib/components/FileUploader/index.d.ts +2 -0
- package/lib/components/FileUploader/index.js +1 -0
- package/lib/components/FormVisualizer/FormVisualizer.d.ts +92 -0
- package/lib/components/FormVisualizer/FormVisualizer.js +289 -0
- package/lib/components/FormVisualizer/index.d.ts +2 -0
- package/lib/components/FormVisualizer/index.js +1 -0
- package/lib/components/Highlight/Highlight.d.ts +7 -0
- package/lib/components/Highlight/Highlight.js +51 -0
- package/lib/components/Highlight/index.d.ts +2 -0
- package/lib/components/Highlight/index.js +1 -0
- package/lib/components/ImageResize/ImageResize.d.ts +28 -0
- package/lib/components/ImageResize/ImageResize.js +479 -0
- package/lib/components/ImageResize/index.d.ts +2 -0
- package/lib/components/ImageResize/index.js +1 -0
- package/lib/components/ImageResizeButton/ImageResizeButton.d.ts +26 -0
- package/lib/components/ImageResizeButton/ImageResizeButton.js +65 -0
- package/lib/components/ImageResizeButton/index.d.ts +2 -0
- package/lib/components/ImageResizeButton/index.js +1 -0
- package/lib/components/Input/Input.d.ts +8 -0
- package/lib/components/Input/Input.js +353 -0
- package/lib/components/Input/index.d.ts +2 -0
- package/lib/components/Input/index.js +1 -0
- package/lib/components/InputTags/InputTags.d.ts +8 -0
- package/lib/components/InputTags/InputTags.js +94 -0
- package/lib/components/InputTags/index.d.ts +2 -0
- package/lib/components/InputTags/index.js +1 -0
- package/lib/components/ListSelect/ListSelect.d.ts +8 -0
- package/lib/components/ListSelect/ListSelect.js +94 -0
- package/lib/components/ListSelect/index.d.ts +2 -0
- package/lib/components/ListSelect/index.js +1 -0
- package/lib/components/MaterialButton/MaterialButton.d.ts +13 -0
- package/lib/components/MaterialButton/MaterialButton.js +177 -0
- package/lib/components/MaterialButton/index.d.ts +2 -0
- package/lib/components/MaterialButton/index.js +1 -0
- package/lib/components/MenuBar/MenuBar.d.ts +8 -0
- package/lib/components/MenuBar/MenuBar.js +139 -0
- package/lib/components/MenuBar/index.d.ts +2 -0
- package/lib/components/MenuBar/index.js +1 -0
- package/lib/components/MonthPicker/MonthPicker.d.ts +8 -0
- package/lib/components/MonthPicker/MonthPicker.js +313 -0
- package/lib/components/MonthPicker/index.d.ts +2 -0
- package/lib/components/MonthPicker/index.js +1 -0
- package/lib/components/MultipleSelect/MultipleSelect.d.ts +8 -0
- package/lib/components/MultipleSelect/MultipleSelect.js +106 -0
- package/lib/components/MultipleSelect/index.d.ts +2 -0
- package/lib/components/MultipleSelect/index.js +1 -0
- package/lib/components/OtpInput/OtpInput.tsx +244 -0
- package/lib/components/OtpInput/index.d.ts +2 -0
- package/lib/components/OtpInput/index.js +1 -0
- package/lib/components/OutputText/OutputText.d.ts +8 -0
- package/lib/components/OutputText/OutputText.js +57 -0
- package/lib/components/OutputText/index.d.ts +2 -0
- package/lib/components/OutputText/index.js +1 -0
- package/lib/components/Pagination/Pagination.d.ts +8 -0
- package/lib/components/Pagination/Pagination.js +32 -0
- package/lib/components/Pagination/index.d.ts +2 -0
- package/lib/components/Pagination/index.js +1 -0
- package/lib/components/Programa/Programa.d.ts +31 -0
- package/lib/components/Programa/Programa.js +172 -0
- package/lib/components/Programa/index.d.ts +2 -0
- package/lib/components/Programa/index.js +1 -0
- package/lib/components/ProgressBar/ProgressBar.d.ts +8 -0
- package/lib/components/ProgressBar/ProgressBar.js +71 -0
- package/lib/components/ProgressBar/index.d.ts +2 -0
- package/lib/components/ProgressBar/index.js +1 -0
- package/lib/components/Select/Select.d.ts +8 -0
- package/lib/components/Select/Select.js +117 -0
- package/lib/components/Select/index.d.ts +2 -0
- package/lib/components/Select/index.js +1 -0
- package/lib/components/SimpleTable/SimpleTable.d.ts +13 -0
- package/lib/components/SimpleTable/SimpleTable.js +504 -0
- package/lib/components/SimpleTable/index.d.ts +2 -0
- package/lib/components/SimpleTable/index.js +2 -0
- package/lib/components/Stepper/Stepper.d.ts +54 -0
- package/lib/components/Stepper/Stepper.js +222 -0
- package/lib/components/Stepper/index.d.ts +2 -0
- package/lib/components/Stepper/index.js +1 -0
- package/lib/components/TablePicker/TablePicker.d.ts +8 -0
- package/lib/components/TablePicker/TablePicker.js +238 -0
- package/lib/components/TablePicker/index.d.ts +2 -0
- package/lib/components/TablePicker/index.js +1 -0
- package/lib/components/Tabs/Tabs.d.ts +8 -0
- package/lib/components/Tabs/Tabs.js +59 -0
- package/lib/components/Tabs/index.d.ts +2 -0
- package/lib/components/Tabs/index.js +1 -0
- package/lib/components/TextArea/TextArea.d.ts +8 -0
- package/lib/components/TextArea/TextArea.js +123 -0
- package/lib/components/TextArea/index.d.ts +2 -0
- package/lib/components/TextArea/index.js +1 -0
- package/lib/components/ThreadLog/ThreadLog.d.ts +8 -0
- package/lib/components/ThreadLog/ThreadLog.js +189 -0
- package/lib/components/ThreadLog/index.d.ts +2 -0
- package/lib/components/ThreadLog/index.js +1 -0
- package/lib/components/UtilAutoComplete/UtilAutoComplete.d.ts +93 -0
- package/lib/components/UtilAutoComplete/UtilAutoComplete.js +130 -0
- package/lib/components/UtilAutoComplete/index.d.ts +2 -0
- package/lib/components/UtilAutoComplete/index.js +1 -0
- package/lib/components/index.d.ts +148 -0
- package/lib/components/index.js +146 -0
- package/lib/fieldsRedux/createField.d.ts +8 -0
- package/lib/fieldsRedux/createField.js +120 -0
- package/lib/fieldsRedux/fieldsRedux.d.ts +71 -0
- package/lib/fieldsRedux/fieldsRedux.js +391 -0
- package/lib/fieldsRedux/index.d.ts +4 -0
- package/lib/fieldsRedux/index.js +5 -0
- package/lib/fieldsRedux/passFields.d.ts +5 -0
- package/lib/fieldsRedux/passFields.js +76 -0
- package/lib/reducers/argous.ts +103 -0
- package/lib/reducers/index.ts +6 -0
- package/lib/types.d.ts +144 -0
- package/lib/utils/api.ts +153 -0
- package/lib/utils/config.ts +12 -0
- package/lib/utils/date.ts +63 -0
- package/lib/utils/index.ts +314 -0
- package/lib/utils/rippleEffect.js +211 -0
- package/lib/utils/store.ts +11 -0
- package/lib/utils/xmlToJson.js +117 -0
- package/package.json +1 -1
- package/dist/components/ArgousComplexTableBody/dnd/Container.d.ts +0 -55
- package/dist/components/ArgousComplexTableBody/dnd/Container.js +0 -173
- package/dist/components/ArgousComplexTableBody/dnd/Draggable.d.ts +0 -14
- package/dist/components/ArgousComplexTableBody/dnd/Draggable.js +0 -73
- package/dist/components/ArgousComplexTableBody/dnd/index.d.ts +0 -2
- package/dist/components/ArgousComplexTableBody/dnd/index.js +0 -10
- package/dist/components/ConfirmModal/useModal.d.ts +0 -2
- package/dist/components/ConfirmModal/useModal.js +0 -9
- package/dist/components/DropArea/worker.d.ts +0 -1
- package/dist/components/DropArea/worker.js +0 -55
- package/dist/components/Editor/tinymce/icons/default/icons.d.ts +0 -0
- package/dist/components/Editor/tinymce/icons/default/icons.js +0 -173
- package/dist/components/Editor/tinymce/plugins/advlist/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/advlist/plugin.js +0 -271
- package/dist/components/Editor/tinymce/plugins/anchor/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/anchor/plugin.js +0 -207
- package/dist/components/Editor/tinymce/plugins/autolink/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/autolink/plugin.js +0 -187
- package/dist/components/Editor/tinymce/plugins/autoresize/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/autoresize/plugin.js +0 -163
- package/dist/components/Editor/tinymce/plugins/autosave/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/autosave/plugin.js +0 -199
- package/dist/components/Editor/tinymce/plugins/bbcode/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/bbcode/plugin.js +0 -94
- package/dist/components/Editor/tinymce/plugins/charmap/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/charmap/plugin.js +0 -1691
- package/dist/components/Editor/tinymce/plugins/code/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/code/plugin.js +0 -85
- package/dist/components/Editor/tinymce/plugins/codesample/plugin.js +0 -2331
- package/dist/components/Editor/tinymce/plugins/colorpicker/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/contextmenu/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/directionality/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/directionality/plugin.js +0 -300
- package/dist/components/Editor/tinymce/plugins/emoticons/js/emojiimages.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/emoticons/js/emojiimages.js +0 -9425
- package/dist/components/Editor/tinymce/plugins/emoticons/js/emojis.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/emoticons/js/emojis.js +0 -9424
- package/dist/components/Editor/tinymce/plugins/emoticons/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/emoticons/plugin.js +0 -585
- package/dist/components/Editor/tinymce/plugins/fullpage/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/fullpage/plugin.js +0 -539
- package/dist/components/Editor/tinymce/plugins/fullscreen/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/fullscreen/plugin.js +0 -962
- package/dist/components/Editor/tinymce/plugins/help/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/help/plugin.js +0 -850
- package/dist/components/Editor/tinymce/plugins/hr/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/hr/plugin.js +0 -41
- package/dist/components/Editor/tinymce/plugins/image/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/image/plugin.js +0 -1673
- package/dist/components/Editor/tinymce/plugins/imagetools/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/imagetools/plugin.js +0 -1335
- package/dist/components/Editor/tinymce/plugins/importcss/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/importcss/plugin.js +0 -346
- package/dist/components/Editor/tinymce/plugins/insertdatetime/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/insertdatetime/plugin.js +0 -171
- package/dist/components/Editor/tinymce/plugins/legacyoutput/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/legacyoutput/plugin.js +0 -193
- package/dist/components/Editor/tinymce/plugins/link/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/link/plugin.js +0 -1282
- package/dist/components/Editor/tinymce/plugins/lists/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/lists/plugin.js +0 -2256
- package/dist/components/Editor/tinymce/plugins/media/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/media/plugin.js +0 -1374
- package/dist/components/Editor/tinymce/plugins/nonbreaking/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/nonbreaking/plugin.js +0 -93
- package/dist/components/Editor/tinymce/plugins/noneditable/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/noneditable/plugin.js +0 -114
- package/dist/components/Editor/tinymce/plugins/pagebreak/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/pagebreak/plugin.js +0 -96
- package/dist/components/Editor/tinymce/plugins/paste/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/paste/plugin.js +0 -1747
- package/dist/components/Editor/tinymce/plugins/preview/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/preview/plugin.js +0 -119
- package/dist/components/Editor/tinymce/plugins/print/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/print/plugin.js +0 -48
- package/dist/components/Editor/tinymce/plugins/quickbars/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/quickbars/plugin.js +0 -475
- package/dist/components/Editor/tinymce/plugins/save/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/save/plugin.js +0 -112
- package/dist/components/Editor/tinymce/plugins/searchreplace/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/searchreplace/plugin.js +0 -1149
- package/dist/components/Editor/tinymce/plugins/spellchecker/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/spellchecker/plugin.js +0 -723
- package/dist/components/Editor/tinymce/plugins/tabfocus/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/tabfocus/plugin.js +0 -124
- package/dist/components/Editor/tinymce/plugins/table/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/table/plugin.js +0 -10853
- package/dist/components/Editor/tinymce/plugins/template/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/template/plugin.js +0 -561
- package/dist/components/Editor/tinymce/plugins/textcolor/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/textpattern/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/textpattern/plugin.js +0 -1393
- package/dist/components/Editor/tinymce/plugins/toc/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/toc/plugin.js +0 -227
- package/dist/components/Editor/tinymce/plugins/visualblocks/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/visualblocks/plugin.js +0 -94
- package/dist/components/Editor/tinymce/plugins/visualchars/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/visualchars/plugin.js +0 -521
- package/dist/components/Editor/tinymce/plugins/wordcount/plugin.d.ts +0 -0
- package/dist/components/Editor/tinymce/plugins/wordcount/plugin.js +0 -397
- package/dist/components/Editor/tinymce/themes/mobile/theme.js +0 -13348
- package/dist/components/Editor/tinymce/themes/silver/theme.js +0 -32028
- package/dist/components/Editor/tinymce/tinymce.js +0 -30486
- package/dist/components/FilePreparer/worker.d.ts +0 -2
- package/dist/components/FilePreparer/worker.js +0 -31
- package/dist/convertReacticons.d.ts +0 -1
- package/dist/convertReacticons.js +0 -62
- package/dist/utils/Fields.d.ts +0 -0
- package/dist/utils/Fields.js +0 -1
|
@@ -0,0 +1,1354 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
|
3
|
+
* Licensed under the LGPL or a commercial license.
|
|
4
|
+
* For LGPL see License.txt in the project root for license information.
|
|
5
|
+
* For commercial licenses see https://www.tiny.cloud/
|
|
6
|
+
*
|
|
7
|
+
* Version: 5.9.0 (TBD)
|
|
8
|
+
*/
|
|
9
|
+
(function () {
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
var Cell = function (initial) {
|
|
13
|
+
var value = initial;
|
|
14
|
+
var get = function () {
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
var set = function (v) {
|
|
18
|
+
value = v;
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
get: get,
|
|
22
|
+
set: set
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
27
|
+
|
|
28
|
+
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
29
|
+
|
|
30
|
+
var isSimpleType = function (type) {
|
|
31
|
+
return function (value) {
|
|
32
|
+
return typeof value === type;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
var isNullable = function (a) {
|
|
36
|
+
return a === null || a === undefined;
|
|
37
|
+
};
|
|
38
|
+
var isNonNullable = function (a) {
|
|
39
|
+
return !isNullable(a);
|
|
40
|
+
};
|
|
41
|
+
var isFunction = isSimpleType('function');
|
|
42
|
+
|
|
43
|
+
var noop = function () {
|
|
44
|
+
};
|
|
45
|
+
var constant = function (value) {
|
|
46
|
+
return function () {
|
|
47
|
+
return value;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
var never = constant(false);
|
|
51
|
+
var always = constant(true);
|
|
52
|
+
|
|
53
|
+
var none = function () {
|
|
54
|
+
return NONE;
|
|
55
|
+
};
|
|
56
|
+
var NONE = function () {
|
|
57
|
+
var eq = function (o) {
|
|
58
|
+
return o.isNone();
|
|
59
|
+
};
|
|
60
|
+
var call = function (thunk) {
|
|
61
|
+
return thunk();
|
|
62
|
+
};
|
|
63
|
+
var id = function (n) {
|
|
64
|
+
return n;
|
|
65
|
+
};
|
|
66
|
+
var me = {
|
|
67
|
+
fold: function (n, _s) {
|
|
68
|
+
return n();
|
|
69
|
+
},
|
|
70
|
+
is: never,
|
|
71
|
+
isSome: never,
|
|
72
|
+
isNone: always,
|
|
73
|
+
getOr: id,
|
|
74
|
+
getOrThunk: call,
|
|
75
|
+
getOrDie: function (msg) {
|
|
76
|
+
throw new Error(msg || 'error: getOrDie called on none.');
|
|
77
|
+
},
|
|
78
|
+
getOrNull: constant(null),
|
|
79
|
+
getOrUndefined: constant(undefined),
|
|
80
|
+
or: id,
|
|
81
|
+
orThunk: call,
|
|
82
|
+
map: none,
|
|
83
|
+
each: noop,
|
|
84
|
+
bind: none,
|
|
85
|
+
exists: never,
|
|
86
|
+
forall: always,
|
|
87
|
+
filter: none,
|
|
88
|
+
equals: eq,
|
|
89
|
+
equals_: eq,
|
|
90
|
+
toArray: function () {
|
|
91
|
+
return [];
|
|
92
|
+
},
|
|
93
|
+
toString: constant('none()')
|
|
94
|
+
};
|
|
95
|
+
return me;
|
|
96
|
+
}();
|
|
97
|
+
var some = function (a) {
|
|
98
|
+
var constant_a = constant(a);
|
|
99
|
+
var self = function () {
|
|
100
|
+
return me;
|
|
101
|
+
};
|
|
102
|
+
var bind = function (f) {
|
|
103
|
+
return f(a);
|
|
104
|
+
};
|
|
105
|
+
var me = {
|
|
106
|
+
fold: function (n, s) {
|
|
107
|
+
return s(a);
|
|
108
|
+
},
|
|
109
|
+
is: function (v) {
|
|
110
|
+
return a === v;
|
|
111
|
+
},
|
|
112
|
+
isSome: always,
|
|
113
|
+
isNone: never,
|
|
114
|
+
getOr: constant_a,
|
|
115
|
+
getOrThunk: constant_a,
|
|
116
|
+
getOrDie: constant_a,
|
|
117
|
+
getOrNull: constant_a,
|
|
118
|
+
getOrUndefined: constant_a,
|
|
119
|
+
or: self,
|
|
120
|
+
orThunk: self,
|
|
121
|
+
map: function (f) {
|
|
122
|
+
return some(f(a));
|
|
123
|
+
},
|
|
124
|
+
each: function (f) {
|
|
125
|
+
f(a);
|
|
126
|
+
},
|
|
127
|
+
bind: bind,
|
|
128
|
+
exists: bind,
|
|
129
|
+
forall: bind,
|
|
130
|
+
filter: function (f) {
|
|
131
|
+
return f(a) ? me : NONE;
|
|
132
|
+
},
|
|
133
|
+
toArray: function () {
|
|
134
|
+
return [a];
|
|
135
|
+
},
|
|
136
|
+
toString: function () {
|
|
137
|
+
return 'some(' + a + ')';
|
|
138
|
+
},
|
|
139
|
+
equals: function (o) {
|
|
140
|
+
return o.is(a);
|
|
141
|
+
},
|
|
142
|
+
equals_: function (o, elementEq) {
|
|
143
|
+
return o.fold(never, function (b) {
|
|
144
|
+
return elementEq(a, b);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
return me;
|
|
149
|
+
};
|
|
150
|
+
var from = function (value) {
|
|
151
|
+
return value === null || value === undefined ? NONE : some(value);
|
|
152
|
+
};
|
|
153
|
+
var Optional = {
|
|
154
|
+
some: some,
|
|
155
|
+
none: none,
|
|
156
|
+
from: from
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var create = function (width, height) {
|
|
160
|
+
return resize(document.createElement('canvas'), width, height);
|
|
161
|
+
};
|
|
162
|
+
var clone = function (canvas) {
|
|
163
|
+
var tCanvas = create(canvas.width, canvas.height);
|
|
164
|
+
var ctx = get2dContext(tCanvas);
|
|
165
|
+
ctx.drawImage(canvas, 0, 0);
|
|
166
|
+
return tCanvas;
|
|
167
|
+
};
|
|
168
|
+
var get2dContext = function (canvas) {
|
|
169
|
+
return canvas.getContext('2d');
|
|
170
|
+
};
|
|
171
|
+
var resize = function (canvas, width, height) {
|
|
172
|
+
canvas.width = width;
|
|
173
|
+
canvas.height = height;
|
|
174
|
+
return canvas;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
var getWidth = function (image) {
|
|
178
|
+
return image.naturalWidth || image.width;
|
|
179
|
+
};
|
|
180
|
+
var getHeight = function (image) {
|
|
181
|
+
return image.naturalHeight || image.height;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
var promise = function () {
|
|
185
|
+
var Promise = function (fn) {
|
|
186
|
+
if (typeof this !== 'object') {
|
|
187
|
+
throw new TypeError('Promises must be constructed via new');
|
|
188
|
+
}
|
|
189
|
+
if (typeof fn !== 'function') {
|
|
190
|
+
throw new TypeError('not a function');
|
|
191
|
+
}
|
|
192
|
+
this._state = null;
|
|
193
|
+
this._value = null;
|
|
194
|
+
this._deferreds = [];
|
|
195
|
+
doResolve(fn, bind(resolve, this), bind(reject, this));
|
|
196
|
+
};
|
|
197
|
+
var anyWindow = window;
|
|
198
|
+
var asap = Promise.immediateFn || typeof anyWindow.setImmediate === 'function' && anyWindow.setImmediate || function (fn) {
|
|
199
|
+
return setTimeout(fn, 1);
|
|
200
|
+
};
|
|
201
|
+
var bind = function (fn, thisArg) {
|
|
202
|
+
return function () {
|
|
203
|
+
var args = [];
|
|
204
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
205
|
+
args[_i] = arguments[_i];
|
|
206
|
+
}
|
|
207
|
+
return fn.apply(thisArg, args);
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
var isArray = Array.isArray || function (value) {
|
|
211
|
+
return Object.prototype.toString.call(value) === '[object Array]';
|
|
212
|
+
};
|
|
213
|
+
function handle(deferred) {
|
|
214
|
+
var me = this;
|
|
215
|
+
if (this._state === null) {
|
|
216
|
+
this._deferreds.push(deferred);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
asap(function () {
|
|
220
|
+
var cb = me._state ? deferred.onFulfilled : deferred.onRejected;
|
|
221
|
+
if (cb === null) {
|
|
222
|
+
(me._state ? deferred.resolve : deferred.reject)(me._value);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
var ret;
|
|
226
|
+
try {
|
|
227
|
+
ret = cb(me._value);
|
|
228
|
+
} catch (e) {
|
|
229
|
+
deferred.reject(e);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
deferred.resolve(ret);
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function resolve(newValue) {
|
|
236
|
+
try {
|
|
237
|
+
if (newValue === this) {
|
|
238
|
+
throw new TypeError('A promise cannot be resolved with itself.');
|
|
239
|
+
}
|
|
240
|
+
if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {
|
|
241
|
+
var then = newValue.then;
|
|
242
|
+
if (typeof then === 'function') {
|
|
243
|
+
doResolve(bind(then, newValue), bind(resolve, this), bind(reject, this));
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
this._state = true;
|
|
248
|
+
this._value = newValue;
|
|
249
|
+
finale.call(this);
|
|
250
|
+
} catch (e) {
|
|
251
|
+
reject.call(this, e);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function reject(newValue) {
|
|
255
|
+
this._state = false;
|
|
256
|
+
this._value = newValue;
|
|
257
|
+
finale.call(this);
|
|
258
|
+
}
|
|
259
|
+
function finale() {
|
|
260
|
+
for (var _i = 0, _a = this._deferreds; _i < _a.length; _i++) {
|
|
261
|
+
var deferred = _a[_i];
|
|
262
|
+
handle.call(this, deferred);
|
|
263
|
+
}
|
|
264
|
+
this._deferreds = [];
|
|
265
|
+
}
|
|
266
|
+
function Handler(onFulfilled, onRejected, resolve, reject) {
|
|
267
|
+
this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
|
|
268
|
+
this.onRejected = typeof onRejected === 'function' ? onRejected : null;
|
|
269
|
+
this.resolve = resolve;
|
|
270
|
+
this.reject = reject;
|
|
271
|
+
}
|
|
272
|
+
var doResolve = function (fn, onFulfilled, onRejected) {
|
|
273
|
+
var done = false;
|
|
274
|
+
try {
|
|
275
|
+
fn(function (value) {
|
|
276
|
+
if (done) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
done = true;
|
|
280
|
+
onFulfilled(value);
|
|
281
|
+
}, function (reason) {
|
|
282
|
+
if (done) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
done = true;
|
|
286
|
+
onRejected(reason);
|
|
287
|
+
});
|
|
288
|
+
} catch (ex) {
|
|
289
|
+
if (done) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
done = true;
|
|
293
|
+
onRejected(ex);
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
Promise.prototype.catch = function (onRejected) {
|
|
297
|
+
return this.then(null, onRejected);
|
|
298
|
+
};
|
|
299
|
+
Promise.prototype.then = function (onFulfilled, onRejected) {
|
|
300
|
+
var me = this;
|
|
301
|
+
return new Promise(function (resolve, reject) {
|
|
302
|
+
handle.call(me, new Handler(onFulfilled, onRejected, resolve, reject));
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
Promise.all = function () {
|
|
306
|
+
var values = [];
|
|
307
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
308
|
+
values[_i] = arguments[_i];
|
|
309
|
+
}
|
|
310
|
+
var args = Array.prototype.slice.call(values.length === 1 && isArray(values[0]) ? values[0] : values);
|
|
311
|
+
return new Promise(function (resolve, reject) {
|
|
312
|
+
if (args.length === 0) {
|
|
313
|
+
return resolve([]);
|
|
314
|
+
}
|
|
315
|
+
var remaining = args.length;
|
|
316
|
+
var res = function (i, val) {
|
|
317
|
+
try {
|
|
318
|
+
if (val && (typeof val === 'object' || typeof val === 'function')) {
|
|
319
|
+
var then = val.then;
|
|
320
|
+
if (typeof then === 'function') {
|
|
321
|
+
then.call(val, function (val) {
|
|
322
|
+
res(i, val);
|
|
323
|
+
}, reject);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
args[i] = val;
|
|
328
|
+
if (--remaining === 0) {
|
|
329
|
+
resolve(args);
|
|
330
|
+
}
|
|
331
|
+
} catch (ex) {
|
|
332
|
+
reject(ex);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
for (var i = 0; i < args.length; i++) {
|
|
336
|
+
res(i, args[i]);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
Promise.resolve = function (value) {
|
|
341
|
+
if (value && typeof value === 'object' && value.constructor === Promise) {
|
|
342
|
+
return value;
|
|
343
|
+
}
|
|
344
|
+
return new Promise(function (resolve) {
|
|
345
|
+
resolve(value);
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
Promise.reject = function (reason) {
|
|
349
|
+
return new Promise(function (resolve, reject) {
|
|
350
|
+
reject(reason);
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
Promise.race = function (values) {
|
|
354
|
+
return new Promise(function (resolve, reject) {
|
|
355
|
+
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
|
|
356
|
+
var value = values_1[_i];
|
|
357
|
+
value.then(resolve, reject);
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
};
|
|
361
|
+
return Promise;
|
|
362
|
+
};
|
|
363
|
+
var Promise = window.Promise ? window.Promise : promise();
|
|
364
|
+
|
|
365
|
+
var imageToBlob = function (image) {
|
|
366
|
+
var src = image.src;
|
|
367
|
+
if (src.indexOf('data:') === 0) {
|
|
368
|
+
return dataUriToBlob(src);
|
|
369
|
+
}
|
|
370
|
+
return anyUriToBlob(src);
|
|
371
|
+
};
|
|
372
|
+
var blobToImage = function (blob) {
|
|
373
|
+
return new Promise(function (resolve, reject) {
|
|
374
|
+
var blobUrl = URL.createObjectURL(blob);
|
|
375
|
+
var image = new Image();
|
|
376
|
+
var removeListeners = function () {
|
|
377
|
+
image.removeEventListener('load', loaded);
|
|
378
|
+
image.removeEventListener('error', error);
|
|
379
|
+
};
|
|
380
|
+
var loaded = function () {
|
|
381
|
+
removeListeners();
|
|
382
|
+
resolve(image);
|
|
383
|
+
};
|
|
384
|
+
var error = function () {
|
|
385
|
+
removeListeners();
|
|
386
|
+
reject('Unable to load data of type ' + blob.type + ': ' + blobUrl);
|
|
387
|
+
};
|
|
388
|
+
image.addEventListener('load', loaded);
|
|
389
|
+
image.addEventListener('error', error);
|
|
390
|
+
image.src = blobUrl;
|
|
391
|
+
if (image.complete) {
|
|
392
|
+
setTimeout(loaded, 0);
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
};
|
|
396
|
+
var anyUriToBlob = function (url) {
|
|
397
|
+
return new Promise(function (resolve, reject) {
|
|
398
|
+
var xhr = new XMLHttpRequest();
|
|
399
|
+
xhr.open('GET', url, true);
|
|
400
|
+
xhr.responseType = 'blob';
|
|
401
|
+
xhr.onload = function () {
|
|
402
|
+
if (this.status === 200) {
|
|
403
|
+
resolve(this.response);
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
xhr.onerror = function () {
|
|
407
|
+
var _this = this;
|
|
408
|
+
var corsError = function () {
|
|
409
|
+
var obj = new Error('No access to download image');
|
|
410
|
+
obj.code = 18;
|
|
411
|
+
obj.name = 'SecurityError';
|
|
412
|
+
return obj;
|
|
413
|
+
};
|
|
414
|
+
var genericError = function () {
|
|
415
|
+
return new Error('Error ' + _this.status + ' downloading image');
|
|
416
|
+
};
|
|
417
|
+
reject(this.status === 0 ? corsError() : genericError());
|
|
418
|
+
};
|
|
419
|
+
xhr.send();
|
|
420
|
+
});
|
|
421
|
+
};
|
|
422
|
+
var dataUriToBlobSync = function (uri) {
|
|
423
|
+
var data = uri.split(',');
|
|
424
|
+
var matches = /data:([^;]+)/.exec(data[0]);
|
|
425
|
+
if (!matches) {
|
|
426
|
+
return Optional.none();
|
|
427
|
+
}
|
|
428
|
+
var mimetype = matches[1];
|
|
429
|
+
var base64 = data[1];
|
|
430
|
+
var sliceSize = 1024;
|
|
431
|
+
var byteCharacters = atob(base64);
|
|
432
|
+
var bytesLength = byteCharacters.length;
|
|
433
|
+
var slicesCount = Math.ceil(bytesLength / sliceSize);
|
|
434
|
+
var byteArrays = new Array(slicesCount);
|
|
435
|
+
for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
|
|
436
|
+
var begin = sliceIndex * sliceSize;
|
|
437
|
+
var end = Math.min(begin + sliceSize, bytesLength);
|
|
438
|
+
var bytes = new Array(end - begin);
|
|
439
|
+
for (var offset = begin, i = 0; offset < end; ++i, ++offset) {
|
|
440
|
+
bytes[i] = byteCharacters[offset].charCodeAt(0);
|
|
441
|
+
}
|
|
442
|
+
byteArrays[sliceIndex] = new Uint8Array(bytes);
|
|
443
|
+
}
|
|
444
|
+
return Optional.some(new Blob(byteArrays, { type: mimetype }));
|
|
445
|
+
};
|
|
446
|
+
var dataUriToBlob = function (uri) {
|
|
447
|
+
return new Promise(function (resolve, reject) {
|
|
448
|
+
dataUriToBlobSync(uri).fold(function () {
|
|
449
|
+
reject('uri is not base64: ' + uri);
|
|
450
|
+
}, resolve);
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
var canvasToBlob = function (canvas, type, quality) {
|
|
454
|
+
type = type || 'image/png';
|
|
455
|
+
if (isFunction(HTMLCanvasElement.prototype.toBlob)) {
|
|
456
|
+
return new Promise(function (resolve, reject) {
|
|
457
|
+
canvas.toBlob(function (blob) {
|
|
458
|
+
if (blob) {
|
|
459
|
+
resolve(blob);
|
|
460
|
+
} else {
|
|
461
|
+
reject();
|
|
462
|
+
}
|
|
463
|
+
}, type, quality);
|
|
464
|
+
});
|
|
465
|
+
} else {
|
|
466
|
+
return dataUriToBlob(canvas.toDataURL(type, quality));
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
var canvasToDataURL = function (canvas, type, quality) {
|
|
470
|
+
type = type || 'image/png';
|
|
471
|
+
return canvas.toDataURL(type, quality);
|
|
472
|
+
};
|
|
473
|
+
var blobToCanvas = function (blob) {
|
|
474
|
+
return blobToImage(blob).then(function (image) {
|
|
475
|
+
revokeImageUrl(image);
|
|
476
|
+
var canvas = create(getWidth(image), getHeight(image));
|
|
477
|
+
var context = get2dContext(canvas);
|
|
478
|
+
context.drawImage(image, 0, 0);
|
|
479
|
+
return canvas;
|
|
480
|
+
});
|
|
481
|
+
};
|
|
482
|
+
var blobToDataUri = function (blob) {
|
|
483
|
+
return new Promise(function (resolve) {
|
|
484
|
+
var reader = new FileReader();
|
|
485
|
+
reader.onloadend = function () {
|
|
486
|
+
resolve(reader.result);
|
|
487
|
+
};
|
|
488
|
+
reader.readAsDataURL(blob);
|
|
489
|
+
});
|
|
490
|
+
};
|
|
491
|
+
var revokeImageUrl = function (image) {
|
|
492
|
+
URL.revokeObjectURL(image.src);
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
var blobToImage$1 = function (blob) {
|
|
496
|
+
return blobToImage(blob);
|
|
497
|
+
};
|
|
498
|
+
var imageToBlob$1 = function (image) {
|
|
499
|
+
return imageToBlob(image);
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
var each = function (xs, f) {
|
|
503
|
+
for (var i = 0, len = xs.length; i < len; i++) {
|
|
504
|
+
var x = xs[i];
|
|
505
|
+
f(x, i);
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
var foldl = function (xs, f, acc) {
|
|
509
|
+
each(xs, function (x) {
|
|
510
|
+
acc = f(acc, x);
|
|
511
|
+
});
|
|
512
|
+
return acc;
|
|
513
|
+
};
|
|
514
|
+
var findUntil = function (xs, pred, until) {
|
|
515
|
+
for (var i = 0, len = xs.length; i < len; i++) {
|
|
516
|
+
var x = xs[i];
|
|
517
|
+
if (pred(x, i)) {
|
|
518
|
+
return Optional.some(x);
|
|
519
|
+
} else if (until(x, i)) {
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return Optional.none();
|
|
524
|
+
};
|
|
525
|
+
var find = function (xs, pred) {
|
|
526
|
+
return findUntil(xs, pred, never);
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
var create$1 = function (getCanvas, blob, uri) {
|
|
530
|
+
var initialType = blob.type;
|
|
531
|
+
var getType = constant(initialType);
|
|
532
|
+
var toBlob = function () {
|
|
533
|
+
return Promise.resolve(blob);
|
|
534
|
+
};
|
|
535
|
+
var toDataURL = constant(uri);
|
|
536
|
+
var toBase64 = function () {
|
|
537
|
+
return uri.split(',')[1];
|
|
538
|
+
};
|
|
539
|
+
var toAdjustedBlob = function (type, quality) {
|
|
540
|
+
return getCanvas.then(function (canvas) {
|
|
541
|
+
return canvasToBlob(canvas, type, quality);
|
|
542
|
+
});
|
|
543
|
+
};
|
|
544
|
+
var toAdjustedDataURL = function (type, quality) {
|
|
545
|
+
return getCanvas.then(function (canvas) {
|
|
546
|
+
return canvasToDataURL(canvas, type, quality);
|
|
547
|
+
});
|
|
548
|
+
};
|
|
549
|
+
var toAdjustedBase64 = function (type, quality) {
|
|
550
|
+
return toAdjustedDataURL(type, quality).then(function (dataurl) {
|
|
551
|
+
return dataurl.split(',')[1];
|
|
552
|
+
});
|
|
553
|
+
};
|
|
554
|
+
var toCanvas = function () {
|
|
555
|
+
return getCanvas.then(clone);
|
|
556
|
+
};
|
|
557
|
+
return {
|
|
558
|
+
getType: getType,
|
|
559
|
+
toBlob: toBlob,
|
|
560
|
+
toDataURL: toDataURL,
|
|
561
|
+
toBase64: toBase64,
|
|
562
|
+
toAdjustedBlob: toAdjustedBlob,
|
|
563
|
+
toAdjustedDataURL: toAdjustedDataURL,
|
|
564
|
+
toAdjustedBase64: toAdjustedBase64,
|
|
565
|
+
toCanvas: toCanvas
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
var fromBlob = function (blob) {
|
|
569
|
+
return blobToDataUri(blob).then(function (uri) {
|
|
570
|
+
return create$1(blobToCanvas(blob), blob, uri);
|
|
571
|
+
});
|
|
572
|
+
};
|
|
573
|
+
var fromCanvas = function (canvas, type) {
|
|
574
|
+
return canvasToBlob(canvas, type).then(function (blob) {
|
|
575
|
+
return create$1(Promise.resolve(canvas), blob, canvas.toDataURL());
|
|
576
|
+
});
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
var ceilWithPrecision = function (num, precision) {
|
|
580
|
+
if (precision === void 0) {
|
|
581
|
+
precision = 2;
|
|
582
|
+
}
|
|
583
|
+
var mul = Math.pow(10, precision);
|
|
584
|
+
var upper = Math.round(num * mul);
|
|
585
|
+
return Math.ceil(upper / mul);
|
|
586
|
+
};
|
|
587
|
+
var rotate = function (ir, angle) {
|
|
588
|
+
return ir.toCanvas().then(function (canvas) {
|
|
589
|
+
return applyRotate(canvas, ir.getType(), angle);
|
|
590
|
+
});
|
|
591
|
+
};
|
|
592
|
+
var applyRotate = function (image, type, angle) {
|
|
593
|
+
var degrees = angle < 0 ? 360 + angle : angle;
|
|
594
|
+
var rad = degrees * Math.PI / 180;
|
|
595
|
+
var width = image.width;
|
|
596
|
+
var height = image.height;
|
|
597
|
+
var sin = Math.sin(rad);
|
|
598
|
+
var cos = Math.cos(rad);
|
|
599
|
+
var newWidth = ceilWithPrecision(Math.abs(width * cos) + Math.abs(height * sin));
|
|
600
|
+
var newHeight = ceilWithPrecision(Math.abs(width * sin) + Math.abs(height * cos));
|
|
601
|
+
var canvas = create(newWidth, newHeight);
|
|
602
|
+
var context = get2dContext(canvas);
|
|
603
|
+
context.translate(newWidth / 2, newHeight / 2);
|
|
604
|
+
context.rotate(rad);
|
|
605
|
+
context.drawImage(image, -width / 2, -height / 2);
|
|
606
|
+
return fromCanvas(canvas, type);
|
|
607
|
+
};
|
|
608
|
+
var flip = function (ir, axis) {
|
|
609
|
+
return ir.toCanvas().then(function (canvas) {
|
|
610
|
+
return applyFlip(canvas, ir.getType(), axis);
|
|
611
|
+
});
|
|
612
|
+
};
|
|
613
|
+
var applyFlip = function (image, type, axis) {
|
|
614
|
+
var canvas = create(image.width, image.height);
|
|
615
|
+
var context = get2dContext(canvas);
|
|
616
|
+
if (axis === 'v') {
|
|
617
|
+
context.scale(1, -1);
|
|
618
|
+
context.drawImage(image, 0, -canvas.height);
|
|
619
|
+
} else {
|
|
620
|
+
context.scale(-1, 1);
|
|
621
|
+
context.drawImage(image, -canvas.width, 0);
|
|
622
|
+
}
|
|
623
|
+
return fromCanvas(canvas, type);
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
var flip$1 = function (ir, axis) {
|
|
627
|
+
return flip(ir, axis);
|
|
628
|
+
};
|
|
629
|
+
var rotate$1 = function (ir, angle) {
|
|
630
|
+
return rotate(ir, angle);
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
var keys = Object.keys;
|
|
634
|
+
var each$1 = function (obj, f) {
|
|
635
|
+
var props = keys(obj);
|
|
636
|
+
for (var k = 0, len = props.length; k < len; k++) {
|
|
637
|
+
var i = props[k];
|
|
638
|
+
var x = obj[i];
|
|
639
|
+
f(x, i);
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
var sendRequest = function (url, headers, withCredentials) {
|
|
644
|
+
if (withCredentials === void 0) {
|
|
645
|
+
withCredentials = false;
|
|
646
|
+
}
|
|
647
|
+
return new Promise(function (resolve) {
|
|
648
|
+
var xhr = new XMLHttpRequest();
|
|
649
|
+
xhr.onreadystatechange = function () {
|
|
650
|
+
if (xhr.readyState === 4) {
|
|
651
|
+
resolve({
|
|
652
|
+
status: xhr.status,
|
|
653
|
+
blob: xhr.response
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
xhr.open('GET', url, true);
|
|
658
|
+
xhr.withCredentials = withCredentials;
|
|
659
|
+
each$1(headers, function (value, key) {
|
|
660
|
+
xhr.setRequestHeader(key, value);
|
|
661
|
+
});
|
|
662
|
+
xhr.responseType = 'blob';
|
|
663
|
+
xhr.send();
|
|
664
|
+
});
|
|
665
|
+
};
|
|
666
|
+
var readBlobText = function (blob) {
|
|
667
|
+
return new Promise(function (resolve, reject) {
|
|
668
|
+
var reader = new FileReader();
|
|
669
|
+
reader.onload = function () {
|
|
670
|
+
resolve(reader.result);
|
|
671
|
+
};
|
|
672
|
+
reader.onerror = function (e) {
|
|
673
|
+
reject(e);
|
|
674
|
+
};
|
|
675
|
+
reader.readAsText(blob);
|
|
676
|
+
});
|
|
677
|
+
};
|
|
678
|
+
var parseJson = function (text) {
|
|
679
|
+
try {
|
|
680
|
+
return Optional.some(JSON.parse(text));
|
|
681
|
+
} catch (ex) {
|
|
682
|
+
return Optional.none();
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
var friendlyHttpErrors = [
|
|
687
|
+
{
|
|
688
|
+
code: 404,
|
|
689
|
+
message: 'Could not find Image Proxy'
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
code: 403,
|
|
693
|
+
message: 'Rejected request'
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
code: 0,
|
|
697
|
+
message: 'Incorrect Image Proxy URL'
|
|
698
|
+
}
|
|
699
|
+
];
|
|
700
|
+
var friendlyServiceErrors = [
|
|
701
|
+
{
|
|
702
|
+
type: 'not_found',
|
|
703
|
+
message: 'Failed to load image.'
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
type: 'key_missing',
|
|
707
|
+
message: 'The request did not include an api key.'
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
type: 'key_not_found',
|
|
711
|
+
message: 'The provided api key could not be found.'
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
type: 'domain_not_trusted',
|
|
715
|
+
message: 'The api key is not valid for the request origins.'
|
|
716
|
+
}
|
|
717
|
+
];
|
|
718
|
+
var traverseJson = function (json, path) {
|
|
719
|
+
var value = foldl(path, function (result, key) {
|
|
720
|
+
return isNonNullable(result) ? result[key] : undefined;
|
|
721
|
+
}, json);
|
|
722
|
+
return Optional.from(value);
|
|
723
|
+
};
|
|
724
|
+
var isServiceErrorCode = function (code, blob) {
|
|
725
|
+
return (blob === null || blob === void 0 ? void 0 : blob.type) === 'application/json' && (code === 400 || code === 403 || code === 404 || code === 500);
|
|
726
|
+
};
|
|
727
|
+
var getHttpErrorMsg = function (status) {
|
|
728
|
+
var message = find(friendlyHttpErrors, function (error) {
|
|
729
|
+
return status === error.code;
|
|
730
|
+
}).fold(constant('Unknown ImageProxy error'), function (error) {
|
|
731
|
+
return error.message;
|
|
732
|
+
});
|
|
733
|
+
return 'ImageProxy HTTP error: ' + message;
|
|
734
|
+
};
|
|
735
|
+
var handleHttpError = function (status) {
|
|
736
|
+
var message = getHttpErrorMsg(status);
|
|
737
|
+
return Promise.reject(message);
|
|
738
|
+
};
|
|
739
|
+
var getServiceErrorMsg = function (type) {
|
|
740
|
+
return find(friendlyServiceErrors, function (error) {
|
|
741
|
+
return error.type === type;
|
|
742
|
+
}).fold(constant('Unknown service error'), function (error) {
|
|
743
|
+
return error.message;
|
|
744
|
+
});
|
|
745
|
+
};
|
|
746
|
+
var getServiceError = function (text) {
|
|
747
|
+
var serviceError = parseJson(text);
|
|
748
|
+
var errorMsg = serviceError.bind(function (err) {
|
|
749
|
+
return traverseJson(err, [
|
|
750
|
+
'error',
|
|
751
|
+
'type'
|
|
752
|
+
]).map(getServiceErrorMsg);
|
|
753
|
+
}).getOr('Invalid JSON in service error message');
|
|
754
|
+
return 'ImageProxy Service error: ' + errorMsg;
|
|
755
|
+
};
|
|
756
|
+
var handleServiceError = function (blob) {
|
|
757
|
+
return readBlobText(blob).then(function (text) {
|
|
758
|
+
var serviceError = getServiceError(text);
|
|
759
|
+
return Promise.reject(serviceError);
|
|
760
|
+
});
|
|
761
|
+
};
|
|
762
|
+
var handleServiceErrorResponse = function (status, blob) {
|
|
763
|
+
return isServiceErrorCode(status, blob) ? handleServiceError(blob) : handleHttpError(status);
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
var appendApiKey = function (url, apiKey) {
|
|
767
|
+
var separator = url.indexOf('?') === -1 ? '?' : '&';
|
|
768
|
+
if (/[?&]apiKey=/.test(url)) {
|
|
769
|
+
return url;
|
|
770
|
+
} else {
|
|
771
|
+
return url + separator + 'apiKey=' + encodeURIComponent(apiKey);
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
var isError = function (status) {
|
|
775
|
+
return status < 200 || status >= 300;
|
|
776
|
+
};
|
|
777
|
+
var requestServiceBlob = function (url, apiKey) {
|
|
778
|
+
var headers = {
|
|
779
|
+
'Content-Type': 'application/json;charset=UTF-8',
|
|
780
|
+
'tiny-api-key': apiKey
|
|
781
|
+
};
|
|
782
|
+
return sendRequest(appendApiKey(url, apiKey), headers).then(function (result) {
|
|
783
|
+
return isError(result.status) ? handleServiceErrorResponse(result.status, result.blob) : Promise.resolve(result.blob);
|
|
784
|
+
});
|
|
785
|
+
};
|
|
786
|
+
var requestBlob = function (url, withCredentials) {
|
|
787
|
+
return sendRequest(url, {}, withCredentials).then(function (result) {
|
|
788
|
+
return isError(result.status) ? handleHttpError(result.status) : Promise.resolve(result.blob);
|
|
789
|
+
});
|
|
790
|
+
};
|
|
791
|
+
var getUrl = function (url, apiKey, withCredentials) {
|
|
792
|
+
if (withCredentials === void 0) {
|
|
793
|
+
withCredentials = false;
|
|
794
|
+
}
|
|
795
|
+
return apiKey ? requestServiceBlob(url, apiKey) : requestBlob(url, withCredentials);
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
var blobToImageResult = function (blob) {
|
|
799
|
+
return fromBlob(blob);
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
var ELEMENT = 1;
|
|
803
|
+
|
|
804
|
+
var fromHtml = function (html, scope) {
|
|
805
|
+
var doc = scope || document;
|
|
806
|
+
var div = doc.createElement('div');
|
|
807
|
+
div.innerHTML = html;
|
|
808
|
+
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
|
809
|
+
console.error('HTML does not have a single root node', html);
|
|
810
|
+
throw new Error('HTML must have a single root node');
|
|
811
|
+
}
|
|
812
|
+
return fromDom(div.childNodes[0]);
|
|
813
|
+
};
|
|
814
|
+
var fromTag = function (tag, scope) {
|
|
815
|
+
var doc = scope || document;
|
|
816
|
+
var node = doc.createElement(tag);
|
|
817
|
+
return fromDom(node);
|
|
818
|
+
};
|
|
819
|
+
var fromText = function (text, scope) {
|
|
820
|
+
var doc = scope || document;
|
|
821
|
+
var node = doc.createTextNode(text);
|
|
822
|
+
return fromDom(node);
|
|
823
|
+
};
|
|
824
|
+
var fromDom = function (node) {
|
|
825
|
+
if (node === null || node === undefined) {
|
|
826
|
+
throw new Error('Node cannot be null or undefined');
|
|
827
|
+
}
|
|
828
|
+
return { dom: node };
|
|
829
|
+
};
|
|
830
|
+
var fromPoint = function (docElm, x, y) {
|
|
831
|
+
return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
|
|
832
|
+
};
|
|
833
|
+
var SugarElement = {
|
|
834
|
+
fromHtml: fromHtml,
|
|
835
|
+
fromTag: fromTag,
|
|
836
|
+
fromText: fromText,
|
|
837
|
+
fromDom: fromDom,
|
|
838
|
+
fromPoint: fromPoint
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
var is = function (element, selector) {
|
|
842
|
+
var dom = element.dom;
|
|
843
|
+
if (dom.nodeType !== ELEMENT) {
|
|
844
|
+
return false;
|
|
845
|
+
} else {
|
|
846
|
+
var elem = dom;
|
|
847
|
+
if (elem.matches !== undefined) {
|
|
848
|
+
return elem.matches(selector);
|
|
849
|
+
} else if (elem.msMatchesSelector !== undefined) {
|
|
850
|
+
return elem.msMatchesSelector(selector);
|
|
851
|
+
} else if (elem.webkitMatchesSelector !== undefined) {
|
|
852
|
+
return elem.webkitMatchesSelector(selector);
|
|
853
|
+
} else if (elem.mozMatchesSelector !== undefined) {
|
|
854
|
+
return elem.mozMatchesSelector(selector);
|
|
855
|
+
} else {
|
|
856
|
+
throw new Error('Browser lacks native selectors');
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
var Global = typeof window !== 'undefined' ? window : Function('return this;')();
|
|
862
|
+
|
|
863
|
+
var child = function (scope, predicate) {
|
|
864
|
+
var pred = function (node) {
|
|
865
|
+
return predicate(SugarElement.fromDom(node));
|
|
866
|
+
};
|
|
867
|
+
var result = find(scope.dom.childNodes, pred);
|
|
868
|
+
return result.map(SugarElement.fromDom);
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
var child$1 = function (scope, selector) {
|
|
872
|
+
return child(scope, function (e) {
|
|
873
|
+
return is(e, selector);
|
|
874
|
+
});
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
|
878
|
+
|
|
879
|
+
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Promise');
|
|
880
|
+
|
|
881
|
+
var global$4 = tinymce.util.Tools.resolve('tinymce.util.URI');
|
|
882
|
+
|
|
883
|
+
var getToolbarItems = function (editor) {
|
|
884
|
+
return editor.getParam('imagetools_toolbar', 'rotateleft rotateright flipv fliph editimage imageoptions');
|
|
885
|
+
};
|
|
886
|
+
var getProxyUrl = function (editor) {
|
|
887
|
+
return editor.getParam('imagetools_proxy');
|
|
888
|
+
};
|
|
889
|
+
var getCorsHosts = function (editor) {
|
|
890
|
+
return editor.getParam('imagetools_cors_hosts', [], 'string[]');
|
|
891
|
+
};
|
|
892
|
+
var getCredentialsHosts = function (editor) {
|
|
893
|
+
return editor.getParam('imagetools_credentials_hosts', [], 'string[]');
|
|
894
|
+
};
|
|
895
|
+
var getFetchImage = function (editor) {
|
|
896
|
+
return Optional.from(editor.getParam('imagetools_fetch_image', null, 'function'));
|
|
897
|
+
};
|
|
898
|
+
var getApiKey = function (editor) {
|
|
899
|
+
return editor.getParam('api_key', editor.getParam('imagetools_api_key', '', 'string'), 'string');
|
|
900
|
+
};
|
|
901
|
+
var getUploadTimeout = function (editor) {
|
|
902
|
+
return editor.getParam('images_upload_timeout', 30000, 'number');
|
|
903
|
+
};
|
|
904
|
+
var shouldReuseFilename = function (editor) {
|
|
905
|
+
return editor.getParam('images_reuse_filename', false, 'boolean');
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
var getImageSize = function (img) {
|
|
909
|
+
var width, height;
|
|
910
|
+
var isPxValue = function (value) {
|
|
911
|
+
return /^[0-9\.]+px$/.test(value);
|
|
912
|
+
};
|
|
913
|
+
width = img.style.width;
|
|
914
|
+
height = img.style.height;
|
|
915
|
+
if (width || height) {
|
|
916
|
+
if (isPxValue(width) && isPxValue(height)) {
|
|
917
|
+
return {
|
|
918
|
+
w: parseInt(width, 10),
|
|
919
|
+
h: parseInt(height, 10)
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
return null;
|
|
923
|
+
}
|
|
924
|
+
width = img.width;
|
|
925
|
+
height = img.height;
|
|
926
|
+
if (width && height) {
|
|
927
|
+
return {
|
|
928
|
+
w: parseInt(width, 10),
|
|
929
|
+
h: parseInt(height, 10)
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
return null;
|
|
933
|
+
};
|
|
934
|
+
var setImageSize = function (img, size) {
|
|
935
|
+
var width, height;
|
|
936
|
+
if (size) {
|
|
937
|
+
width = img.style.width;
|
|
938
|
+
height = img.style.height;
|
|
939
|
+
if (width || height) {
|
|
940
|
+
img.style.width = size.w + 'px';
|
|
941
|
+
img.style.height = size.h + 'px';
|
|
942
|
+
img.removeAttribute('data-mce-style');
|
|
943
|
+
}
|
|
944
|
+
width = img.width;
|
|
945
|
+
height = img.height;
|
|
946
|
+
if (width || height) {
|
|
947
|
+
img.setAttribute('width', String(size.w));
|
|
948
|
+
img.setAttribute('height', String(size.h));
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
var getNaturalImageSize = function (img) {
|
|
953
|
+
return {
|
|
954
|
+
w: img.naturalWidth,
|
|
955
|
+
h: img.naturalHeight
|
|
956
|
+
};
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
var count = 0;
|
|
960
|
+
var getFigureImg = function (elem) {
|
|
961
|
+
return child$1(SugarElement.fromDom(elem), 'img');
|
|
962
|
+
};
|
|
963
|
+
var isFigure = function (editor, elem) {
|
|
964
|
+
return editor.dom.is(elem, 'figure');
|
|
965
|
+
};
|
|
966
|
+
var isImage = function (editor, imgNode) {
|
|
967
|
+
return editor.dom.is(imgNode, 'img:not([data-mce-object],[data-mce-placeholder])');
|
|
968
|
+
};
|
|
969
|
+
var getEditableImage = function (editor, node) {
|
|
970
|
+
var isEditable = function (imgNode) {
|
|
971
|
+
return isImage(editor, imgNode) && (isLocalImage(editor, imgNode) || isCorsImage(editor, imgNode) || isNonNullable(getProxyUrl(editor)));
|
|
972
|
+
};
|
|
973
|
+
if (isFigure(editor, node)) {
|
|
974
|
+
return getFigureImg(node).bind(function (img) {
|
|
975
|
+
return isEditable(img.dom) ? Optional.some(img.dom) : Optional.none();
|
|
976
|
+
});
|
|
977
|
+
} else {
|
|
978
|
+
return isEditable(node) ? Optional.some(node) : Optional.none();
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
var displayError = function (editor, error) {
|
|
982
|
+
editor.notificationManager.open({
|
|
983
|
+
text: error,
|
|
984
|
+
type: 'error'
|
|
985
|
+
});
|
|
986
|
+
};
|
|
987
|
+
var getSelectedImage = function (editor) {
|
|
988
|
+
var elem = editor.selection.getNode();
|
|
989
|
+
var figureElm = editor.dom.getParent(elem, 'figure.image');
|
|
990
|
+
if (figureElm !== null && isFigure(editor, figureElm)) {
|
|
991
|
+
return getFigureImg(figureElm);
|
|
992
|
+
} else if (isImage(editor, elem)) {
|
|
993
|
+
return Optional.some(SugarElement.fromDom(elem));
|
|
994
|
+
} else {
|
|
995
|
+
return Optional.none();
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
var extractFilename = function (editor, url, group) {
|
|
999
|
+
var m = url.match(/(?:\/|^)(([^\/\?]+)\.(?:[a-z0-9.]+))(?:\?|$)/i);
|
|
1000
|
+
return isNonNullable(m) ? editor.dom.encode(m[group]) : null;
|
|
1001
|
+
};
|
|
1002
|
+
var createId = function () {
|
|
1003
|
+
return 'imagetools' + count++;
|
|
1004
|
+
};
|
|
1005
|
+
var isLocalImage = function (editor, img) {
|
|
1006
|
+
var url = img.src;
|
|
1007
|
+
return url.indexOf('data:') === 0 || url.indexOf('blob:') === 0 || new global$4(url).host === editor.documentBaseURI.host;
|
|
1008
|
+
};
|
|
1009
|
+
var isCorsImage = function (editor, img) {
|
|
1010
|
+
return global$1.inArray(getCorsHosts(editor), new global$4(img.src).host) !== -1;
|
|
1011
|
+
};
|
|
1012
|
+
var isCorsWithCredentialsImage = function (editor, img) {
|
|
1013
|
+
return global$1.inArray(getCredentialsHosts(editor), new global$4(img.src).host) !== -1;
|
|
1014
|
+
};
|
|
1015
|
+
var defaultFetchImage = function (editor, img) {
|
|
1016
|
+
if (isCorsImage(editor, img)) {
|
|
1017
|
+
return getUrl(img.src, null, isCorsWithCredentialsImage(editor, img));
|
|
1018
|
+
}
|
|
1019
|
+
if (!isLocalImage(editor, img)) {
|
|
1020
|
+
var proxyUrl = getProxyUrl(editor);
|
|
1021
|
+
var src = proxyUrl + (proxyUrl.indexOf('?') === -1 ? '?' : '&') + 'url=' + encodeURIComponent(img.src);
|
|
1022
|
+
var apiKey = getApiKey(editor);
|
|
1023
|
+
return getUrl(src, apiKey, false);
|
|
1024
|
+
}
|
|
1025
|
+
return imageToBlob$1(img);
|
|
1026
|
+
};
|
|
1027
|
+
var imageToBlob$2 = function (editor, img) {
|
|
1028
|
+
return getFetchImage(editor).fold(function () {
|
|
1029
|
+
return defaultFetchImage(editor, img);
|
|
1030
|
+
}, function (customFetchImage) {
|
|
1031
|
+
return customFetchImage(img);
|
|
1032
|
+
});
|
|
1033
|
+
};
|
|
1034
|
+
var findBlob = function (editor, img) {
|
|
1035
|
+
var blobInfo = editor.editorUpload.blobCache.getByUri(img.src);
|
|
1036
|
+
if (blobInfo) {
|
|
1037
|
+
return global$3.resolve(blobInfo.blob());
|
|
1038
|
+
}
|
|
1039
|
+
return imageToBlob$2(editor, img);
|
|
1040
|
+
};
|
|
1041
|
+
var startTimedUpload = function (editor, imageUploadTimerState) {
|
|
1042
|
+
var imageUploadTimer = global$2.setEditorTimeout(editor, function () {
|
|
1043
|
+
editor.editorUpload.uploadImagesAuto();
|
|
1044
|
+
}, getUploadTimeout(editor));
|
|
1045
|
+
imageUploadTimerState.set(imageUploadTimer);
|
|
1046
|
+
};
|
|
1047
|
+
var cancelTimedUpload = function (imageUploadTimerState) {
|
|
1048
|
+
global$2.clearTimeout(imageUploadTimerState.get());
|
|
1049
|
+
};
|
|
1050
|
+
var updateSelectedImage = function (editor, origBlob, ir, uploadImmediately, imageUploadTimerState, selectedImage, size) {
|
|
1051
|
+
return ir.toBlob().then(function (blob) {
|
|
1052
|
+
var uri, name, filename, blobInfo;
|
|
1053
|
+
var blobCache = editor.editorUpload.blobCache;
|
|
1054
|
+
uri = selectedImage.src;
|
|
1055
|
+
var useFilename = origBlob.type === blob.type;
|
|
1056
|
+
if (shouldReuseFilename(editor)) {
|
|
1057
|
+
blobInfo = blobCache.getByUri(uri);
|
|
1058
|
+
if (isNonNullable(blobInfo)) {
|
|
1059
|
+
uri = blobInfo.uri();
|
|
1060
|
+
name = blobInfo.name();
|
|
1061
|
+
filename = blobInfo.filename();
|
|
1062
|
+
} else {
|
|
1063
|
+
name = extractFilename(editor, uri, 2);
|
|
1064
|
+
filename = extractFilename(editor, uri, 1);
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
blobInfo = blobCache.create({
|
|
1068
|
+
id: createId(),
|
|
1069
|
+
blob: blob,
|
|
1070
|
+
base64: ir.toBase64(),
|
|
1071
|
+
uri: uri,
|
|
1072
|
+
name: name,
|
|
1073
|
+
filename: useFilename ? filename : undefined
|
|
1074
|
+
});
|
|
1075
|
+
blobCache.add(blobInfo);
|
|
1076
|
+
editor.undoManager.transact(function () {
|
|
1077
|
+
var imageLoadedHandler = function () {
|
|
1078
|
+
editor.$(selectedImage).off('load', imageLoadedHandler);
|
|
1079
|
+
editor.nodeChanged();
|
|
1080
|
+
if (uploadImmediately) {
|
|
1081
|
+
editor.editorUpload.uploadImagesAuto();
|
|
1082
|
+
} else {
|
|
1083
|
+
cancelTimedUpload(imageUploadTimerState);
|
|
1084
|
+
startTimedUpload(editor, imageUploadTimerState);
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
editor.$(selectedImage).on('load', imageLoadedHandler);
|
|
1088
|
+
if (size) {
|
|
1089
|
+
editor.$(selectedImage).attr({
|
|
1090
|
+
width: size.w,
|
|
1091
|
+
height: size.h
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
editor.$(selectedImage).attr({ src: blobInfo.blobUri() }).removeAttr('data-mce-src');
|
|
1095
|
+
});
|
|
1096
|
+
return blobInfo;
|
|
1097
|
+
});
|
|
1098
|
+
};
|
|
1099
|
+
var selectedImageOperation = function (editor, imageUploadTimerState, fn, size) {
|
|
1100
|
+
return function () {
|
|
1101
|
+
var imgOpt = getSelectedImage(editor);
|
|
1102
|
+
return imgOpt.fold(function () {
|
|
1103
|
+
displayError(editor, 'Could not find selected image');
|
|
1104
|
+
}, function (img) {
|
|
1105
|
+
return editor._scanForImages().then(function () {
|
|
1106
|
+
return findBlob(editor, img.dom);
|
|
1107
|
+
}).then(function (blob) {
|
|
1108
|
+
return blobToImageResult(blob).then(fn).then(function (imageResult) {
|
|
1109
|
+
return updateSelectedImage(editor, blob, imageResult, false, imageUploadTimerState, img.dom, size);
|
|
1110
|
+
});
|
|
1111
|
+
}).catch(function (error) {
|
|
1112
|
+
displayError(editor, error);
|
|
1113
|
+
});
|
|
1114
|
+
});
|
|
1115
|
+
};
|
|
1116
|
+
};
|
|
1117
|
+
var rotate$2 = function (editor, imageUploadTimerState, angle) {
|
|
1118
|
+
return function () {
|
|
1119
|
+
var imgOpt = getSelectedImage(editor);
|
|
1120
|
+
var flippedSize = imgOpt.fold(function () {
|
|
1121
|
+
return null;
|
|
1122
|
+
}, function (img) {
|
|
1123
|
+
var size = getImageSize(img.dom);
|
|
1124
|
+
return size ? {
|
|
1125
|
+
w: size.h,
|
|
1126
|
+
h: size.w
|
|
1127
|
+
} : null;
|
|
1128
|
+
});
|
|
1129
|
+
return selectedImageOperation(editor, imageUploadTimerState, function (imageResult) {
|
|
1130
|
+
return rotate$1(imageResult, angle);
|
|
1131
|
+
}, flippedSize)();
|
|
1132
|
+
};
|
|
1133
|
+
};
|
|
1134
|
+
var flip$2 = function (editor, imageUploadTimerState, axis) {
|
|
1135
|
+
return function () {
|
|
1136
|
+
return selectedImageOperation(editor, imageUploadTimerState, function (imageResult) {
|
|
1137
|
+
return flip$1(imageResult, axis);
|
|
1138
|
+
})();
|
|
1139
|
+
};
|
|
1140
|
+
};
|
|
1141
|
+
var handleDialogBlob = function (editor, imageUploadTimerState, img, originalSize, blob) {
|
|
1142
|
+
return blobToImage$1(blob).then(function (newImage) {
|
|
1143
|
+
var newSize = getNaturalImageSize(newImage);
|
|
1144
|
+
if (originalSize.w !== newSize.w || originalSize.h !== newSize.h) {
|
|
1145
|
+
if (getImageSize(img)) {
|
|
1146
|
+
setImageSize(img, newSize);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
URL.revokeObjectURL(newImage.src);
|
|
1150
|
+
return blob;
|
|
1151
|
+
}).then(blobToImageResult).then(function (imageResult) {
|
|
1152
|
+
return updateSelectedImage(editor, blob, imageResult, true, imageUploadTimerState, img);
|
|
1153
|
+
});
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
var saveState = 'save-state';
|
|
1157
|
+
var disable = 'disable';
|
|
1158
|
+
var enable = 'enable';
|
|
1159
|
+
|
|
1160
|
+
var createState = function (blob) {
|
|
1161
|
+
return {
|
|
1162
|
+
blob: blob,
|
|
1163
|
+
url: URL.createObjectURL(blob)
|
|
1164
|
+
};
|
|
1165
|
+
};
|
|
1166
|
+
var makeOpen = function (editor, imageUploadTimerState) {
|
|
1167
|
+
return function () {
|
|
1168
|
+
var getLoadedSpec = function (currentState) {
|
|
1169
|
+
return {
|
|
1170
|
+
title: 'Edit Image',
|
|
1171
|
+
size: 'large',
|
|
1172
|
+
body: {
|
|
1173
|
+
type: 'panel',
|
|
1174
|
+
items: [{
|
|
1175
|
+
type: 'imagetools',
|
|
1176
|
+
name: 'imagetools',
|
|
1177
|
+
label: 'Edit Image',
|
|
1178
|
+
currentState: currentState
|
|
1179
|
+
}]
|
|
1180
|
+
},
|
|
1181
|
+
buttons: [
|
|
1182
|
+
{
|
|
1183
|
+
type: 'cancel',
|
|
1184
|
+
name: 'cancel',
|
|
1185
|
+
text: 'Cancel'
|
|
1186
|
+
},
|
|
1187
|
+
{
|
|
1188
|
+
type: 'submit',
|
|
1189
|
+
name: 'save',
|
|
1190
|
+
text: 'Save',
|
|
1191
|
+
primary: true,
|
|
1192
|
+
disabled: true
|
|
1193
|
+
}
|
|
1194
|
+
],
|
|
1195
|
+
onSubmit: function (api) {
|
|
1196
|
+
var blob = api.getData().imagetools.blob;
|
|
1197
|
+
originalImgOpt.each(function (originalImg) {
|
|
1198
|
+
originalSizeOpt.each(function (originalSize) {
|
|
1199
|
+
handleDialogBlob(editor, imageUploadTimerState, originalImg.dom, originalSize, blob);
|
|
1200
|
+
});
|
|
1201
|
+
});
|
|
1202
|
+
api.close();
|
|
1203
|
+
},
|
|
1204
|
+
onCancel: noop,
|
|
1205
|
+
onAction: function (api, details) {
|
|
1206
|
+
switch (details.name) {
|
|
1207
|
+
case saveState:
|
|
1208
|
+
if (details.value) {
|
|
1209
|
+
api.enable('save');
|
|
1210
|
+
} else {
|
|
1211
|
+
api.disable('save');
|
|
1212
|
+
}
|
|
1213
|
+
break;
|
|
1214
|
+
case disable:
|
|
1215
|
+
api.disable('save');
|
|
1216
|
+
api.disable('cancel');
|
|
1217
|
+
break;
|
|
1218
|
+
case enable:
|
|
1219
|
+
api.enable('cancel');
|
|
1220
|
+
break;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
};
|
|
1225
|
+
var originalImgOpt = getSelectedImage(editor);
|
|
1226
|
+
var originalSizeOpt = originalImgOpt.map(function (origImg) {
|
|
1227
|
+
return getNaturalImageSize(origImg.dom);
|
|
1228
|
+
});
|
|
1229
|
+
originalImgOpt.each(function (img) {
|
|
1230
|
+
getEditableImage(editor, img.dom).each(function (_) {
|
|
1231
|
+
findBlob(editor, img.dom).then(function (blob) {
|
|
1232
|
+
var state = createState(blob);
|
|
1233
|
+
editor.windowManager.open(getLoadedSpec(state));
|
|
1234
|
+
});
|
|
1235
|
+
});
|
|
1236
|
+
});
|
|
1237
|
+
};
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
var register = function (editor, imageUploadTimerState) {
|
|
1241
|
+
global$1.each({
|
|
1242
|
+
mceImageRotateLeft: rotate$2(editor, imageUploadTimerState, -90),
|
|
1243
|
+
mceImageRotateRight: rotate$2(editor, imageUploadTimerState, 90),
|
|
1244
|
+
mceImageFlipVertical: flip$2(editor, imageUploadTimerState, 'v'),
|
|
1245
|
+
mceImageFlipHorizontal: flip$2(editor, imageUploadTimerState, 'h'),
|
|
1246
|
+
mceEditImage: makeOpen(editor, imageUploadTimerState)
|
|
1247
|
+
}, function (fn, cmd) {
|
|
1248
|
+
editor.addCommand(cmd, fn);
|
|
1249
|
+
});
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
var setup = function (editor, imageUploadTimerState, lastSelectedImageState) {
|
|
1253
|
+
editor.on('NodeChange', function (e) {
|
|
1254
|
+
var lastSelectedImage = lastSelectedImageState.get();
|
|
1255
|
+
var selectedImage = getEditableImage(editor, e.element);
|
|
1256
|
+
if (lastSelectedImage && !selectedImage.exists(function (img) {
|
|
1257
|
+
return lastSelectedImage.src === img.src;
|
|
1258
|
+
})) {
|
|
1259
|
+
cancelTimedUpload(imageUploadTimerState);
|
|
1260
|
+
editor.editorUpload.uploadImagesAuto();
|
|
1261
|
+
lastSelectedImageState.set(null);
|
|
1262
|
+
}
|
|
1263
|
+
selectedImage.each(lastSelectedImageState.set);
|
|
1264
|
+
});
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
var register$1 = function (editor) {
|
|
1268
|
+
var cmd = function (command) {
|
|
1269
|
+
return function () {
|
|
1270
|
+
return editor.execCommand(command);
|
|
1271
|
+
};
|
|
1272
|
+
};
|
|
1273
|
+
editor.ui.registry.addButton('rotateleft', {
|
|
1274
|
+
tooltip: 'Rotate counterclockwise',
|
|
1275
|
+
icon: 'rotate-left',
|
|
1276
|
+
onAction: cmd('mceImageRotateLeft')
|
|
1277
|
+
});
|
|
1278
|
+
editor.ui.registry.addButton('rotateright', {
|
|
1279
|
+
tooltip: 'Rotate clockwise',
|
|
1280
|
+
icon: 'rotate-right',
|
|
1281
|
+
onAction: cmd('mceImageRotateRight')
|
|
1282
|
+
});
|
|
1283
|
+
editor.ui.registry.addButton('flipv', {
|
|
1284
|
+
tooltip: 'Flip vertically',
|
|
1285
|
+
icon: 'flip-vertically',
|
|
1286
|
+
onAction: cmd('mceImageFlipVertical')
|
|
1287
|
+
});
|
|
1288
|
+
editor.ui.registry.addButton('fliph', {
|
|
1289
|
+
tooltip: 'Flip horizontally',
|
|
1290
|
+
icon: 'flip-horizontally',
|
|
1291
|
+
onAction: cmd('mceImageFlipHorizontal')
|
|
1292
|
+
});
|
|
1293
|
+
editor.ui.registry.addButton('editimage', {
|
|
1294
|
+
tooltip: 'Edit image',
|
|
1295
|
+
icon: 'edit-image',
|
|
1296
|
+
onAction: cmd('mceEditImage'),
|
|
1297
|
+
onSetup: function (buttonApi) {
|
|
1298
|
+
var setDisabled = function () {
|
|
1299
|
+
var disabled = getSelectedImage(editor).forall(function (element) {
|
|
1300
|
+
return getEditableImage(editor, element.dom).isNone();
|
|
1301
|
+
});
|
|
1302
|
+
buttonApi.setDisabled(disabled);
|
|
1303
|
+
};
|
|
1304
|
+
editor.on('NodeChange', setDisabled);
|
|
1305
|
+
return function () {
|
|
1306
|
+
editor.off('NodeChange', setDisabled);
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1309
|
+
});
|
|
1310
|
+
editor.ui.registry.addButton('imageoptions', {
|
|
1311
|
+
tooltip: 'Image options',
|
|
1312
|
+
icon: 'image',
|
|
1313
|
+
onAction: cmd('mceImage')
|
|
1314
|
+
});
|
|
1315
|
+
editor.ui.registry.addContextMenu('imagetools', {
|
|
1316
|
+
update: function (element) {
|
|
1317
|
+
return getEditableImage(editor, element).fold(function () {
|
|
1318
|
+
return [];
|
|
1319
|
+
}, function (_) {
|
|
1320
|
+
return [{
|
|
1321
|
+
text: 'Edit image',
|
|
1322
|
+
icon: 'edit-image',
|
|
1323
|
+
onAction: cmd('mceEditImage')
|
|
1324
|
+
}];
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
var register$2 = function (editor) {
|
|
1331
|
+
editor.ui.registry.addContextToolbar('imagetools', {
|
|
1332
|
+
items: getToolbarItems(editor),
|
|
1333
|
+
predicate: function (elem) {
|
|
1334
|
+
return getEditableImage(editor, elem).isSome();
|
|
1335
|
+
},
|
|
1336
|
+
position: 'node',
|
|
1337
|
+
scope: 'node'
|
|
1338
|
+
});
|
|
1339
|
+
};
|
|
1340
|
+
|
|
1341
|
+
function Plugin () {
|
|
1342
|
+
global.add('imagetools', function (editor) {
|
|
1343
|
+
var imageUploadTimerState = Cell(0);
|
|
1344
|
+
var lastSelectedImageState = Cell(null);
|
|
1345
|
+
register(editor, imageUploadTimerState);
|
|
1346
|
+
register$1(editor);
|
|
1347
|
+
register$2(editor);
|
|
1348
|
+
setup(editor, imageUploadTimerState, lastSelectedImageState);
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
Plugin();
|
|
1353
|
+
|
|
1354
|
+
}());
|