@ckeditor/ckeditor5-image 32.0.0 → 34.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/LICENSE.md +2 -2
- package/README.md +2 -1
- package/build/image.js +2 -2
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/jv.js +1 -0
- package/build/translations/lv.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/ur.js +1 -0
- package/lang/translations/el.po +22 -22
- package/lang/translations/en-au.po +3 -3
- package/lang/translations/es.po +7 -7
- package/lang/translations/hr.po +12 -12
- package/lang/translations/jv.po +113 -0
- package/lang/translations/lv.po +12 -12
- package/lang/translations/sk.po +3 -3
- package/lang/translations/ur.po +113 -0
- package/package.json +32 -31
- package/src/image/converters.js +6 -8
- package/src/image/imageblockediting.js +6 -8
- package/src/image/imageinlineediting.js +4 -7
- package/src/image/utils.js +42 -22
- package/src/imagecaption/imagecaptionediting.js +6 -32
- package/src/imagecaption/imagecaptionui.js +4 -6
- package/src/imagecaption/imagecaptionutils.js +89 -0
- package/src/imagecaption/toggleimagecaptioncommand.js +6 -7
- package/src/imagestyle/utils.js +64 -48
- package/src/imageutils.js +6 -9
- package/src/index.js +2 -0
- package/src/imagecaption/utils.js +0 -63
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2022, 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
|
-
/**
|
|
7
|
-
* @module image/imagecaption/utils
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Returns the caption model element from a given image element. Returns `null` if no caption is found.
|
|
12
|
-
*
|
|
13
|
-
* @param {module:engine/model/element~Element} imageModelElement
|
|
14
|
-
* @returns {module:engine/model/element~Element|null}
|
|
15
|
-
*/
|
|
16
|
-
export function getCaptionFromImageModelElement( imageModelElement ) {
|
|
17
|
-
for ( const node of imageModelElement.getChildren() ) {
|
|
18
|
-
if ( !!node && node.is( 'element', 'caption' ) ) {
|
|
19
|
-
return node;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Returns the caption model element for a model selection. Returns `null` if the selection has no caption element ancestor.
|
|
28
|
-
*
|
|
29
|
-
* @param {module:image/imageutils~ImageUtils} imageUtils
|
|
30
|
-
* @param {module:engine/model/selection~Selection} selection
|
|
31
|
-
* @returns {module:engine/model/element~Element|null}
|
|
32
|
-
*/
|
|
33
|
-
export function getCaptionFromModelSelection( imageUtils, selection ) {
|
|
34
|
-
const captionElement = selection.getFirstPosition().findAncestor( 'caption' );
|
|
35
|
-
|
|
36
|
-
if ( !captionElement ) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if ( imageUtils.isBlockImage( captionElement.parent ) ) {
|
|
41
|
-
return captionElement;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* {@link module:engine/view/matcher~Matcher} pattern. Checks if a given element is a `<figcaption>` element that is placed
|
|
49
|
-
* inside the image `<figure>` element.
|
|
50
|
-
*
|
|
51
|
-
* @param {module:image/imageutils~ImageUtils} imageUtils
|
|
52
|
-
* @param {module:engine/view/element~Element} element
|
|
53
|
-
* @returns {Object|null} Returns the object accepted by {@link module:engine/view/matcher~Matcher} or `null` if the element
|
|
54
|
-
* cannot be matched.
|
|
55
|
-
*/
|
|
56
|
-
export function matchImageCaptionViewElement( imageUtils, element ) {
|
|
57
|
-
// Convert only captions for images.
|
|
58
|
-
if ( element.name == 'figcaption' && imageUtils.isBlockImageView( element.parent ) ) {
|
|
59
|
-
return { name: true };
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return null;
|
|
63
|
-
}
|