create-nextjs-cms 0.5.56 → 0.5.60
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 +4 -4
- package/templates/default/CHANGELOG.md +140 -140
- package/templates/default/_gitignore +1 -0
- package/templates/default/app/(rootLayout)/admins/page.tsx +7 -2
- package/templates/default/app/(rootLayout)/advanced/page.tsx +8 -2
- package/templates/default/app/(rootLayout)/browse/[section]/[page]/page.tsx +17 -3
- package/templates/default/app/(rootLayout)/categorized/[section]/page.tsx +9 -1
- package/templates/default/app/(rootLayout)/dashboard-new/page.tsx +7 -0
- package/templates/default/app/(rootLayout)/edit/[section]/[itemId]/page.tsx +11 -1
- package/templates/default/app/(rootLayout)/layout.tsx +8 -1
- package/templates/default/app/(rootLayout)/new/[section]/page.tsx +9 -1
- package/templates/default/app/(rootLayout)/section/[section]/page.tsx +10 -1
- package/templates/default/app/(rootLayout)/settings/page.tsx +7 -1
- package/templates/default/app/api/trpc/[trpc]/route.ts +1 -1
- package/templates/default/app/api/video/route.ts +1 -1
- package/templates/default/app/layout.tsx +1 -1
- package/templates/default/app/providers.tsx +4 -4
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/LICENSE +191 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/README.md +118 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/install/build.js +38 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/install/check.js +14 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/channel.js +177 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/colour.js +195 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/composite.js +212 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/constructor.js +499 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/index.d.ts +1971 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/index.js +16 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/input.js +809 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/is.js +143 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/libvips.js +207 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/operation.js +1016 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/output.js +1666 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/resize.js +595 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/sharp.js +121 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/utility.js +291 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/package.json +202 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/binding.gyp +298 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/common.cc +1130 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/common.h +402 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/metadata.cc +346 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/metadata.h +90 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/operations.cc +499 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/operations.h +137 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/pipeline.cc +1814 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/pipeline.h +408 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/sharp.cc +43 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/stats.cc +186 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/stats.h +62 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/utilities.cc +288 -0
- package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/utilities.h +22 -0
- package/templates/default/components/BrowsePage.tsx +4 -4
- package/templates/default/components/DashboardNewPage.tsx +252 -0
- package/templates/default/components/LogPage.tsx +2 -3
- package/templates/default/components/SettingsPage.tsx +1 -1
- package/templates/default/components/form/Form.tsx +5 -5
- package/templates/default/components/form/helpers/_section-hot-reload.js +1 -1
- package/templates/default/components/form/helpers/util.ts +5 -5
- package/templates/default/dynamic-schemas/schema.ts +381 -381
- package/templates/default/next-env.d.ts +1 -1
- package/templates/default/next.config.ts +24 -0
- package/templates/default/package.json +23 -17
- package/templates/default/{middleware.ts → proxy.ts} +3 -4
- package/templates/default/tsconfig.json +6 -3
- package/templates/default/app/api/placeholder/route.ts +0 -7
- package/templates/default/public/tinymce/CHANGELOG.md +0 -3940
- package/templates/default/public/tinymce/README.md +0 -77
- package/templates/default/public/tinymce/bower.json +0 -27
- package/templates/default/public/tinymce/composer.json +0 -52
- package/templates/default/public/tinymce/icons/default/icons.js +0 -239
- package/templates/default/public/tinymce/icons/default/icons.min.js +0 -1
- package/templates/default/public/tinymce/icons/default/index.js +0 -7
- package/templates/default/public/tinymce/license.md +0 -9
- package/templates/default/public/tinymce/models/dom/index.js +0 -7
- package/templates/default/public/tinymce/models/dom/model.js +0 -8980
- package/templates/default/public/tinymce/models/dom/model.min.js +0 -1
- package/templates/default/public/tinymce/notices.txt +0 -21
- package/templates/default/public/tinymce/package.json +0 -32
- package/templates/default/public/tinymce/plugins/accordion/index.js +0 -7
- package/templates/default/public/tinymce/plugins/accordion/plugin.js +0 -1373
- package/templates/default/public/tinymce/plugins/accordion/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/advlist/index.js +0 -7
- package/templates/default/public/tinymce/plugins/advlist/plugin.js +0 -473
- package/templates/default/public/tinymce/plugins/advlist/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/anchor/index.js +0 -7
- package/templates/default/public/tinymce/plugins/anchor/plugin.js +0 -237
- package/templates/default/public/tinymce/plugins/anchor/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/autolink/index.js +0 -7
- package/templates/default/public/tinymce/plugins/autolink/plugin.js +0 -315
- package/templates/default/public/tinymce/plugins/autolink/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/autoresize/index.js +0 -7
- package/templates/default/public/tinymce/plugins/autoresize/plugin.js +0 -221
- package/templates/default/public/tinymce/plugins/autoresize/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/autosave/index.js +0 -7
- package/templates/default/public/tinymce/plugins/autosave/plugin.js +0 -249
- package/templates/default/public/tinymce/plugins/autosave/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/charmap/index.js +0 -7
- package/templates/default/public/tinymce/plugins/charmap/plugin.js +0 -997
- package/templates/default/public/tinymce/plugins/charmap/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/code/index.js +0 -7
- package/templates/default/public/tinymce/plugins/code/plugin.js +0 -98
- package/templates/default/public/tinymce/plugins/code/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/codesample/index.js +0 -7
- package/templates/default/public/tinymce/plugins/codesample/plugin.js +0 -3655
- package/templates/default/public/tinymce/plugins/codesample/plugin.min.js +0 -9
- package/templates/default/public/tinymce/plugins/directionality/index.js +0 -7
- package/templates/default/public/tinymce/plugins/directionality/plugin.js +0 -634
- package/templates/default/public/tinymce/plugins/directionality/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/emoticons/index.js +0 -7
- package/templates/default/public/tinymce/plugins/emoticons/js/emojiimages.js +0 -1
- package/templates/default/public/tinymce/plugins/emoticons/js/emojiimages.min.js +0 -1
- package/templates/default/public/tinymce/plugins/emoticons/js/emojis.js +0 -1
- package/templates/default/public/tinymce/plugins/emoticons/js/emojis.min.js +0 -1
- package/templates/default/public/tinymce/plugins/emoticons/plugin.js +0 -809
- package/templates/default/public/tinymce/plugins/emoticons/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/fullscreen/index.js +0 -7
- package/templates/default/public/tinymce/plugins/fullscreen/plugin.js +0 -1607
- package/templates/default/public/tinymce/plugins/fullscreen/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/help/index.js +0 -7
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ar.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/bg-BG.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ca.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/cs.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/da.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/de.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/el.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/en.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/es.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/eu.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fa.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fi.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fr-FR.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/he-IL.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/he_IL.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hi.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hr.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hu-HU.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/id.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/it.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ja.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/kk.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ko-KR.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ms.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nb-NO.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nl.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pl.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt-BR.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt-PT.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ro.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ru.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sk.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sl-SI.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sv-SE.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/th-TH.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/th_TH.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/tr.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/uk.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/vi.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh-CN.js +0 -87
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh-TW.js +0 -93
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +0 -87
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +0 -93
- package/templates/default/public/tinymce/plugins/help/plugin.js +0 -826
- package/templates/default/public/tinymce/plugins/help/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/image/index.js +0 -7
- package/templates/default/public/tinymce/plugins/image/plugin.js +0 -1691
- package/templates/default/public/tinymce/plugins/image/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/importcss/index.js +0 -7
- package/templates/default/public/tinymce/plugins/importcss/plugin.js +0 -401
- package/templates/default/public/tinymce/plugins/importcss/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/insertdatetime/index.js +0 -7
- package/templates/default/public/tinymce/plugins/insertdatetime/plugin.js +0 -187
- package/templates/default/public/tinymce/plugins/insertdatetime/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/link/index.js +0 -7
- package/templates/default/public/tinymce/plugins/link/plugin.js +0 -1709
- package/templates/default/public/tinymce/plugins/link/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/lists/index.js +0 -7
- package/templates/default/public/tinymce/plugins/lists/plugin.js +0 -602
- package/templates/default/public/tinymce/plugins/lists/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/media/index.js +0 -7
- package/templates/default/public/tinymce/plugins/media/plugin.js +0 -1442
- package/templates/default/public/tinymce/plugins/media/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/nonbreaking/index.js +0 -7
- package/templates/default/public/tinymce/plugins/nonbreaking/plugin.js +0 -128
- package/templates/default/public/tinymce/plugins/nonbreaking/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/pagebreak/index.js +0 -7
- package/templates/default/public/tinymce/plugins/pagebreak/plugin.js +0 -123
- package/templates/default/public/tinymce/plugins/pagebreak/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/preview/index.js +0 -7
- package/templates/default/public/tinymce/plugins/preview/plugin.js +0 -843
- package/templates/default/public/tinymce/plugins/preview/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/quickbars/index.js +0 -7
- package/templates/default/public/tinymce/plugins/quickbars/plugin.js +0 -654
- package/templates/default/public/tinymce/plugins/quickbars/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/save/index.js +0 -7
- package/templates/default/public/tinymce/plugins/save/plugin.js +0 -136
- package/templates/default/public/tinymce/plugins/save/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/searchreplace/index.js +0 -7
- package/templates/default/public/tinymce/plugins/searchreplace/plugin.js +0 -1367
- package/templates/default/public/tinymce/plugins/searchreplace/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/table/index.js +0 -7
- package/templates/default/public/tinymce/plugins/table/plugin.js +0 -4008
- package/templates/default/public/tinymce/plugins/table/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/visualblocks/index.js +0 -7
- package/templates/default/public/tinymce/plugins/visualblocks/plugin.js +0 -106
- package/templates/default/public/tinymce/plugins/visualblocks/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/visualchars/index.js +0 -7
- package/templates/default/public/tinymce/plugins/visualchars/plugin.js +0 -808
- package/templates/default/public/tinymce/plugins/visualchars/plugin.min.js +0 -1
- package/templates/default/public/tinymce/plugins/wordcount/index.js +0 -7
- package/templates/default/public/tinymce/plugins/wordcount/plugin.js +0 -480
- package/templates/default/public/tinymce/plugins/wordcount/plugin.min.js +0 -1
- package/templates/default/public/tinymce/skins/content/dark/content.css +0 -75
- package/templates/default/public/tinymce/skins/content/dark/content.js +0 -10
- package/templates/default/public/tinymce/skins/content/dark/content.min.css +0 -10
- package/templates/default/public/tinymce/skins/content/dark/content.min.ts +0 -3
- package/templates/default/public/tinymce/skins/content/dark/content.ts +0 -3
- package/templates/default/public/tinymce/skins/content/default/content.css +0 -70
- package/templates/default/public/tinymce/skins/content/default/content.js +0 -10
- package/templates/default/public/tinymce/skins/content/default/content.min.css +0 -10
- package/templates/default/public/tinymce/skins/content/default/content.min.ts +0 -3
- package/templates/default/public/tinymce/skins/content/default/content.ts +0 -3
- package/templates/default/public/tinymce/skins/content/document/content.css +0 -75
- package/templates/default/public/tinymce/skins/content/document/content.js +0 -10
- package/templates/default/public/tinymce/skins/content/document/content.min.css +0 -10
- package/templates/default/public/tinymce/skins/content/document/content.min.ts +0 -3
- package/templates/default/public/tinymce/skins/content/document/content.ts +0 -3
- package/templates/default/public/tinymce/skins/content/tinymce-5/content.css +0 -70
- package/templates/default/public/tinymce/skins/content/tinymce-5/content.js +0 -10
- package/templates/default/public/tinymce/skins/content/tinymce-5/content.min.css +0 -10
- package/templates/default/public/tinymce/skins/content/tinymce-5/content.min.ts +0 -3
- package/templates/default/public/tinymce/skins/content/tinymce-5/content.ts +0 -3
- package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.css +0 -75
- package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.js +0 -10
- package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.min.css +0 -10
- package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.min.ts +0 -3
- package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.ts +0 -3
- package/templates/default/public/tinymce/skins/content/writer/content.css +0 -71
- package/templates/default/public/tinymce/skins/content/writer/content.js +0 -10
- package/templates/default/public/tinymce/skins/content/writer/content.min.css +0 -10
- package/templates/default/public/tinymce/skins/content/writer/content.min.ts +0 -3
- package/templates/default/public/tinymce/skins/content/writer/content.ts +0 -3
- package/templates/default/public/tinymce/skins/ui/oxide/content.css +0 -1037
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.css +0 -1031
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.js +0 -10
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.min.css +0 -10
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.min.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/oxide/content.js +0 -10
- package/templates/default/public/tinymce/skins/ui/oxide/content.min.css +0 -10
- package/templates/default/public/tinymce/skins/ui/oxide/content.min.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/oxide/content.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/oxide/skin.css +0 -5615
- package/templates/default/public/tinymce/skins/ui/oxide/skin.js +0 -1
- package/templates/default/public/tinymce/skins/ui/oxide/skin.min.css +0 -1
- package/templates/default/public/tinymce/skins/ui/oxide/skin.min.ts +0 -507
- package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.css +0 -30
- package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.js +0 -1
- package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.min.css +0 -1
- package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.min.ts +0 -9
- package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.ts +0 -9
- package/templates/default/public/tinymce/skins/ui/oxide/skin.ts +0 -507
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.css +0 -1025
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.css +0 -1031
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.js +0 -10
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.min.css +0 -10
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.min.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.js +0 -10
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.min.css +0 -10
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.min.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.css +0 -5618
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.js +0 -1
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.min.css +0 -1
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.min.ts +0 -507
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +0 -30
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +0 -1
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +0 -1
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.ts +0 -9
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.ts +0 -9
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.ts +0 -507
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.css +0 -1037
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.css +0 -1031
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.js +0 -10
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.min.css +0 -10
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.min.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.js +0 -10
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.min.css +0 -10
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.min.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.css +0 -5734
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.js +0 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.min.css +0 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.min.ts +0 -508
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.css +0 -30
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +0 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +0 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.ts +0 -9
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.ts +0 -9
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.ts +0 -508
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.css +0 -1025
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.css +0 -1031
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.js +0 -10
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +0 -10
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.min.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.js +0 -10
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.min.css +0 -10
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.min.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.ts +0 -116
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.css +0 -5734
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.js +0 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.min.css +0 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.min.ts +0 -508
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.css +0 -30
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +0 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +0 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.ts +0 -9
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.ts +0 -9
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.ts +0 -508
- package/templates/default/public/tinymce/themes/silver/index.js +0 -7
- package/templates/default/public/tinymce/themes/silver/theme.js +0 -34748
- package/templates/default/public/tinymce/themes/silver/theme.min.js +0 -1
- package/templates/default/public/tinymce/tinymce.d.ts +0 -3413
- package/templates/default/public/tinymce/tinymce.js +0 -41518
- package/templates/default/public/tinymce/tinymce.min.js +0 -10
|
@@ -1,1691 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TinyMCE version 8.3.1 (2025-12-17)
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
(function () {
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
var global$4 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
9
|
-
|
|
10
|
-
/* eslint-disable @typescript-eslint/no-wrapper-object-types */
|
|
11
|
-
const getPrototypeOf = Object.getPrototypeOf;
|
|
12
|
-
const hasProto = (v, constructor, predicate) => {
|
|
13
|
-
if (predicate(v, constructor.prototype)) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
// String-based fallback time
|
|
18
|
-
return v.constructor?.name === constructor.name;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const typeOf = (x) => {
|
|
22
|
-
const t = typeof x;
|
|
23
|
-
if (x === null) {
|
|
24
|
-
return 'null';
|
|
25
|
-
}
|
|
26
|
-
else if (t === 'object' && Array.isArray(x)) {
|
|
27
|
-
return 'array';
|
|
28
|
-
}
|
|
29
|
-
else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
|
|
30
|
-
return 'string';
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
return t;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const isType = (type) => (value) => typeOf(value) === type;
|
|
37
|
-
const isSimpleType = (type) => (value) => typeof value === type;
|
|
38
|
-
const eq = (t) => (a) => t === a;
|
|
39
|
-
const is = (value, constructor) => isObject(value) && hasProto(value, constructor, (o, proto) => getPrototypeOf(o) === proto);
|
|
40
|
-
const isString = isType('string');
|
|
41
|
-
const isObject = isType('object');
|
|
42
|
-
const isPlainObject = (value) => is(value, Object);
|
|
43
|
-
const isArray = isType('array');
|
|
44
|
-
const isNull = eq(null);
|
|
45
|
-
const isBoolean = isSimpleType('boolean');
|
|
46
|
-
const isNullable = (a) => a === null || a === undefined;
|
|
47
|
-
const isNonNullable = (a) => !isNullable(a);
|
|
48
|
-
const isFunction = isSimpleType('function');
|
|
49
|
-
const isNumber = isSimpleType('number');
|
|
50
|
-
const isArrayOf = (value, pred) => {
|
|
51
|
-
if (isArray(value)) {
|
|
52
|
-
for (let i = 0, len = value.length; i < len; ++i) {
|
|
53
|
-
if (!(pred(value[i]))) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const noop = () => { };
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* The `Optional` type represents a value (of any type) that potentially does
|
|
66
|
-
* not exist. Any `Optional<T>` can either be a `Some<T>` (in which case the
|
|
67
|
-
* value does exist) or a `None` (in which case the value does not exist). This
|
|
68
|
-
* module defines a whole lot of FP-inspired utility functions for dealing with
|
|
69
|
-
* `Optional` objects.
|
|
70
|
-
*
|
|
71
|
-
* Comparison with null or undefined:
|
|
72
|
-
* - We don't get fancy null coalescing operators with `Optional`
|
|
73
|
-
* - We do get fancy helper functions with `Optional`
|
|
74
|
-
* - `Optional` support nesting, and allow for the type to still be nullable (or
|
|
75
|
-
* another `Optional`)
|
|
76
|
-
* - There is no option to turn off strict-optional-checks like there is for
|
|
77
|
-
* strict-null-checks
|
|
78
|
-
*/
|
|
79
|
-
class Optional {
|
|
80
|
-
tag;
|
|
81
|
-
value;
|
|
82
|
-
// Sneaky optimisation: every instance of Optional.none is identical, so just
|
|
83
|
-
// reuse the same object
|
|
84
|
-
static singletonNone = new Optional(false);
|
|
85
|
-
// The internal representation has a `tag` and a `value`, but both are
|
|
86
|
-
// private: able to be console.logged, but not able to be accessed by code
|
|
87
|
-
constructor(tag, value) {
|
|
88
|
-
this.tag = tag;
|
|
89
|
-
this.value = value;
|
|
90
|
-
}
|
|
91
|
-
// --- Identities ---
|
|
92
|
-
/**
|
|
93
|
-
* Creates a new `Optional<T>` that **does** contain a value.
|
|
94
|
-
*/
|
|
95
|
-
static some(value) {
|
|
96
|
-
return new Optional(true, value);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Create a new `Optional<T>` that **does not** contain a value. `T` can be
|
|
100
|
-
* any type because we don't actually have a `T`.
|
|
101
|
-
*/
|
|
102
|
-
static none() {
|
|
103
|
-
return Optional.singletonNone;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Perform a transform on an `Optional` type. Regardless of whether this
|
|
107
|
-
* `Optional` contains a value or not, `fold` will return a value of type `U`.
|
|
108
|
-
* If this `Optional` does not contain a value, the `U` will be created by
|
|
109
|
-
* calling `onNone`. If this `Optional` does contain a value, the `U` will be
|
|
110
|
-
* created by calling `onSome`.
|
|
111
|
-
*
|
|
112
|
-
* For the FP enthusiasts in the room, this function:
|
|
113
|
-
* 1. Could be used to implement all of the functions below
|
|
114
|
-
* 2. Forms a catamorphism
|
|
115
|
-
*/
|
|
116
|
-
fold(onNone, onSome) {
|
|
117
|
-
if (this.tag) {
|
|
118
|
-
return onSome(this.value);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
return onNone();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Determine if this `Optional` object contains a value.
|
|
126
|
-
*/
|
|
127
|
-
isSome() {
|
|
128
|
-
return this.tag;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Determine if this `Optional` object **does not** contain a value.
|
|
132
|
-
*/
|
|
133
|
-
isNone() {
|
|
134
|
-
return !this.tag;
|
|
135
|
-
}
|
|
136
|
-
// --- Functor (name stolen from Haskell / maths) ---
|
|
137
|
-
/**
|
|
138
|
-
* Perform a transform on an `Optional` object, **if** there is a value. If
|
|
139
|
-
* you provide a function to turn a T into a U, this is the function you use
|
|
140
|
-
* to turn an `Optional<T>` into an `Optional<U>`. If this **does** contain
|
|
141
|
-
* a value then the output will also contain a value (that value being the
|
|
142
|
-
* output of `mapper(this.value)`), and if this **does not** contain a value
|
|
143
|
-
* then neither will the output.
|
|
144
|
-
*/
|
|
145
|
-
map(mapper) {
|
|
146
|
-
if (this.tag) {
|
|
147
|
-
return Optional.some(mapper(this.value));
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
return Optional.none();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
// --- Monad (name stolen from Haskell / maths) ---
|
|
154
|
-
/**
|
|
155
|
-
* Perform a transform on an `Optional` object, **if** there is a value.
|
|
156
|
-
* Unlike `map`, here the transform itself also returns an `Optional`.
|
|
157
|
-
*/
|
|
158
|
-
bind(binder) {
|
|
159
|
-
if (this.tag) {
|
|
160
|
-
return binder(this.value);
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
return Optional.none();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
// --- Traversable (name stolen from Haskell / maths) ---
|
|
167
|
-
/**
|
|
168
|
-
* For a given predicate, this function finds out if there **exists** a value
|
|
169
|
-
* inside this `Optional` object that meets the predicate. In practice, this
|
|
170
|
-
* means that for `Optional`s that do not contain a value it returns false (as
|
|
171
|
-
* no predicate-meeting value exists).
|
|
172
|
-
*/
|
|
173
|
-
exists(predicate) {
|
|
174
|
-
return this.tag && predicate(this.value);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* For a given predicate, this function finds out if **all** the values inside
|
|
178
|
-
* this `Optional` object meet the predicate. In practice, this means that
|
|
179
|
-
* for `Optional`s that do not contain a value it returns true (as all 0
|
|
180
|
-
* objects do meet the predicate).
|
|
181
|
-
*/
|
|
182
|
-
forall(predicate) {
|
|
183
|
-
return !this.tag || predicate(this.value);
|
|
184
|
-
}
|
|
185
|
-
filter(predicate) {
|
|
186
|
-
if (!this.tag || predicate(this.value)) {
|
|
187
|
-
return this;
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
return Optional.none();
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
// --- Getters ---
|
|
194
|
-
/**
|
|
195
|
-
* Get the value out of the inside of the `Optional` object, using a default
|
|
196
|
-
* `replacement` value if the provided `Optional` object does not contain a
|
|
197
|
-
* value.
|
|
198
|
-
*/
|
|
199
|
-
getOr(replacement) {
|
|
200
|
-
return this.tag ? this.value : replacement;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Get the value out of the inside of the `Optional` object, using a default
|
|
204
|
-
* `replacement` value if the provided `Optional` object does not contain a
|
|
205
|
-
* value. Unlike `getOr`, in this method the `replacement` object is also
|
|
206
|
-
* `Optional` - meaning that this method will always return an `Optional`.
|
|
207
|
-
*/
|
|
208
|
-
or(replacement) {
|
|
209
|
-
return this.tag ? this : replacement;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Get the value out of the inside of the `Optional` object, using a default
|
|
213
|
-
* `replacement` value if the provided `Optional` object does not contain a
|
|
214
|
-
* value. Unlike `getOr`, in this method the `replacement` value is
|
|
215
|
-
* "thunked" - that is to say that you don't pass a value to `getOrThunk`, you
|
|
216
|
-
* pass a function which (if called) will **return** the `value` you want to
|
|
217
|
-
* use.
|
|
218
|
-
*/
|
|
219
|
-
getOrThunk(thunk) {
|
|
220
|
-
return this.tag ? this.value : thunk();
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Get the value out of the inside of the `Optional` object, using a default
|
|
224
|
-
* `replacement` value if the provided Optional object does not contain a
|
|
225
|
-
* value.
|
|
226
|
-
*
|
|
227
|
-
* Unlike `or`, in this method the `replacement` value is "thunked" - that is
|
|
228
|
-
* to say that you don't pass a value to `orThunk`, you pass a function which
|
|
229
|
-
* (if called) will **return** the `value` you want to use.
|
|
230
|
-
*
|
|
231
|
-
* Unlike `getOrThunk`, in this method the `replacement` value is also
|
|
232
|
-
* `Optional`, meaning that this method will always return an `Optional`.
|
|
233
|
-
*/
|
|
234
|
-
orThunk(thunk) {
|
|
235
|
-
return this.tag ? this : thunk();
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Get the value out of the inside of the `Optional` object, throwing an
|
|
239
|
-
* exception if the provided `Optional` object does not contain a value.
|
|
240
|
-
*
|
|
241
|
-
* WARNING:
|
|
242
|
-
* You should only be using this function if you know that the `Optional`
|
|
243
|
-
* object **is not** empty (otherwise you're throwing exceptions in production
|
|
244
|
-
* code, which is bad).
|
|
245
|
-
*
|
|
246
|
-
* In tests this is more acceptable.
|
|
247
|
-
*
|
|
248
|
-
* Prefer other methods to this, such as `.each`.
|
|
249
|
-
*/
|
|
250
|
-
getOrDie(message) {
|
|
251
|
-
if (!this.tag) {
|
|
252
|
-
throw new Error(message ?? 'Called getOrDie on None');
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
return this.value;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
// --- Interop with null and undefined ---
|
|
259
|
-
/**
|
|
260
|
-
* Creates an `Optional` value from a nullable (or undefined-able) input.
|
|
261
|
-
* Null, or undefined, is converted to `None`, and anything else is converted
|
|
262
|
-
* to `Some`.
|
|
263
|
-
*/
|
|
264
|
-
static from(value) {
|
|
265
|
-
return isNonNullable(value) ? Optional.some(value) : Optional.none();
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Converts an `Optional` to a nullable type, by getting the value if it
|
|
269
|
-
* exists, or returning `null` if it does not.
|
|
270
|
-
*/
|
|
271
|
-
getOrNull() {
|
|
272
|
-
return this.tag ? this.value : null;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Converts an `Optional` to an undefined-able type, by getting the value if
|
|
276
|
-
* it exists, or returning `undefined` if it does not.
|
|
277
|
-
*/
|
|
278
|
-
getOrUndefined() {
|
|
279
|
-
return this.value;
|
|
280
|
-
}
|
|
281
|
-
// --- Utilities ---
|
|
282
|
-
/**
|
|
283
|
-
* If the `Optional` contains a value, perform an action on that value.
|
|
284
|
-
* Unlike the rest of the methods on this type, `.each` has side-effects. If
|
|
285
|
-
* you want to transform an `Optional<T>` **into** something, then this is not
|
|
286
|
-
* the method for you. If you want to use an `Optional<T>` to **do**
|
|
287
|
-
* something, then this is the method for you - provided you're okay with not
|
|
288
|
-
* doing anything in the case where the `Optional` doesn't have a value inside
|
|
289
|
-
* it. If you're not sure whether your use-case fits into transforming
|
|
290
|
-
* **into** something or **doing** something, check whether it has a return
|
|
291
|
-
* value. If it does, you should be performing a transform.
|
|
292
|
-
*/
|
|
293
|
-
each(worker) {
|
|
294
|
-
if (this.tag) {
|
|
295
|
-
worker(this.value);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Turn the `Optional` object into an array that contains all of the values
|
|
300
|
-
* stored inside the `Optional`. In practice, this means the output will have
|
|
301
|
-
* either 0 or 1 elements.
|
|
302
|
-
*/
|
|
303
|
-
toArray() {
|
|
304
|
-
return this.tag ? [this.value] : [];
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Turn the `Optional` object into a string for debugging or printing. Not
|
|
308
|
-
* recommended for production code, but good for debugging. Also note that
|
|
309
|
-
* these days an `Optional` object can be logged to the console directly, and
|
|
310
|
-
* its inner value (if it exists) will be visible.
|
|
311
|
-
*/
|
|
312
|
-
toString() {
|
|
313
|
-
return this.tag ? `some(${this.value})` : 'none()';
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const nativeSlice = Array.prototype.slice;
|
|
318
|
-
const nativePush = Array.prototype.push;
|
|
319
|
-
const flatten = (xs) => {
|
|
320
|
-
// Note, this is possible because push supports multiple arguments:
|
|
321
|
-
// http://jsperf.com/concat-push/6
|
|
322
|
-
// Note that in the past, concat() would silently work (very slowly) for array-like objects.
|
|
323
|
-
// With this change it will throw an error.
|
|
324
|
-
const r = [];
|
|
325
|
-
for (let i = 0, len = xs.length; i < len; ++i) {
|
|
326
|
-
// Ensure that each value is an array itself
|
|
327
|
-
if (!isArray(xs[i])) {
|
|
328
|
-
throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
|
|
329
|
-
}
|
|
330
|
-
nativePush.apply(r, xs[i]);
|
|
331
|
-
}
|
|
332
|
-
return r;
|
|
333
|
-
};
|
|
334
|
-
const get = (xs, i) => i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
|
|
335
|
-
const head = (xs) => get(xs, 0);
|
|
336
|
-
isFunction(Array.from) ? Array.from : (x) => nativeSlice.call(x);
|
|
337
|
-
const findMap = (arr, f) => {
|
|
338
|
-
for (let i = 0; i < arr.length; i++) {
|
|
339
|
-
const r = f(arr[i], i);
|
|
340
|
-
if (r.isSome()) {
|
|
341
|
-
return r;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
return Optional.none();
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
// There are many variations of Object iteration that are faster than the 'for-in' style:
|
|
348
|
-
// http://jsperf.com/object-keys-iteration/107
|
|
349
|
-
//
|
|
350
|
-
// Use the native keys if it is available (IE9+), otherwise fall back to manually filtering
|
|
351
|
-
const keys = Object.keys;
|
|
352
|
-
const hasOwnProperty = Object.hasOwnProperty;
|
|
353
|
-
const each = (obj, f) => {
|
|
354
|
-
const props = keys(obj);
|
|
355
|
-
for (let k = 0, len = props.length; k < len; k++) {
|
|
356
|
-
const i = props[k];
|
|
357
|
-
const x = obj[i];
|
|
358
|
-
f(x, i);
|
|
359
|
-
}
|
|
360
|
-
};
|
|
361
|
-
const objAcc = (r) => (x, i) => {
|
|
362
|
-
r[i] = x;
|
|
363
|
-
};
|
|
364
|
-
const internalFilter = (obj, pred, onTrue, onFalse) => {
|
|
365
|
-
each(obj, (x, i) => {
|
|
366
|
-
(pred(x, i) ? onTrue : onFalse)(x, i);
|
|
367
|
-
});
|
|
368
|
-
};
|
|
369
|
-
const filter = (obj, pred) => {
|
|
370
|
-
const t = {};
|
|
371
|
-
internalFilter(obj, pred, objAcc(t), noop);
|
|
372
|
-
return t;
|
|
373
|
-
};
|
|
374
|
-
const has = (obj, key) => hasOwnProperty.call(obj, key);
|
|
375
|
-
const hasNonNullableKey = (obj, key) => has(obj, key) && obj[key] !== undefined && obj[key] !== null;
|
|
376
|
-
|
|
377
|
-
const deep = (old, nu) => {
|
|
378
|
-
const bothObjects = isPlainObject(old) && isPlainObject(nu);
|
|
379
|
-
return bothObjects ? deepMerge(old, nu) : nu;
|
|
380
|
-
};
|
|
381
|
-
const baseMerge = (merger) => {
|
|
382
|
-
return (...objects) => {
|
|
383
|
-
if (objects.length === 0) {
|
|
384
|
-
throw new Error(`Can't merge zero objects`);
|
|
385
|
-
}
|
|
386
|
-
const ret = {};
|
|
387
|
-
for (let j = 0; j < objects.length; j++) {
|
|
388
|
-
const curObject = objects[j];
|
|
389
|
-
for (const key in curObject) {
|
|
390
|
-
if (has(curObject, key)) {
|
|
391
|
-
ret[key] = merger(ret[key], curObject[key]);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
return ret;
|
|
396
|
-
};
|
|
397
|
-
};
|
|
398
|
-
const deepMerge = baseMerge(deep);
|
|
399
|
-
|
|
400
|
-
const isNotEmpty = (s) => s.length > 0;
|
|
401
|
-
|
|
402
|
-
const fromHtml = (html, scope) => {
|
|
403
|
-
const doc = scope || document;
|
|
404
|
-
const div = doc.createElement('div');
|
|
405
|
-
div.innerHTML = html;
|
|
406
|
-
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
|
407
|
-
const message = 'HTML does not have a single root node';
|
|
408
|
-
// eslint-disable-next-line no-console
|
|
409
|
-
console.error(message, html);
|
|
410
|
-
throw new Error(message);
|
|
411
|
-
}
|
|
412
|
-
return fromDom(div.childNodes[0]);
|
|
413
|
-
};
|
|
414
|
-
const fromTag = (tag, scope) => {
|
|
415
|
-
const doc = scope || document;
|
|
416
|
-
const node = doc.createElement(tag);
|
|
417
|
-
return fromDom(node);
|
|
418
|
-
};
|
|
419
|
-
const fromText = (text, scope) => {
|
|
420
|
-
const doc = scope || document;
|
|
421
|
-
const node = doc.createTextNode(text);
|
|
422
|
-
return fromDom(node);
|
|
423
|
-
};
|
|
424
|
-
const fromDom = (node) => {
|
|
425
|
-
// TODO: Consider removing this check, but left atm for safety
|
|
426
|
-
if (node === null || node === undefined) {
|
|
427
|
-
throw new Error('Node cannot be null or undefined');
|
|
428
|
-
}
|
|
429
|
-
return {
|
|
430
|
-
dom: node
|
|
431
|
-
};
|
|
432
|
-
};
|
|
433
|
-
const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
|
|
434
|
-
// tslint:disable-next-line:variable-name
|
|
435
|
-
const SugarElement = {
|
|
436
|
-
fromHtml,
|
|
437
|
-
fromTag,
|
|
438
|
-
fromText,
|
|
439
|
-
fromDom,
|
|
440
|
-
fromPoint
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
const rawSet = (dom, key, value) => {
|
|
444
|
-
/*
|
|
445
|
-
* JQuery coerced everything to a string, and silently did nothing on text node/null/undefined.
|
|
446
|
-
*
|
|
447
|
-
* We fail on those invalid cases, only allowing numbers and booleans.
|
|
448
|
-
*/
|
|
449
|
-
if (isString(value) || isBoolean(value) || isNumber(value)) {
|
|
450
|
-
dom.setAttribute(key, value + '');
|
|
451
|
-
}
|
|
452
|
-
else {
|
|
453
|
-
// eslint-disable-next-line no-console
|
|
454
|
-
console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);
|
|
455
|
-
throw new Error('Attribute value was not simple');
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
const set = (element, key, value) => {
|
|
459
|
-
rawSet(element.dom, key, value);
|
|
460
|
-
};
|
|
461
|
-
const remove = (element, key) => {
|
|
462
|
-
element.dom.removeAttribute(key);
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
var global$3 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
|
466
|
-
|
|
467
|
-
var global$2 = tinymce.util.Tools.resolve('tinymce.util.URI');
|
|
468
|
-
|
|
469
|
-
const option = (name) => (editor) => editor.options.get(name);
|
|
470
|
-
const register$2 = (editor) => {
|
|
471
|
-
const registerOption = editor.options.register;
|
|
472
|
-
registerOption('image_dimensions', {
|
|
473
|
-
processor: 'boolean',
|
|
474
|
-
default: true
|
|
475
|
-
});
|
|
476
|
-
registerOption('image_advtab', {
|
|
477
|
-
processor: 'boolean',
|
|
478
|
-
default: false
|
|
479
|
-
});
|
|
480
|
-
registerOption('image_uploadtab', {
|
|
481
|
-
processor: 'boolean',
|
|
482
|
-
default: true
|
|
483
|
-
});
|
|
484
|
-
registerOption('image_prepend_url', {
|
|
485
|
-
processor: 'string',
|
|
486
|
-
default: ''
|
|
487
|
-
});
|
|
488
|
-
registerOption('image_class_list', {
|
|
489
|
-
processor: 'object[]'
|
|
490
|
-
});
|
|
491
|
-
registerOption('image_description', {
|
|
492
|
-
processor: 'boolean',
|
|
493
|
-
default: true
|
|
494
|
-
});
|
|
495
|
-
registerOption('image_title', {
|
|
496
|
-
processor: 'boolean',
|
|
497
|
-
default: false
|
|
498
|
-
});
|
|
499
|
-
registerOption('image_caption', {
|
|
500
|
-
processor: 'boolean',
|
|
501
|
-
default: false
|
|
502
|
-
});
|
|
503
|
-
registerOption('image_list', {
|
|
504
|
-
processor: (value) => {
|
|
505
|
-
const valid = value === false || isString(value) || isArrayOf(value, isObject) || isFunction(value);
|
|
506
|
-
return valid ? { value, valid } : { valid: false, message: 'Must be false, a string, an array or a function.' };
|
|
507
|
-
},
|
|
508
|
-
default: false
|
|
509
|
-
});
|
|
510
|
-
};
|
|
511
|
-
const hasDimensions = option('image_dimensions');
|
|
512
|
-
const hasAdvTab = option('image_advtab');
|
|
513
|
-
const hasUploadTab = option('image_uploadtab');
|
|
514
|
-
const getPrependUrl = option('image_prepend_url');
|
|
515
|
-
const getClassList = option('image_class_list');
|
|
516
|
-
const hasDescription = option('image_description');
|
|
517
|
-
const hasImageTitle = option('image_title');
|
|
518
|
-
const hasImageCaption = option('image_caption');
|
|
519
|
-
const getImageList = option('image_list');
|
|
520
|
-
const showAccessibilityOptions = option('a11y_advanced_options');
|
|
521
|
-
const isAutomaticUploadsEnabled = option('automatic_uploads');
|
|
522
|
-
const hasUploadUrl = (editor) => isNotEmpty(editor.options.get('images_upload_url'));
|
|
523
|
-
const hasUploadHandler = (editor) => isNonNullable(editor.options.get('images_upload_handler'));
|
|
524
|
-
|
|
525
|
-
// TODO: Figure out if these would ever be something other than numbers. This was added in: #TINY-1350
|
|
526
|
-
const parseIntAndGetMax = (val1, val2) => Math.max(parseInt(val1, 10), parseInt(val2, 10));
|
|
527
|
-
const getImageSize = (url) => new Promise((callback) => {
|
|
528
|
-
const img = document.createElement('img');
|
|
529
|
-
const done = (dimensions) => {
|
|
530
|
-
if (img.parentNode) {
|
|
531
|
-
img.parentNode.removeChild(img);
|
|
532
|
-
}
|
|
533
|
-
callback(dimensions);
|
|
534
|
-
};
|
|
535
|
-
img.addEventListener('load', () => {
|
|
536
|
-
const width = parseIntAndGetMax(img.width, img.clientWidth);
|
|
537
|
-
const height = parseIntAndGetMax(img.height, img.clientHeight);
|
|
538
|
-
const dimensions = { width, height };
|
|
539
|
-
done(Promise.resolve(dimensions));
|
|
540
|
-
});
|
|
541
|
-
img.addEventListener('error', () => {
|
|
542
|
-
done(Promise.reject(`Failed to get image dimensions for: ${url}`));
|
|
543
|
-
});
|
|
544
|
-
const style = img.style;
|
|
545
|
-
style.visibility = 'hidden';
|
|
546
|
-
style.position = 'fixed';
|
|
547
|
-
style.bottom = style.left = '0px';
|
|
548
|
-
style.width = style.height = 'auto';
|
|
549
|
-
document.body.appendChild(img);
|
|
550
|
-
img.src = url;
|
|
551
|
-
});
|
|
552
|
-
const removePixelSuffix = (value) => {
|
|
553
|
-
if (value) {
|
|
554
|
-
value = value.replace(/px$/, '');
|
|
555
|
-
}
|
|
556
|
-
return value;
|
|
557
|
-
};
|
|
558
|
-
const addPixelSuffix = (value) => {
|
|
559
|
-
if (value.length > 0 && /^[0-9]+$/.test(value)) {
|
|
560
|
-
value += 'px';
|
|
561
|
-
}
|
|
562
|
-
return value;
|
|
563
|
-
};
|
|
564
|
-
const mergeMargins = (css) => {
|
|
565
|
-
if (css.margin) {
|
|
566
|
-
const splitMargin = String(css.margin).split(' ');
|
|
567
|
-
switch (splitMargin.length) {
|
|
568
|
-
case 1: // margin: toprightbottomleft;
|
|
569
|
-
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
|
570
|
-
css['margin-right'] = css['margin-right'] || splitMargin[0];
|
|
571
|
-
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
|
|
572
|
-
css['margin-left'] = css['margin-left'] || splitMargin[0];
|
|
573
|
-
break;
|
|
574
|
-
case 2: // margin: topbottom rightleft;
|
|
575
|
-
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
|
576
|
-
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
|
577
|
-
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
|
|
578
|
-
css['margin-left'] = css['margin-left'] || splitMargin[1];
|
|
579
|
-
break;
|
|
580
|
-
case 3: // margin: top rightleft bottom;
|
|
581
|
-
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
|
582
|
-
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
|
583
|
-
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
|
|
584
|
-
css['margin-left'] = css['margin-left'] || splitMargin[1];
|
|
585
|
-
break;
|
|
586
|
-
case 4: // margin: top right bottom left;
|
|
587
|
-
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
|
588
|
-
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
|
589
|
-
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
|
|
590
|
-
css['margin-left'] = css['margin-left'] || splitMargin[3];
|
|
591
|
-
}
|
|
592
|
-
delete css.margin;
|
|
593
|
-
}
|
|
594
|
-
return css;
|
|
595
|
-
};
|
|
596
|
-
// TODO: Input on this callback should really be validated
|
|
597
|
-
const createImageList = (editor, callback) => {
|
|
598
|
-
const imageList = getImageList(editor);
|
|
599
|
-
if (isString(imageList)) {
|
|
600
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
601
|
-
fetch(imageList)
|
|
602
|
-
.then((res) => {
|
|
603
|
-
if (res.ok) {
|
|
604
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
605
|
-
res.json().then(callback);
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
else if (isFunction(imageList)) {
|
|
610
|
-
imageList(callback);
|
|
611
|
-
}
|
|
612
|
-
else {
|
|
613
|
-
callback(imageList);
|
|
614
|
-
}
|
|
615
|
-
};
|
|
616
|
-
const waitLoadImage = (editor, data, imgElm) => {
|
|
617
|
-
const selectImage = () => {
|
|
618
|
-
imgElm.onload = imgElm.onerror = null;
|
|
619
|
-
if (editor.selection) {
|
|
620
|
-
editor.selection.select(imgElm);
|
|
621
|
-
editor.nodeChanged();
|
|
622
|
-
}
|
|
623
|
-
};
|
|
624
|
-
imgElm.onload = () => {
|
|
625
|
-
if (!data.width && !data.height && hasDimensions(editor)) {
|
|
626
|
-
editor.dom.setAttribs(imgElm, {
|
|
627
|
-
width: String(imgElm.clientWidth),
|
|
628
|
-
height: String(imgElm.clientHeight)
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
selectImage();
|
|
632
|
-
};
|
|
633
|
-
imgElm.onerror = selectImage;
|
|
634
|
-
};
|
|
635
|
-
const blobToDataUri = (blob) => new Promise((resolve, reject) => {
|
|
636
|
-
const reader = new FileReader();
|
|
637
|
-
reader.onload = () => {
|
|
638
|
-
resolve(reader.result);
|
|
639
|
-
};
|
|
640
|
-
reader.onerror = () => {
|
|
641
|
-
reject(reader.error?.message);
|
|
642
|
-
};
|
|
643
|
-
reader.readAsDataURL(blob);
|
|
644
|
-
});
|
|
645
|
-
const isPlaceholderImage = (imgElm) => imgElm.nodeName === 'IMG' && (imgElm.hasAttribute('data-mce-object') || imgElm.hasAttribute('data-mce-placeholder'));
|
|
646
|
-
const isSafeImageUrl = (editor, src) => {
|
|
647
|
-
const getOption = editor.options.get;
|
|
648
|
-
return global$2.isDomSafe(src, 'img', {
|
|
649
|
-
allow_html_data_urls: getOption('allow_html_data_urls'),
|
|
650
|
-
allow_script_urls: getOption('allow_script_urls'),
|
|
651
|
-
allow_svg_data_urls: getOption('allow_svg_data_urls')
|
|
652
|
-
});
|
|
653
|
-
};
|
|
654
|
-
|
|
655
|
-
const DOM = global$3.DOM;
|
|
656
|
-
const getHspace = (image) => {
|
|
657
|
-
if (image.style.marginLeft && image.style.marginRight && image.style.marginLeft === image.style.marginRight) {
|
|
658
|
-
return removePixelSuffix(image.style.marginLeft);
|
|
659
|
-
}
|
|
660
|
-
else {
|
|
661
|
-
return '';
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
const getVspace = (image) => {
|
|
665
|
-
if (image.style.marginTop && image.style.marginBottom && image.style.marginTop === image.style.marginBottom) {
|
|
666
|
-
return removePixelSuffix(image.style.marginTop);
|
|
667
|
-
}
|
|
668
|
-
else {
|
|
669
|
-
return '';
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
const getBorder = (image) => {
|
|
673
|
-
if (image.style.borderWidth) {
|
|
674
|
-
return removePixelSuffix(image.style.borderWidth);
|
|
675
|
-
}
|
|
676
|
-
else {
|
|
677
|
-
return '';
|
|
678
|
-
}
|
|
679
|
-
};
|
|
680
|
-
const getAttrib = (image, name) => {
|
|
681
|
-
if (image.hasAttribute(name)) {
|
|
682
|
-
return image.getAttribute(name) ?? '';
|
|
683
|
-
}
|
|
684
|
-
else {
|
|
685
|
-
return '';
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
|
-
const hasCaption = (image) => image.parentNode !== null && image.parentNode.nodeName === 'FIGURE';
|
|
689
|
-
const updateAttrib = (image, name, value) => {
|
|
690
|
-
if (value === '' || value === null) {
|
|
691
|
-
image.removeAttribute(name);
|
|
692
|
-
}
|
|
693
|
-
else {
|
|
694
|
-
image.setAttribute(name, value);
|
|
695
|
-
}
|
|
696
|
-
};
|
|
697
|
-
const wrapInFigure = (image) => {
|
|
698
|
-
const figureElm = DOM.create('figure', { class: 'image' });
|
|
699
|
-
DOM.insertAfter(figureElm, image);
|
|
700
|
-
figureElm.appendChild(image);
|
|
701
|
-
figureElm.appendChild(DOM.create('figcaption', { contentEditable: 'true' }, 'Caption'));
|
|
702
|
-
figureElm.contentEditable = 'false';
|
|
703
|
-
};
|
|
704
|
-
const removeFigure = (image) => {
|
|
705
|
-
const figureElm = image.parentNode;
|
|
706
|
-
if (isNonNullable(figureElm)) {
|
|
707
|
-
DOM.insertAfter(image, figureElm);
|
|
708
|
-
DOM.remove(figureElm);
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
const toggleCaption = (image) => {
|
|
712
|
-
if (hasCaption(image)) {
|
|
713
|
-
removeFigure(image);
|
|
714
|
-
}
|
|
715
|
-
else {
|
|
716
|
-
wrapInFigure(image);
|
|
717
|
-
}
|
|
718
|
-
};
|
|
719
|
-
const normalizeStyle = (image, normalizeCss) => {
|
|
720
|
-
const attrValue = image.getAttribute('style');
|
|
721
|
-
const value = normalizeCss(attrValue !== null ? attrValue : '');
|
|
722
|
-
if (value.length > 0) {
|
|
723
|
-
image.setAttribute('style', value);
|
|
724
|
-
image.setAttribute('data-mce-style', value);
|
|
725
|
-
}
|
|
726
|
-
else {
|
|
727
|
-
image.removeAttribute('style');
|
|
728
|
-
}
|
|
729
|
-
};
|
|
730
|
-
const setSize = (name, normalizeCss) => (image, name, value) => {
|
|
731
|
-
const styles = image.style;
|
|
732
|
-
if (styles[name]) {
|
|
733
|
-
styles[name] = addPixelSuffix(value);
|
|
734
|
-
normalizeStyle(image, normalizeCss);
|
|
735
|
-
}
|
|
736
|
-
else {
|
|
737
|
-
updateAttrib(image, name, value);
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
const getSize = (image, name) => {
|
|
741
|
-
if (image.style[name]) {
|
|
742
|
-
return removePixelSuffix(image.style[name]);
|
|
743
|
-
}
|
|
744
|
-
else {
|
|
745
|
-
return getAttrib(image, name);
|
|
746
|
-
}
|
|
747
|
-
};
|
|
748
|
-
const setHspace = (image, value) => {
|
|
749
|
-
const pxValue = addPixelSuffix(value);
|
|
750
|
-
image.style.marginLeft = pxValue;
|
|
751
|
-
image.style.marginRight = pxValue;
|
|
752
|
-
};
|
|
753
|
-
const setVspace = (image, value) => {
|
|
754
|
-
const pxValue = addPixelSuffix(value);
|
|
755
|
-
image.style.marginTop = pxValue;
|
|
756
|
-
image.style.marginBottom = pxValue;
|
|
757
|
-
};
|
|
758
|
-
const setBorder = (image, value) => {
|
|
759
|
-
const pxValue = addPixelSuffix(value);
|
|
760
|
-
image.style.borderWidth = pxValue;
|
|
761
|
-
};
|
|
762
|
-
const setBorderStyle = (image, value) => {
|
|
763
|
-
image.style.borderStyle = value;
|
|
764
|
-
};
|
|
765
|
-
const getBorderStyle = (image) => image.style.borderStyle ?? '';
|
|
766
|
-
const isFigure = (elm) => isNonNullable(elm) && elm.nodeName === 'FIGURE';
|
|
767
|
-
const isImage = (elm) => elm.nodeName === 'IMG';
|
|
768
|
-
const getIsDecorative = (image) => {
|
|
769
|
-
const alt = DOM.getAttrib(image, 'alt');
|
|
770
|
-
const role = DOM.getAttrib(image, 'role');
|
|
771
|
-
// WCAG Technique H67: Using null alt text and no title attribute on img elements for images that AT should ignore
|
|
772
|
-
// Source: https://www.w3.org/TR/WCAG20-TECHS/H67.html
|
|
773
|
-
// Key point: Decorative images should have alt="" and either no title or empty title (title="")
|
|
774
|
-
// ARIA 1.2 Specification: Defines role="presentation" and role="none" as synonymous roles
|
|
775
|
-
// Source: https://www.w3.org/TR/wai-aria-1.2/
|
|
776
|
-
// Key point: These roles remove semantic meaning and prohibit aria-label and aria-labelledby
|
|
777
|
-
const hasAlt = image.hasAttribute('alt');
|
|
778
|
-
return (hasAlt && alt.length === 0) || (role === 'presentation') || (role === 'none');
|
|
779
|
-
};
|
|
780
|
-
const getAlt = (image) => {
|
|
781
|
-
if (getIsDecorative(image)) {
|
|
782
|
-
return '';
|
|
783
|
-
}
|
|
784
|
-
else {
|
|
785
|
-
return getAttrib(image, 'alt');
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
const defaultData = () => ({
|
|
789
|
-
src: '',
|
|
790
|
-
alt: '',
|
|
791
|
-
title: '',
|
|
792
|
-
width: '',
|
|
793
|
-
height: '',
|
|
794
|
-
class: '',
|
|
795
|
-
style: '',
|
|
796
|
-
caption: false,
|
|
797
|
-
hspace: '',
|
|
798
|
-
vspace: '',
|
|
799
|
-
border: '',
|
|
800
|
-
borderStyle: '',
|
|
801
|
-
isDecorative: false
|
|
802
|
-
});
|
|
803
|
-
const getStyleValue = (normalizeCss, data) => {
|
|
804
|
-
const image = document.createElement('img');
|
|
805
|
-
updateAttrib(image, 'style', data.style);
|
|
806
|
-
if (getHspace(image) || data.hspace !== '') {
|
|
807
|
-
setHspace(image, data.hspace);
|
|
808
|
-
}
|
|
809
|
-
if (getVspace(image) || data.vspace !== '') {
|
|
810
|
-
setVspace(image, data.vspace);
|
|
811
|
-
}
|
|
812
|
-
if (getBorder(image) || data.border !== '') {
|
|
813
|
-
setBorder(image, data.border);
|
|
814
|
-
}
|
|
815
|
-
if (getBorderStyle(image) || data.borderStyle !== '') {
|
|
816
|
-
setBorderStyle(image, data.borderStyle);
|
|
817
|
-
}
|
|
818
|
-
return normalizeCss(image.getAttribute('style') ?? '');
|
|
819
|
-
};
|
|
820
|
-
const create = (normalizeCss, data) => {
|
|
821
|
-
const image = document.createElement('img');
|
|
822
|
-
write(normalizeCss, { ...data, caption: false }, image);
|
|
823
|
-
// Always set alt even if data.alt is an empty string
|
|
824
|
-
setAlt(image, data.alt, data.isDecorative);
|
|
825
|
-
if (data.caption) {
|
|
826
|
-
const figure = DOM.create('figure', { class: 'image' });
|
|
827
|
-
figure.appendChild(image);
|
|
828
|
-
figure.appendChild(DOM.create('figcaption', { contentEditable: 'true' }, 'Caption'));
|
|
829
|
-
figure.contentEditable = 'false';
|
|
830
|
-
return figure;
|
|
831
|
-
}
|
|
832
|
-
else {
|
|
833
|
-
return image;
|
|
834
|
-
}
|
|
835
|
-
};
|
|
836
|
-
const read = (normalizeCss, image) => ({
|
|
837
|
-
src: getAttrib(image, 'src'),
|
|
838
|
-
alt: getAlt(image),
|
|
839
|
-
title: getAttrib(image, 'title'),
|
|
840
|
-
width: getSize(image, 'width'),
|
|
841
|
-
height: getSize(image, 'height'),
|
|
842
|
-
class: getAttrib(image, 'class'),
|
|
843
|
-
style: normalizeCss(getAttrib(image, 'style')),
|
|
844
|
-
caption: hasCaption(image),
|
|
845
|
-
hspace: getHspace(image),
|
|
846
|
-
vspace: getVspace(image),
|
|
847
|
-
border: getBorder(image),
|
|
848
|
-
borderStyle: getBorderStyle(image),
|
|
849
|
-
isDecorative: getIsDecorative(image)
|
|
850
|
-
});
|
|
851
|
-
const updateProp = (image, oldData, newData, name, set) => {
|
|
852
|
-
if (newData[name] !== oldData[name]) {
|
|
853
|
-
set(image, name, String(newData[name]));
|
|
854
|
-
}
|
|
855
|
-
};
|
|
856
|
-
const setAlt = (image, alt, isDecorative) => {
|
|
857
|
-
if (isDecorative) {
|
|
858
|
-
DOM.setAttrib(image, 'role', 'presentation');
|
|
859
|
-
// unfortunately can't set "" attr value with domutils
|
|
860
|
-
const sugarImage = SugarElement.fromDom(image);
|
|
861
|
-
set(sugarImage, 'alt', '');
|
|
862
|
-
}
|
|
863
|
-
else {
|
|
864
|
-
if (isNull(alt)) {
|
|
865
|
-
const sugarImage = SugarElement.fromDom(image);
|
|
866
|
-
remove(sugarImage, 'alt');
|
|
867
|
-
}
|
|
868
|
-
else {
|
|
869
|
-
// unfortunately can't set "" attr value with domutils
|
|
870
|
-
const sugarImage = SugarElement.fromDom(image);
|
|
871
|
-
set(sugarImage, 'alt', alt);
|
|
872
|
-
}
|
|
873
|
-
if (DOM.getAttrib(image, 'role') === 'presentation') {
|
|
874
|
-
DOM.setAttrib(image, 'role', '');
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
};
|
|
878
|
-
const updateAlt = (image, oldData, newData) => {
|
|
879
|
-
if (newData.alt !== oldData.alt || newData.isDecorative !== oldData.isDecorative) {
|
|
880
|
-
setAlt(image, newData.alt, newData.isDecorative);
|
|
881
|
-
}
|
|
882
|
-
};
|
|
883
|
-
const normalized = (set, normalizeCss) => (image, name, value) => {
|
|
884
|
-
set(image, value);
|
|
885
|
-
normalizeStyle(image, normalizeCss);
|
|
886
|
-
};
|
|
887
|
-
const write = (normalizeCss, newData, image) => {
|
|
888
|
-
const oldData = read(normalizeCss, image);
|
|
889
|
-
updateProp(image, oldData, newData, 'caption', (image, _name, _value) => toggleCaption(image));
|
|
890
|
-
updateProp(image, oldData, newData, 'src', updateAttrib);
|
|
891
|
-
updateProp(image, oldData, newData, 'title', updateAttrib);
|
|
892
|
-
updateProp(image, oldData, newData, 'width', setSize('width', normalizeCss));
|
|
893
|
-
updateProp(image, oldData, newData, 'height', setSize('height', normalizeCss));
|
|
894
|
-
updateProp(image, oldData, newData, 'class', updateAttrib);
|
|
895
|
-
updateProp(image, oldData, newData, 'style', normalized((image, value) => updateAttrib(image, 'style', value), normalizeCss));
|
|
896
|
-
updateProp(image, oldData, newData, 'hspace', normalized(setHspace, normalizeCss));
|
|
897
|
-
updateProp(image, oldData, newData, 'vspace', normalized(setVspace, normalizeCss));
|
|
898
|
-
updateProp(image, oldData, newData, 'border', normalized(setBorder, normalizeCss));
|
|
899
|
-
updateProp(image, oldData, newData, 'borderStyle', normalized(setBorderStyle, normalizeCss));
|
|
900
|
-
updateAlt(image, oldData, newData);
|
|
901
|
-
};
|
|
902
|
-
|
|
903
|
-
const normalizeCss$1 = (editor, cssText) => {
|
|
904
|
-
const css = editor.dom.styles.parse(cssText);
|
|
905
|
-
const mergedCss = mergeMargins(css);
|
|
906
|
-
const compressed = editor.dom.styles.parse(editor.dom.styles.serialize(mergedCss));
|
|
907
|
-
return editor.dom.styles.serialize(compressed);
|
|
908
|
-
};
|
|
909
|
-
const getSelectedImage = (editor) => {
|
|
910
|
-
const imgElm = editor.selection.getNode();
|
|
911
|
-
const figureElm = editor.dom.getParent(imgElm, 'figure.image');
|
|
912
|
-
if (figureElm) {
|
|
913
|
-
return editor.dom.select('img', figureElm)[0];
|
|
914
|
-
}
|
|
915
|
-
if (imgElm && (imgElm.nodeName !== 'IMG' || isPlaceholderImage(imgElm))) {
|
|
916
|
-
return null;
|
|
917
|
-
}
|
|
918
|
-
return imgElm;
|
|
919
|
-
};
|
|
920
|
-
const splitTextBlock = (editor, figure) => {
|
|
921
|
-
const dom = editor.dom;
|
|
922
|
-
const textBlockElements = filter(editor.schema.getTextBlockElements(), (_, parentElm) => !editor.schema.isValidChild(parentElm, 'figure'));
|
|
923
|
-
const textBlock = dom.getParent(figure.parentNode, (node) => hasNonNullableKey(textBlockElements, node.nodeName), editor.getBody());
|
|
924
|
-
if (textBlock) {
|
|
925
|
-
return dom.split(textBlock, figure) ?? figure;
|
|
926
|
-
}
|
|
927
|
-
else {
|
|
928
|
-
return figure;
|
|
929
|
-
}
|
|
930
|
-
};
|
|
931
|
-
const readImageDataFromSelection = (editor) => {
|
|
932
|
-
const image = getSelectedImage(editor);
|
|
933
|
-
return image ? read((css) => normalizeCss$1(editor, css), image) : defaultData();
|
|
934
|
-
};
|
|
935
|
-
const insertImageAtCaret = (editor, data) => {
|
|
936
|
-
const elm = create((css) => normalizeCss$1(editor, css), data);
|
|
937
|
-
editor.dom.setAttrib(elm, 'data-mce-id', '__mcenew');
|
|
938
|
-
editor.focus();
|
|
939
|
-
editor.insertContent(elm.outerHTML);
|
|
940
|
-
const insertedElm = editor.dom.select('*[data-mce-id="__mcenew"]')[0];
|
|
941
|
-
editor.dom.setAttrib(insertedElm, 'data-mce-id', null);
|
|
942
|
-
if (isFigure(insertedElm)) {
|
|
943
|
-
const figure = splitTextBlock(editor, insertedElm);
|
|
944
|
-
editor.selection.select(figure);
|
|
945
|
-
}
|
|
946
|
-
else {
|
|
947
|
-
editor.selection.select(insertedElm);
|
|
948
|
-
}
|
|
949
|
-
};
|
|
950
|
-
const syncSrcAttr = (editor, image) => {
|
|
951
|
-
editor.dom.setAttrib(image, 'src', image.getAttribute('src'));
|
|
952
|
-
};
|
|
953
|
-
const deleteImage = (editor, image) => {
|
|
954
|
-
if (image) {
|
|
955
|
-
const elm = editor.dom.is(image.parentNode, 'figure.image') ? image.parentNode : image;
|
|
956
|
-
editor.dom.remove(elm);
|
|
957
|
-
editor.focus();
|
|
958
|
-
editor.nodeChanged();
|
|
959
|
-
if (editor.dom.isEmpty(editor.getBody())) {
|
|
960
|
-
editor.setContent('');
|
|
961
|
-
editor.selection.setCursorLocation();
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
};
|
|
965
|
-
const writeImageDataToSelection = (editor, data) => {
|
|
966
|
-
const image = getSelectedImage(editor);
|
|
967
|
-
if (image) {
|
|
968
|
-
write((css) => normalizeCss$1(editor, css), data, image);
|
|
969
|
-
syncSrcAttr(editor, image);
|
|
970
|
-
if (isFigure(image.parentNode)) {
|
|
971
|
-
editor.dom.setStyle(image, 'float', '');
|
|
972
|
-
const figure = image.parentNode;
|
|
973
|
-
splitTextBlock(editor, figure);
|
|
974
|
-
editor.selection.select(image.parentNode);
|
|
975
|
-
}
|
|
976
|
-
else {
|
|
977
|
-
editor.selection.select(image);
|
|
978
|
-
waitLoadImage(editor, data, image);
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
};
|
|
982
|
-
const sanitizeImageData = (editor, data) => {
|
|
983
|
-
// Sanitize the URL
|
|
984
|
-
const src = data.src;
|
|
985
|
-
return {
|
|
986
|
-
...data,
|
|
987
|
-
src: isSafeImageUrl(editor, src) ? src : ''
|
|
988
|
-
};
|
|
989
|
-
};
|
|
990
|
-
const insertOrUpdateImage = (editor, partialData) => {
|
|
991
|
-
const image = getSelectedImage(editor);
|
|
992
|
-
if (image) {
|
|
993
|
-
const selectedImageData = read((css) => normalizeCss$1(editor, css), image);
|
|
994
|
-
const data = { ...selectedImageData, ...partialData };
|
|
995
|
-
const sanitizedData = sanitizeImageData(editor, data);
|
|
996
|
-
if (data.src) {
|
|
997
|
-
writeImageDataToSelection(editor, sanitizedData);
|
|
998
|
-
}
|
|
999
|
-
else {
|
|
1000
|
-
deleteImage(editor, image);
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
else if (partialData.src) {
|
|
1004
|
-
insertImageAtCaret(editor, { ...defaultData(), ...partialData });
|
|
1005
|
-
}
|
|
1006
|
-
};
|
|
1007
|
-
|
|
1008
|
-
var global$1 = tinymce.util.Tools.resolve('tinymce.util.ImageUploader');
|
|
1009
|
-
|
|
1010
|
-
var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
1011
|
-
|
|
1012
|
-
const getValue = (item) => isString(item.value) ? item.value : '';
|
|
1013
|
-
const getText = (item) => {
|
|
1014
|
-
if (isString(item.text)) {
|
|
1015
|
-
return item.text;
|
|
1016
|
-
}
|
|
1017
|
-
else if (isString(item.title)) {
|
|
1018
|
-
return item.title;
|
|
1019
|
-
}
|
|
1020
|
-
else {
|
|
1021
|
-
return '';
|
|
1022
|
-
}
|
|
1023
|
-
};
|
|
1024
|
-
const sanitizeList = (list, extractValue) => {
|
|
1025
|
-
const out = [];
|
|
1026
|
-
global.each(list, (item) => {
|
|
1027
|
-
const text = getText(item);
|
|
1028
|
-
if (item.menu !== undefined) {
|
|
1029
|
-
const items = sanitizeList(item.menu, extractValue);
|
|
1030
|
-
out.push({ text, items }); // list group
|
|
1031
|
-
}
|
|
1032
|
-
else {
|
|
1033
|
-
const value = extractValue(item);
|
|
1034
|
-
out.push({ text, value }); // list value
|
|
1035
|
-
}
|
|
1036
|
-
});
|
|
1037
|
-
return out;
|
|
1038
|
-
};
|
|
1039
|
-
const sanitizer = (extractor = getValue) => (list) => {
|
|
1040
|
-
if (list) {
|
|
1041
|
-
return Optional.from(list).map((list) => sanitizeList(list, extractor));
|
|
1042
|
-
}
|
|
1043
|
-
else {
|
|
1044
|
-
return Optional.none();
|
|
1045
|
-
}
|
|
1046
|
-
};
|
|
1047
|
-
const sanitize = (list) => sanitizer(getValue)(list);
|
|
1048
|
-
const isGroup = (item) => has(item, 'items');
|
|
1049
|
-
const findEntryDelegate = (list, value) => findMap(list, (item) => {
|
|
1050
|
-
if (isGroup(item)) {
|
|
1051
|
-
return findEntryDelegate(item.items, value);
|
|
1052
|
-
}
|
|
1053
|
-
else if (item.value === value) {
|
|
1054
|
-
return Optional.some(item);
|
|
1055
|
-
}
|
|
1056
|
-
else {
|
|
1057
|
-
return Optional.none();
|
|
1058
|
-
}
|
|
1059
|
-
});
|
|
1060
|
-
const findEntry = (optList, value) => optList.bind((list) => findEntryDelegate(list, value));
|
|
1061
|
-
const ListUtils = {
|
|
1062
|
-
sanitizer,
|
|
1063
|
-
sanitize,
|
|
1064
|
-
findEntry
|
|
1065
|
-
};
|
|
1066
|
-
|
|
1067
|
-
const makeTab$2 = (_info) => ({
|
|
1068
|
-
title: 'Advanced',
|
|
1069
|
-
name: 'advanced',
|
|
1070
|
-
items: [
|
|
1071
|
-
{
|
|
1072
|
-
type: 'grid',
|
|
1073
|
-
columns: 2,
|
|
1074
|
-
items: [
|
|
1075
|
-
{
|
|
1076
|
-
type: 'input',
|
|
1077
|
-
label: 'Vertical space',
|
|
1078
|
-
name: 'vspace',
|
|
1079
|
-
inputMode: 'numeric'
|
|
1080
|
-
},
|
|
1081
|
-
{
|
|
1082
|
-
type: 'input',
|
|
1083
|
-
label: 'Horizontal space',
|
|
1084
|
-
name: 'hspace',
|
|
1085
|
-
inputMode: 'numeric'
|
|
1086
|
-
},
|
|
1087
|
-
{
|
|
1088
|
-
type: 'input',
|
|
1089
|
-
label: 'Border width',
|
|
1090
|
-
name: 'border',
|
|
1091
|
-
inputMode: 'numeric'
|
|
1092
|
-
},
|
|
1093
|
-
{
|
|
1094
|
-
type: 'listbox',
|
|
1095
|
-
name: 'borderstyle',
|
|
1096
|
-
label: 'Border style',
|
|
1097
|
-
items: [
|
|
1098
|
-
{ text: 'Select...', value: '' },
|
|
1099
|
-
{ text: 'Solid', value: 'solid' },
|
|
1100
|
-
{ text: 'Dotted', value: 'dotted' },
|
|
1101
|
-
{ text: 'Dashed', value: 'dashed' },
|
|
1102
|
-
{ text: 'Double', value: 'double' },
|
|
1103
|
-
{ text: 'Groove', value: 'groove' },
|
|
1104
|
-
{ text: 'Ridge', value: 'ridge' },
|
|
1105
|
-
{ text: 'Inset', value: 'inset' },
|
|
1106
|
-
{ text: 'Outset', value: 'outset' },
|
|
1107
|
-
{ text: 'None', value: 'none' },
|
|
1108
|
-
{ text: 'Hidden', value: 'hidden' }
|
|
1109
|
-
]
|
|
1110
|
-
}
|
|
1111
|
-
]
|
|
1112
|
-
}
|
|
1113
|
-
]
|
|
1114
|
-
});
|
|
1115
|
-
const AdvTab = {
|
|
1116
|
-
makeTab: makeTab$2
|
|
1117
|
-
};
|
|
1118
|
-
|
|
1119
|
-
const collect = (editor) => {
|
|
1120
|
-
const urlListSanitizer = ListUtils.sanitizer((item) => editor.convertURL(item.value || item.url || '', 'src'));
|
|
1121
|
-
const futureImageList = new Promise((completer) => {
|
|
1122
|
-
createImageList(editor, (imageList) => {
|
|
1123
|
-
completer(urlListSanitizer(imageList).map((items) => flatten([
|
|
1124
|
-
[{ text: 'None', value: '' }],
|
|
1125
|
-
items
|
|
1126
|
-
])));
|
|
1127
|
-
});
|
|
1128
|
-
});
|
|
1129
|
-
const classList = ListUtils.sanitize(getClassList(editor));
|
|
1130
|
-
const hasAdvTab$1 = hasAdvTab(editor);
|
|
1131
|
-
const hasUploadTab$1 = hasUploadTab(editor);
|
|
1132
|
-
const hasUploadUrl$1 = hasUploadUrl(editor);
|
|
1133
|
-
const hasUploadHandler$1 = hasUploadHandler(editor);
|
|
1134
|
-
const image = readImageDataFromSelection(editor);
|
|
1135
|
-
const hasDescription$1 = hasDescription(editor);
|
|
1136
|
-
const hasImageTitle$1 = hasImageTitle(editor);
|
|
1137
|
-
const hasDimensions$1 = hasDimensions(editor);
|
|
1138
|
-
const hasImageCaption$1 = hasImageCaption(editor);
|
|
1139
|
-
const hasAccessibilityOptions = showAccessibilityOptions(editor);
|
|
1140
|
-
const automaticUploads = isAutomaticUploadsEnabled(editor);
|
|
1141
|
-
const prependURL = Optional.some(getPrependUrl(editor)).filter((preUrl) => isString(preUrl) && preUrl.length > 0);
|
|
1142
|
-
return futureImageList.then((imageList) => ({
|
|
1143
|
-
image,
|
|
1144
|
-
imageList,
|
|
1145
|
-
classList,
|
|
1146
|
-
hasAdvTab: hasAdvTab$1,
|
|
1147
|
-
hasUploadTab: hasUploadTab$1,
|
|
1148
|
-
hasUploadUrl: hasUploadUrl$1,
|
|
1149
|
-
hasUploadHandler: hasUploadHandler$1,
|
|
1150
|
-
hasDescription: hasDescription$1,
|
|
1151
|
-
hasImageTitle: hasImageTitle$1,
|
|
1152
|
-
hasDimensions: hasDimensions$1,
|
|
1153
|
-
hasImageCaption: hasImageCaption$1,
|
|
1154
|
-
prependURL,
|
|
1155
|
-
hasAccessibilityOptions,
|
|
1156
|
-
automaticUploads
|
|
1157
|
-
}));
|
|
1158
|
-
};
|
|
1159
|
-
|
|
1160
|
-
const makeItems = (info) => {
|
|
1161
|
-
const imageUrl = {
|
|
1162
|
-
name: 'src',
|
|
1163
|
-
type: 'urlinput',
|
|
1164
|
-
filetype: 'image',
|
|
1165
|
-
label: 'Source',
|
|
1166
|
-
picker_text: 'Browse files'
|
|
1167
|
-
};
|
|
1168
|
-
const imageList = info.imageList.map((items) => ({
|
|
1169
|
-
name: 'images',
|
|
1170
|
-
type: 'listbox',
|
|
1171
|
-
label: 'Image list',
|
|
1172
|
-
items
|
|
1173
|
-
}));
|
|
1174
|
-
const imageDescription = {
|
|
1175
|
-
name: 'alt',
|
|
1176
|
-
type: 'input',
|
|
1177
|
-
label: 'Alternative description',
|
|
1178
|
-
enabled: !(info.hasAccessibilityOptions && info.image.isDecorative)
|
|
1179
|
-
};
|
|
1180
|
-
const imageTitle = {
|
|
1181
|
-
name: 'title',
|
|
1182
|
-
type: 'input',
|
|
1183
|
-
label: 'Image title'
|
|
1184
|
-
};
|
|
1185
|
-
const imageDimensions = {
|
|
1186
|
-
name: 'dimensions',
|
|
1187
|
-
type: 'sizeinput'
|
|
1188
|
-
};
|
|
1189
|
-
const isDecorative = {
|
|
1190
|
-
type: 'label',
|
|
1191
|
-
label: 'Accessibility',
|
|
1192
|
-
items: [{
|
|
1193
|
-
name: 'isDecorative',
|
|
1194
|
-
type: 'checkbox',
|
|
1195
|
-
label: 'Image is decorative'
|
|
1196
|
-
}]
|
|
1197
|
-
};
|
|
1198
|
-
// TODO: the original listbox supported styled items but bridge does not seem to support this
|
|
1199
|
-
const classList = info.classList.map((items) => ({
|
|
1200
|
-
name: 'classes',
|
|
1201
|
-
type: 'listbox',
|
|
1202
|
-
label: 'Class',
|
|
1203
|
-
items
|
|
1204
|
-
}));
|
|
1205
|
-
const caption = {
|
|
1206
|
-
type: 'label',
|
|
1207
|
-
label: 'Caption',
|
|
1208
|
-
items: [
|
|
1209
|
-
{
|
|
1210
|
-
type: 'checkbox',
|
|
1211
|
-
name: 'caption',
|
|
1212
|
-
label: 'Show caption'
|
|
1213
|
-
}
|
|
1214
|
-
]
|
|
1215
|
-
};
|
|
1216
|
-
const getDialogContainerType = (useColumns) => useColumns ? { type: 'grid', columns: 2 } : { type: 'panel' };
|
|
1217
|
-
return flatten([
|
|
1218
|
-
[imageUrl],
|
|
1219
|
-
imageList.toArray(),
|
|
1220
|
-
info.hasAccessibilityOptions && info.hasDescription ? [isDecorative] : [],
|
|
1221
|
-
info.hasDescription ? [imageDescription] : [],
|
|
1222
|
-
info.hasImageTitle ? [imageTitle] : [],
|
|
1223
|
-
info.hasDimensions ? [imageDimensions] : [],
|
|
1224
|
-
[{
|
|
1225
|
-
...getDialogContainerType(info.classList.isSome() && info.hasImageCaption),
|
|
1226
|
-
items: flatten([
|
|
1227
|
-
classList.toArray(),
|
|
1228
|
-
info.hasImageCaption ? [caption] : []
|
|
1229
|
-
])
|
|
1230
|
-
}]
|
|
1231
|
-
]);
|
|
1232
|
-
};
|
|
1233
|
-
const makeTab$1 = (info) => ({
|
|
1234
|
-
title: 'General',
|
|
1235
|
-
name: 'general',
|
|
1236
|
-
items: makeItems(info)
|
|
1237
|
-
});
|
|
1238
|
-
const MainTab = {
|
|
1239
|
-
makeTab: makeTab$1,
|
|
1240
|
-
makeItems
|
|
1241
|
-
};
|
|
1242
|
-
|
|
1243
|
-
const makeTab = (_info) => {
|
|
1244
|
-
const items = [
|
|
1245
|
-
{
|
|
1246
|
-
type: 'dropzone',
|
|
1247
|
-
name: 'fileinput'
|
|
1248
|
-
}
|
|
1249
|
-
];
|
|
1250
|
-
return {
|
|
1251
|
-
title: 'Upload',
|
|
1252
|
-
name: 'upload',
|
|
1253
|
-
items
|
|
1254
|
-
};
|
|
1255
|
-
};
|
|
1256
|
-
const UploadTab = {
|
|
1257
|
-
makeTab
|
|
1258
|
-
};
|
|
1259
|
-
|
|
1260
|
-
const createState = (info) => ({
|
|
1261
|
-
prevImage: ListUtils.findEntry(info.imageList, info.image.src),
|
|
1262
|
-
prevAlt: info.image.alt,
|
|
1263
|
-
open: true
|
|
1264
|
-
});
|
|
1265
|
-
const fromImageData = (image) => ({
|
|
1266
|
-
src: {
|
|
1267
|
-
value: image.src,
|
|
1268
|
-
meta: {}
|
|
1269
|
-
},
|
|
1270
|
-
images: image.src,
|
|
1271
|
-
alt: image.alt,
|
|
1272
|
-
title: image.title,
|
|
1273
|
-
dimensions: {
|
|
1274
|
-
width: image.width,
|
|
1275
|
-
height: image.height
|
|
1276
|
-
},
|
|
1277
|
-
classes: image.class,
|
|
1278
|
-
caption: image.caption,
|
|
1279
|
-
style: image.style,
|
|
1280
|
-
vspace: image.vspace,
|
|
1281
|
-
border: image.border,
|
|
1282
|
-
hspace: image.hspace,
|
|
1283
|
-
borderstyle: image.borderStyle,
|
|
1284
|
-
fileinput: [],
|
|
1285
|
-
isDecorative: image.isDecorative
|
|
1286
|
-
});
|
|
1287
|
-
const toImageData = (data, removeEmptyAlt) => ({
|
|
1288
|
-
src: data.src.value,
|
|
1289
|
-
alt: (data.alt === null || data.alt.length === 0) && removeEmptyAlt ? null : data.alt,
|
|
1290
|
-
title: data.title,
|
|
1291
|
-
width: data.dimensions.width,
|
|
1292
|
-
height: data.dimensions.height,
|
|
1293
|
-
class: data.classes,
|
|
1294
|
-
style: data.style,
|
|
1295
|
-
caption: data.caption,
|
|
1296
|
-
hspace: data.hspace,
|
|
1297
|
-
vspace: data.vspace,
|
|
1298
|
-
border: data.border,
|
|
1299
|
-
borderStyle: data.borderstyle,
|
|
1300
|
-
isDecorative: data.isDecorative
|
|
1301
|
-
});
|
|
1302
|
-
const addPrependUrl2 = (info, srcURL) => {
|
|
1303
|
-
// Add the prependURL
|
|
1304
|
-
if (!/^(?:[a-zA-Z]+:)?\/\//.test(srcURL)) {
|
|
1305
|
-
return info.prependURL.bind((prependUrl) => {
|
|
1306
|
-
if (srcURL.substring(0, prependUrl.length) !== prependUrl) {
|
|
1307
|
-
return Optional.some(prependUrl + srcURL);
|
|
1308
|
-
}
|
|
1309
|
-
return Optional.none();
|
|
1310
|
-
});
|
|
1311
|
-
}
|
|
1312
|
-
return Optional.none();
|
|
1313
|
-
};
|
|
1314
|
-
const addPrependUrl = (info, api) => {
|
|
1315
|
-
const data = api.getData();
|
|
1316
|
-
addPrependUrl2(info, data.src.value).each((srcURL) => {
|
|
1317
|
-
api.setData({ src: { value: srcURL, meta: data.src.meta } });
|
|
1318
|
-
});
|
|
1319
|
-
};
|
|
1320
|
-
const formFillFromMeta2 = (info, data, meta) => {
|
|
1321
|
-
if (info.hasDescription && isString(meta.alt)) {
|
|
1322
|
-
data.alt = meta.alt;
|
|
1323
|
-
}
|
|
1324
|
-
if (info.hasAccessibilityOptions) {
|
|
1325
|
-
data.isDecorative = meta.isDecorative || data.isDecorative || false;
|
|
1326
|
-
}
|
|
1327
|
-
if (info.hasImageTitle && isString(meta.title)) {
|
|
1328
|
-
data.title = meta.title;
|
|
1329
|
-
}
|
|
1330
|
-
if (info.hasDimensions) {
|
|
1331
|
-
if (isString(meta.width)) {
|
|
1332
|
-
data.dimensions.width = meta.width;
|
|
1333
|
-
}
|
|
1334
|
-
if (isString(meta.height)) {
|
|
1335
|
-
data.dimensions.height = meta.height;
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
if (isString(meta.class)) {
|
|
1339
|
-
ListUtils.findEntry(info.classList, meta.class).each((entry) => {
|
|
1340
|
-
data.classes = entry.value;
|
|
1341
|
-
});
|
|
1342
|
-
}
|
|
1343
|
-
if (info.hasImageCaption) {
|
|
1344
|
-
if (isBoolean(meta.caption)) {
|
|
1345
|
-
data.caption = meta.caption;
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
if (info.hasAdvTab) {
|
|
1349
|
-
if (isString(meta.style)) {
|
|
1350
|
-
data.style = meta.style;
|
|
1351
|
-
}
|
|
1352
|
-
if (isString(meta.vspace)) {
|
|
1353
|
-
data.vspace = meta.vspace;
|
|
1354
|
-
}
|
|
1355
|
-
if (isString(meta.border)) {
|
|
1356
|
-
data.border = meta.border;
|
|
1357
|
-
}
|
|
1358
|
-
if (isString(meta.hspace)) {
|
|
1359
|
-
data.hspace = meta.hspace;
|
|
1360
|
-
}
|
|
1361
|
-
if (isString(meta.borderstyle)) {
|
|
1362
|
-
data.borderstyle = meta.borderstyle;
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
};
|
|
1366
|
-
const formFillFromMeta = (info, api) => {
|
|
1367
|
-
const data = api.getData();
|
|
1368
|
-
const meta = data.src.meta;
|
|
1369
|
-
if (meta !== undefined) {
|
|
1370
|
-
const newData = deepMerge({}, data);
|
|
1371
|
-
formFillFromMeta2(info, newData, meta);
|
|
1372
|
-
api.setData(newData);
|
|
1373
|
-
}
|
|
1374
|
-
};
|
|
1375
|
-
const calculateImageSize = (helpers, info, state, api) => {
|
|
1376
|
-
const data = api.getData();
|
|
1377
|
-
const url = data.src.value;
|
|
1378
|
-
const meta = data.src.meta || {};
|
|
1379
|
-
if (!meta.width && !meta.height && info.hasDimensions) {
|
|
1380
|
-
if (isNotEmpty(url)) {
|
|
1381
|
-
helpers.imageSize(url)
|
|
1382
|
-
.then((size) => {
|
|
1383
|
-
if (state.open) {
|
|
1384
|
-
api.setData({ dimensions: size });
|
|
1385
|
-
}
|
|
1386
|
-
})
|
|
1387
|
-
// eslint-disable-next-line no-console
|
|
1388
|
-
.catch((e) => console.error(e));
|
|
1389
|
-
}
|
|
1390
|
-
else {
|
|
1391
|
-
api.setData({ dimensions: { width: '', height: '' } });
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
};
|
|
1395
|
-
const updateImagesDropdown = (info, state, api) => {
|
|
1396
|
-
const data = api.getData();
|
|
1397
|
-
const image = ListUtils.findEntry(info.imageList, data.src.value);
|
|
1398
|
-
state.prevImage = image;
|
|
1399
|
-
api.setData({ images: image.map((entry) => entry.value).getOr('') });
|
|
1400
|
-
};
|
|
1401
|
-
const changeSrc = (helpers, info, state, api) => {
|
|
1402
|
-
addPrependUrl(info, api);
|
|
1403
|
-
formFillFromMeta(info, api);
|
|
1404
|
-
calculateImageSize(helpers, info, state, api);
|
|
1405
|
-
updateImagesDropdown(info, state, api);
|
|
1406
|
-
};
|
|
1407
|
-
const changeImages = (helpers, info, state, api) => {
|
|
1408
|
-
const data = api.getData();
|
|
1409
|
-
const image = ListUtils.findEntry(info.imageList, data.images);
|
|
1410
|
-
image.each((img) => {
|
|
1411
|
-
const updateAlt = data.alt === '' || state.prevImage.map((image) => image.text === data.alt).getOr(false);
|
|
1412
|
-
if (updateAlt) {
|
|
1413
|
-
if (img.value === '') {
|
|
1414
|
-
api.setData({ src: img, alt: state.prevAlt });
|
|
1415
|
-
}
|
|
1416
|
-
else {
|
|
1417
|
-
api.setData({ src: img, alt: img.text });
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
else {
|
|
1421
|
-
api.setData({ src: img });
|
|
1422
|
-
}
|
|
1423
|
-
});
|
|
1424
|
-
state.prevImage = image;
|
|
1425
|
-
changeSrc(helpers, info, state, api);
|
|
1426
|
-
};
|
|
1427
|
-
const changeFileInput = (helpers, info, state, api) => {
|
|
1428
|
-
const data = api.getData();
|
|
1429
|
-
api.block('Uploading image'); // What msg do we pass to the lock?
|
|
1430
|
-
head(data.fileinput)
|
|
1431
|
-
.fold(() => {
|
|
1432
|
-
api.unblock();
|
|
1433
|
-
}, (file) => {
|
|
1434
|
-
const blobUri = URL.createObjectURL(file);
|
|
1435
|
-
const finalize = () => {
|
|
1436
|
-
api.unblock();
|
|
1437
|
-
URL.revokeObjectURL(blobUri);
|
|
1438
|
-
};
|
|
1439
|
-
const updateSrcAndSwitchTab = (url) => {
|
|
1440
|
-
api.setData({ src: { value: url, meta: {} } });
|
|
1441
|
-
api.showTab('general');
|
|
1442
|
-
changeSrc(helpers, info, state, api);
|
|
1443
|
-
api.focus('src');
|
|
1444
|
-
};
|
|
1445
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1446
|
-
blobToDataUri(file).then((dataUrl) => {
|
|
1447
|
-
const blobInfo = helpers.createBlobCache(file, blobUri, dataUrl);
|
|
1448
|
-
if (info.automaticUploads) {
|
|
1449
|
-
helpers.uploadImage(blobInfo).then((result) => {
|
|
1450
|
-
updateSrcAndSwitchTab(result.url);
|
|
1451
|
-
finalize();
|
|
1452
|
-
}).catch((err) => {
|
|
1453
|
-
finalize();
|
|
1454
|
-
helpers.alertErr(err, () => {
|
|
1455
|
-
api.focus('fileinput');
|
|
1456
|
-
});
|
|
1457
|
-
});
|
|
1458
|
-
}
|
|
1459
|
-
else {
|
|
1460
|
-
helpers.addToBlobCache(blobInfo);
|
|
1461
|
-
updateSrcAndSwitchTab(blobInfo.blobUri());
|
|
1462
|
-
api.unblock();
|
|
1463
|
-
}
|
|
1464
|
-
});
|
|
1465
|
-
});
|
|
1466
|
-
};
|
|
1467
|
-
const changeHandler = (helpers, info, state) => (api, evt) => {
|
|
1468
|
-
if (evt.name === 'src') {
|
|
1469
|
-
changeSrc(helpers, info, state, api);
|
|
1470
|
-
}
|
|
1471
|
-
else if (evt.name === 'images') {
|
|
1472
|
-
changeImages(helpers, info, state, api);
|
|
1473
|
-
}
|
|
1474
|
-
else if (evt.name === 'alt') {
|
|
1475
|
-
state.prevAlt = api.getData().alt;
|
|
1476
|
-
}
|
|
1477
|
-
else if (evt.name === 'fileinput') {
|
|
1478
|
-
changeFileInput(helpers, info, state, api);
|
|
1479
|
-
}
|
|
1480
|
-
else if (evt.name === 'isDecorative') {
|
|
1481
|
-
api.setEnabled('alt', !api.getData().isDecorative);
|
|
1482
|
-
}
|
|
1483
|
-
};
|
|
1484
|
-
const closeHandler = (state) => () => {
|
|
1485
|
-
state.open = false;
|
|
1486
|
-
};
|
|
1487
|
-
const makeDialogBody = (info) => {
|
|
1488
|
-
if (info.hasAdvTab || info.hasUploadUrl || info.hasUploadHandler) {
|
|
1489
|
-
const tabPanel = {
|
|
1490
|
-
type: 'tabpanel',
|
|
1491
|
-
tabs: flatten([
|
|
1492
|
-
[MainTab.makeTab(info)],
|
|
1493
|
-
info.hasAdvTab ? [AdvTab.makeTab(info)] : [],
|
|
1494
|
-
info.hasUploadTab && (info.hasUploadUrl || info.hasUploadHandler) ? [UploadTab.makeTab(info)] : []
|
|
1495
|
-
])
|
|
1496
|
-
};
|
|
1497
|
-
return tabPanel;
|
|
1498
|
-
}
|
|
1499
|
-
else {
|
|
1500
|
-
const panel = {
|
|
1501
|
-
type: 'panel',
|
|
1502
|
-
items: MainTab.makeItems(info)
|
|
1503
|
-
};
|
|
1504
|
-
return panel;
|
|
1505
|
-
}
|
|
1506
|
-
};
|
|
1507
|
-
const submitHandler = (editor, info, helpers) => (api) => {
|
|
1508
|
-
const data = deepMerge(fromImageData(info.image), api.getData());
|
|
1509
|
-
// The data architecture relies on passing everything through the style field for validation.
|
|
1510
|
-
// Since the style field was removed that process must be simulated on submit.
|
|
1511
|
-
const finalData = {
|
|
1512
|
-
...data,
|
|
1513
|
-
style: getStyleValue(helpers.normalizeCss, toImageData(data, false))
|
|
1514
|
-
};
|
|
1515
|
-
editor.execCommand('mceUpdateImage', false, toImageData(finalData, info.hasAccessibilityOptions));
|
|
1516
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1517
|
-
editor.editorUpload.uploadImagesAuto();
|
|
1518
|
-
api.close();
|
|
1519
|
-
};
|
|
1520
|
-
const imageSize = (editor) => (url) => {
|
|
1521
|
-
// If the URL isn't safe then don't attempt to load it to get the sizes
|
|
1522
|
-
if (!isSafeImageUrl(editor, url)) {
|
|
1523
|
-
return Promise.resolve({ width: '', height: '' });
|
|
1524
|
-
}
|
|
1525
|
-
else {
|
|
1526
|
-
return getImageSize(editor.documentBaseURI.toAbsolute(url)).then((dimensions) => ({
|
|
1527
|
-
width: String(dimensions.width),
|
|
1528
|
-
height: String(dimensions.height)
|
|
1529
|
-
}));
|
|
1530
|
-
}
|
|
1531
|
-
};
|
|
1532
|
-
const createBlobCache = (editor) => (file, blobUri, dataUrl) => editor.editorUpload.blobCache.create({
|
|
1533
|
-
blob: file,
|
|
1534
|
-
blobUri,
|
|
1535
|
-
name: file.name?.replace(/\.[^\.]+$/, ''),
|
|
1536
|
-
filename: file.name,
|
|
1537
|
-
base64: dataUrl.split(',')[1]
|
|
1538
|
-
});
|
|
1539
|
-
const addToBlobCache = (editor) => (blobInfo) => {
|
|
1540
|
-
editor.editorUpload.blobCache.add(blobInfo);
|
|
1541
|
-
};
|
|
1542
|
-
const alertErr = (editor) => (message, callback) => {
|
|
1543
|
-
editor.windowManager.alert(message, callback);
|
|
1544
|
-
};
|
|
1545
|
-
const normalizeCss = (editor) => (cssText) => normalizeCss$1(editor, cssText);
|
|
1546
|
-
const parseStyle = (editor) => (cssText) => editor.dom.parseStyle(cssText);
|
|
1547
|
-
const serializeStyle = (editor) => (stylesArg, name) => editor.dom.serializeStyle(stylesArg, name);
|
|
1548
|
-
const uploadImage = (editor) => (blobInfo) => global$1(editor).upload([blobInfo], false).then((results) => {
|
|
1549
|
-
if (results.length === 0) {
|
|
1550
|
-
return Promise.reject('Failed to upload image');
|
|
1551
|
-
}
|
|
1552
|
-
else if (results[0].status === false) {
|
|
1553
|
-
return Promise.reject(results[0].error?.message);
|
|
1554
|
-
}
|
|
1555
|
-
else {
|
|
1556
|
-
return results[0];
|
|
1557
|
-
}
|
|
1558
|
-
});
|
|
1559
|
-
const Dialog = (editor) => {
|
|
1560
|
-
const helpers = {
|
|
1561
|
-
imageSize: imageSize(editor),
|
|
1562
|
-
addToBlobCache: addToBlobCache(editor),
|
|
1563
|
-
createBlobCache: createBlobCache(editor),
|
|
1564
|
-
alertErr: alertErr(editor),
|
|
1565
|
-
normalizeCss: normalizeCss(editor),
|
|
1566
|
-
parseStyle: parseStyle(editor),
|
|
1567
|
-
serializeStyle: serializeStyle(editor),
|
|
1568
|
-
uploadImage: uploadImage(editor)
|
|
1569
|
-
};
|
|
1570
|
-
const open = () => {
|
|
1571
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1572
|
-
collect(editor)
|
|
1573
|
-
.then((info) => {
|
|
1574
|
-
const state = createState(info);
|
|
1575
|
-
return {
|
|
1576
|
-
title: 'Insert/Edit Image',
|
|
1577
|
-
size: 'normal',
|
|
1578
|
-
body: makeDialogBody(info),
|
|
1579
|
-
buttons: [
|
|
1580
|
-
{
|
|
1581
|
-
type: 'cancel',
|
|
1582
|
-
name: 'cancel',
|
|
1583
|
-
text: 'Cancel'
|
|
1584
|
-
},
|
|
1585
|
-
{
|
|
1586
|
-
type: 'submit',
|
|
1587
|
-
name: 'save',
|
|
1588
|
-
text: 'Save',
|
|
1589
|
-
primary: true
|
|
1590
|
-
}
|
|
1591
|
-
],
|
|
1592
|
-
initialData: fromImageData(info.image),
|
|
1593
|
-
onSubmit: submitHandler(editor, info, helpers),
|
|
1594
|
-
onChange: changeHandler(helpers, info, state),
|
|
1595
|
-
onClose: closeHandler(state)
|
|
1596
|
-
};
|
|
1597
|
-
})
|
|
1598
|
-
.then(editor.windowManager.open);
|
|
1599
|
-
};
|
|
1600
|
-
return {
|
|
1601
|
-
open
|
|
1602
|
-
};
|
|
1603
|
-
};
|
|
1604
|
-
|
|
1605
|
-
const register$1 = (editor) => {
|
|
1606
|
-
editor.addCommand('mceImage', Dialog(editor).open);
|
|
1607
|
-
// TODO: This command is likely to be short lived we only need it until we expose the rtc model though a new api so it shouldn't be documented
|
|
1608
|
-
// it's just a command since that is a convenient method for the rtc plugin to override the default dom mutation behaviour
|
|
1609
|
-
editor.addCommand('mceUpdateImage', (_ui, data) => {
|
|
1610
|
-
editor.undoManager.transact(() => insertOrUpdateImage(editor, data));
|
|
1611
|
-
});
|
|
1612
|
-
};
|
|
1613
|
-
|
|
1614
|
-
const hasImageClass = (node) => {
|
|
1615
|
-
const className = node.attr('class');
|
|
1616
|
-
return isNonNullable(className) && /\bimage\b/.test(className);
|
|
1617
|
-
};
|
|
1618
|
-
const toggleContentEditableState = (state) => (nodes) => {
|
|
1619
|
-
let i = nodes.length;
|
|
1620
|
-
const toggleContentEditable = (node) => {
|
|
1621
|
-
node.attr('contenteditable', state ? 'true' : null);
|
|
1622
|
-
};
|
|
1623
|
-
while (i--) {
|
|
1624
|
-
const node = nodes[i];
|
|
1625
|
-
if (hasImageClass(node)) {
|
|
1626
|
-
node.attr('contenteditable', state ? 'false' : null);
|
|
1627
|
-
global.each(node.getAll('figcaption'), toggleContentEditable);
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
};
|
|
1631
|
-
const setup = (editor) => {
|
|
1632
|
-
editor.on('PreInit', () => {
|
|
1633
|
-
editor.parser.addNodeFilter('figure', toggleContentEditableState(true));
|
|
1634
|
-
editor.serializer.addNodeFilter('figure', toggleContentEditableState(false));
|
|
1635
|
-
});
|
|
1636
|
-
};
|
|
1637
|
-
|
|
1638
|
-
const onSetupEditable = (editor) => (api) => {
|
|
1639
|
-
const nodeChanged = () => {
|
|
1640
|
-
api.setEnabled(editor.selection.isEditable());
|
|
1641
|
-
};
|
|
1642
|
-
editor.on('NodeChange', nodeChanged);
|
|
1643
|
-
nodeChanged();
|
|
1644
|
-
return () => {
|
|
1645
|
-
editor.off('NodeChange', nodeChanged);
|
|
1646
|
-
};
|
|
1647
|
-
};
|
|
1648
|
-
const register = (editor) => {
|
|
1649
|
-
editor.ui.registry.addToggleButton('image', {
|
|
1650
|
-
icon: 'image',
|
|
1651
|
-
tooltip: 'Insert/edit image',
|
|
1652
|
-
onAction: Dialog(editor).open,
|
|
1653
|
-
onSetup: (buttonApi) => {
|
|
1654
|
-
// Set the initial state and then bind to selection changes to update the state when the selection changes
|
|
1655
|
-
buttonApi.setActive(isNonNullable(getSelectedImage(editor)));
|
|
1656
|
-
const unbindSelectorChanged = editor.selection.selectorChangedWithUnbind('img:not([data-mce-object]):not([data-mce-placeholder]),figure.image', buttonApi.setActive).unbind;
|
|
1657
|
-
const unbindEditable = onSetupEditable(editor)(buttonApi);
|
|
1658
|
-
return () => {
|
|
1659
|
-
unbindSelectorChanged();
|
|
1660
|
-
unbindEditable();
|
|
1661
|
-
};
|
|
1662
|
-
}
|
|
1663
|
-
});
|
|
1664
|
-
editor.ui.registry.addMenuItem('image', {
|
|
1665
|
-
icon: 'image',
|
|
1666
|
-
text: 'Image...',
|
|
1667
|
-
onAction: Dialog(editor).open,
|
|
1668
|
-
onSetup: onSetupEditable(editor)
|
|
1669
|
-
});
|
|
1670
|
-
editor.ui.registry.addContextMenu('image', {
|
|
1671
|
-
update: (element) => editor.selection.isEditable() && (isFigure(element) || (isImage(element) && !isPlaceholderImage(element))) ? ['image'] : []
|
|
1672
|
-
});
|
|
1673
|
-
};
|
|
1674
|
-
|
|
1675
|
-
var Plugin = () => {
|
|
1676
|
-
global$4.add('image', (editor) => {
|
|
1677
|
-
register$2(editor);
|
|
1678
|
-
setup(editor);
|
|
1679
|
-
register(editor);
|
|
1680
|
-
register$1(editor);
|
|
1681
|
-
});
|
|
1682
|
-
};
|
|
1683
|
-
|
|
1684
|
-
Plugin();
|
|
1685
|
-
/** *****
|
|
1686
|
-
* DO NOT EXPORT ANYTHING
|
|
1687
|
-
*
|
|
1688
|
-
* IF YOU DO ROLLUP WILL LEAVE A GLOBAL ON THE PAGE
|
|
1689
|
-
*******/
|
|
1690
|
-
|
|
1691
|
-
})();
|