@ckeditor/ckeditor5-image 29.1.0 → 31.1.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/build/image.js +1 -1
- 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/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/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/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/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/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 +1 -0
- package/lang/translations/de.po +6 -6
- package/lang/translations/es.po +5 -5
- package/lang/translations/gl.po +3 -3
- package/lang/translations/id.po +3 -3
- package/lang/translations/it.po +3 -3
- package/lang/translations/nl.po +2 -2
- package/lang/translations/pt-br.po +4 -4
- package/lang/translations/ru.po +3 -3
- package/lang/translations/sr-latn.po +3 -3
- package/lang/translations/sr.po +3 -3
- package/lang/translations/uz.po +113 -0
- package/lang/translations/zh.po +4 -4
- package/package.json +31 -31
- package/src/autoimage.js +4 -1
- package/src/image/converters.js +8 -8
- package/src/image/imageblockediting.js +4 -1
- package/src/image/imageinlineediting.js +5 -1
- package/src/image/ui/utils.js +2 -1
- package/src/image/utils.js +4 -9
- package/src/imagecaption/imagecaptionediting.js +2 -12
- package/src/imageinsert/ui/imageinsertpanelview.js +10 -0
- package/src/imagestyle/converters.js +2 -1
- package/src/imagetextalternative/ui/textalternativeformview.js +10 -0
- package/src/imageupload/imageuploadprogress.js +3 -3
- package/CHANGELOG.md +0 -423
- package/theme/icons/image_placeholder.svg +0 -1
package/src/image/converters.js
CHANGED
|
@@ -39,11 +39,14 @@ export function upcastImageFigure( imageUtils ) {
|
|
|
39
39
|
// Find an image element inside the figure element.
|
|
40
40
|
const viewImage = imageUtils.findViewImgElement( data.viewItem );
|
|
41
41
|
|
|
42
|
-
// Do not convert if image element is absent
|
|
43
|
-
if ( !viewImage || !
|
|
42
|
+
// Do not convert if image element is absent or was already converted.
|
|
43
|
+
if ( !viewImage || !conversionApi.consumable.test( viewImage, { name: true } ) ) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
// Consume the figure to prevent other converters from processing it again.
|
|
48
|
+
conversionApi.consumable.consume( data.viewItem, { name: true, classes: 'image' } );
|
|
49
|
+
|
|
47
50
|
// Convert view image to model image.
|
|
48
51
|
const conversionResult = conversionApi.convertItem( viewImage, data.modelCursor );
|
|
49
52
|
|
|
@@ -52,6 +55,9 @@ export function upcastImageFigure( imageUtils ) {
|
|
|
52
55
|
|
|
53
56
|
// When image wasn't successfully converted then finish conversion.
|
|
54
57
|
if ( !modelImage ) {
|
|
58
|
+
// Revert consumed figure so other features can convert it.
|
|
59
|
+
conversionApi.consumable.revert( data.viewItem, { name: true, classes: 'image' } );
|
|
60
|
+
|
|
55
61
|
return;
|
|
56
62
|
}
|
|
57
63
|
|
|
@@ -136,12 +142,6 @@ export function upcastPicture( imageUtils ) {
|
|
|
136
142
|
data.modelCursor = conversionResult.modelCursor;
|
|
137
143
|
|
|
138
144
|
modelImage = first( conversionResult.modelRange.getItems() );
|
|
139
|
-
|
|
140
|
-
// It could be that the <img/> was broken (e.g. missing "src"). There's no point in converting
|
|
141
|
-
// <picture> any further around a broken <img/>.
|
|
142
|
-
if ( !modelImage ) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
conversionApi.consumable.consume( pictureViewElement, { name: true } );
|
|
@@ -112,7 +112,10 @@ export default class ImageBlockEditing extends Plugin {
|
|
|
112
112
|
conversion.for( 'upcast' )
|
|
113
113
|
.elementToElement( {
|
|
114
114
|
view: getImgViewElementMatcher( editor, 'imageBlock' ),
|
|
115
|
-
model: ( viewImage, { writer } ) => writer.createElement(
|
|
115
|
+
model: ( viewImage, { writer } ) => writer.createElement(
|
|
116
|
+
'imageBlock',
|
|
117
|
+
viewImage.hasAttribute( 'src' ) ? { src: viewImage.getAttribute( 'src' ) } : null
|
|
118
|
+
)
|
|
116
119
|
} )
|
|
117
120
|
.add( upcastImageFigure( imageUtils ) );
|
|
118
121
|
}
|
|
@@ -64,6 +64,7 @@ export default class ImageInlineEditing extends Plugin {
|
|
|
64
64
|
isObject: true,
|
|
65
65
|
isInline: true,
|
|
66
66
|
allowWhere: '$text',
|
|
67
|
+
allowAttributesOf: '$text',
|
|
67
68
|
allowAttributes: [ 'alt', 'src', 'srcset' ]
|
|
68
69
|
} );
|
|
69
70
|
|
|
@@ -120,7 +121,10 @@ export default class ImageInlineEditing extends Plugin {
|
|
|
120
121
|
conversion.for( 'upcast' )
|
|
121
122
|
.elementToElement( {
|
|
122
123
|
view: getImgViewElementMatcher( editor, 'imageInline' ),
|
|
123
|
-
model: ( viewImage, { writer } ) => writer.createElement(
|
|
124
|
+
model: ( viewImage, { writer } ) => writer.createElement(
|
|
125
|
+
'imageInline',
|
|
126
|
+
viewImage.hasAttribute( 'src' ) ? { src: viewImage.getAttribute( 'src' ) } : null
|
|
127
|
+
)
|
|
124
128
|
} );
|
|
125
129
|
}
|
|
126
130
|
|
package/src/image/ui/utils.js
CHANGED
|
@@ -47,7 +47,8 @@ export function getBalloonPositionData( editor ) {
|
|
|
47
47
|
defaultPositions.northArrowSouthEast,
|
|
48
48
|
defaultPositions.southArrowNorth,
|
|
49
49
|
defaultPositions.southArrowNorthWest,
|
|
50
|
-
defaultPositions.southArrowNorthEast
|
|
50
|
+
defaultPositions.southArrowNorthEast,
|
|
51
|
+
defaultPositions.viewportStickyNorth
|
|
51
52
|
]
|
|
52
53
|
};
|
|
53
54
|
}
|
package/src/image/utils.js
CHANGED
|
@@ -49,19 +49,14 @@ export function createImageViewElement( writer, imageType ) {
|
|
|
49
49
|
*/
|
|
50
50
|
export function getImgViewElementMatcher( editor, matchImageType ) {
|
|
51
51
|
if ( editor.plugins.has( 'ImageInlineEditing' ) !== editor.plugins.has( 'ImageBlockEditing' ) ) {
|
|
52
|
-
return {
|
|
53
|
-
name: 'img',
|
|
54
|
-
attributes: {
|
|
55
|
-
src: true
|
|
56
|
-
}
|
|
57
|
-
};
|
|
52
|
+
return { name: 'img' };
|
|
58
53
|
}
|
|
59
54
|
|
|
60
55
|
const imageUtils = editor.plugins.get( 'ImageUtils' );
|
|
61
56
|
|
|
62
57
|
return element => {
|
|
63
|
-
//
|
|
64
|
-
if ( !imageUtils.isInlineImageView( element )
|
|
58
|
+
// Check if view element is an `img`.
|
|
59
|
+
if ( !imageUtils.isInlineImageView( element ) ) {
|
|
65
60
|
return null;
|
|
66
61
|
}
|
|
67
62
|
|
|
@@ -73,7 +68,7 @@ export function getImgViewElementMatcher( editor, matchImageType ) {
|
|
|
73
68
|
return null;
|
|
74
69
|
}
|
|
75
70
|
|
|
76
|
-
return { name: true
|
|
71
|
+
return { name: true };
|
|
77
72
|
};
|
|
78
73
|
}
|
|
79
74
|
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
11
|
import { Element, enablePlaceholder } from 'ckeditor5/src/engine';
|
|
12
|
-
import {
|
|
13
|
-
import { toArray } from 'ckeditor5/src/utils';
|
|
12
|
+
import { toWidgetEditable } from 'ckeditor5/src/widget';
|
|
14
13
|
|
|
15
14
|
import ToggleImageCaptionCommand from './toggleimagecaptioncommand';
|
|
16
15
|
|
|
@@ -132,16 +131,7 @@ export default class ImageCaptionEditing extends Plugin {
|
|
|
132
131
|
keepOnFocus: true
|
|
133
132
|
} );
|
|
134
133
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
setHighlightHandling(
|
|
138
|
-
widgetEditable,
|
|
139
|
-
writer,
|
|
140
|
-
( element, descriptor, writer ) => writer.addClass( toArray( descriptor.classes ), element ),
|
|
141
|
-
( element, descriptor, writer ) => writer.removeClass( toArray( descriptor.classes ), element )
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
return widgetEditable;
|
|
134
|
+
return toWidgetEditable( figcaptionElement, writer );
|
|
145
135
|
}
|
|
146
136
|
} );
|
|
147
137
|
|
|
@@ -203,6 +203,16 @@ export default class ImageInsertPanelView extends View {
|
|
|
203
203
|
}, { priority: 'high' } );
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
/**
|
|
207
|
+
* @inheritDoc
|
|
208
|
+
*/
|
|
209
|
+
destroy() {
|
|
210
|
+
super.destroy();
|
|
211
|
+
|
|
212
|
+
this.focusTracker.destroy();
|
|
213
|
+
this.keystrokes.destroy();
|
|
214
|
+
}
|
|
215
|
+
|
|
206
216
|
/**
|
|
207
217
|
* Returns a view of the integration.
|
|
208
218
|
*
|
|
@@ -61,7 +61,8 @@ export function viewToModelStyleAttribute( styles ) {
|
|
|
61
61
|
const viewElement = data.viewItem;
|
|
62
62
|
const modelImageElement = first( data.modelRange.getItems() );
|
|
63
63
|
|
|
64
|
-
//
|
|
64
|
+
// Run this converter only if an image has been found in the model.
|
|
65
|
+
// In some cases it may not be found (for example if we run this on a figure with different type than image).
|
|
65
66
|
if ( !modelImageElement ) {
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
@@ -151,6 +151,16 @@ export default class TextAlternativeFormView extends View {
|
|
|
151
151
|
} );
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* @inheritDoc
|
|
156
|
+
*/
|
|
157
|
+
destroy() {
|
|
158
|
+
super.destroy();
|
|
159
|
+
|
|
160
|
+
this.focusTracker.destroy();
|
|
161
|
+
this.keystrokes.destroy();
|
|
162
|
+
}
|
|
163
|
+
|
|
154
164
|
/**
|
|
155
165
|
* Creates the button view.
|
|
156
166
|
*
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
import { Plugin } from 'ckeditor5/src/core';
|
|
13
13
|
import { FileRepository } from 'ckeditor5/src/upload';
|
|
14
14
|
|
|
15
|
-
import uploadingPlaceholder from '../../theme/icons/image_placeholder.svg';
|
|
16
|
-
|
|
17
15
|
import '../../theme/imageuploadprogress.css';
|
|
18
16
|
import '../../theme/imageuploadicon.css';
|
|
19
17
|
import '../../theme/imageuploadloader.css';
|
|
@@ -41,10 +39,12 @@ export default class ImageUploadProgress extends Plugin {
|
|
|
41
39
|
/**
|
|
42
40
|
* The image placeholder that is displayed before real image data can be accessed.
|
|
43
41
|
*
|
|
42
|
+
* For the record, this image is a 1x1 px GIF with an aspect ratio set by CSS.
|
|
43
|
+
*
|
|
44
44
|
* @protected
|
|
45
45
|
* @member {String} #placeholder
|
|
46
46
|
*/
|
|
47
|
-
this.placeholder = 'data:image/
|
|
47
|
+
this.placeholder = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|