@ckeditor/ckeditor5-image 31.0.0 → 33.0.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/build/image.js +3 -3
- package/build/image.js.map +1 -0
- package/build/translations/bs.js +1 -0
- package/build/translations/cs.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/uz.js +1 -0
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/ckeditor5-metadata.json +1 -0
- package/lang/translations/ar.po +1 -1
- package/lang/translations/ast.po +1 -1
- package/lang/translations/az.po +1 -1
- package/lang/translations/bg.po +1 -1
- package/lang/translations/bs.po +113 -0
- package/lang/translations/cs.po +4 -4
- package/lang/translations/da.po +1 -1
- package/lang/translations/de-ch.po +1 -1
- package/lang/translations/de.po +1 -1
- package/lang/translations/el.po +23 -23
- package/lang/translations/en-au.po +1 -1
- package/lang/translations/en-gb.po +1 -1
- package/lang/translations/en.po +1 -1
- package/lang/translations/eo.po +1 -1
- package/lang/translations/es.po +13 -13
- package/lang/translations/et.po +1 -1
- package/lang/translations/eu.po +1 -1
- package/lang/translations/fa.po +1 -1
- package/lang/translations/fi.po +1 -1
- package/lang/translations/fr.po +1 -1
- package/lang/translations/gl.po +1 -1
- package/lang/translations/he.po +1 -1
- package/lang/translations/hi.po +1 -1
- package/lang/translations/hr.po +1 -1
- package/lang/translations/hu.po +1 -1
- package/lang/translations/id.po +4 -4
- package/lang/translations/it.po +1 -1
- package/lang/translations/ja.po +1 -1
- package/lang/translations/km.po +1 -1
- package/lang/translations/kn.po +1 -1
- package/lang/translations/ko.po +1 -1
- package/lang/translations/ku.po +1 -1
- package/lang/translations/lt.po +1 -1
- package/lang/translations/lv.po +1 -1
- package/lang/translations/nb.po +1 -1
- package/lang/translations/ne.po +1 -1
- package/lang/translations/nl.po +1 -1
- package/lang/translations/no.po +1 -1
- package/lang/translations/pl.po +1 -1
- package/lang/translations/pt-br.po +6 -6
- package/lang/translations/pt.po +1 -1
- package/lang/translations/ro.po +1 -1
- package/lang/translations/ru.po +1 -1
- package/lang/translations/si.po +1 -1
- package/lang/translations/sk.po +1 -1
- package/lang/translations/sq.po +1 -1
- package/lang/translations/sr-latn.po +1 -1
- package/lang/translations/sr.po +1 -1
- package/lang/translations/sv.po +1 -1
- package/lang/translations/th.po +1 -1
- package/lang/translations/tk.po +1 -1
- package/lang/translations/tr.po +1 -1
- package/lang/translations/ug.po +1 -1
- package/lang/translations/uk.po +1 -1
- package/lang/translations/uz.po +113 -0
- package/lang/translations/vi.po +1 -1
- package/lang/translations/zh-cn.po +2 -2
- package/lang/translations/zh.po +5 -5
- package/package.json +35 -34
- package/src/autoimage.js +1 -1
- package/src/image/converters.js +13 -11
- package/src/image/imageblockediting.js +6 -6
- package/src/image/imageediting.js +1 -1
- package/src/image/imageinlineediting.js +5 -4
- package/src/image/imageloadobserver.js +1 -1
- package/src/image/imagetypecommand.js +1 -1
- package/src/image/insertimagecommand.js +1 -1
- package/src/image/ui/utils.js +1 -1
- package/src/image/utils.js +23 -17
- package/src/image.js +1 -1
- package/src/imageblock.js +1 -1
- package/src/imagecaption/imagecaptionediting.js +7 -33
- package/src/imagecaption/imagecaptionui.js +5 -7
- package/src/imagecaption/imagecaptionutils.js +89 -0
- package/src/imagecaption/toggleimagecaptioncommand.js +7 -8
- package/src/imagecaption.js +1 -1
- package/src/imageinline.js +1 -1
- package/src/imageinsert/imageinsertui.js +1 -1
- package/src/imageinsert/ui/imageinsertformrowview.js +1 -1
- package/src/imageinsert/ui/imageinsertpanelview.js +11 -1
- package/src/imageinsert/utils.js +1 -1
- package/src/imageinsert.js +1 -1
- package/src/imageresize/imageresizebuttons.js +1 -1
- package/src/imageresize/imageresizeediting.js +1 -1
- package/src/imageresize/imageresizehandles.js +1 -1
- package/src/imageresize/resizeimagecommand.js +1 -1
- package/src/imageresize.js +1 -1
- package/src/imagestyle/converters.js +1 -1
- package/src/imagestyle/imagestylecommand.js +1 -1
- package/src/imagestyle/imagestyleediting.js +1 -1
- package/src/imagestyle/imagestyleui.js +1 -1
- package/src/imagestyle/utils.js +65 -49
- package/src/imagestyle.js +1 -1
- package/src/imagetextalternative/imagetextalternativecommand.js +1 -1
- package/src/imagetextalternative/imagetextalternativeediting.js +1 -1
- package/src/imagetextalternative/imagetextalternativeui.js +1 -1
- package/src/imagetextalternative/ui/textalternativeformview.js +11 -1
- package/src/imagetextalternative.js +1 -1
- package/src/imagetoolbar.js +1 -1
- package/src/imageupload/imageuploadediting.js +7 -7
- package/src/imageupload/imageuploadprogress.js +4 -4
- package/src/imageupload/imageuploadui.js +1 -1
- package/src/imageupload/uploadimagecommand.js +1 -1
- package/src/imageupload/utils.js +1 -1
- package/src/imageupload.js +1 -1
- package/src/imageutils.js +1 -1
- package/src/index.js +2 -1
- package/src/pictureediting.js +1 -1
- package/theme/image.css +1 -1
- package/theme/imagecaption.css +1 -1
- package/theme/imageinsert.css +1 -1
- package/theme/imageinsertformrowview.css +1 -1
- package/theme/imageresize.css +1 -1
- package/theme/imagestyle.css +1 -1
- package/theme/imageuploadicon.css +1 -1
- package/theme/imageuploadloader.css +1 -1
- package/theme/imageuploadprogress.css +1 -1
- package/theme/textalternativeform.css +1 -1
- package/src/imagecaption/utils.js +0 -63
- package/theme/icons/image_placeholder.svg +0 -1
package/src/image/ui/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
package/src/image/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -10,33 +10,39 @@
|
|
|
10
10
|
import { first } from 'ckeditor5/src/utils';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Creates a view element representing the
|
|
13
|
+
* Creates a view element representing the inline image.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* <span class="image-inline"><img></img></span>
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* Note that `alt` and `src` attributes are converted separately, so they are not included.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* @protected
|
|
20
|
+
* @param {module:engine/view/downcastwriter~DowncastWriter} writer
|
|
21
|
+
* @returns {module:engine/view/containerelement~ContainerElement}
|
|
22
|
+
*/
|
|
23
|
+
export function createInlineImageViewElement( writer ) {
|
|
24
|
+
return writer.createContainerElement( 'span', { class: 'image-inline' },
|
|
25
|
+
writer.createEmptyElement( 'img' ),
|
|
26
|
+
{ isAllowedInsideAttributeElement: true }
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Creates a view element representing the block image.
|
|
20
32
|
*
|
|
21
|
-
* <
|
|
33
|
+
* <figure class="image"><img></img></figure>
|
|
22
34
|
*
|
|
23
35
|
* Note that `alt` and `src` attributes are converted separately, so they are not included.
|
|
24
36
|
*
|
|
25
37
|
* @protected
|
|
26
38
|
* @param {module:engine/view/downcastwriter~DowncastWriter} writer
|
|
27
|
-
* @param {'imageBlock'|'imageInline'} imageType The type of created image.
|
|
28
39
|
* @returns {module:engine/view/containerelement~ContainerElement}
|
|
29
40
|
*/
|
|
30
|
-
export function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
writer.createContainerElement( 'span', { class: 'image-inline' }, { isAllowedInsideAttributeElement: true } );
|
|
36
|
-
|
|
37
|
-
writer.insert( writer.createPositionAt( container, 0 ), emptyElement );
|
|
38
|
-
|
|
39
|
-
return container;
|
|
41
|
+
export function createBlockImageViewElement( writer ) {
|
|
42
|
+
return writer.createContainerElement( 'figure', { class: 'image' }, [
|
|
43
|
+
writer.createEmptyElement( 'img' ),
|
|
44
|
+
writer.createSlot()
|
|
45
|
+
] );
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
/**
|
package/src/image.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
package/src/imageblock.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -14,7 +14,7 @@ import { toWidgetEditable } from 'ckeditor5/src/widget';
|
|
|
14
14
|
import ToggleImageCaptionCommand from './toggleimagecaptioncommand';
|
|
15
15
|
|
|
16
16
|
import ImageUtils from '../imageutils';
|
|
17
|
-
import
|
|
17
|
+
import ImageCaptionUtils from './imagecaptionutils';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* The image caption engine plugin. It is responsible for:
|
|
@@ -30,7 +30,7 @@ export default class ImageCaptionEditing extends Plugin {
|
|
|
30
30
|
* @inheritDoc
|
|
31
31
|
*/
|
|
32
32
|
static get requires() {
|
|
33
|
-
return [ ImageUtils ];
|
|
33
|
+
return [ ImageUtils, ImageCaptionUtils ];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -93,11 +93,12 @@ export default class ImageCaptionEditing extends Plugin {
|
|
|
93
93
|
const editor = this.editor;
|
|
94
94
|
const view = editor.editing.view;
|
|
95
95
|
const imageUtils = editor.plugins.get( 'ImageUtils' );
|
|
96
|
+
const imageCaptionUtils = editor.plugins.get( 'ImageCaptionUtils' );
|
|
96
97
|
const t = editor.t;
|
|
97
98
|
|
|
98
99
|
// View -> model converter for the data pipeline.
|
|
99
100
|
editor.conversion.for( 'upcast' ).elementToElement( {
|
|
100
|
-
view: element => matchImageCaptionViewElement(
|
|
101
|
+
view: element => imageCaptionUtils.matchImageCaptionViewElement( element ),
|
|
101
102
|
model: 'caption'
|
|
102
103
|
} );
|
|
103
104
|
|
|
@@ -134,9 +135,6 @@ export default class ImageCaptionEditing extends Plugin {
|
|
|
134
135
|
return toWidgetEditable( figcaptionElement, writer );
|
|
135
136
|
}
|
|
136
137
|
} );
|
|
137
|
-
|
|
138
|
-
editor.editing.mapper.on( 'modelToViewPosition', mapModelPositionToView( view ) );
|
|
139
|
-
editor.data.mapper.on( 'modelToViewPosition', mapModelPositionToView( view ) );
|
|
140
138
|
}
|
|
141
139
|
|
|
142
140
|
/**
|
|
@@ -149,6 +147,7 @@ export default class ImageCaptionEditing extends Plugin {
|
|
|
149
147
|
_setupImageTypeCommandsIntegration() {
|
|
150
148
|
const editor = this.editor;
|
|
151
149
|
const imageUtils = editor.plugins.get( 'ImageUtils' );
|
|
150
|
+
const imageCaptionUtils = editor.plugins.get( 'ImageCaptionUtils' );
|
|
152
151
|
const imageTypeInlineCommand = editor.commands.get( 'imageTypeInline' );
|
|
153
152
|
const imageTypeBlockCommand = editor.commands.get( 'imageTypeBlock' );
|
|
154
153
|
|
|
@@ -166,7 +165,7 @@ export default class ImageCaptionEditing extends Plugin {
|
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
if ( imageUtils.isBlockImage( oldElement ) ) {
|
|
169
|
-
const oldCaptionElement = getCaptionFromImageModelElement( oldElement );
|
|
168
|
+
const oldCaptionElement = imageCaptionUtils.getCaptionFromImageModelElement( oldElement );
|
|
170
169
|
|
|
171
170
|
// If the old element was a captioned block image (the caption was visible),
|
|
172
171
|
// simply save it so it can be restored.
|
|
@@ -244,28 +243,3 @@ export default class ImageCaptionEditing extends Plugin {
|
|
|
244
243
|
this._savedCaptionsMap.set( imageModelElement, caption.toJSON() );
|
|
245
244
|
}
|
|
246
245
|
}
|
|
247
|
-
|
|
248
|
-
// Creates a mapper callback that reverses the order of `<img>` and `<figcaption>` in the image.
|
|
249
|
-
// Without it, `<figcaption>` would precede the `<img>` in the conversion.
|
|
250
|
-
//
|
|
251
|
-
// <imageBlock>^</imageBlock> -> <figure><img>^<caption></caption></figure>
|
|
252
|
-
//
|
|
253
|
-
// @private
|
|
254
|
-
// @param {module:engine/view/view~View} editingView
|
|
255
|
-
// @returns {Function}
|
|
256
|
-
function mapModelPositionToView( editingView ) {
|
|
257
|
-
return ( evt, data ) => {
|
|
258
|
-
const modelPosition = data.modelPosition;
|
|
259
|
-
const parent = modelPosition.parent;
|
|
260
|
-
|
|
261
|
-
if ( !parent.is( 'element', 'imageBlock' ) ) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const viewElement = data.mapper.toViewElement( parent );
|
|
266
|
-
|
|
267
|
-
// The "img" element is inserted by ImageBlockEditing during the downcast conversion via
|
|
268
|
-
// an explicit view position so the "0" position does not need any mapping.
|
|
269
|
-
data.viewPosition = editingView.createPositionAt( viewElement, modelPosition.offset + 1 );
|
|
270
|
-
};
|
|
271
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { Plugin, icons } from 'ckeditor5/src/core';
|
|
11
11
|
import { ButtonView } from 'ckeditor5/src/ui';
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
import { getCaptionFromModelSelection } from './utils';
|
|
12
|
+
import ImageCaptionUtils from './imagecaptionutils';
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* The image caption UI plugin. It introduces the `'toggleImageCaption'` UI button.
|
|
@@ -23,7 +21,7 @@ export default class ImageCaptionUI extends Plugin {
|
|
|
23
21
|
* @inheritDoc
|
|
24
22
|
*/
|
|
25
23
|
static get requires() {
|
|
26
|
-
return [
|
|
24
|
+
return [ ImageCaptionUtils ];
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
/**
|
|
@@ -39,7 +37,7 @@ export default class ImageCaptionUI extends Plugin {
|
|
|
39
37
|
init() {
|
|
40
38
|
const editor = this.editor;
|
|
41
39
|
const editingView = editor.editing.view;
|
|
42
|
-
const
|
|
40
|
+
const imageCaptionUtils = editor.plugins.get( 'ImageCaptionUtils' );
|
|
43
41
|
const t = editor.t;
|
|
44
42
|
|
|
45
43
|
editor.ui.componentFactory.add( 'toggleImageCaption', locale => {
|
|
@@ -59,7 +57,7 @@ export default class ImageCaptionUI extends Plugin {
|
|
|
59
57
|
editor.execute( 'toggleImageCaption', { focusCaptionOnShow: true } );
|
|
60
58
|
|
|
61
59
|
// Scroll to the selection and highlight the caption if the caption showed up.
|
|
62
|
-
const modelCaptionElement = getCaptionFromModelSelection(
|
|
60
|
+
const modelCaptionElement = imageCaptionUtils.getCaptionFromModelSelection( editor.model.document.selection );
|
|
63
61
|
|
|
64
62
|
if ( modelCaptionElement ) {
|
|
65
63
|
const figcaptionElement = editor.editing.mapper.toViewElement( modelCaptionElement );
|
|
@@ -0,0 +1,89 @@
|
|
|
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/imagecaptionutils/utils
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
11
|
+
|
|
12
|
+
import ImageUtils from '../imageutils';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The image caption utilities plugin.
|
|
16
|
+
*
|
|
17
|
+
* @extends module:core/plugin~Plugin
|
|
18
|
+
*/
|
|
19
|
+
export default class ImageCaptionUtils extends Plugin {
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get pluginName() {
|
|
24
|
+
return 'ImageCaptionUtils';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static get requires() {
|
|
31
|
+
return [ ImageUtils ];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns the caption model element from a given image element. Returns `null` if no caption is found.
|
|
36
|
+
*
|
|
37
|
+
* @param {module:engine/model/element~Element} imageModelElement
|
|
38
|
+
* @returns {module:engine/model/element~Element|null}
|
|
39
|
+
*/
|
|
40
|
+
getCaptionFromImageModelElement( imageModelElement ) {
|
|
41
|
+
for ( const node of imageModelElement.getChildren() ) {
|
|
42
|
+
if ( !!node && node.is( 'element', 'caption' ) ) {
|
|
43
|
+
return node;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns the caption model element for a model selection. Returns `null` if the selection has no caption element ancestor.
|
|
52
|
+
*
|
|
53
|
+
* @param {module:engine/model/selection~Selection} selection
|
|
54
|
+
* @returns {module:engine/model/element~Element|null}
|
|
55
|
+
*/
|
|
56
|
+
getCaptionFromModelSelection( selection ) {
|
|
57
|
+
const imageUtils = this.editor.plugins.get( 'ImageUtils' );
|
|
58
|
+
const captionElement = selection.getFirstPosition().findAncestor( 'caption' );
|
|
59
|
+
|
|
60
|
+
if ( !captionElement ) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if ( imageUtils.isBlockImage( captionElement.parent ) ) {
|
|
65
|
+
return captionElement;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* {@link module:engine/view/matcher~Matcher} pattern. Checks if a given element is a `<figcaption>` element that is placed
|
|
73
|
+
* inside the image `<figure>` element.
|
|
74
|
+
*
|
|
75
|
+
* @param {module:engine/view/element~Element} element
|
|
76
|
+
* @returns {Object|null} Returns the object accepted by {@link module:engine/view/matcher~Matcher} or `null` if the element
|
|
77
|
+
* cannot be matched.
|
|
78
|
+
*/
|
|
79
|
+
matchImageCaptionViewElement( element ) {
|
|
80
|
+
const imageUtils = this.editor.plugins.get( 'ImageUtils' );
|
|
81
|
+
|
|
82
|
+
// Convert only captions for images.
|
|
83
|
+
if ( element.name == 'figcaption' && imageUtils.isBlockImageView( element.parent ) ) {
|
|
84
|
+
return { name: true };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
import { Command } from 'ckeditor5/src/core';
|
|
11
11
|
|
|
12
12
|
import ImageBlockEditing from '../image/imageblockediting';
|
|
13
|
-
import { getCaptionFromImageModelElement, getCaptionFromModelSelection } from './utils';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* The toggle image caption command.
|
|
@@ -41,7 +40,7 @@ export default class ToggleImageCaptionCommand extends Command {
|
|
|
41
40
|
*/
|
|
42
41
|
refresh() {
|
|
43
42
|
const editor = this.editor;
|
|
44
|
-
const
|
|
43
|
+
const imageCaptionUtils = editor.plugins.get( 'ImageCaptionUtils' );
|
|
45
44
|
|
|
46
45
|
// Only block images can get captions.
|
|
47
46
|
if ( !editor.plugins.has( ImageBlockEditing ) ) {
|
|
@@ -55,7 +54,7 @@ export default class ToggleImageCaptionCommand extends Command {
|
|
|
55
54
|
const selectedElement = selection.getSelectedElement();
|
|
56
55
|
|
|
57
56
|
if ( !selectedElement ) {
|
|
58
|
-
const ancestorCaptionElement = getCaptionFromModelSelection(
|
|
57
|
+
const ancestorCaptionElement = imageCaptionUtils.getCaptionFromModelSelection( selection );
|
|
59
58
|
|
|
60
59
|
this.isEnabled = !!ancestorCaptionElement;
|
|
61
60
|
this.value = !!ancestorCaptionElement;
|
|
@@ -70,7 +69,7 @@ export default class ToggleImageCaptionCommand extends Command {
|
|
|
70
69
|
if ( !this.isEnabled ) {
|
|
71
70
|
this.value = false;
|
|
72
71
|
} else {
|
|
73
|
-
this.value = !!getCaptionFromImageModelElement( selectedElement );
|
|
72
|
+
this.value = !!imageCaptionUtils.getCaptionFromImageModelElement( selectedElement );
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
|
|
@@ -145,14 +144,14 @@ export default class ToggleImageCaptionCommand extends Command {
|
|
|
145
144
|
const editor = this.editor;
|
|
146
145
|
const selection = editor.model.document.selection;
|
|
147
146
|
const imageCaptionEditing = editor.plugins.get( 'ImageCaptionEditing' );
|
|
148
|
-
const
|
|
147
|
+
const imageCaptionUtils = editor.plugins.get( 'ImageCaptionUtils' );
|
|
149
148
|
let selectedImage = selection.getSelectedElement();
|
|
150
149
|
let captionElement;
|
|
151
150
|
|
|
152
151
|
if ( selectedImage ) {
|
|
153
|
-
captionElement = getCaptionFromImageModelElement( selectedImage );
|
|
152
|
+
captionElement = imageCaptionUtils.getCaptionFromImageModelElement( selectedImage );
|
|
154
153
|
} else {
|
|
155
|
-
captionElement = getCaptionFromModelSelection(
|
|
154
|
+
captionElement = imageCaptionUtils.getCaptionFromModelSelection( selection );
|
|
156
155
|
selectedImage = captionElement.parent;
|
|
157
156
|
}
|
|
158
157
|
|
package/src/imagecaption.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
package/src/imageinline.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -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
|
*
|
package/src/imageinsert/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
package/src/imageinsert.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
package/src/imageresize.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|