@ckeditor/ckeditor5-image 47.6.1 → 48.0.0-alpha.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/LICENSE.md +1 -1
- package/ckeditor5-metadata.json +25 -25
- package/{src → dist}/autoimage.d.ts +4 -4
- package/{src → dist}/image/converters.d.ts +1 -1
- package/{src → dist}/image/imageblockediting.d.ts +2 -2
- package/{src → dist}/image/imageediting.d.ts +1 -1
- package/{src → dist}/image/imageinlineediting.d.ts +2 -2
- package/{src → dist}/image/imageloadobserver.d.ts +1 -1
- package/{src → dist}/image/imageplaceholder.d.ts +1 -1
- package/{src → dist}/image/imagetypecommand.d.ts +2 -2
- package/{src → dist}/image/insertimagecommand.d.ts +2 -2
- package/{src → dist}/image/replaceimagesourcecommand.d.ts +2 -2
- package/{src → dist}/image/ui/utils.d.ts +2 -2
- package/{src → dist}/image/utils.d.ts +2 -2
- package/{src → dist}/image.d.ts +1 -1
- package/{src → dist}/imageblock.d.ts +2 -2
- package/{src → dist}/imagecaption/imagecaptionediting.d.ts +2 -2
- package/{src → dist}/imagecaption/imagecaptionui.d.ts +1 -1
- package/{src → dist}/imagecaption/imagecaptionutils.d.ts +2 -2
- package/{src → dist}/imagecaption/toggleimagecaptioncommand.d.ts +1 -1
- package/{src → dist}/imagecaption.d.ts +1 -1
- package/{src → dist}/imageconfig.d.ts +25 -16
- package/{src → dist}/imageinline.d.ts +2 -2
- package/{src → dist}/imageinsert/imageinsertui.d.ts +3 -3
- package/{src → dist}/imageinsert/imageinsertviaurlui.d.ts +2 -2
- package/{src → dist}/imageinsert/ui/imageinsertformview.d.ts +2 -2
- package/{src → dist}/imageinsert/ui/imageinserturlview.d.ts +2 -2
- package/{src → dist}/imageinsert.d.ts +1 -1
- package/{src → dist}/imageinsertviaurl.d.ts +1 -1
- package/{src → dist}/imageresize/imagecustomresizeui.d.ts +2 -2
- package/{src → dist}/imageresize/imageresizebuttons.d.ts +1 -1
- package/{src → dist}/imageresize/imageresizeediting.d.ts +1 -1
- package/{src → dist}/imageresize/imageresizehandles.d.ts +2 -2
- package/{src → dist}/imageresize/resizeimagecommand.d.ts +1 -1
- package/{src → dist}/imageresize/ui/imagecustomresizeformview.d.ts +2 -4
- package/{src → dist}/imageresize/utils/getselectedimageeditornodes.d.ts +2 -2
- package/{src → dist}/imageresize/utils/getselectedimagepossibleresizerange.d.ts +1 -1
- package/{src → dist}/imageresize/utils/getselectedimagewidthinunits.d.ts +1 -1
- package/{src → dist}/imageresize.d.ts +1 -1
- package/{src → dist}/imagesizeattributes.d.ts +1 -1
- package/{src → dist}/imagestyle/converters.d.ts +2 -2
- package/{src → dist}/imagestyle/imagestylecommand.d.ts +2 -2
- package/{src → dist}/imagestyle/imagestyleediting.d.ts +1 -1
- package/{src → dist}/imagestyle/imagestyleui.d.ts +1 -1
- package/{src → dist}/imagestyle/utils.d.ts +1 -1
- package/{src → dist}/imagestyle.d.ts +1 -1
- package/{src → dist}/imagetextalternative/imagetextalternativecommand.d.ts +1 -1
- package/{src → dist}/imagetextalternative/imagetextalternativeediting.d.ts +1 -1
- package/{src → dist}/imagetextalternative/imagetextalternativeui.d.ts +2 -2
- package/{src → dist}/imagetextalternative/ui/textalternativeformview.d.ts +2 -4
- package/{src → dist}/imagetextalternative.d.ts +1 -1
- package/{src → dist}/imagetoolbar.d.ts +2 -2
- package/{src → dist}/imageupload/imageuploadediting.d.ts +5 -5
- package/{src → dist}/imageupload/imageuploadprogress.d.ts +1 -1
- package/{src → dist}/imageupload/imageuploadui.d.ts +1 -1
- package/{src → dist}/imageupload/uploadimagecommand.d.ts +2 -2
- package/{src → dist}/imageupload/utils.d.ts +1 -1
- package/{src → dist}/imageupload.d.ts +1 -1
- package/{src → dist}/imageutils.d.ts +2 -2
- package/dist/index-content.css +97 -100
- package/dist/index-editor.css +313 -190
- package/dist/index.css +388 -458
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/{src → dist}/pictureediting.d.ts +1 -1
- package/package.json +29 -53
- package/build/image.js +0 -5
- package/build/translations/af.js +0 -1
- package/build/translations/ar.js +0 -1
- package/build/translations/ast.js +0 -1
- package/build/translations/az.js +0 -1
- package/build/translations/be.js +0 -1
- package/build/translations/bg.js +0 -1
- package/build/translations/bn.js +0 -1
- package/build/translations/bs.js +0 -1
- package/build/translations/ca.js +0 -1
- package/build/translations/cs.js +0 -1
- package/build/translations/da.js +0 -1
- package/build/translations/de-ch.js +0 -1
- package/build/translations/de.js +0 -1
- package/build/translations/el.js +0 -1
- package/build/translations/en-au.js +0 -1
- package/build/translations/en-gb.js +0 -1
- package/build/translations/eo.js +0 -1
- package/build/translations/es-co.js +0 -1
- package/build/translations/es.js +0 -1
- package/build/translations/et.js +0 -1
- package/build/translations/eu.js +0 -1
- package/build/translations/fa.js +0 -1
- package/build/translations/fi.js +0 -1
- package/build/translations/fr.js +0 -1
- package/build/translations/gl.js +0 -1
- package/build/translations/gu.js +0 -1
- package/build/translations/he.js +0 -1
- package/build/translations/hi.js +0 -1
- package/build/translations/hr.js +0 -1
- package/build/translations/hu.js +0 -1
- package/build/translations/hy.js +0 -1
- package/build/translations/id.js +0 -1
- package/build/translations/it.js +0 -1
- package/build/translations/ja.js +0 -1
- package/build/translations/jv.js +0 -1
- package/build/translations/kk.js +0 -1
- package/build/translations/km.js +0 -1
- package/build/translations/kn.js +0 -1
- package/build/translations/ko.js +0 -1
- package/build/translations/ku.js +0 -1
- package/build/translations/lt.js +0 -1
- package/build/translations/lv.js +0 -1
- package/build/translations/ms.js +0 -1
- package/build/translations/nb.js +0 -1
- package/build/translations/ne.js +0 -1
- package/build/translations/nl.js +0 -1
- package/build/translations/no.js +0 -1
- package/build/translations/oc.js +0 -1
- package/build/translations/pl.js +0 -1
- package/build/translations/pt-br.js +0 -1
- package/build/translations/pt.js +0 -1
- package/build/translations/ro.js +0 -1
- package/build/translations/ru.js +0 -1
- package/build/translations/si.js +0 -1
- package/build/translations/sk.js +0 -1
- package/build/translations/sl.js +0 -1
- package/build/translations/sq.js +0 -1
- package/build/translations/sr-latn.js +0 -1
- package/build/translations/sr.js +0 -1
- package/build/translations/sv.js +0 -1
- package/build/translations/th.js +0 -1
- package/build/translations/ti.js +0 -1
- package/build/translations/tk.js +0 -1
- package/build/translations/tr.js +0 -1
- package/build/translations/tt.js +0 -1
- package/build/translations/ug.js +0 -1
- package/build/translations/uk.js +0 -1
- package/build/translations/ur.js +0 -1
- package/build/translations/uz.js +0 -1
- package/build/translations/vi.js +0 -1
- package/build/translations/zh-cn.js +0 -1
- package/build/translations/zh.js +0 -1
- package/lang/contexts.json +0 -48
- package/lang/translations/af.po +0 -196
- package/lang/translations/ar.po +0 -196
- package/lang/translations/ast.po +0 -196
- package/lang/translations/az.po +0 -196
- package/lang/translations/be.po +0 -196
- package/lang/translations/bg.po +0 -196
- package/lang/translations/bn.po +0 -196
- package/lang/translations/bs.po +0 -196
- package/lang/translations/ca.po +0 -196
- package/lang/translations/cs.po +0 -196
- package/lang/translations/da.po +0 -196
- package/lang/translations/de-ch.po +0 -196
- package/lang/translations/de.po +0 -196
- package/lang/translations/el.po +0 -196
- package/lang/translations/en-au.po +0 -196
- package/lang/translations/en-gb.po +0 -196
- package/lang/translations/en.po +0 -196
- package/lang/translations/eo.po +0 -196
- package/lang/translations/es-co.po +0 -196
- package/lang/translations/es.po +0 -196
- package/lang/translations/et.po +0 -196
- package/lang/translations/eu.po +0 -196
- package/lang/translations/fa.po +0 -196
- package/lang/translations/fi.po +0 -196
- package/lang/translations/fr.po +0 -196
- package/lang/translations/gl.po +0 -196
- package/lang/translations/gu.po +0 -196
- package/lang/translations/he.po +0 -196
- package/lang/translations/hi.po +0 -196
- package/lang/translations/hr.po +0 -196
- package/lang/translations/hu.po +0 -196
- package/lang/translations/hy.po +0 -196
- package/lang/translations/id.po +0 -196
- package/lang/translations/it.po +0 -196
- package/lang/translations/ja.po +0 -196
- package/lang/translations/jv.po +0 -196
- package/lang/translations/kk.po +0 -196
- package/lang/translations/km.po +0 -196
- package/lang/translations/kn.po +0 -196
- package/lang/translations/ko.po +0 -196
- package/lang/translations/ku.po +0 -196
- package/lang/translations/lt.po +0 -196
- package/lang/translations/lv.po +0 -196
- package/lang/translations/ms.po +0 -196
- package/lang/translations/nb.po +0 -196
- package/lang/translations/ne.po +0 -196
- package/lang/translations/nl.po +0 -196
- package/lang/translations/no.po +0 -196
- package/lang/translations/oc.po +0 -196
- package/lang/translations/pl.po +0 -196
- package/lang/translations/pt-br.po +0 -196
- package/lang/translations/pt.po +0 -196
- package/lang/translations/ro.po +0 -196
- package/lang/translations/ru.po +0 -196
- package/lang/translations/si.po +0 -196
- package/lang/translations/sk.po +0 -196
- package/lang/translations/sl.po +0 -196
- package/lang/translations/sq.po +0 -196
- package/lang/translations/sr-latn.po +0 -196
- package/lang/translations/sr.po +0 -196
- package/lang/translations/sv.po +0 -196
- package/lang/translations/th.po +0 -196
- package/lang/translations/ti.po +0 -196
- package/lang/translations/tk.po +0 -196
- package/lang/translations/tr.po +0 -196
- package/lang/translations/tt.po +0 -196
- package/lang/translations/ug.po +0 -196
- package/lang/translations/uk.po +0 -196
- package/lang/translations/ur.po +0 -196
- package/lang/translations/uz.po +0 -196
- package/lang/translations/vi.po +0 -196
- package/lang/translations/zh-cn.po +0 -196
- package/lang/translations/zh.po +0 -196
- package/src/augmentation.js +0 -5
- package/src/autoimage.js +0 -148
- package/src/image/converters.js +0 -236
- package/src/image/imageblockediting.js +0 -159
- package/src/image/imageediting.js +0 -69
- package/src/image/imageinlineediting.js +0 -178
- package/src/image/imageloadobserver.js +0 -52
- package/src/image/imageplaceholder.js +0 -119
- package/src/image/imagetypecommand.js +0 -84
- package/src/image/insertimagecommand.js +0 -125
- package/src/image/replaceimagesourcecommand.js +0 -75
- package/src/image/ui/utils.js +0 -46
- package/src/image/utils.js +0 -125
- package/src/image.js +0 -44
- package/src/imageblock.js +0 -44
- package/src/imagecaption/imagecaptionediting.js +0 -238
- package/src/imagecaption/imagecaptionui.js +0 -68
- package/src/imagecaption/imagecaptionutils.js +0 -68
- package/src/imagecaption/toggleimagecaptioncommand.js +0 -138
- package/src/imagecaption.js +0 -36
- package/src/imageconfig.js +0 -5
- package/src/imageinline.js +0 -44
- package/src/imageinsert/imageinsertui.js +0 -216
- package/src/imageinsert/imageinsertviaurlui.js +0 -175
- package/src/imageinsert/ui/imageinsertformview.js +0 -117
- package/src/imageinsert/ui/imageinserturlview.js +0 -102
- package/src/imageinsert.js +0 -43
- package/src/imageinsertviaurl.js +0 -41
- package/src/imageresize/imagecustomresizeui.js +0 -177
- package/src/imageresize/imageresizebuttons.js +0 -303
- package/src/imageresize/imageresizeediting.js +0 -206
- package/src/imageresize/imageresizehandles.js +0 -118
- package/src/imageresize/resizeimagecommand.js +0 -63
- package/src/imageresize/ui/imagecustomresizeformview.js +0 -264
- package/src/imageresize/utils/getselectedimageeditornodes.js +0 -25
- package/src/imageresize/utils/getselectedimagepossibleresizerange.js +0 -33
- package/src/imageresize/utils/getselectedimagewidthinunits.js +0 -42
- package/src/imageresize/utils/tryparsedimensionwithunit.js +0 -58
- package/src/imageresize.js +0 -38
- package/src/imagesizeattributes.js +0 -163
- package/src/imagestyle/converters.js +0 -118
- package/src/imagestyle/imagestylecommand.js +0 -117
- package/src/imagestyle/imagestyleediting.js +0 -127
- package/src/imagestyle/imagestyleui.js +0 -198
- package/src/imagestyle/utils.js +0 -333
- package/src/imagestyle.js +0 -42
- package/src/imagetextalternative/imagetextalternativecommand.js +0 -44
- package/src/imagetextalternative/imagetextalternativeediting.js +0 -41
- package/src/imagetextalternative/imagetextalternativeui.js +0 -183
- package/src/imagetextalternative/ui/textalternativeformview.js +0 -193
- package/src/imagetextalternative.js +0 -39
- package/src/imagetoolbar.js +0 -63
- package/src/imageupload/imageuploadediting.js +0 -482
- package/src/imageupload/imageuploadprogress.js +0 -222
- package/src/imageupload/imageuploadui.js +0 -135
- package/src/imageupload/uploadimagecommand.js +0 -110
- package/src/imageupload/utils.js +0 -114
- package/src/imageupload.js +0 -42
- package/src/imageutils.js +0 -309
- package/src/index.js +0 -67
- package/src/pictureediting.js +0 -136
- package/theme/image.css +0 -143
- package/theme/imagecaption.css +0 -53
- package/theme/imagecustomresizeform.css +0 -4
- package/theme/imageinsert.css +0 -14
- package/theme/imageplaceholder.css +0 -10
- package/theme/imageresize.css +0 -53
- package/theme/imagestyle.css +0 -120
- package/theme/imageuploadicon.css +0 -23
- package/theme/imageuploadloader.css +0 -18
- package/theme/imageuploadprogress.css +0 -19
- package/theme/textalternativeform.css +0 -4
- /package/{src → dist}/augmentation.d.ts +0 -0
- /package/{src → dist}/imageresize/utils/tryparsedimensionwithunit.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
6
|
-
import { WidgetResize } from 'ckeditor5/src/widget.js';
|
|
7
|
-
import { ImageUtils } from '../imageutils.js';
|
|
8
|
-
import { ImageLoadObserver } from '../image/imageloadobserver.js';
|
|
9
|
-
const RESIZABLE_IMAGES_CSS_SELECTOR = 'figure.image.ck-widget > img,' +
|
|
10
|
-
'figure.image.ck-widget > picture > img,' +
|
|
11
|
-
'figure.image.ck-widget > a > img,' +
|
|
12
|
-
'figure.image.ck-widget > a > picture > img,' +
|
|
13
|
-
'span.image-inline.ck-widget > img,' +
|
|
14
|
-
'span.image-inline.ck-widget > picture > img';
|
|
15
|
-
const RESIZED_IMAGE_CLASS = 'image_resized';
|
|
16
|
-
/**
|
|
17
|
-
* The image resize by handles feature.
|
|
18
|
-
*
|
|
19
|
-
* It adds the ability to resize each image using handles or manually by
|
|
20
|
-
* {@link module:image/imageresize/imageresizebuttons~ImageResizeButtons} buttons.
|
|
21
|
-
*/
|
|
22
|
-
export class ImageResizeHandles extends Plugin {
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
static get requires() {
|
|
27
|
-
return [WidgetResize, ImageUtils];
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
static get pluginName() {
|
|
33
|
-
return 'ImageResizeHandles';
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* @inheritDoc
|
|
37
|
-
*/
|
|
38
|
-
static get isOfficialPlugin() {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* @inheritDoc
|
|
43
|
-
*/
|
|
44
|
-
init() {
|
|
45
|
-
const command = this.editor.commands.get('resizeImage');
|
|
46
|
-
this.bind('isEnabled').to(command);
|
|
47
|
-
this._setupResizerCreator();
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Attaches the listeners responsible for creating a resizer for each image, except for images inside the HTML embed preview.
|
|
51
|
-
*/
|
|
52
|
-
_setupResizerCreator() {
|
|
53
|
-
const editor = this.editor;
|
|
54
|
-
const editingView = editor.editing.view;
|
|
55
|
-
const imageUtils = editor.plugins.get('ImageUtils');
|
|
56
|
-
editingView.addObserver(ImageLoadObserver);
|
|
57
|
-
this.listenTo(editingView.document, 'imageLoaded', (evt, domEvent) => {
|
|
58
|
-
// The resizer must be attached only to images loaded by the `ImageInsert`, `ImageUpload` or `LinkImage` plugins.
|
|
59
|
-
if (!domEvent.target.matches(RESIZABLE_IMAGES_CSS_SELECTOR)) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const domConverter = editor.editing.view.domConverter;
|
|
63
|
-
const imageView = domConverter.domToView(domEvent.target);
|
|
64
|
-
const widgetView = imageUtils.getImageWidgetFromImageView(imageView);
|
|
65
|
-
let resizer = this.editor.plugins.get(WidgetResize).getResizerByViewElement(widgetView);
|
|
66
|
-
if (resizer) {
|
|
67
|
-
// There are rare cases when the image will be triggered multiple times for the same widget, e.g. when
|
|
68
|
-
// the image's source was changed after upload (https://github.com/ckeditor/ckeditor5/pull/8108#issuecomment-708302992).
|
|
69
|
-
resizer.redraw();
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const mapper = editor.editing.mapper;
|
|
73
|
-
const imageModel = mapper.toModelElement(widgetView);
|
|
74
|
-
resizer = editor.plugins
|
|
75
|
-
.get(WidgetResize)
|
|
76
|
-
.attachTo({
|
|
77
|
-
unit: editor.config.get('image.resizeUnit'),
|
|
78
|
-
modelElement: imageModel,
|
|
79
|
-
viewElement: widgetView,
|
|
80
|
-
editor,
|
|
81
|
-
getHandleHost(domWidgetElement) {
|
|
82
|
-
return domWidgetElement.querySelector('img');
|
|
83
|
-
},
|
|
84
|
-
getResizeHost() {
|
|
85
|
-
return domConverter.mapViewToDom(mapper.toViewElement(imageModel));
|
|
86
|
-
},
|
|
87
|
-
isCentered() {
|
|
88
|
-
const imageStyle = imageModel.getAttribute('imageStyle');
|
|
89
|
-
return imageStyle == 'alignCenter';
|
|
90
|
-
},
|
|
91
|
-
onCommit(newValue) {
|
|
92
|
-
// Get rid of the CSS class in case the command execution that follows is unsuccessful
|
|
93
|
-
// (e.g. Track Changes can override it and the new dimensions will not apply). Otherwise,
|
|
94
|
-
// the presence of the class and the absence of the width style will cause it to take 100%
|
|
95
|
-
// of the horizontal space.
|
|
96
|
-
editingView.change(writer => {
|
|
97
|
-
writer.removeClass(RESIZED_IMAGE_CLASS, widgetView);
|
|
98
|
-
});
|
|
99
|
-
editor.execute('resizeImage', { width: newValue });
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
resizer.on('updateSize', () => {
|
|
103
|
-
if (!widgetView.hasClass(RESIZED_IMAGE_CLASS)) {
|
|
104
|
-
editingView.change(writer => {
|
|
105
|
-
writer.addClass(RESIZED_IMAGE_CLASS, widgetView);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
const target = imageModel.name === 'imageInline' ? imageView : widgetView;
|
|
109
|
-
if (target.getStyle('height')) {
|
|
110
|
-
editingView.change(writer => {
|
|
111
|
-
writer.removeStyle('height', target);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
resizer.bind('isEnabled').to(this);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module image/imageresize/resizeimagecommand
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from 'ckeditor5/src/core.js';
|
|
9
|
-
/**
|
|
10
|
-
* The resize image command. Currently, it only supports the width attribute.
|
|
11
|
-
*/
|
|
12
|
-
export class ResizeImageCommand extends Command {
|
|
13
|
-
/**
|
|
14
|
-
* @inheritDoc
|
|
15
|
-
*/
|
|
16
|
-
refresh() {
|
|
17
|
-
const editor = this.editor;
|
|
18
|
-
const imageUtils = editor.plugins.get('ImageUtils');
|
|
19
|
-
const element = imageUtils.getClosestSelectedImageElement(editor.model.document.selection);
|
|
20
|
-
this.isEnabled = !!element;
|
|
21
|
-
if (!element || !element.hasAttribute('resizedWidth')) {
|
|
22
|
-
this.value = null;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
this.value = {
|
|
26
|
-
width: element.getAttribute('resizedWidth'),
|
|
27
|
-
height: null
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Executes the command.
|
|
33
|
-
*
|
|
34
|
-
* ```ts
|
|
35
|
-
* // Sets the width to 50%:
|
|
36
|
-
* editor.execute( 'resizeImage', { width: '50%' } );
|
|
37
|
-
*
|
|
38
|
-
* // Removes the width attribute:
|
|
39
|
-
* editor.execute( 'resizeImage', { width: null } );
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @param options
|
|
43
|
-
* @param options.width The new width of the image.
|
|
44
|
-
* @fires execute
|
|
45
|
-
*/
|
|
46
|
-
execute(options) {
|
|
47
|
-
const editor = this.editor;
|
|
48
|
-
const model = editor.model;
|
|
49
|
-
const imageUtils = editor.plugins.get('ImageUtils');
|
|
50
|
-
const imageElement = imageUtils.getClosestSelectedImageElement(model.document.selection);
|
|
51
|
-
this.value = {
|
|
52
|
-
width: options.width,
|
|
53
|
-
height: null
|
|
54
|
-
};
|
|
55
|
-
if (imageElement) {
|
|
56
|
-
model.change(writer => {
|
|
57
|
-
writer.setAttribute('resizedWidth', options.width, imageElement);
|
|
58
|
-
writer.removeAttribute('resizedHeight', imageElement);
|
|
59
|
-
imageUtils.setImageNaturalSizeAttributes(imageElement);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module image/imageresize/ui/imagecustomresizeformview
|
|
7
|
-
*/
|
|
8
|
-
import { ButtonView, FocusCycler, FormHeaderView, FormRowView, LabeledFieldView, View, ViewCollection, createLabeledInputNumber, submitHandler } from 'ckeditor5/src/ui.js';
|
|
9
|
-
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
|
|
10
|
-
import { IconPreviousArrow } from 'ckeditor5/src/icons.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
|
-
// eslint-disable-next-line ckeditor5-rules/ckeditor-imports
|
|
16
|
-
import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
|
|
17
|
-
/**
|
|
18
|
-
* The ImageCustomResizeFormView class.
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export class ImageCustomResizeFormView extends View {
|
|
23
|
-
/**
|
|
24
|
-
* Tracks information about the DOM focus in the form.
|
|
25
|
-
*/
|
|
26
|
-
focusTracker;
|
|
27
|
-
/**
|
|
28
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
29
|
-
*/
|
|
30
|
-
keystrokes;
|
|
31
|
-
/**
|
|
32
|
-
* Resize unit shortcut.
|
|
33
|
-
*/
|
|
34
|
-
unit;
|
|
35
|
-
/**
|
|
36
|
-
* The Back button view displayed in the header.
|
|
37
|
-
*/
|
|
38
|
-
backButtonView;
|
|
39
|
-
/**
|
|
40
|
-
* A button used to submit the form.
|
|
41
|
-
*/
|
|
42
|
-
saveButtonView;
|
|
43
|
-
/**
|
|
44
|
-
* An input with a label.
|
|
45
|
-
*/
|
|
46
|
-
labeledInput;
|
|
47
|
-
/**
|
|
48
|
-
* A collection of child views.
|
|
49
|
-
*/
|
|
50
|
-
children;
|
|
51
|
-
/**
|
|
52
|
-
* A collection of views which can be focused in the form.
|
|
53
|
-
*/
|
|
54
|
-
_focusables;
|
|
55
|
-
/**
|
|
56
|
-
* Helps cycling over {@link #_focusables} in the form.
|
|
57
|
-
*/
|
|
58
|
-
_focusCycler;
|
|
59
|
-
/**
|
|
60
|
-
* An array of form validators used by {@link #isValid}.
|
|
61
|
-
*/
|
|
62
|
-
_validators;
|
|
63
|
-
/**
|
|
64
|
-
* @inheritDoc
|
|
65
|
-
*/
|
|
66
|
-
constructor(locale, unit, validators) {
|
|
67
|
-
super(locale);
|
|
68
|
-
this.focusTracker = new FocusTracker();
|
|
69
|
-
this.keystrokes = new KeystrokeHandler();
|
|
70
|
-
this.unit = unit;
|
|
71
|
-
// Create buttons.
|
|
72
|
-
this.backButtonView = this._createBackButton();
|
|
73
|
-
this.saveButtonView = this._createSaveButton();
|
|
74
|
-
// Create input fields.
|
|
75
|
-
this.labeledInput = this._createLabeledInputView();
|
|
76
|
-
this.children = this.createCollection([this._createHeaderView()]);
|
|
77
|
-
this.children.add(new FormRowView(locale, {
|
|
78
|
-
children: [
|
|
79
|
-
this.labeledInput,
|
|
80
|
-
this.saveButtonView
|
|
81
|
-
],
|
|
82
|
-
class: [
|
|
83
|
-
'ck-form__row_with-submit',
|
|
84
|
-
'ck-form__row_large-top-padding'
|
|
85
|
-
]
|
|
86
|
-
}));
|
|
87
|
-
this._focusables = new ViewCollection();
|
|
88
|
-
this._validators = validators;
|
|
89
|
-
// Close the panel on esc key press when the **form has focus**.
|
|
90
|
-
this.keystrokes.set('Esc', (data, cancel) => {
|
|
91
|
-
this.fire('cancel');
|
|
92
|
-
cancel();
|
|
93
|
-
});
|
|
94
|
-
this._focusCycler = new FocusCycler({
|
|
95
|
-
focusables: this._focusables,
|
|
96
|
-
focusTracker: this.focusTracker,
|
|
97
|
-
keystrokeHandler: this.keystrokes,
|
|
98
|
-
actions: {
|
|
99
|
-
// Navigate form fields backwards using the Shift + Tab keystroke.
|
|
100
|
-
focusPrevious: 'shift + tab',
|
|
101
|
-
// Navigate form fields forwards using the Tab key.
|
|
102
|
-
focusNext: 'tab'
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
this.setTemplate({
|
|
106
|
-
tag: 'form',
|
|
107
|
-
attributes: {
|
|
108
|
-
class: [
|
|
109
|
-
'ck',
|
|
110
|
-
'ck-form',
|
|
111
|
-
'ck-image-custom-resize-form',
|
|
112
|
-
'ck-responsive-form'
|
|
113
|
-
],
|
|
114
|
-
// https://github.com/ckeditor/ckeditor5-image/issues/40
|
|
115
|
-
tabindex: '-1'
|
|
116
|
-
},
|
|
117
|
-
children: this.children
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @inheritDoc
|
|
122
|
-
*/
|
|
123
|
-
render() {
|
|
124
|
-
super.render();
|
|
125
|
-
submitHandler({
|
|
126
|
-
view: this
|
|
127
|
-
});
|
|
128
|
-
const childViews = [
|
|
129
|
-
this.backButtonView,
|
|
130
|
-
this.labeledInput,
|
|
131
|
-
this.saveButtonView
|
|
132
|
-
];
|
|
133
|
-
childViews.forEach(v => {
|
|
134
|
-
// Register the view as focusable.
|
|
135
|
-
this._focusables.add(v);
|
|
136
|
-
// Register the view in the focus tracker.
|
|
137
|
-
this.focusTracker.add(v.element);
|
|
138
|
-
});
|
|
139
|
-
this.keystrokes.listenTo(this.element);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* @inheritDoc
|
|
143
|
-
*/
|
|
144
|
-
destroy() {
|
|
145
|
-
super.destroy();
|
|
146
|
-
this.focusTracker.destroy();
|
|
147
|
-
this.keystrokes.destroy();
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Creates a back button view that cancels the form.
|
|
151
|
-
*/
|
|
152
|
-
_createBackButton() {
|
|
153
|
-
const t = this.locale.t;
|
|
154
|
-
const backButton = new ButtonView(this.locale);
|
|
155
|
-
backButton.set({
|
|
156
|
-
class: 'ck-button-back',
|
|
157
|
-
label: t('Back'),
|
|
158
|
-
icon: IconPreviousArrow,
|
|
159
|
-
tooltip: true
|
|
160
|
-
});
|
|
161
|
-
backButton.delegate('execute').to(this, 'cancel');
|
|
162
|
-
return backButton;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Creates a save button view that resize the image.
|
|
166
|
-
*/
|
|
167
|
-
_createSaveButton() {
|
|
168
|
-
const t = this.locale.t;
|
|
169
|
-
const saveButton = new ButtonView(this.locale);
|
|
170
|
-
saveButton.set({
|
|
171
|
-
label: t('Save'),
|
|
172
|
-
withText: true,
|
|
173
|
-
type: 'submit',
|
|
174
|
-
class: 'ck-button-action ck-button-bold'
|
|
175
|
-
});
|
|
176
|
-
return saveButton;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Creates a header view for the form.
|
|
180
|
-
*/
|
|
181
|
-
_createHeaderView() {
|
|
182
|
-
const t = this.locale.t;
|
|
183
|
-
const header = new FormHeaderView(this.locale, {
|
|
184
|
-
label: t('Image Resize')
|
|
185
|
-
});
|
|
186
|
-
header.children.add(this.backButtonView, 0);
|
|
187
|
-
return header;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Creates an input with a label.
|
|
191
|
-
*
|
|
192
|
-
* @returns Labeled field view instance.
|
|
193
|
-
*/
|
|
194
|
-
_createLabeledInputView() {
|
|
195
|
-
const t = this.locale.t;
|
|
196
|
-
const labeledInput = new LabeledFieldView(this.locale, createLabeledInputNumber);
|
|
197
|
-
labeledInput.label = t('Resize image (in %0)', this.unit);
|
|
198
|
-
labeledInput.class = 'ck-labeled-field-view_full-width';
|
|
199
|
-
labeledInput.fieldView.set({
|
|
200
|
-
step: 0.1
|
|
201
|
-
});
|
|
202
|
-
return labeledInput;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Validates the form and returns `false` when some fields are invalid.
|
|
206
|
-
*/
|
|
207
|
-
isValid() {
|
|
208
|
-
this.resetFormStatus();
|
|
209
|
-
for (const validator of this._validators) {
|
|
210
|
-
const errorText = validator(this);
|
|
211
|
-
// One error per field is enough.
|
|
212
|
-
if (errorText) {
|
|
213
|
-
// Apply updated error.
|
|
214
|
-
this.labeledInput.errorText = errorText;
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return true;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Cleans up the supplementary error and information text of the {@link #labeledInput}
|
|
222
|
-
* bringing them back to the state when the form has been displayed for the first time.
|
|
223
|
-
*
|
|
224
|
-
* See {@link #isValid}.
|
|
225
|
-
*/
|
|
226
|
-
resetFormStatus() {
|
|
227
|
-
this.labeledInput.errorText = null;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* The native DOM `value` of the input element of {@link #labeledInput}.
|
|
231
|
-
*/
|
|
232
|
-
get rawSize() {
|
|
233
|
-
const { element } = this.labeledInput.fieldView;
|
|
234
|
-
if (!element) {
|
|
235
|
-
return null;
|
|
236
|
-
}
|
|
237
|
-
return element.value;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Get numeric value of size. Returns `null` if value of size input element in {@link #labeledInput}.is not a number.
|
|
241
|
-
*/
|
|
242
|
-
get parsedSize() {
|
|
243
|
-
const { rawSize } = this;
|
|
244
|
-
if (rawSize === null) {
|
|
245
|
-
return null;
|
|
246
|
-
}
|
|
247
|
-
const parsed = Number.parseFloat(rawSize);
|
|
248
|
-
if (Number.isNaN(parsed)) {
|
|
249
|
-
return null;
|
|
250
|
-
}
|
|
251
|
-
return parsed;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Returns serialized image input size with unit.
|
|
255
|
-
* Returns `null` if value of size input element in {@link #labeledInput}.is not a number.
|
|
256
|
-
*/
|
|
257
|
-
get sizeWithUnits() {
|
|
258
|
-
const { parsedSize, unit } = this;
|
|
259
|
-
if (parsedSize === null) {
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
return `${parsedSize}${unit}`;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
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
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export function getSelectedImageEditorNodes(editor) {
|
|
12
|
-
const { editing } = editor;
|
|
13
|
-
const imageUtils = editor.plugins.get('ImageUtils');
|
|
14
|
-
const imageModelElement = imageUtils.getClosestSelectedImageElement(editor.model.document.selection);
|
|
15
|
-
if (!imageModelElement) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
const imageViewElement = editing.mapper.toViewElement(imageModelElement);
|
|
19
|
-
const imageDOMElement = editing.view.domConverter.mapViewToDom(imageViewElement);
|
|
20
|
-
return {
|
|
21
|
-
model: imageModelElement,
|
|
22
|
-
view: imageViewElement,
|
|
23
|
-
dom: imageDOMElement
|
|
24
|
-
};
|
|
25
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
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
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export function getSelectedImagePossibleResizeRange(editor, targetUnit) {
|
|
17
|
-
const imageNodes = getSelectedImageEditorNodes(editor);
|
|
18
|
-
if (!imageNodes) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
const imageParentWidthPx = calculateResizeHostAncestorWidth(imageNodes.dom);
|
|
22
|
-
const minimumImageWidth = tryParseDimensionWithUnit(window.getComputedStyle(imageNodes.dom).minWidth) || {
|
|
23
|
-
value: 1,
|
|
24
|
-
unit: 'px'
|
|
25
|
-
};
|
|
26
|
-
const lower = Math.max(0.1, tryCastDimensionsToUnit(imageParentWidthPx, minimumImageWidth, targetUnit).value);
|
|
27
|
-
const upper = targetUnit === 'px' ? imageParentWidthPx : 100;
|
|
28
|
-
return {
|
|
29
|
-
unit: targetUnit,
|
|
30
|
-
lower,
|
|
31
|
-
upper
|
|
32
|
-
};
|
|
33
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
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
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export function getSelectedImageWidthInUnits(editor, targetUnit) {
|
|
25
|
-
const imageNodes = getSelectedImageEditorNodes(editor);
|
|
26
|
-
if (!imageNodes) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const parsedResizedWidth = tryParseDimensionWithUnit(imageNodes.model.getAttribute('resizedWidth') || null);
|
|
30
|
-
if (!parsedResizedWidth) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
if (parsedResizedWidth.unit === targetUnit) {
|
|
34
|
-
return parsedResizedWidth;
|
|
35
|
-
}
|
|
36
|
-
const imageParentWidthPx = calculateResizeHostAncestorWidth(imageNodes.dom);
|
|
37
|
-
const imageHolderDimension = {
|
|
38
|
-
unit: 'px',
|
|
39
|
-
value: new Rect(imageNodes.dom).width
|
|
40
|
-
};
|
|
41
|
-
return tryCastDimensionsToUnit(imageParentWidthPx, imageHolderDimension, targetUnit);
|
|
42
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
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
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
export function tryParseDimensionWithUnit(dimension) {
|
|
24
|
-
if (!dimension) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
const [, rawValue, unit] = dimension.trim().match(/([.,\d]+)(%|px)$/) || [];
|
|
28
|
-
const parsedValue = Number.parseFloat(rawValue);
|
|
29
|
-
if (Number.isNaN(parsedValue)) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
value: parsedValue,
|
|
34
|
-
unit
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Converts dimension between `px` -> `%` and `%` -> `px`.
|
|
39
|
-
*
|
|
40
|
-
* @param parentDimensionPx Dimension of parent element that contains measured element.
|
|
41
|
-
* @param dimension Measured element dimension.
|
|
42
|
-
* @returns Casted dimension.
|
|
43
|
-
* @internal
|
|
44
|
-
*/
|
|
45
|
-
export function tryCastDimensionsToUnit(parentDimensionPx, dimension, targetUnit) {
|
|
46
|
-
// "%" -> "px" conversion
|
|
47
|
-
if (targetUnit === 'px') {
|
|
48
|
-
return {
|
|
49
|
-
value: dimension.value,
|
|
50
|
-
unit: 'px'
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
// "px" -> "%" conversion
|
|
54
|
-
return {
|
|
55
|
-
value: dimension.value / parentDimensionPx * 100,
|
|
56
|
-
unit: '%'
|
|
57
|
-
};
|
|
58
|
-
}
|
package/src/imageresize.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
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 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
|
-
}
|