@ckeditor/ckeditor5-image 35.3.2 → 36.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.
Files changed (69) hide show
  1. package/LICENSE.md +1 -1
  2. package/build/image.js +2 -2
  3. package/build/translations/sr-latn.js +1 -1
  4. package/build/translations/sr.js +1 -1
  5. package/lang/translations/sr-latn.po +2 -2
  6. package/lang/translations/sr.po +2 -2
  7. package/package.json +32 -32
  8. package/src/autoimage.js +1 -1
  9. package/src/image/converters.js +1 -1
  10. package/src/image/imageblockediting.js +1 -1
  11. package/src/image/imageediting.js +6 -2
  12. package/src/image/imageinlineediting.js +1 -1
  13. package/src/image/imageloadobserver.js +1 -1
  14. package/src/image/imagetypecommand.js +1 -1
  15. package/src/image/insertimagecommand.js +1 -1
  16. package/src/image/replaceimagesourcecommand.js +49 -0
  17. package/src/image/ui/utils.js +1 -1
  18. package/src/image/utils.js +4 -2
  19. package/src/image.js +1 -1
  20. package/src/imageblock.js +2 -2
  21. package/src/imagecaption/imagecaptionediting.js +1 -1
  22. package/src/imagecaption/imagecaptionui.js +1 -1
  23. package/src/imagecaption/imagecaptionutils.js +1 -1
  24. package/src/imagecaption/toggleimagecaptioncommand.js +1 -1
  25. package/src/imagecaption.js +1 -1
  26. package/src/imageinline.js +1 -1
  27. package/src/imageinsert/imageinsertui.js +11 -13
  28. package/src/imageinsert/ui/imageinsertformrowview.js +1 -1
  29. package/src/imageinsert/ui/imageinsertpanelview.js +1 -1
  30. package/src/imageinsert/utils.js +1 -1
  31. package/src/imageinsert.js +1 -1
  32. package/src/imageinsertviaurl.js +1 -1
  33. package/src/imageresize/imageresizebuttons.js +4 -4
  34. package/src/imageresize/imageresizeediting.js +1 -1
  35. package/src/imageresize/imageresizehandles.js +1 -1
  36. package/src/imageresize/resizeimagecommand.js +1 -1
  37. package/src/imageresize.js +1 -1
  38. package/src/imagestyle/converters.js +1 -1
  39. package/src/imagestyle/imagestylecommand.js +1 -1
  40. package/src/imagestyle/imagestyleediting.js +1 -1
  41. package/src/imagestyle/imagestyleui.js +1 -1
  42. package/src/imagestyle/utils.js +1 -1
  43. package/src/imagestyle.js +1 -1
  44. package/src/imagetextalternative/imagetextalternativecommand.js +1 -1
  45. package/src/imagetextalternative/imagetextalternativeediting.js +1 -1
  46. package/src/imagetextalternative/imagetextalternativeui.js +11 -6
  47. package/src/imagetextalternative/ui/textalternativeformview.js +1 -1
  48. package/src/imagetextalternative.js +1 -1
  49. package/src/imagetoolbar.js +1 -1
  50. package/src/imageupload/imageuploadediting.js +1 -1
  51. package/src/imageupload/imageuploadprogress.js +1 -1
  52. package/src/imageupload/imageuploadui.js +1 -1
  53. package/src/imageupload/uploadimagecommand.js +1 -1
  54. package/src/imageupload/utils.js +1 -1
  55. package/src/imageupload.js +1 -1
  56. package/src/imageutils.js +1 -1
  57. package/src/index.js +1 -1
  58. package/src/pictureediting.js +1 -1
  59. package/theme/image.css +1 -1
  60. package/theme/imagecaption.css +1 -1
  61. package/theme/imageinsert.css +1 -1
  62. package/theme/imageinsertformrowview.css +1 -1
  63. package/theme/imageresize.css +1 -1
  64. package/theme/imagestyle.css +1 -1
  65. package/theme/imageuploadicon.css +1 -1
  66. package/theme/imageuploadloader.css +1 -1
  67. package/theme/imageuploadprogress.css +1 -1
  68. package/theme/textalternativeform.css +1 -1
  69. package/build/image.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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
 
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ import { Command } from 'ckeditor5/src/core';
7
+
8
+ /**
9
+ * @module image/image/replaceimagesourcecommand
10
+ */
11
+
12
+ /**
13
+ * Replace image source command.
14
+ *
15
+ * Changes image source to the one provided. Can be executed as follows:
16
+ *
17
+ * editor.execute( 'replaceImageSource', { source: 'http://url.to.the/image' } );
18
+ *
19
+ * @extends module:core/command~Command
20
+ */
21
+ export default class ReplaceImageSourceCommand extends Command {
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ refresh() {
26
+ const editor = this.editor;
27
+ const imageUtils = editor.plugins.get( 'ImageUtils' );
28
+ const element = this.editor.model.document.selection.getSelectedElement();
29
+
30
+ this.isEnabled = imageUtils.isImage( element );
31
+ this.value = this.isEnabled ? element.getAttribute( 'src' ) : null;
32
+ }
33
+
34
+ /**
35
+ * Executes the command.
36
+ *
37
+ * @fires execute
38
+ * @param {Object} options Options for the executed command.
39
+ * @param {String} [options.source] The image source to replace.
40
+ */
41
+ execute( options ) {
42
+ const image = this.editor.model.document.selection.getSelectedElement();
43
+ this.editor.model.change( writer => {
44
+ writer.setAttribute( 'src', options.source, image );
45
+ writer.removeAttribute( 'srcset', image );
46
+ writer.removeAttribute( 'sizes', image );
47
+ } );
48
+ }
49
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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
 
@@ -69,7 +69,9 @@ export function getImgViewElementMatcher( editor, matchImageType ) {
69
69
 
70
70
  // The <img> can be standalone, wrapped in <figure>...</figure> (ImageBlock plugin) or
71
71
  // wrapped in <figure><a>...</a></figure> (LinkImage plugin).
72
- const imageType = element.findAncestor( imageUtils.isBlockImageView ) ? 'imageBlock' : 'imageInline';
72
+ const imageType = element.getStyle( 'display' ) == 'block' || element.findAncestor( imageUtils.isBlockImageView ) ?
73
+ 'imageBlock' :
74
+ 'imageInline';
73
75
 
74
76
  if ( imageType !== matchImageType ) {
75
77
  return null;
package/src/image.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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
 
@@ -16,7 +16,7 @@ import ImageBlockEditing from './image/imageblockediting';
16
16
  import '../theme/image.css';
17
17
 
18
18
  /**
19
- * The image inline plugin.
19
+ * The image block plugin.
20
20
  *
21
21
  * This is a "glue" plugin which loads the following plugins:
22
22
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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
 
@@ -111,27 +111,30 @@ export default class ImageInsertUI extends Plugin {
111
111
  _setUpDropdown( command ) {
112
112
  const editor = this.editor;
113
113
  const t = editor.t;
114
- const imageInsertView = new ImageInsertPanelView( editor.locale, prepareIntegrations( editor ) );
115
- const insertButtonView = imageInsertView.insertButtonView;
116
- const insertImageViaUrlForm = imageInsertView.getIntegration( 'insertImageViaUrl' );
117
114
  const dropdownView = this.dropdownView;
118
115
  const panelView = dropdownView.panelView;
119
116
  const imageUtils = this.editor.plugins.get( 'ImageUtils' );
117
+ const replaceImageSourceCommand = editor.commands.get( 'replaceImageSource' );
118
+
119
+ let imageInsertView;
120
120
 
121
121
  dropdownView.bind( 'isEnabled' ).to( command );
122
122
 
123
- // Defer the children injection to improve initial performance.
124
- // See https://github.com/ckeditor/ckeditor5/pull/8019#discussion_r484069652.
125
123
  dropdownView.once( 'change:isOpen', () => {
124
+ imageInsertView = new ImageInsertPanelView( editor.locale, prepareIntegrations( editor ) );
125
+
126
+ imageInsertView.delegate( 'submit', 'cancel' ).to( dropdownView );
126
127
  panelView.children.add( imageInsertView );
127
128
  } );
128
129
 
129
130
  dropdownView.on( 'change:isOpen', () => {
130
131
  const selectedElement = editor.model.document.selection.getSelectedElement();
132
+ const insertButtonView = imageInsertView.insertButtonView;
133
+ const insertImageViaUrlForm = imageInsertView.getIntegration( 'insertImageViaUrl' );
131
134
 
132
135
  if ( dropdownView.isOpen ) {
133
136
  if ( imageUtils.isImage( selectedElement ) ) {
134
- imageInsertView.imageURLInputValue = selectedElement.getAttribute( 'src' );
137
+ imageInsertView.imageURLInputValue = replaceImageSourceCommand.value;
135
138
  insertButtonView.label = t( 'Update' );
136
139
  insertImageViaUrlForm.label = t( 'Update image URL' );
137
140
  } else {
@@ -145,7 +148,6 @@ export default class ImageInsertUI extends Plugin {
145
148
  // invisible form/input cannot be focused/selected.
146
149
  }, { priority: 'low' } );
147
150
 
148
- imageInsertView.delegate( 'submit', 'cancel' ).to( dropdownView );
149
151
  this.delegate( 'cancel' ).to( dropdownView );
150
152
 
151
153
  dropdownView.on( 'submit', () => {
@@ -161,11 +163,7 @@ export default class ImageInsertUI extends Plugin {
161
163
  const selectedElement = editor.model.document.selection.getSelectedElement();
162
164
 
163
165
  if ( imageUtils.isImage( selectedElement ) ) {
164
- editor.model.change( writer => {
165
- writer.setAttribute( 'src', imageInsertView.imageURLInputValue, selectedElement );
166
- writer.removeAttribute( 'srcset', selectedElement );
167
- writer.removeAttribute( 'sizes', selectedElement );
168
- } );
166
+ editor.execute( 'replaceImageSource', { source: imageInsertView.imageURLInputValue } );
169
167
  } else {
170
168
  editor.execute( 'insertImage', { source: imageInsertView.imageURLInputValue } );
171
169
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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
 
@@ -167,9 +167,9 @@ export default class ImageResizeButtons extends Plugin {
167
167
  dropdownView.bind( 'isOn' ).to( command );
168
168
  dropdownView.bind( 'isEnabled' ).to( this );
169
169
 
170
- addListToDropdown( dropdownView, this._getResizeDropdownListItemDefinitions( options, command ) );
171
-
172
- dropdownView.listView.ariaLabel = t( 'Image resize list' );
170
+ addListToDropdown( dropdownView, () => this._getResizeDropdownListItemDefinitions( options, command ), {
171
+ ariaLabel: t( 'Image resize list' )
172
+ } );
173
173
 
174
174
  // Execute command when an item from the dropdown is selected.
175
175
  this.listenTo( dropdownView, 'execute', evt => {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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/imagestyle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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
 
@@ -40,7 +40,6 @@ export default class ImageTextAlternativeUI extends Plugin {
40
40
  */
41
41
  init() {
42
42
  this._createButton();
43
- this._createForm();
44
43
  }
45
44
 
46
45
  /**
@@ -50,7 +49,9 @@ export default class ImageTextAlternativeUI extends Plugin {
50
49
  super.destroy();
51
50
 
52
51
  // Destroy created UI components as they are not automatically destroyed (see ckeditor5#1341).
53
- this._form.destroy();
52
+ if ( this._form ) {
53
+ this._form.destroy();
54
+ }
54
55
  }
55
56
 
56
57
  /**
@@ -145,7 +146,7 @@ export default class ImageTextAlternativeUI extends Plugin {
145
146
  clickOutsideHandler( {
146
147
  emitter: this._form,
147
148
  activator: () => this._isVisible,
148
- contextElements: [ this._balloon.view.element ],
149
+ contextElements: () => [ this._balloon.view.element ],
149
150
  callback: () => this._hideForm()
150
151
  } );
151
152
  }
@@ -160,6 +161,10 @@ export default class ImageTextAlternativeUI extends Plugin {
160
161
  return;
161
162
  }
162
163
 
164
+ if ( !this._form ) {
165
+ this._createForm();
166
+ }
167
+
163
168
  const editor = this.editor;
164
169
  const command = editor.commands.get( 'imageTextAlternative' );
165
170
  const labeledInput = this._form.labeledInput;
@@ -216,7 +221,7 @@ export default class ImageTextAlternativeUI extends Plugin {
216
221
  * @type {Boolean}
217
222
  */
218
223
  get _isVisible() {
219
- return this._balloon.visibleView === this._form;
224
+ return !!this._balloon && this._balloon.visibleView === this._form;
220
225
  }
221
226
 
222
227
  /**
@@ -226,6 +231,6 @@ export default class ImageTextAlternativeUI extends Plugin {
226
231
  * @type {Boolean}
227
232
  */
228
233
  get _isInBalloon() {
229
- return this._balloon.hasView( this._form );
234
+ return !!this._balloon && this._balloon.hasView( this._form );
230
235
  }
231
236
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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/imageutils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, 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/theme/image.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, 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
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, 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
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, 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
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, 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
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, 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
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, 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
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, 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
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, 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