@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,186 @@
|
|
|
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/imageresize/ui/imagecustomresizeformview
|
|
7
|
+
*/
|
|
8
|
+
import { ButtonView, FocusCycler, LabeledFieldView, View, ViewCollection, createLabeledInputNumber, submitHandler } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import { icons } from 'ckeditor5/src/core.js';
|
|
11
|
+
import '../../../theme/imagecustomresizeform.css';
|
|
12
|
+
// See: #8833.
|
|
13
|
+
// eslint-disable-next-line ckeditor5-rules/ckeditor-imports
|
|
14
|
+
import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
|
|
15
|
+
/**
|
|
16
|
+
* The ImageCustomResizeFormView class.
|
|
17
|
+
*/
|
|
18
|
+
export default class ImageCustomResizeFormView extends View {
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
constructor(locale, unit, validators) {
|
|
23
|
+
super(locale);
|
|
24
|
+
const t = this.locale.t;
|
|
25
|
+
this.focusTracker = new FocusTracker();
|
|
26
|
+
this.keystrokes = new KeystrokeHandler();
|
|
27
|
+
this.unit = unit;
|
|
28
|
+
this.labeledInput = this._createLabeledInputView();
|
|
29
|
+
this.saveButtonView = this._createButton(t('Save'), icons.check, 'ck-button-save');
|
|
30
|
+
this.saveButtonView.type = 'submit';
|
|
31
|
+
this.cancelButtonView = this._createButton(t('Cancel'), icons.cancel, 'ck-button-cancel', 'cancel');
|
|
32
|
+
this._focusables = new ViewCollection();
|
|
33
|
+
this._validators = validators;
|
|
34
|
+
this._focusCycler = new FocusCycler({
|
|
35
|
+
focusables: this._focusables,
|
|
36
|
+
focusTracker: this.focusTracker,
|
|
37
|
+
keystrokeHandler: this.keystrokes,
|
|
38
|
+
actions: {
|
|
39
|
+
// Navigate form fields backwards using the Shift + Tab keystroke.
|
|
40
|
+
focusPrevious: 'shift + tab',
|
|
41
|
+
// Navigate form fields forwards using the Tab key.
|
|
42
|
+
focusNext: 'tab'
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
this.setTemplate({
|
|
46
|
+
tag: 'form',
|
|
47
|
+
attributes: {
|
|
48
|
+
class: [
|
|
49
|
+
'ck',
|
|
50
|
+
'ck-image-custom-resize-form',
|
|
51
|
+
'ck-responsive-form'
|
|
52
|
+
],
|
|
53
|
+
// https://github.com/ckeditor/ckeditor5-image/issues/40
|
|
54
|
+
tabindex: '-1'
|
|
55
|
+
},
|
|
56
|
+
children: [
|
|
57
|
+
this.labeledInput,
|
|
58
|
+
this.saveButtonView,
|
|
59
|
+
this.cancelButtonView
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @inheritDoc
|
|
65
|
+
*/
|
|
66
|
+
render() {
|
|
67
|
+
super.render();
|
|
68
|
+
this.keystrokes.listenTo(this.element);
|
|
69
|
+
submitHandler({ view: this });
|
|
70
|
+
[this.labeledInput, this.saveButtonView, this.cancelButtonView]
|
|
71
|
+
.forEach(v => {
|
|
72
|
+
// Register the view as focusable.
|
|
73
|
+
this._focusables.add(v);
|
|
74
|
+
// Register the view in the focus tracker.
|
|
75
|
+
this.focusTracker.add(v.element);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @inheritDoc
|
|
80
|
+
*/
|
|
81
|
+
destroy() {
|
|
82
|
+
super.destroy();
|
|
83
|
+
this.focusTracker.destroy();
|
|
84
|
+
this.keystrokes.destroy();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Creates the button view.
|
|
88
|
+
*
|
|
89
|
+
* @param label The button label
|
|
90
|
+
* @param icon The button's icon.
|
|
91
|
+
* @param className The additional button CSS class name.
|
|
92
|
+
* @param eventName The event name that the ButtonView#execute event will be delegated to.
|
|
93
|
+
* @returns The button view instance.
|
|
94
|
+
*/
|
|
95
|
+
_createButton(label, icon, className, eventName) {
|
|
96
|
+
const button = new ButtonView(this.locale);
|
|
97
|
+
button.set({
|
|
98
|
+
label,
|
|
99
|
+
icon,
|
|
100
|
+
tooltip: true
|
|
101
|
+
});
|
|
102
|
+
button.extendTemplate({
|
|
103
|
+
attributes: {
|
|
104
|
+
class: className
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
if (eventName) {
|
|
108
|
+
button.delegate('execute').to(this, eventName);
|
|
109
|
+
}
|
|
110
|
+
return button;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Creates an input with a label.
|
|
114
|
+
*
|
|
115
|
+
* @returns Labeled field view instance.
|
|
116
|
+
*/
|
|
117
|
+
_createLabeledInputView() {
|
|
118
|
+
const t = this.locale.t;
|
|
119
|
+
const labeledInput = new LabeledFieldView(this.locale, createLabeledInputNumber);
|
|
120
|
+
labeledInput.label = t('Resize image (in %0)', this.unit);
|
|
121
|
+
labeledInput.fieldView.set({
|
|
122
|
+
step: 0.1
|
|
123
|
+
});
|
|
124
|
+
return labeledInput;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Validates the form and returns `false` when some fields are invalid.
|
|
128
|
+
*/
|
|
129
|
+
isValid() {
|
|
130
|
+
this.resetFormStatus();
|
|
131
|
+
for (const validator of this._validators) {
|
|
132
|
+
const errorText = validator(this);
|
|
133
|
+
// One error per field is enough.
|
|
134
|
+
if (errorText) {
|
|
135
|
+
// Apply updated error.
|
|
136
|
+
this.labeledInput.errorText = errorText;
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Cleans up the supplementary error and information text of the {@link #labeledInput}
|
|
144
|
+
* bringing them back to the state when the form has been displayed for the first time.
|
|
145
|
+
*
|
|
146
|
+
* See {@link #isValid}.
|
|
147
|
+
*/
|
|
148
|
+
resetFormStatus() {
|
|
149
|
+
this.labeledInput.errorText = null;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The native DOM `value` of the input element of {@link #labeledInput}.
|
|
153
|
+
*/
|
|
154
|
+
get rawSize() {
|
|
155
|
+
const { element } = this.labeledInput.fieldView;
|
|
156
|
+
if (!element) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
return element.value;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get numeric value of size. Returns `null` if value of size input element in {@link #labeledInput}.is not a number.
|
|
163
|
+
*/
|
|
164
|
+
get parsedSize() {
|
|
165
|
+
const { rawSize } = this;
|
|
166
|
+
if (rawSize === null) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
const parsed = Number.parseFloat(rawSize);
|
|
170
|
+
if (Number.isNaN(parsed)) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
return parsed;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Returns serialized image input size with unit.
|
|
177
|
+
* Returns `null` if value of size input element in {@link #labeledInput}.is not a number.
|
|
178
|
+
*/
|
|
179
|
+
get sizeWithUnits() {
|
|
180
|
+
const { parsedSize, unit } = this;
|
|
181
|
+
if (parsedSize === null) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
return `${parsedSize}${unit}`;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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/imageresize/utils/getselectedimageeditornodes
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewElement, Element } from 'ckeditor5/src/engine.js';
|
|
9
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
10
|
+
/**
|
|
11
|
+
* Finds model, view and DOM element for selected image element. Returns `null` if there is no image selected.
|
|
12
|
+
*
|
|
13
|
+
* @param editor Editor instance.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getSelectedImageEditorNodes(editor: Editor): ImageEditorNodes | null;
|
|
16
|
+
/**
|
|
17
|
+
* @internal;
|
|
18
|
+
*/
|
|
19
|
+
type ImageEditorNodes = {
|
|
20
|
+
model: Element;
|
|
21
|
+
view: ViewElement;
|
|
22
|
+
dom: HTMLElement;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
* Finds model, view and DOM element for selected image element. Returns `null` if there is no image selected.
|
|
7
|
+
*
|
|
8
|
+
* @param editor Editor instance.
|
|
9
|
+
*/
|
|
10
|
+
export function getSelectedImageEditorNodes(editor) {
|
|
11
|
+
const { editing } = editor;
|
|
12
|
+
const imageUtils = editor.plugins.get('ImageUtils');
|
|
13
|
+
const imageModelElement = imageUtils.getClosestSelectedImageElement(editor.model.document.selection);
|
|
14
|
+
if (!imageModelElement) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const imageViewElement = editing.mapper.toViewElement(imageModelElement);
|
|
18
|
+
const imageDOMElement = editing.view.domConverter.mapViewToDom(imageViewElement);
|
|
19
|
+
return {
|
|
20
|
+
model: imageModelElement,
|
|
21
|
+
view: imageViewElement,
|
|
22
|
+
dom: imageDOMElement
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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/imageresize/utils/getselectedimagepossibleresizerange
|
|
7
|
+
*/
|
|
8
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
9
|
+
/**
|
|
10
|
+
* Returns min and max value of resize image in specified unit.
|
|
11
|
+
*
|
|
12
|
+
* @param editor Editor instance.
|
|
13
|
+
* @param targetUnit Unit in which dimension will be returned.
|
|
14
|
+
* @returns Possible resize range in numeric form.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getSelectedImagePossibleResizeRange(editor: Editor, targetUnit: string): PossibleResizeImageRange | null;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export type PossibleResizeImageRange = {
|
|
21
|
+
unit: string;
|
|
22
|
+
lower: number;
|
|
23
|
+
upper: number;
|
|
24
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
import { calculateResizeHostAncestorWidth } from 'ckeditor5/src/widget.js';
|
|
6
|
+
import { getSelectedImageEditorNodes } from './getselectedimageeditornodes.js';
|
|
7
|
+
import { tryCastDimensionsToUnit, tryParseDimensionWithUnit } from './tryparsedimensionwithunit.js';
|
|
8
|
+
/**
|
|
9
|
+
* Returns min and max value of resize image in specified unit.
|
|
10
|
+
*
|
|
11
|
+
* @param editor Editor instance.
|
|
12
|
+
* @param targetUnit Unit in which dimension will be returned.
|
|
13
|
+
* @returns Possible resize range in numeric form.
|
|
14
|
+
*/
|
|
15
|
+
export function getSelectedImagePossibleResizeRange(editor, targetUnit) {
|
|
16
|
+
const imageNodes = getSelectedImageEditorNodes(editor);
|
|
17
|
+
if (!imageNodes) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const imageParentWidthPx = calculateResizeHostAncestorWidth(imageNodes.dom);
|
|
21
|
+
const minimumImageWidth = tryParseDimensionWithUnit(window.getComputedStyle(imageNodes.dom).minWidth) || {
|
|
22
|
+
value: 1,
|
|
23
|
+
unit: 'px'
|
|
24
|
+
};
|
|
25
|
+
const lower = Math.max(0.1, tryCastDimensionsToUnit(imageParentWidthPx, minimumImageWidth, targetUnit).value);
|
|
26
|
+
const upper = targetUnit === 'px' ? imageParentWidthPx : 100;
|
|
27
|
+
return {
|
|
28
|
+
unit: targetUnit,
|
|
29
|
+
lower,
|
|
30
|
+
upper
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
6
|
+
import { type DimensionWithUnit } from './tryparsedimensionwithunit.js';
|
|
7
|
+
/**
|
|
8
|
+
* Returns image width in specified units. It is width of image after resize.
|
|
9
|
+
*
|
|
10
|
+
* * If image is not selected or command is disabled then `null` will be returned.
|
|
11
|
+
* * If image is not fully loaded (and it is impossible to determine its natural size) then `null` will be returned.
|
|
12
|
+
* * If `targetUnit` percentage is passed then it will return width percentage of image related to its accessors.
|
|
13
|
+
*
|
|
14
|
+
* @param editor Editor instance.
|
|
15
|
+
* @param targetUnit Unit in which dimension will be returned.
|
|
16
|
+
* @returns Parsed image width after resize (with unit).
|
|
17
|
+
*/
|
|
18
|
+
export declare function getSelectedImageWidthInUnits(editor: Editor, targetUnit: string): DimensionWithUnit | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
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/imageresize/utils/getselectedimagewidthinunits
|
|
7
|
+
*/
|
|
8
|
+
import { Rect } from 'ckeditor5/src/utils.js';
|
|
9
|
+
import { calculateResizeHostAncestorWidth } from 'ckeditor5/src/widget.js';
|
|
10
|
+
import { tryCastDimensionsToUnit, tryParseDimensionWithUnit } from './tryparsedimensionwithunit.js';
|
|
11
|
+
import { getSelectedImageEditorNodes } from './getselectedimageeditornodes.js';
|
|
12
|
+
/**
|
|
13
|
+
* Returns image width in specified units. It is width of image after resize.
|
|
14
|
+
*
|
|
15
|
+
* * If image is not selected or command is disabled then `null` will be returned.
|
|
16
|
+
* * If image is not fully loaded (and it is impossible to determine its natural size) then `null` will be returned.
|
|
17
|
+
* * If `targetUnit` percentage is passed then it will return width percentage of image related to its accessors.
|
|
18
|
+
*
|
|
19
|
+
* @param editor Editor instance.
|
|
20
|
+
* @param targetUnit Unit in which dimension will be returned.
|
|
21
|
+
* @returns Parsed image width after resize (with unit).
|
|
22
|
+
*/
|
|
23
|
+
export function getSelectedImageWidthInUnits(editor, targetUnit) {
|
|
24
|
+
const imageNodes = getSelectedImageEditorNodes(editor);
|
|
25
|
+
if (!imageNodes) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const parsedResizedWidth = tryParseDimensionWithUnit(imageNodes.model.getAttribute('resizedWidth') || null);
|
|
29
|
+
if (!parsedResizedWidth) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
if (parsedResizedWidth.unit === targetUnit) {
|
|
33
|
+
return parsedResizedWidth;
|
|
34
|
+
}
|
|
35
|
+
const imageParentWidthPx = calculateResizeHostAncestorWidth(imageNodes.dom);
|
|
36
|
+
const imageHolderDimension = {
|
|
37
|
+
unit: 'px',
|
|
38
|
+
value: new Rect(imageNodes.dom).width
|
|
39
|
+
};
|
|
40
|
+
return tryCastDimensionsToUnit(imageParentWidthPx, imageHolderDimension, targetUnit);
|
|
41
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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/imageresize/utils/tryparsedimensionwithunit
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Parses provided string with dimension value and returns extracted numeric value and unit.
|
|
10
|
+
*
|
|
11
|
+
* * If non-string dimension is passed then `null` value is returned.
|
|
12
|
+
* * If unit is missing then `null` is returned.
|
|
13
|
+
* * If numeric value part of string is not a number then `null` is returned.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* `"222px"` => `{ value: 222, unit: "px" }`
|
|
17
|
+
* `"99%"` => `{ value: 99, unit: "%" }`
|
|
18
|
+
|
|
19
|
+
* @param dimension Unsafe string with dimension.
|
|
20
|
+
* @returns Parsed dimension with extracted numeric value and units.
|
|
21
|
+
*/
|
|
22
|
+
export declare function tryParseDimensionWithUnit(dimension: string | null | undefined): DimensionWithUnit | null;
|
|
23
|
+
/**
|
|
24
|
+
* Converts dimension between `px` -> `%` and `%` -> `px`.
|
|
25
|
+
*
|
|
26
|
+
* @param parentDimensionPx Dimension of parent element that contains measured element.
|
|
27
|
+
* @param dimension Measured element dimension.
|
|
28
|
+
* @returns Casted dimension.
|
|
29
|
+
*/
|
|
30
|
+
export declare function tryCastDimensionsToUnit(parentDimensionPx: number, dimension: DimensionWithUnit, targetUnit: string): DimensionWithUnit;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export type DimensionWithUnit = {
|
|
35
|
+
value: number;
|
|
36
|
+
unit: string;
|
|
37
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
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/imageresize/utils/tryparsedimensionwithunit
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Parses provided string with dimension value and returns extracted numeric value and unit.
|
|
10
|
+
*
|
|
11
|
+
* * If non-string dimension is passed then `null` value is returned.
|
|
12
|
+
* * If unit is missing then `null` is returned.
|
|
13
|
+
* * If numeric value part of string is not a number then `null` is returned.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* `"222px"` => `{ value: 222, unit: "px" }`
|
|
17
|
+
* `"99%"` => `{ value: 99, unit: "%" }`
|
|
18
|
+
|
|
19
|
+
* @param dimension Unsafe string with dimension.
|
|
20
|
+
* @returns Parsed dimension with extracted numeric value and units.
|
|
21
|
+
*/
|
|
22
|
+
export function tryParseDimensionWithUnit(dimension) {
|
|
23
|
+
if (!dimension) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const [, rawValue, unit] = dimension.trim().match(/([.,\d]+)(%|px)$/) || [];
|
|
27
|
+
const parsedValue = Number.parseFloat(rawValue);
|
|
28
|
+
if (Number.isNaN(parsedValue)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
value: parsedValue,
|
|
33
|
+
unit
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Converts dimension between `px` -> `%` and `%` -> `px`.
|
|
38
|
+
*
|
|
39
|
+
* @param parentDimensionPx Dimension of parent element that contains measured element.
|
|
40
|
+
* @param dimension Measured element dimension.
|
|
41
|
+
* @returns Casted dimension.
|
|
42
|
+
*/
|
|
43
|
+
export function tryCastDimensionsToUnit(parentDimensionPx, dimension, targetUnit) {
|
|
44
|
+
// "%" -> "px" conversion
|
|
45
|
+
if (targetUnit === 'px') {
|
|
46
|
+
return {
|
|
47
|
+
value: dimension.value,
|
|
48
|
+
unit: 'px'
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
// "px" -> "%" conversion
|
|
52
|
+
return {
|
|
53
|
+
value: dimension.value / parentDimensionPx * 100,
|
|
54
|
+
unit: '%'
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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/imageresize
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import ImageResizeButtons from './imageresize/imageresizebuttons.js';
|
|
10
|
+
import ImageResizeEditing from './imageresize/imageresizeediting.js';
|
|
11
|
+
import ImageResizeHandles from './imageresize/imageresizehandles.js';
|
|
12
|
+
import ImageCustomResizeUI from './imageresize/imagecustomresizeui.js';
|
|
13
|
+
import '../theme/imageresize.css';
|
|
14
|
+
/**
|
|
15
|
+
* The image resize plugin.
|
|
16
|
+
*
|
|
17
|
+
* It adds a possibility to resize each image using handles.
|
|
18
|
+
*/
|
|
19
|
+
export default class ImageResize extends Plugin {
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get requires(): readonly [typeof ImageResizeEditing, typeof ImageResizeHandles, typeof ImageCustomResizeUI, typeof ImageResizeButtons];
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get pluginName(): "ImageResize";
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
static get isOfficialPlugin(): true;
|
|
32
|
+
}
|
|
@@ -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/imageresize
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import ImageResizeButtons from './imageresize/imageresizebuttons.js';
|
|
10
|
+
import ImageResizeEditing from './imageresize/imageresizeediting.js';
|
|
11
|
+
import ImageResizeHandles from './imageresize/imageresizehandles.js';
|
|
12
|
+
import ImageCustomResizeUI from './imageresize/imagecustomresizeui.js';
|
|
13
|
+
import '../theme/imageresize.css';
|
|
14
|
+
/**
|
|
15
|
+
* The image resize plugin.
|
|
16
|
+
*
|
|
17
|
+
* It adds a possibility to resize each image using handles.
|
|
18
|
+
*/
|
|
19
|
+
export default class ImageResize extends Plugin {
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get requires() {
|
|
24
|
+
return [ImageResizeEditing, ImageResizeHandles, ImageCustomResizeUI, ImageResizeButtons];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get pluginName() {
|
|
30
|
+
return 'ImageResize';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
static get isOfficialPlugin() {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -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/imagesizeattributes
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import ImageUtils from './imageutils.js';
|
|
10
|
+
/**
|
|
11
|
+
* This plugin enables `width` and `height` attributes in inline and block image elements.
|
|
12
|
+
*/
|
|
13
|
+
export default class ImageSizeAttributes extends Plugin {
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
static get requires(): readonly [typeof ImageUtils];
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get pluginName(): "ImageSizeAttributes";
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get isOfficialPlugin(): true;
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
afterInit(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Registers the `width` and `height` attributes for inline and block images.
|
|
32
|
+
*/
|
|
33
|
+
private _registerSchema;
|
|
34
|
+
/**
|
|
35
|
+
* Registers converters for `width` and `height` attributes.
|
|
36
|
+
*/
|
|
37
|
+
private _registerConverters;
|
|
38
|
+
}
|