@ckeditor/ckeditor5-image 0.0.0-internal-20241017.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/LICENSE.md +21 -0
- package/README.md +26 -0
- package/build/image.js +5 -0
- package/build/translations/ar.js +1 -0
- package/build/translations/ast.js +1 -0
- package/build/translations/az.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/bn.js +1 -0
- package/build/translations/bs.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de-ch.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/en-gb.js +1 -0
- package/build/translations/eo.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/eu.js +1 -0
- package/build/translations/fa.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/gl.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/jv.js +1 -0
- package/build/translations/km.js +1 -0
- package/build/translations/kn.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/ku.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/ms.js +1 -0
- package/build/translations/nb.js +1 -0
- package/build/translations/ne.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/si.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sq.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/ti.js +1 -0
- package/build/translations/tk.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/ug.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/ur.js +1 -0
- package/build/translations/uz.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +270 -0
- package/dist/augmentation.d.ts +61 -0
- package/dist/autoimage.d.ts +60 -0
- package/dist/image/converters.d.ts +70 -0
- package/dist/image/imageblockediting.d.ts +67 -0
- package/dist/image/imageediting.d.ts +38 -0
- package/dist/image/imageinlineediting.d.ts +68 -0
- package/dist/image/imageloadobserver.d.ts +52 -0
- package/dist/image/imageplaceholder.d.ts +47 -0
- package/dist/image/imagetypecommand.d.ts +48 -0
- package/dist/image/insertimagecommand.d.ts +72 -0
- package/dist/image/replaceimagesourcecommand.d.ts +55 -0
- package/dist/image/ui/utils.d.ts +29 -0
- package/dist/image/utils.d.ts +68 -0
- package/dist/image.d.ts +42 -0
- package/dist/imageblock.d.ts +42 -0
- package/dist/imagecaption/imagecaptionediting.d.ts +97 -0
- package/dist/imagecaption/imagecaptionui.d.ts +34 -0
- package/dist/imagecaption/imagecaptionutils.d.ts +46 -0
- package/dist/imagecaption/toggleimagecaptioncommand.d.ts +70 -0
- package/dist/imagecaption.d.ts +34 -0
- package/dist/imageconfig.d.ts +716 -0
- package/dist/imageinline.d.ts +42 -0
- package/dist/imageinsert/imageinsertui.d.ts +90 -0
- package/dist/imageinsert/imageinsertviaurlui.d.ts +74 -0
- package/dist/imageinsert/ui/imageinsertformview.d.ts +60 -0
- package/dist/imageinsert/ui/imageinserturlview.d.ts +68 -0
- package/dist/imageinsert.d.ts +41 -0
- package/dist/imageinsertviaurl.d.ts +39 -0
- package/dist/imageresize/imagecustomresizeui.d.ts +69 -0
- package/dist/imageresize/imageresizebuttons.d.ts +72 -0
- package/dist/imageresize/imageresizeediting.d.ts +49 -0
- package/dist/imageresize/imageresizehandles.d.ts +39 -0
- package/dist/imageresize/resizeimagecommand.d.ts +46 -0
- package/dist/imageresize/ui/imagecustomresizeformview.d.ts +133 -0
- package/dist/imageresize/utils/getselectedimageeditornodes.d.ts +28 -0
- package/dist/imageresize/utils/getselectedimagepossibleresizerange.d.ts +28 -0
- package/dist/imageresize/utils/getselectedimagewidthinunits.d.ts +22 -0
- package/dist/imageresize/utils/tryparsedimensionwithunit.d.ts +41 -0
- package/dist/imageresize.d.ts +36 -0
- package/dist/imagesizeattributes.d.ts +42 -0
- package/dist/imagestyle/converters.d.ts +28 -0
- package/dist/imagestyle/imagestylecommand.d.ts +72 -0
- package/dist/imagestyle/imagestyleediting.d.ts +58 -0
- package/dist/imagestyle/imagestyleui.d.ts +64 -0
- package/dist/imagestyle/utils.d.ts +105 -0
- package/dist/imagestyle.d.ts +40 -0
- package/dist/imagetextalternative/imagetextalternativecommand.d.ts +38 -0
- package/dist/imagetextalternative/imagetextalternativeediting.d.ts +36 -0
- package/dist/imagetextalternative/imagetextalternativeui.d.ts +76 -0
- package/dist/imagetextalternative/ui/textalternativeformview.d.ts +94 -0
- package/dist/imagetextalternative.d.ts +37 -0
- package/dist/imagetoolbar.d.ts +43 -0
- package/dist/imageupload/imageuploadediting.d.ts +119 -0
- package/dist/imageupload/imageuploadprogress.d.ts +50 -0
- package/dist/imageupload/imageuploadui.d.ts +55 -0
- package/dist/imageupload/uploadimagecommand.d.ts +78 -0
- package/dist/imageupload/utils.d.ts +37 -0
- package/dist/imageupload.d.ts +40 -0
- package/dist/imageutils.d.ts +133 -0
- package/dist/index-content.css +150 -0
- package/dist/index-editor.css +248 -0
- package/dist/index.css +579 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +6383 -0
- package/dist/index.js.map +1 -0
- package/dist/pictureediting.d.ts +96 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/ar.umd.js +11 -0
- package/dist/translations/ast.d.ts +8 -0
- package/dist/translations/ast.js +5 -0
- package/dist/translations/ast.umd.js +11 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/az.umd.js +11 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bg.umd.js +11 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/bn.umd.js +11 -0
- package/dist/translations/bs.d.ts +8 -0
- package/dist/translations/bs.js +5 -0
- package/dist/translations/bs.umd.js +11 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/ca.umd.js +11 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/cs.umd.js +11 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/da.umd.js +11 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +5 -0
- package/dist/translations/de-ch.umd.js +11 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/de.umd.js +11 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/el.umd.js +11 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en-au.umd.js +11 -0
- package/dist/translations/en-gb.d.ts +8 -0
- package/dist/translations/en-gb.js +5 -0
- package/dist/translations/en-gb.umd.js +11 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/en.umd.js +11 -0
- package/dist/translations/eo.d.ts +8 -0
- package/dist/translations/eo.js +5 -0
- package/dist/translations/eo.umd.js +11 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/es.umd.js +11 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/et.umd.js +11 -0
- package/dist/translations/eu.d.ts +8 -0
- package/dist/translations/eu.js +5 -0
- package/dist/translations/eu.umd.js +11 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fa.umd.js +11 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fi.umd.js +11 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/fr.umd.js +11 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/gl.umd.js +11 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/he.umd.js +11 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hi.umd.js +11 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hr.umd.js +11 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/hu.umd.js +11 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/id.umd.js +11 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/it.umd.js +11 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/ja.umd.js +11 -0
- package/dist/translations/jv.d.ts +8 -0
- package/dist/translations/jv.js +5 -0
- package/dist/translations/jv.umd.js +11 -0
- package/dist/translations/km.d.ts +8 -0
- package/dist/translations/km.js +5 -0
- package/dist/translations/km.umd.js +11 -0
- package/dist/translations/kn.d.ts +8 -0
- package/dist/translations/kn.js +5 -0
- package/dist/translations/kn.umd.js +11 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/ko.umd.js +11 -0
- package/dist/translations/ku.d.ts +8 -0
- package/dist/translations/ku.js +5 -0
- package/dist/translations/ku.umd.js +11 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lt.umd.js +11 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/lv.umd.js +11 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/ms.umd.js +11 -0
- package/dist/translations/nb.d.ts +8 -0
- package/dist/translations/nb.js +5 -0
- package/dist/translations/nb.umd.js +11 -0
- package/dist/translations/ne.d.ts +8 -0
- package/dist/translations/ne.js +5 -0
- package/dist/translations/ne.umd.js +11 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/nl.umd.js +11 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/no.umd.js +11 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pl.umd.js +11 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt-br.umd.js +11 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/pt.umd.js +11 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ro.umd.js +11 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/ru.umd.js +11 -0
- package/dist/translations/si.d.ts +8 -0
- package/dist/translations/si.js +5 -0
- package/dist/translations/si.umd.js +11 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sk.umd.js +11 -0
- package/dist/translations/sq.d.ts +8 -0
- package/dist/translations/sq.js +5 -0
- package/dist/translations/sq.umd.js +11 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr-latn.umd.js +11 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sr.umd.js +11 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/sv.umd.js +11 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/th.umd.js +11 -0
- package/dist/translations/ti.d.ts +8 -0
- package/dist/translations/ti.js +5 -0
- package/dist/translations/ti.umd.js +11 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +5 -0
- package/dist/translations/tk.umd.js +11 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/tr.umd.js +11 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/ug.umd.js +11 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/uk.umd.js +11 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/ur.umd.js +11 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/uz.umd.js +11 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/vi.umd.js +11 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh-cn.umd.js +11 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/translations/zh.umd.js +11 -0
- package/lang/contexts.json +46 -0
- package/lang/translations/ar.po +194 -0
- package/lang/translations/ast.po +194 -0
- package/lang/translations/az.po +194 -0
- package/lang/translations/bg.po +194 -0
- package/lang/translations/bn.po +194 -0
- package/lang/translations/bs.po +194 -0
- package/lang/translations/ca.po +194 -0
- package/lang/translations/cs.po +194 -0
- package/lang/translations/da.po +194 -0
- package/lang/translations/de-ch.po +194 -0
- package/lang/translations/de.po +194 -0
- package/lang/translations/el.po +194 -0
- package/lang/translations/en-au.po +194 -0
- package/lang/translations/en-gb.po +194 -0
- package/lang/translations/en.po +194 -0
- package/lang/translations/eo.po +194 -0
- package/lang/translations/es.po +194 -0
- package/lang/translations/et.po +194 -0
- package/lang/translations/eu.po +194 -0
- package/lang/translations/fa.po +194 -0
- package/lang/translations/fi.po +194 -0
- package/lang/translations/fr.po +194 -0
- package/lang/translations/gl.po +194 -0
- package/lang/translations/he.po +194 -0
- package/lang/translations/hi.po +194 -0
- package/lang/translations/hr.po +194 -0
- package/lang/translations/hu.po +194 -0
- package/lang/translations/id.po +194 -0
- package/lang/translations/it.po +194 -0
- package/lang/translations/ja.po +194 -0
- package/lang/translations/jv.po +194 -0
- package/lang/translations/km.po +194 -0
- package/lang/translations/kn.po +194 -0
- package/lang/translations/ko.po +194 -0
- package/lang/translations/ku.po +194 -0
- package/lang/translations/lt.po +194 -0
- package/lang/translations/lv.po +194 -0
- package/lang/translations/ms.po +194 -0
- package/lang/translations/nb.po +194 -0
- package/lang/translations/ne.po +194 -0
- package/lang/translations/nl.po +194 -0
- package/lang/translations/no.po +194 -0
- package/lang/translations/pl.po +194 -0
- package/lang/translations/pt-br.po +194 -0
- package/lang/translations/pt.po +194 -0
- package/lang/translations/ro.po +194 -0
- package/lang/translations/ru.po +194 -0
- package/lang/translations/si.po +194 -0
- package/lang/translations/sk.po +194 -0
- package/lang/translations/sq.po +194 -0
- package/lang/translations/sr-latn.po +194 -0
- package/lang/translations/sr.po +194 -0
- package/lang/translations/sv.po +194 -0
- package/lang/translations/th.po +194 -0
- package/lang/translations/ti.po +194 -0
- package/lang/translations/tk.po +194 -0
- package/lang/translations/tr.po +194 -0
- package/lang/translations/ug.po +194 -0
- package/lang/translations/uk.po +194 -0
- package/lang/translations/ur.po +194 -0
- package/lang/translations/uz.po +194 -0
- package/lang/translations/vi.po +194 -0
- package/lang/translations/zh-cn.po +194 -0
- package/lang/translations/zh.po +194 -0
- package/package.json +48 -0
- package/src/augmentation.d.ts +57 -0
- package/src/augmentation.js +5 -0
- package/src/autoimage.d.ts +56 -0
- package/src/autoimage.js +138 -0
- package/src/image/converters.d.ts +66 -0
- package/src/image/converters.js +232 -0
- package/src/image/imageblockediting.d.ts +63 -0
- package/src/image/imageblockediting.js +159 -0
- package/src/image/imageediting.d.ts +34 -0
- package/src/image/imageediting.js +69 -0
- package/src/image/imageinlineediting.d.ts +64 -0
- package/src/image/imageinlineediting.js +178 -0
- package/src/image/imageloadobserver.d.ts +48 -0
- package/src/image/imageloadobserver.js +52 -0
- package/src/image/imageplaceholder.d.ts +43 -0
- package/src/image/imageplaceholder.js +119 -0
- package/src/image/imagetypecommand.d.ts +44 -0
- package/src/image/imagetypecommand.js +80 -0
- package/src/image/insertimagecommand.d.ts +68 -0
- package/src/image/insertimagecommand.js +121 -0
- package/src/image/replaceimagesourcecommand.d.ts +51 -0
- package/src/image/replaceimagesourcecommand.js +75 -0
- package/src/image/ui/utils.d.ts +25 -0
- package/src/image/ui/utils.js +44 -0
- package/src/image/utils.d.ts +64 -0
- package/src/image/utils.js +121 -0
- package/src/image.d.ts +38 -0
- package/src/image.js +44 -0
- package/src/imageblock.d.ts +38 -0
- package/src/imageblock.js +44 -0
- package/src/imagecaption/imagecaptionediting.d.ts +93 -0
- package/src/imagecaption/imagecaptionediting.js +231 -0
- package/src/imagecaption/imagecaptionui.d.ts +30 -0
- package/src/imagecaption/imagecaptionui.js +67 -0
- package/src/imagecaption/imagecaptionutils.d.ts +42 -0
- package/src/imagecaption/imagecaptionutils.js +68 -0
- package/src/imagecaption/toggleimagecaptioncommand.d.ts +66 -0
- package/src/imagecaption/toggleimagecaptioncommand.js +138 -0
- package/src/imagecaption.d.ts +30 -0
- package/src/imagecaption.js +36 -0
- package/src/imageconfig.d.ts +712 -0
- package/src/imageconfig.js +5 -0
- package/src/imageinline.d.ts +38 -0
- package/src/imageinline.js +44 -0
- package/src/imageinsert/imageinsertui.d.ts +86 -0
- package/src/imageinsert/imageinsertui.js +217 -0
- package/src/imageinsert/imageinsertviaurlui.d.ts +70 -0
- package/src/imageinsert/imageinsertviaurlui.js +174 -0
- package/src/imageinsert/ui/imageinsertformview.d.ts +56 -0
- package/src/imageinsert/ui/imageinsertformview.js +95 -0
- package/src/imageinsert/ui/imageinserturlview.d.ts +64 -0
- package/src/imageinsert/ui/imageinserturlview.js +88 -0
- package/src/imageinsert.d.ts +37 -0
- package/src/imageinsert.js +43 -0
- package/src/imageinsertviaurl.d.ts +35 -0
- package/src/imageinsertviaurl.js +41 -0
- package/src/imageresize/imagecustomresizeui.d.ts +65 -0
- package/src/imageresize/imagecustomresizeui.js +174 -0
- package/src/imageresize/imageresizebuttons.d.ts +68 -0
- package/src/imageresize/imageresizebuttons.js +295 -0
- package/src/imageresize/imageresizeediting.d.ts +45 -0
- package/src/imageresize/imageresizeediting.js +183 -0
- package/src/imageresize/imageresizehandles.d.ts +35 -0
- package/src/imageresize/imageresizehandles.js +118 -0
- package/src/imageresize/resizeimagecommand.d.ts +42 -0
- package/src/imageresize/resizeimagecommand.js +63 -0
- package/src/imageresize/ui/imagecustomresizeformview.d.ts +129 -0
- package/src/imageresize/ui/imagecustomresizeformview.js +186 -0
- package/src/imageresize/utils/getselectedimageeditornodes.d.ts +24 -0
- package/src/imageresize/utils/getselectedimageeditornodes.js +24 -0
- package/src/imageresize/utils/getselectedimagepossibleresizerange.d.ts +24 -0
- package/src/imageresize/utils/getselectedimagepossibleresizerange.js +32 -0
- package/src/imageresize/utils/getselectedimagewidthinunits.d.ts +18 -0
- package/src/imageresize/utils/getselectedimagewidthinunits.js +41 -0
- package/src/imageresize/utils/tryparsedimensionwithunit.d.ts +37 -0
- package/src/imageresize/utils/tryparsedimensionwithunit.js +56 -0
- package/src/imageresize.d.ts +32 -0
- package/src/imageresize.js +38 -0
- package/src/imagesizeattributes.d.ts +38 -0
- package/src/imagesizeattributes.js +148 -0
- package/src/imagestyle/converters.d.ts +24 -0
- package/src/imagestyle/converters.js +79 -0
- package/src/imagestyle/imagestylecommand.d.ts +68 -0
- package/src/imagestyle/imagestylecommand.js +107 -0
- package/src/imagestyle/imagestyleediting.d.ts +54 -0
- package/src/imagestyle/imagestyleediting.js +114 -0
- package/src/imagestyle/imagestyleui.d.ts +60 -0
- package/src/imagestyle/imagestyleui.js +198 -0
- package/src/imagestyle/utils.d.ts +101 -0
- package/src/imagestyle/utils.js +328 -0
- package/src/imagestyle.d.ts +36 -0
- package/src/imagestyle.js +42 -0
- package/src/imagetextalternative/imagetextalternativecommand.d.ts +34 -0
- package/src/imagetextalternative/imagetextalternativecommand.js +44 -0
- package/src/imagetextalternative/imagetextalternativeediting.d.ts +32 -0
- package/src/imagetextalternative/imagetextalternativeediting.js +41 -0
- package/src/imagetextalternative/imagetextalternativeui.d.ts +72 -0
- package/src/imagetextalternative/imagetextalternativeui.js +179 -0
- package/src/imagetextalternative/ui/textalternativeformview.d.ts +90 -0
- package/src/imagetextalternative/ui/textalternativeformview.js +121 -0
- package/src/imagetextalternative.d.ts +33 -0
- package/src/imagetextalternative.js +39 -0
- package/src/imagetoolbar.d.ts +39 -0
- package/src/imagetoolbar.js +63 -0
- package/src/imageupload/imageuploadediting.d.ts +115 -0
- package/src/imageupload/imageuploadediting.js +361 -0
- package/src/imageupload/imageuploadprogress.d.ts +46 -0
- package/src/imageupload/imageuploadprogress.js +217 -0
- package/src/imageupload/imageuploadui.d.ts +51 -0
- package/src/imageupload/imageuploadui.js +134 -0
- package/src/imageupload/uploadimagecommand.d.ts +74 -0
- package/src/imageupload/uploadimagecommand.js +110 -0
- package/src/imageupload/utils.d.ts +33 -0
- package/src/imageupload/utils.js +112 -0
- package/src/imageupload.d.ts +36 -0
- package/src/imageupload.js +42 -0
- package/src/imageutils.d.ts +129 -0
- package/src/imageutils.js +312 -0
- package/src/index.d.ts +50 -0
- package/src/index.js +41 -0
- package/src/pictureediting.d.ts +92 -0
- package/src/pictureediting.js +136 -0
- package/theme/image.css +143 -0
- package/theme/imagecaption.css +51 -0
- package/theme/imagecustomresizeform.css +33 -0
- package/theme/imageinsert.css +14 -0
- package/theme/imageplaceholder.css +10 -0
- package/theme/imageresize.css +53 -0
- package/theme/imagestyle.css +120 -0
- package/theme/imageuploadicon.css +23 -0
- package/theme/imageuploadloader.css +18 -0
- package/theme/imageuploadprogress.css +19 -0
- package/theme/textalternativeform.css +32 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module image/imageinline
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { Widget } from 'ckeditor5/src/widget.js';
|
|
10
|
+
import ImageTextAlternative from './imagetextalternative.js';
|
|
11
|
+
import ImageInlineEditing from './image/imageinlineediting.js';
|
|
12
|
+
import ImageInsertUI from './imageinsert/imageinsertui.js';
|
|
13
|
+
import '../theme/image.css';
|
|
14
|
+
/**
|
|
15
|
+
* The image inline plugin.
|
|
16
|
+
*
|
|
17
|
+
* This is a "glue" plugin which loads the following plugins:
|
|
18
|
+
*
|
|
19
|
+
* * {@link module:image/image/imageinlineediting~ImageInlineEditing},
|
|
20
|
+
* * {@link module:image/imagetextalternative~ImageTextAlternative}.
|
|
21
|
+
*
|
|
22
|
+
* Usually, it is used in conjunction with other plugins from this package. See the {@glink api/image package page}
|
|
23
|
+
* for more information.
|
|
24
|
+
*/
|
|
25
|
+
export default class ImageInline extends Plugin {
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get requires(): readonly [typeof ImageInlineEditing, typeof Widget, typeof ImageTextAlternative, typeof ImageInsertUI];
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
static get pluginName(): "ImageInline";
|
|
34
|
+
/**
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
static get isOfficialPlugin(): true;
|
|
38
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module image/imageinline
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { Widget } from 'ckeditor5/src/widget.js';
|
|
10
|
+
import ImageTextAlternative from './imagetextalternative.js';
|
|
11
|
+
import ImageInlineEditing from './image/imageinlineediting.js';
|
|
12
|
+
import ImageInsertUI from './imageinsert/imageinsertui.js';
|
|
13
|
+
import '../theme/image.css';
|
|
14
|
+
/**
|
|
15
|
+
* The image inline plugin.
|
|
16
|
+
*
|
|
17
|
+
* This is a "glue" plugin which loads the following plugins:
|
|
18
|
+
*
|
|
19
|
+
* * {@link module:image/image/imageinlineediting~ImageInlineEditing},
|
|
20
|
+
* * {@link module:image/imagetextalternative~ImageTextAlternative}.
|
|
21
|
+
*
|
|
22
|
+
* Usually, it is used in conjunction with other plugins from this package. See the {@glink api/image package page}
|
|
23
|
+
* for more information.
|
|
24
|
+
*/
|
|
25
|
+
export default class ImageInline extends Plugin {
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get requires() {
|
|
30
|
+
return [ImageInlineEditing, Widget, ImageTextAlternative, ImageInsertUI];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
static get pluginName() {
|
|
36
|
+
return 'ImageInline';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
static get isOfficialPlugin() {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module image/imageinsert/imageinsertui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { type Observable } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import { type ButtonView, type DropdownView, type FocusableView, type MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
|
|
11
|
+
import ImageUtils from '../imageutils.js';
|
|
12
|
+
/**
|
|
13
|
+
* The image insert dropdown plugin.
|
|
14
|
+
*
|
|
15
|
+
* For a detailed overview, check the {@glink features/images/image-upload/image-upload Image upload feature}
|
|
16
|
+
* and {@glink features/images/images-inserting Insert images via source URL} documentation.
|
|
17
|
+
*
|
|
18
|
+
* Adds the `'insertImage'` dropdown to the {@link module:ui/componentfactory~ComponentFactory UI component factory}
|
|
19
|
+
* and also the `imageInsert` dropdown as an alias for backward compatibility.
|
|
20
|
+
*
|
|
21
|
+
* Adds the `'menuBar:insertImage'` sub-menu to the {@link module:ui/componentfactory~ComponentFactory UI component factory}, which is
|
|
22
|
+
* by default added to the `'Insert'` menu.
|
|
23
|
+
*/
|
|
24
|
+
export default class ImageInsertUI extends Plugin {
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get pluginName(): "ImageInsertUI";
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
static get isOfficialPlugin(): true;
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
static get requires(): readonly [typeof ImageUtils];
|
|
37
|
+
/**
|
|
38
|
+
* The dropdown view responsible for displaying the image insert UI.
|
|
39
|
+
*/
|
|
40
|
+
dropdownView?: DropdownView;
|
|
41
|
+
/**
|
|
42
|
+
* Observable property used to alter labels while some image is selected and when it is not.
|
|
43
|
+
*
|
|
44
|
+
* @observable
|
|
45
|
+
*/
|
|
46
|
+
isImageSelected: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Registered integrations map.
|
|
49
|
+
*/
|
|
50
|
+
private _integrations;
|
|
51
|
+
/**
|
|
52
|
+
* @inheritDoc
|
|
53
|
+
*/
|
|
54
|
+
constructor(editor: Editor);
|
|
55
|
+
/**
|
|
56
|
+
* @inheritDoc
|
|
57
|
+
*/
|
|
58
|
+
init(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Registers the insert image dropdown integration.
|
|
61
|
+
*/
|
|
62
|
+
registerIntegration({ name, observable, buttonViewCreator, formViewCreator, menuBarButtonViewCreator, requiresForm }: {
|
|
63
|
+
name: string;
|
|
64
|
+
observable: (Observable & {
|
|
65
|
+
isEnabled: boolean;
|
|
66
|
+
}) | (() => Observable & {
|
|
67
|
+
isEnabled: boolean;
|
|
68
|
+
});
|
|
69
|
+
buttonViewCreator: (isOnlyOne: boolean) => ButtonView;
|
|
70
|
+
formViewCreator: (isOnlyOne: boolean) => FocusableView;
|
|
71
|
+
menuBarButtonViewCreator: (isOnlyOne: boolean) => MenuBarMenuListItemButtonView;
|
|
72
|
+
requiresForm?: boolean;
|
|
73
|
+
}): void;
|
|
74
|
+
/**
|
|
75
|
+
* Creates the toolbar component.
|
|
76
|
+
*/
|
|
77
|
+
private _createToolbarComponent;
|
|
78
|
+
/**
|
|
79
|
+
* Creates the menu bar component.
|
|
80
|
+
*/
|
|
81
|
+
private _createMenuBarComponent;
|
|
82
|
+
/**
|
|
83
|
+
* Validates the integrations list.
|
|
84
|
+
*/
|
|
85
|
+
private _prepareIntegrations;
|
|
86
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module image/imageinsert/imageinsertui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, icons } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { logWarning } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import { createDropdown, MenuBarMenuListItemView, MenuBarMenuListView, MenuBarMenuView, SplitButtonView } from 'ckeditor5/src/ui.js';
|
|
11
|
+
import ImageInsertFormView from './ui/imageinsertformview.js';
|
|
12
|
+
import ImageUtils from '../imageutils.js';
|
|
13
|
+
/**
|
|
14
|
+
* The image insert dropdown plugin.
|
|
15
|
+
*
|
|
16
|
+
* For a detailed overview, check the {@glink features/images/image-upload/image-upload Image upload feature}
|
|
17
|
+
* and {@glink features/images/images-inserting Insert images via source URL} documentation.
|
|
18
|
+
*
|
|
19
|
+
* Adds the `'insertImage'` dropdown to the {@link module:ui/componentfactory~ComponentFactory UI component factory}
|
|
20
|
+
* and also the `imageInsert` dropdown as an alias for backward compatibility.
|
|
21
|
+
*
|
|
22
|
+
* Adds the `'menuBar:insertImage'` sub-menu to the {@link module:ui/componentfactory~ComponentFactory UI component factory}, which is
|
|
23
|
+
* by default added to the `'Insert'` menu.
|
|
24
|
+
*/
|
|
25
|
+
export default class ImageInsertUI extends Plugin {
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get pluginName() {
|
|
30
|
+
return 'ImageInsertUI';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
static get isOfficialPlugin() {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
static get requires() {
|
|
42
|
+
return [ImageUtils];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
constructor(editor) {
|
|
48
|
+
super(editor);
|
|
49
|
+
/**
|
|
50
|
+
* Registered integrations map.
|
|
51
|
+
*/
|
|
52
|
+
this._integrations = new Map();
|
|
53
|
+
editor.config.define('image.insert.integrations', [
|
|
54
|
+
'upload',
|
|
55
|
+
'assetManager',
|
|
56
|
+
'url'
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @inheritDoc
|
|
61
|
+
*/
|
|
62
|
+
init() {
|
|
63
|
+
const editor = this.editor;
|
|
64
|
+
const selection = editor.model.document.selection;
|
|
65
|
+
const imageUtils = editor.plugins.get('ImageUtils');
|
|
66
|
+
this.set('isImageSelected', false);
|
|
67
|
+
this.listenTo(editor.model.document, 'change', () => {
|
|
68
|
+
this.isImageSelected = imageUtils.isImage(selection.getSelectedElement());
|
|
69
|
+
});
|
|
70
|
+
const componentCreator = (locale) => this._createToolbarComponent(locale);
|
|
71
|
+
const menuBarComponentCreator = (locale) => this._createMenuBarComponent(locale);
|
|
72
|
+
// Register `insertImage` dropdown and add `imageInsert` dropdown as an alias for backward compatibility.
|
|
73
|
+
editor.ui.componentFactory.add('insertImage', componentCreator);
|
|
74
|
+
editor.ui.componentFactory.add('imageInsert', componentCreator);
|
|
75
|
+
editor.ui.componentFactory.add('menuBar:insertImage', menuBarComponentCreator);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Registers the insert image dropdown integration.
|
|
79
|
+
*/
|
|
80
|
+
registerIntegration({ name, observable, buttonViewCreator, formViewCreator, menuBarButtonViewCreator, requiresForm = false }) {
|
|
81
|
+
if (this._integrations.has(name)) {
|
|
82
|
+
/**
|
|
83
|
+
* There are two insert-image integrations registered with the same name.
|
|
84
|
+
*
|
|
85
|
+
* Make sure that you do not load multiple asset manager plugins.
|
|
86
|
+
*
|
|
87
|
+
* @error image-insert-integration-exists
|
|
88
|
+
*/
|
|
89
|
+
logWarning('image-insert-integration-exists', { name });
|
|
90
|
+
}
|
|
91
|
+
this._integrations.set(name, {
|
|
92
|
+
observable,
|
|
93
|
+
buttonViewCreator,
|
|
94
|
+
menuBarButtonViewCreator,
|
|
95
|
+
formViewCreator,
|
|
96
|
+
requiresForm
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Creates the toolbar component.
|
|
101
|
+
*/
|
|
102
|
+
_createToolbarComponent(locale) {
|
|
103
|
+
const editor = this.editor;
|
|
104
|
+
const t = locale.t;
|
|
105
|
+
const integrations = this._prepareIntegrations();
|
|
106
|
+
if (!integrations.length) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
let dropdownButton;
|
|
110
|
+
const firstIntegration = integrations[0];
|
|
111
|
+
if (integrations.length == 1) {
|
|
112
|
+
// Do not use dropdown for a single integration button (integration that does not require form view).
|
|
113
|
+
if (!firstIntegration.requiresForm) {
|
|
114
|
+
return firstIntegration.buttonViewCreator(true);
|
|
115
|
+
}
|
|
116
|
+
dropdownButton = firstIntegration.buttonViewCreator(true);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
const actionButton = firstIntegration.buttonViewCreator(false);
|
|
120
|
+
dropdownButton = new SplitButtonView(locale, actionButton);
|
|
121
|
+
dropdownButton.tooltip = true;
|
|
122
|
+
dropdownButton.bind('label').to(this, 'isImageSelected', isImageSelected => isImageSelected ?
|
|
123
|
+
t('Replace image') :
|
|
124
|
+
t('Insert image'));
|
|
125
|
+
}
|
|
126
|
+
const dropdownView = this.dropdownView = createDropdown(locale, dropdownButton);
|
|
127
|
+
const observables = integrations.map(({ observable }) => typeof observable == 'function' ? observable() : observable);
|
|
128
|
+
dropdownView.bind('isEnabled').toMany(observables, 'isEnabled', (...isEnabled) => (isEnabled.some(isEnabled => isEnabled)));
|
|
129
|
+
dropdownView.once('change:isOpen', () => {
|
|
130
|
+
const integrationViews = integrations.map(({ formViewCreator }) => formViewCreator(integrations.length == 1));
|
|
131
|
+
const imageInsertFormView = new ImageInsertFormView(editor.locale, integrationViews);
|
|
132
|
+
dropdownView.panelView.children.add(imageInsertFormView);
|
|
133
|
+
});
|
|
134
|
+
return dropdownView;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Creates the menu bar component.
|
|
138
|
+
*/
|
|
139
|
+
_createMenuBarComponent(locale) {
|
|
140
|
+
const t = locale.t;
|
|
141
|
+
const integrations = this._prepareIntegrations();
|
|
142
|
+
if (!integrations.length) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
let resultView;
|
|
146
|
+
const firstIntegration = integrations[0];
|
|
147
|
+
if (integrations.length == 1) {
|
|
148
|
+
resultView = firstIntegration.menuBarButtonViewCreator(true);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
resultView = new MenuBarMenuView(locale);
|
|
152
|
+
const listView = new MenuBarMenuListView(locale);
|
|
153
|
+
resultView.panelView.children.add(listView);
|
|
154
|
+
resultView.buttonView.set({
|
|
155
|
+
icon: icons.image,
|
|
156
|
+
label: t('Image')
|
|
157
|
+
});
|
|
158
|
+
for (const integration of integrations) {
|
|
159
|
+
const listItemView = new MenuBarMenuListItemView(locale, resultView);
|
|
160
|
+
const buttonView = integration.menuBarButtonViewCreator(false);
|
|
161
|
+
listItemView.children.add(buttonView);
|
|
162
|
+
listView.items.add(listItemView);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return resultView;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Validates the integrations list.
|
|
169
|
+
*/
|
|
170
|
+
_prepareIntegrations() {
|
|
171
|
+
const editor = this.editor;
|
|
172
|
+
const items = editor.config.get('image.insert.integrations');
|
|
173
|
+
const result = [];
|
|
174
|
+
if (!items.length) {
|
|
175
|
+
/**
|
|
176
|
+
* The insert image feature requires a list of integrations to be provided in the editor configuration.
|
|
177
|
+
*
|
|
178
|
+
* The default list of integrations is `upload`, `assetManager`, `url`. Those integrations are included
|
|
179
|
+
* in the insert image dropdown if the given feature plugin is loaded. You should omit the `integrations`
|
|
180
|
+
* configuration key to use the default set or provide a selected list of integrations that should be used.
|
|
181
|
+
*
|
|
182
|
+
* @error image-insert-integrations-not-specified
|
|
183
|
+
*/
|
|
184
|
+
logWarning('image-insert-integrations-not-specified');
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
187
|
+
for (const item of items) {
|
|
188
|
+
if (!this._integrations.has(item)) {
|
|
189
|
+
if (!['upload', 'assetManager', 'url'].includes(item)) {
|
|
190
|
+
/**
|
|
191
|
+
* The specified insert image integration name is unknown or the providing plugin is not loaded in the editor.
|
|
192
|
+
*
|
|
193
|
+
* @error image-insert-unknown-integration
|
|
194
|
+
*/
|
|
195
|
+
logWarning('image-insert-unknown-integration', { item });
|
|
196
|
+
}
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
result.push(this._integrations.get(item));
|
|
200
|
+
}
|
|
201
|
+
if (!result.length) {
|
|
202
|
+
/**
|
|
203
|
+
* The image insert feature requires integrations to be registered by separate features.
|
|
204
|
+
*
|
|
205
|
+
* The `insertImage` toolbar button requires integrations to be registered by other features.
|
|
206
|
+
* For example {@link module:image/imageupload~ImageUpload ImageUpload},
|
|
207
|
+
* {@link module:image/imageinsert~ImageInsert ImageInsert},
|
|
208
|
+
* {@link module:image/imageinsertviaurl~ImageInsertViaUrl ImageInsertViaUrl},
|
|
209
|
+
* {@link module:ckbox/ckbox~CKBox CKBox}
|
|
210
|
+
*
|
|
211
|
+
* @error image-insert-integrations-not-registered
|
|
212
|
+
*/
|
|
213
|
+
logWarning('image-insert-integrations-not-registered');
|
|
214
|
+
}
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module image/imageinsert/imageinsertviaurlui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { Dialog } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import ImageInsertUI from './imageinsertui.js';
|
|
11
|
+
/**
|
|
12
|
+
* The image insert via URL plugin (UI part).
|
|
13
|
+
*
|
|
14
|
+
* The plugin introduces two UI components to the {@link module:ui/componentfactory~ComponentFactory UI component factory}:
|
|
15
|
+
*
|
|
16
|
+
* * the `'insertImageViaUrl'` toolbar button,
|
|
17
|
+
* * the `'menuBar:insertImageViaUrl'` menu bar component.
|
|
18
|
+
*
|
|
19
|
+
* It also integrates with the `insertImage` toolbar component and `menuBar:insertImage` menu component, which are default components
|
|
20
|
+
* through which inserting image via URL is available.
|
|
21
|
+
*/
|
|
22
|
+
export default class ImageInsertViaUrlUI extends Plugin {
|
|
23
|
+
private _imageInsertUI;
|
|
24
|
+
private _formView?;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get pluginName(): "ImageInsertViaUrlUI";
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
static get isOfficialPlugin(): true;
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
static get requires(): readonly [typeof ImageInsertUI, typeof Dialog];
|
|
37
|
+
init(): void;
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
afterInit(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Creates the base for various kinds of the button component provided by this feature.
|
|
44
|
+
*/
|
|
45
|
+
private _createInsertUrlButton;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a simple toolbar button, with an icon and a tooltip.
|
|
48
|
+
*/
|
|
49
|
+
private _createToolbarButton;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a button for the dropdown view, with an icon, text and no tooltip.
|
|
52
|
+
*/
|
|
53
|
+
private _createDropdownButton;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a button for the menu bar.
|
|
56
|
+
*/
|
|
57
|
+
private _createMenuBarButton;
|
|
58
|
+
/**
|
|
59
|
+
* Creates the form view used to submit the image URL.
|
|
60
|
+
*/
|
|
61
|
+
private _createInsertUrlView;
|
|
62
|
+
/**
|
|
63
|
+
* Shows the insert image via URL form view in a modal.
|
|
64
|
+
*/
|
|
65
|
+
private _showModal;
|
|
66
|
+
/**
|
|
67
|
+
* Executes appropriate command depending on selection and form value.
|
|
68
|
+
*/
|
|
69
|
+
private _handleSave;
|
|
70
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module image/imageinsert/imageinsertviaurlui
|
|
7
|
+
*/
|
|
8
|
+
import { icons, Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { ButtonView, Dialog, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import ImageInsertUI from './imageinsertui.js';
|
|
11
|
+
import ImageInsertUrlView from './ui/imageinserturlview.js';
|
|
12
|
+
/**
|
|
13
|
+
* The image insert via URL plugin (UI part).
|
|
14
|
+
*
|
|
15
|
+
* The plugin introduces two UI components to the {@link module:ui/componentfactory~ComponentFactory UI component factory}:
|
|
16
|
+
*
|
|
17
|
+
* * the `'insertImageViaUrl'` toolbar button,
|
|
18
|
+
* * the `'menuBar:insertImageViaUrl'` menu bar component.
|
|
19
|
+
*
|
|
20
|
+
* It also integrates with the `insertImage` toolbar component and `menuBar:insertImage` menu component, which are default components
|
|
21
|
+
* through which inserting image via URL is available.
|
|
22
|
+
*/
|
|
23
|
+
export default class ImageInsertViaUrlUI extends Plugin {
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get pluginName() {
|
|
28
|
+
return 'ImageInsertViaUrlUI';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
static get isOfficialPlugin() {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
static get requires() {
|
|
40
|
+
return [ImageInsertUI, Dialog];
|
|
41
|
+
}
|
|
42
|
+
init() {
|
|
43
|
+
this.editor.ui.componentFactory.add('insertImageViaUrl', () => this._createToolbarButton());
|
|
44
|
+
this.editor.ui.componentFactory.add('menuBar:insertImageViaUrl', () => this._createMenuBarButton('standalone'));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @inheritDoc
|
|
48
|
+
*/
|
|
49
|
+
afterInit() {
|
|
50
|
+
this._imageInsertUI = this.editor.plugins.get('ImageInsertUI');
|
|
51
|
+
this._imageInsertUI.registerIntegration({
|
|
52
|
+
name: 'url',
|
|
53
|
+
observable: () => this.editor.commands.get('insertImage'),
|
|
54
|
+
buttonViewCreator: () => this._createToolbarButton(),
|
|
55
|
+
formViewCreator: () => this._createDropdownButton(),
|
|
56
|
+
menuBarButtonViewCreator: isOnly => this._createMenuBarButton(isOnly ? 'insertOnly' : 'insertNested')
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates the base for various kinds of the button component provided by this feature.
|
|
61
|
+
*/
|
|
62
|
+
_createInsertUrlButton(ButtonClass) {
|
|
63
|
+
const button = new ButtonClass(this.editor.locale);
|
|
64
|
+
button.icon = icons.imageUrl;
|
|
65
|
+
button.on('execute', () => {
|
|
66
|
+
this._showModal();
|
|
67
|
+
});
|
|
68
|
+
return button;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Creates a simple toolbar button, with an icon and a tooltip.
|
|
72
|
+
*/
|
|
73
|
+
_createToolbarButton() {
|
|
74
|
+
const t = this.editor.locale.t;
|
|
75
|
+
const button = this._createInsertUrlButton(ButtonView);
|
|
76
|
+
button.tooltip = true;
|
|
77
|
+
button.bind('label').to(this._imageInsertUI, 'isImageSelected', isImageSelected => isImageSelected ? t('Update image URL') : t('Insert image via URL'));
|
|
78
|
+
return button;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Creates a button for the dropdown view, with an icon, text and no tooltip.
|
|
82
|
+
*/
|
|
83
|
+
_createDropdownButton() {
|
|
84
|
+
const t = this.editor.locale.t;
|
|
85
|
+
const button = this._createInsertUrlButton(ButtonView);
|
|
86
|
+
button.withText = true;
|
|
87
|
+
button.bind('label').to(this._imageInsertUI, 'isImageSelected', isImageSelected => isImageSelected ? t('Update image URL') : t('Insert via URL'));
|
|
88
|
+
return button;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Creates a button for the menu bar.
|
|
92
|
+
*/
|
|
93
|
+
_createMenuBarButton(type) {
|
|
94
|
+
const t = this.editor.locale.t;
|
|
95
|
+
const button = this._createInsertUrlButton(MenuBarMenuListItemButtonView);
|
|
96
|
+
button.withText = true;
|
|
97
|
+
switch (type) {
|
|
98
|
+
case 'standalone':
|
|
99
|
+
button.label = t('Image via URL');
|
|
100
|
+
break;
|
|
101
|
+
case 'insertOnly':
|
|
102
|
+
button.label = t('Image');
|
|
103
|
+
break;
|
|
104
|
+
case 'insertNested':
|
|
105
|
+
button.label = t('Via URL');
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
return button;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Creates the form view used to submit the image URL.
|
|
112
|
+
*/
|
|
113
|
+
_createInsertUrlView() {
|
|
114
|
+
const editor = this.editor;
|
|
115
|
+
const locale = editor.locale;
|
|
116
|
+
const replaceImageSourceCommand = editor.commands.get('replaceImageSource');
|
|
117
|
+
const insertImageCommand = editor.commands.get('insertImage');
|
|
118
|
+
const imageInsertUrlView = new ImageInsertUrlView(locale);
|
|
119
|
+
imageInsertUrlView.bind('isImageSelected').to(this._imageInsertUI);
|
|
120
|
+
imageInsertUrlView.bind('isEnabled').toMany([insertImageCommand, replaceImageSourceCommand], 'isEnabled', (...isEnabled) => (isEnabled.some(isCommandEnabled => isCommandEnabled)));
|
|
121
|
+
return imageInsertUrlView;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Shows the insert image via URL form view in a modal.
|
|
125
|
+
*/
|
|
126
|
+
_showModal() {
|
|
127
|
+
const editor = this.editor;
|
|
128
|
+
const locale = editor.locale;
|
|
129
|
+
const t = locale.t;
|
|
130
|
+
const dialog = editor.plugins.get('Dialog');
|
|
131
|
+
if (!this._formView) {
|
|
132
|
+
this._formView = this._createInsertUrlView();
|
|
133
|
+
this._formView.on('submit', () => this._handleSave());
|
|
134
|
+
}
|
|
135
|
+
const replaceImageSourceCommand = editor.commands.get('replaceImageSource');
|
|
136
|
+
this._formView.imageURLInputValue = replaceImageSourceCommand.value || '';
|
|
137
|
+
dialog.show({
|
|
138
|
+
id: 'insertImageViaUrl',
|
|
139
|
+
title: this._imageInsertUI.isImageSelected ?
|
|
140
|
+
t('Update image URL') :
|
|
141
|
+
t('Insert image via URL'),
|
|
142
|
+
isModal: true,
|
|
143
|
+
content: this._formView,
|
|
144
|
+
actionButtons: [
|
|
145
|
+
{
|
|
146
|
+
label: t('Cancel'),
|
|
147
|
+
withText: true,
|
|
148
|
+
onExecute: () => dialog.hide()
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
label: t('Accept'),
|
|
152
|
+
class: 'ck-button-action',
|
|
153
|
+
withText: true,
|
|
154
|
+
onExecute: () => this._handleSave()
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Executes appropriate command depending on selection and form value.
|
|
161
|
+
*/
|
|
162
|
+
_handleSave() {
|
|
163
|
+
const replaceImageSourceCommand = this.editor.commands.get('replaceImageSource');
|
|
164
|
+
// If an image element is currently selected, we want to replace its source attribute (instead of inserting a new image).
|
|
165
|
+
// We detect if an image is selected by checking `replaceImageSource` command state.
|
|
166
|
+
if (replaceImageSourceCommand.isEnabled) {
|
|
167
|
+
this.editor.execute('replaceImageSource', { source: this._formView.imageURLInputValue });
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
this.editor.execute('insertImage', { source: this._formView.imageURLInputValue });
|
|
171
|
+
}
|
|
172
|
+
this.editor.plugins.get('Dialog').hide();
|
|
173
|
+
}
|
|
174
|
+
}
|