@ckeditor/ckeditor5-image 45.0.0 → 45.1.0-alpha.1
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/build/image.js +1 -1
- package/dist/index.js +28 -6
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/imageresize/imageresizebuttons.d.ts +1 -1
- package/src/imageresize/imageresizebuttons.js +2 -2
- package/src/imageresize/imageresizeediting.js +5 -0
- package/src/imagesizeattributes.js +10 -0
- package/src/imagestyle/utils.js +3 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-image",
|
|
3
|
-
"version": "45.0.
|
|
3
|
+
"version": "45.1.0-alpha.1",
|
|
4
4
|
"description": "Image feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ckeditor/ckeditor5-clipboard": "45.0.
|
|
17
|
-
"@ckeditor/ckeditor5-core": "45.0.
|
|
18
|
-
"@ckeditor/ckeditor5-engine": "45.0.
|
|
19
|
-
"@ckeditor/ckeditor5-icons": "45.0.
|
|
20
|
-
"@ckeditor/ckeditor5-typing": "45.0.
|
|
21
|
-
"@ckeditor/ckeditor5-ui": "45.0.
|
|
22
|
-
"@ckeditor/ckeditor5-undo": "45.0.
|
|
23
|
-
"@ckeditor/ckeditor5-upload": "45.0.
|
|
24
|
-
"@ckeditor/ckeditor5-utils": "45.0.
|
|
25
|
-
"@ckeditor/ckeditor5-widget": "45.0.
|
|
26
|
-
"ckeditor5": "45.0.
|
|
16
|
+
"@ckeditor/ckeditor5-clipboard": "45.1.0-alpha.1",
|
|
17
|
+
"@ckeditor/ckeditor5-core": "45.1.0-alpha.1",
|
|
18
|
+
"@ckeditor/ckeditor5-engine": "45.1.0-alpha.1",
|
|
19
|
+
"@ckeditor/ckeditor5-icons": "45.1.0-alpha.1",
|
|
20
|
+
"@ckeditor/ckeditor5-typing": "45.1.0-alpha.1",
|
|
21
|
+
"@ckeditor/ckeditor5-ui": "45.1.0-alpha.1",
|
|
22
|
+
"@ckeditor/ckeditor5-undo": "45.1.0-alpha.1",
|
|
23
|
+
"@ckeditor/ckeditor5-upload": "45.1.0-alpha.1",
|
|
24
|
+
"@ckeditor/ckeditor5-utils": "45.1.0-alpha.1",
|
|
25
|
+
"@ckeditor/ckeditor5-widget": "45.1.0-alpha.1",
|
|
26
|
+
"ckeditor5": "45.1.0-alpha.1",
|
|
27
27
|
"es-toolkit": "1.32.0"
|
|
28
28
|
},
|
|
29
29
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -41,7 +41,7 @@ export default class ImageResizeButtons extends Plugin {
|
|
|
41
41
|
/**
|
|
42
42
|
* A helper function that creates a standalone button component for the plugin.
|
|
43
43
|
*
|
|
44
|
-
* @param
|
|
44
|
+
* @param option A model of the resize option.
|
|
45
45
|
*/
|
|
46
46
|
private _registerImageResizeButton;
|
|
47
47
|
/**
|
|
@@ -69,7 +69,7 @@ export default class ImageResizeButtons extends Plugin {
|
|
|
69
69
|
/**
|
|
70
70
|
* A helper function that creates a standalone button component for the plugin.
|
|
71
71
|
*
|
|
72
|
-
* @param
|
|
72
|
+
* @param option A model of the resize option.
|
|
73
73
|
*/
|
|
74
74
|
_registerImageResizeButton(option) {
|
|
75
75
|
const editor = this.editor;
|
|
@@ -87,7 +87,7 @@ export default class ImageResizeButtons extends Plugin {
|
|
|
87
87
|
* {@link module:image/imageconfig~ImageResizeOption plugin configuration}.
|
|
88
88
|
*
|
|
89
89
|
* @error imageresizebuttons-missing-icon
|
|
90
|
-
* @param option Invalid image resize option.
|
|
90
|
+
* @param {module:image/imageconfig~ImageResizeOption} option Invalid image resize option.
|
|
91
91
|
*/
|
|
92
92
|
throw new CKEditorError('imageresizebuttons-missing-icon', editor, option);
|
|
93
93
|
}
|
|
@@ -179,5 +179,10 @@ export default class ImageResizeEditing extends Plugin {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
|
+
editor.conversion.for('upcast').add(dispatcher => {
|
|
183
|
+
dispatcher.on(`element:${imageType === 'imageBlock' ? 'figure' : 'img'}`, (evt, data, conversionApi) => {
|
|
184
|
+
conversionApi.consumable.consume(data.viewItem, { classes: ['image_resized'] });
|
|
185
|
+
});
|
|
186
|
+
});
|
|
182
187
|
}
|
|
183
188
|
}
|
|
@@ -114,6 +114,16 @@ export default class ImageSizeAttributes extends Plugin {
|
|
|
114
114
|
attachDowncastConverter(dispatcher, 'width', 'width', false);
|
|
115
115
|
attachDowncastConverter(dispatcher, 'height', 'height', false);
|
|
116
116
|
});
|
|
117
|
+
// Consume `aspect-ratio` style if `width` and `height` attributes are set on the image.
|
|
118
|
+
editor.conversion.for('upcast').add(dispatcher => {
|
|
119
|
+
dispatcher.on('element:img', (evt, data, conversionApi) => {
|
|
120
|
+
const width = data.viewItem.getAttribute('width');
|
|
121
|
+
const height = data.viewItem.getAttribute('height');
|
|
122
|
+
if (width && height) {
|
|
123
|
+
conversionApi.consumable.consume(data.viewItem, { styles: ['aspect-ratio'] });
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
117
127
|
function attachDowncastConverter(dispatcher, modelAttributeName, viewAttributeName, setRatioForInlineImage, isEditingDowncast = false) {
|
|
118
128
|
dispatcher.on(`attribute:${modelAttributeName}:${imageType}`, (evt, data, conversionApi) => {
|
|
119
129
|
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
package/src/imagestyle/utils.js
CHANGED
|
@@ -274,8 +274,8 @@ function isValidOption(option, { isBlockPluginLoaded, isInlinePluginLoaded }) {
|
|
|
274
274
|
* are missing. Make sure these plugins are loaded in your editor to get this image style option working.
|
|
275
275
|
*
|
|
276
276
|
* @error image-style-missing-dependency
|
|
277
|
-
* @param {
|
|
278
|
-
* @param {
|
|
277
|
+
* @param {string} style The name of the unsupported option.
|
|
278
|
+
* @param {Array.<string>} missingPlugins The names of the plugins one of which has to be loaded for the particular option.
|
|
279
279
|
*/
|
|
280
280
|
logWarning('image-style-missing-dependency', {
|
|
281
281
|
style: option,
|
|
@@ -312,8 +312,7 @@ function warnInvalidStyle(info) {
|
|
|
312
312
|
* * {@link module:image/imageconfig~ImageStyleDropdownDefinition image style dropdown definition}
|
|
313
313
|
*
|
|
314
314
|
* @error image-style-configuration-definition-invalid
|
|
315
|
-
* @param {
|
|
316
|
-
* @param {String} [style] The name of the invalid image style option
|
|
315
|
+
* @param {object} info The information about the invalid definition.
|
|
317
316
|
*/
|
|
318
317
|
logWarning('image-style-configuration-definition-invalid', info);
|
|
319
318
|
}
|