@ckeditor/ckeditor5-image 36.0.1 → 37.0.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.
Files changed (108) hide show
  1. package/build/image.js +1 -1
  2. package/package.json +40 -35
  3. package/src/augmentation.d.ts +55 -0
  4. package/src/augmentation.js +5 -0
  5. package/src/autoimage.d.ts +48 -0
  6. package/src/autoimage.js +111 -160
  7. package/src/image/converters.d.ts +66 -0
  8. package/src/image/converters.js +200 -261
  9. package/src/image/imageblockediting.d.ts +52 -0
  10. package/src/image/imageblockediting.js +111 -155
  11. package/src/image/imageediting.d.ts +29 -0
  12. package/src/image/imageediting.js +53 -67
  13. package/src/image/imageinlineediting.d.ts +53 -0
  14. package/src/image/imageinlineediting.js +135 -180
  15. package/src/image/imageloadobserver.d.ts +44 -0
  16. package/src/image/imageloadobserver.js +28 -47
  17. package/src/image/imagetypecommand.d.ts +40 -0
  18. package/src/image/imagetypecommand.js +67 -95
  19. package/src/image/insertimagecommand.d.ts +66 -0
  20. package/src/image/insertimagecommand.js +94 -101
  21. package/src/image/replaceimagesourcecommand.d.ts +34 -0
  22. package/src/image/replaceimagesourcecommand.js +28 -33
  23. package/src/image/ui/utils.d.ts +25 -0
  24. package/src/image/ui/utils.js +25 -35
  25. package/src/image/utils.d.ts +52 -0
  26. package/src/image/utils.js +63 -90
  27. package/src/image.d.ts +32 -0
  28. package/src/image.js +12 -43
  29. package/src/imageblock.d.ts +30 -0
  30. package/src/imageblock.js +12 -21
  31. package/src/imagecaption/imagecaptionediting.d.ts +87 -0
  32. package/src/imagecaption/imagecaptionediting.js +203 -262
  33. package/src/imagecaption/imagecaptionui.d.ts +25 -0
  34. package/src/imagecaption/imagecaptionui.js +46 -63
  35. package/src/imagecaption/imagecaptionutils.d.ts +37 -0
  36. package/src/imagecaption/imagecaptionutils.js +51 -78
  37. package/src/imagecaption/toggleimagecaptioncommand.d.ts +66 -0
  38. package/src/imagecaption/toggleimagecaptioncommand.js +112 -138
  39. package/src/imagecaption.d.ts +24 -0
  40. package/src/imagecaption.js +12 -19
  41. package/src/imageconfig.d.ts +713 -0
  42. package/src/imageconfig.js +5 -0
  43. package/src/imageinline.d.ts +30 -0
  44. package/src/imageinline.js +12 -21
  45. package/src/imageinsert/imageinsertui.d.ts +44 -0
  46. package/src/imageinsert/imageinsertui.js +120 -158
  47. package/src/imageinsert/ui/imageinsertformrowview.d.ts +61 -0
  48. package/src/imageinsert/ui/imageinsertformrowview.js +37 -86
  49. package/src/imageinsert/ui/imageinsertpanelview.d.ts +106 -0
  50. package/src/imageinsert/ui/imageinsertpanelview.js +148 -258
  51. package/src/imageinsert/utils.d.ts +25 -0
  52. package/src/imageinsert/utils.js +41 -58
  53. package/src/imageinsert.d.ts +30 -0
  54. package/src/imageinsert.js +13 -84
  55. package/src/imageinsertviaurl.d.ts +29 -0
  56. package/src/imageinsertviaurl.js +12 -18
  57. package/src/imageresize/imageresizebuttons.d.ts +66 -0
  58. package/src/imageresize/imageresizebuttons.js +190 -255
  59. package/src/imageresize/imageresizeediting.d.ts +36 -0
  60. package/src/imageresize/imageresizeediting.js +99 -125
  61. package/src/imageresize/imageresizehandles.d.ts +29 -0
  62. package/src/imageresize/imageresizehandles.js +90 -123
  63. package/src/imageresize/resizeimagecommand.d.ts +42 -0
  64. package/src/imageresize/resizeimagecommand.js +48 -55
  65. package/src/imageresize.d.ts +24 -0
  66. package/src/imageresize.js +12 -209
  67. package/src/imagestyle/converters.d.ts +24 -0
  68. package/src/imagestyle/converters.js +60 -78
  69. package/src/imagestyle/imagestylecommand.d.ts +65 -0
  70. package/src/imagestyle/imagestylecommand.js +88 -124
  71. package/src/imagestyle/imagestyleediting.d.ts +49 -0
  72. package/src/imagestyle/imagestyleediting.js +90 -137
  73. package/src/imagestyle/imagestyleui.d.ts +55 -0
  74. package/src/imagestyle/imagestyleui.js +170 -278
  75. package/src/imagestyle/utils.d.ts +101 -0
  76. package/src/imagestyle/utils.js +256 -309
  77. package/src/imagestyle.d.ts +30 -0
  78. package/src/imagestyle.js +13 -261
  79. package/src/imagetextalternative/imagetextalternativecommand.d.ts +34 -0
  80. package/src/imagetextalternative/imagetextalternativecommand.js +31 -47
  81. package/src/imagetextalternative/imagetextalternativeediting.d.ts +27 -0
  82. package/src/imagetextalternative/imagetextalternativeediting.js +18 -25
  83. package/src/imagetextalternative/imagetextalternativeui.d.ts +67 -0
  84. package/src/imagetextalternative/imagetextalternativeui.js +156 -219
  85. package/src/imagetextalternative/ui/textalternativeformview.d.ts +72 -0
  86. package/src/imagetextalternative/ui/textalternativeformview.js +103 -192
  87. package/src/imagetextalternative.d.ts +27 -0
  88. package/src/imagetextalternative.js +12 -18
  89. package/src/imagetoolbar.d.ts +33 -0
  90. package/src/imagetoolbar.js +31 -77
  91. package/src/imageupload/imageuploadediting.d.ts +108 -0
  92. package/src/imageupload/imageuploadediting.js +307 -427
  93. package/src/imageupload/imageuploadprogress.d.ts +42 -0
  94. package/src/imageupload/imageuploadprogress.js +180 -261
  95. package/src/imageupload/imageuploadui.d.ts +23 -0
  96. package/src/imageupload/imageuploadui.js +40 -57
  97. package/src/imageupload/uploadimagecommand.d.ts +60 -0
  98. package/src/imageupload/uploadimagecommand.js +73 -87
  99. package/src/imageupload/utils.d.ts +33 -0
  100. package/src/imageupload/utils.js +87 -112
  101. package/src/imageupload.d.ts +29 -0
  102. package/src/imageupload.js +12 -61
  103. package/src/imageutils.d.ts +102 -0
  104. package/src/imageutils.js +232 -329
  105. package/src/index.d.ts +47 -0
  106. package/src/index.js +1 -2
  107. package/src/pictureediting.d.ts +86 -0
  108. package/src/pictureediting.js +101 -120
@@ -0,0 +1,5 @@
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
+ export {};
@@ -0,0 +1,30 @@
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
+ * @module image/imageinline
7
+ */
8
+ import { Plugin, type PluginDependencies } from 'ckeditor5/src/core';
9
+ import '../theme/image.css';
10
+ /**
11
+ * The image inline plugin.
12
+ *
13
+ * This is a "glue" plugin which loads the following plugins:
14
+ *
15
+ * * {@link module:image/image/imageinlineediting~ImageInlineEditing},
16
+ * * {@link module:image/imagetextalternative~ImageTextAlternative}.
17
+ *
18
+ * Usually, it is used in conjunction with other plugins from this package. See the {@glink api/image package page}
19
+ * for more information.
20
+ */
21
+ export default class ImageInline extends Plugin {
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires(): PluginDependencies;
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get pluginName(): 'ImageInline';
30
+ }
@@ -2,19 +2,14 @@
2
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
-
6
5
  /**
7
6
  * @module image/imageinline
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import { Widget } from 'ckeditor5/src/widget';
12
-
13
10
  import ImageTextAlternative from './imagetextalternative';
14
11
  import ImageInlineEditing from './image/imageinlineediting';
15
-
16
12
  import '../theme/image.css';
17
-
18
13
  /**
19
14
  * The image inline plugin.
20
15
  *
@@ -25,22 +20,18 @@ import '../theme/image.css';
25
20
  *
26
21
  * Usually, it is used in conjunction with other plugins from this package. See the {@glink api/image package page}
27
22
  * for more information.
28
- *
29
- * @extends module:core/plugin~Plugin
30
23
  */
31
24
  export default class ImageInline extends Plugin {
32
- /**
33
- * @inheritDoc
34
- */
35
- static get requires() {
36
- return [ ImageInlineEditing, Widget, ImageTextAlternative ];
37
- }
38
-
39
- /**
40
- * @inheritDoc
41
- */
42
- static get pluginName() {
43
- return 'ImageInline';
44
- }
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ static get requires() {
29
+ return [ImageInlineEditing, Widget, ImageTextAlternative];
30
+ }
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ static get pluginName() {
35
+ return 'ImageInline';
36
+ }
45
37
  }
46
-
@@ -0,0 +1,44 @@
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
+ * @module image/imageinsert/imageinsertui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import { type DropdownView } from 'ckeditor5/src/ui';
10
+ /**
11
+ * The image insert dropdown plugin.
12
+ *
13
+ * For a detailed overview, check the {@glink features/images/image-upload/image-upload Image upload feature}
14
+ * and {@glink features/images/image-upload/images-inserting#inserting-images-via-source-url Insert images via source URL} documentation.
15
+ *
16
+ * Adds the `'insertImage'` dropdown to the {@link module:ui/componentfactory~ComponentFactory UI component factory}
17
+ * and also the `imageInsert` dropdown as an alias for backward compatibility.
18
+ */
19
+ export default class ImageInsertUI extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get pluginName(): 'ImageInsertUI';
24
+ /**
25
+ * The dropdown view responsible for displaying the image insert UI.
26
+ */
27
+ dropdownView?: DropdownView;
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ init(): void;
32
+ /**
33
+ * Creates the dropdown view.
34
+ *
35
+ * @param locale The localization services instance.
36
+ */
37
+ private _createDropdownView;
38
+ /**
39
+ * Sets up the dropdown view.
40
+ *
41
+ * @param command An uploadImage or insertImage command.
42
+ */
43
+ private _setUpDropdown;
44
+ }
@@ -2,16 +2,13 @@
2
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
-
6
5
  /**
7
6
  * @module image/imageinsert/imageinsertui
8
7
  */
9
-
10
8
  import { Plugin, icons } from 'ckeditor5/src/core';
11
- import ImageInsertPanelView from './ui/imageinsertpanelview';
12
9
  import { SplitButtonView, createDropdown } from 'ckeditor5/src/ui';
10
+ import ImageInsertPanelView from './ui/imageinsertpanelview';
13
11
  import { prepareIntegrations } from './utils';
14
-
15
12
  /**
16
13
  * The image insert dropdown plugin.
17
14
  *
@@ -20,160 +17,125 @@ import { prepareIntegrations } from './utils';
20
17
  *
21
18
  * Adds the `'insertImage'` dropdown to the {@link module:ui/componentfactory~ComponentFactory UI component factory}
22
19
  * and also the `imageInsert` dropdown as an alias for backward compatibility.
23
- *
24
- * @extends module:core/plugin~Plugin
25
20
  */
26
21
  export default class ImageInsertUI extends Plugin {
27
- /**
28
- * @inheritDoc
29
- */
30
- static get pluginName() {
31
- return 'ImageInsertUI';
32
- }
33
-
34
- /**
35
- * @inheritDoc
36
- */
37
- init() {
38
- const editor = this.editor;
39
- const componentCreator = locale => {
40
- return this._createDropdownView( locale );
41
- };
42
-
43
- // Register `insertImage` dropdown and add `imageInsert` dropdown as an alias for backward compatibility.
44
- editor.ui.componentFactory.add( 'insertImage', componentCreator );
45
- editor.ui.componentFactory.add( 'imageInsert', componentCreator );
46
- }
47
-
48
- /**
49
- * Creates the dropdown view.
50
- *
51
- * @param {module:utils/locale~Locale} locale The localization services instance.
52
- *
53
- * @private
54
- * @returns {module:ui/dropdown/dropdownview~DropdownView}
55
- */
56
- _createDropdownView( locale ) {
57
- const editor = this.editor;
58
- const t = locale.t;
59
-
60
- const uploadImageCommand = editor.commands.get( 'uploadImage' );
61
- const insertImageCommand = editor.commands.get( 'insertImage' );
62
-
63
- /**
64
- * The dropdown view responsible for displaying the image insert UI.
65
- *
66
- * @member {module:ui/dropdown/dropdownview~DropdownView}
67
- */
68
- this.dropdownView = createDropdown( locale, uploadImageCommand ? SplitButtonView : undefined );
69
-
70
- const buttonView = this.dropdownView.buttonView;
71
- const panelView = this.dropdownView.panelView;
72
-
73
- buttonView.set( {
74
- label: t( 'Insert image' ),
75
- icon: icons.image,
76
- tooltip: true
77
- } );
78
-
79
- panelView.extendTemplate( {
80
- attributes: {
81
- class: 'ck-image-insert__panel'
82
- }
83
- } );
84
-
85
- if ( uploadImageCommand ) {
86
- const splitButtonView = this.dropdownView.buttonView;
87
-
88
- splitButtonView.actionView = editor.ui.componentFactory.create( 'uploadImage' );
89
- // After we replaced action button with `uploadImage` component,
90
- // we have lost a proper styling and some minor visual quirks have appeared.
91
- // Brining back original split button classes helps fix the button styling
92
- // See https://github.com/ckeditor/ckeditor5/issues/7986.
93
- splitButtonView.actionView.extendTemplate( {
94
- attributes: {
95
- class: 'ck ck-button ck-splitbutton__action'
96
- }
97
- } );
98
- }
99
-
100
- return this._setUpDropdown( uploadImageCommand || insertImageCommand );
101
- }
102
-
103
- /**
104
- * Sets up the dropdown view.
105
- *
106
- * @param {module:core/command~Command} command An uploadImage or insertImage command.
107
- *
108
- * @private
109
- * @returns {module:ui/dropdown/dropdownview~DropdownView}
110
- */
111
- _setUpDropdown( command ) {
112
- const editor = this.editor;
113
- const t = editor.t;
114
- const dropdownView = this.dropdownView;
115
- const panelView = dropdownView.panelView;
116
- const imageUtils = this.editor.plugins.get( 'ImageUtils' );
117
- const replaceImageSourceCommand = editor.commands.get( 'replaceImageSource' );
118
-
119
- let imageInsertView;
120
-
121
- dropdownView.bind( 'isEnabled' ).to( command );
122
-
123
- dropdownView.once( 'change:isOpen', () => {
124
- imageInsertView = new ImageInsertPanelView( editor.locale, prepareIntegrations( editor ) );
125
-
126
- imageInsertView.delegate( 'submit', 'cancel' ).to( dropdownView );
127
- panelView.children.add( imageInsertView );
128
- } );
129
-
130
- dropdownView.on( 'change:isOpen', () => {
131
- const selectedElement = editor.model.document.selection.getSelectedElement();
132
- const insertButtonView = imageInsertView.insertButtonView;
133
- const insertImageViaUrlForm = imageInsertView.getIntegration( 'insertImageViaUrl' );
134
-
135
- if ( dropdownView.isOpen ) {
136
- if ( imageUtils.isImage( selectedElement ) ) {
137
- imageInsertView.imageURLInputValue = replaceImageSourceCommand.value;
138
- insertButtonView.label = t( 'Update' );
139
- insertImageViaUrlForm.label = t( 'Update image URL' );
140
- } else {
141
- imageInsertView.imageURLInputValue = '';
142
- insertButtonView.label = t( 'Insert' );
143
- insertImageViaUrlForm.label = t( 'Insert image via URL' );
144
- }
145
- }
146
- // Note: Use the low priority to make sure the following listener starts working after the
147
- // default action of the drop-down is executed (i.e. the panel showed up). Otherwise, the
148
- // invisible form/input cannot be focused/selected.
149
- }, { priority: 'low' } );
150
-
151
- this.delegate( 'cancel' ).to( dropdownView );
152
-
153
- dropdownView.on( 'submit', () => {
154
- closePanel();
155
- onSubmit();
156
- } );
157
-
158
- dropdownView.on( 'cancel', () => {
159
- closePanel();
160
- } );
161
-
162
- function onSubmit() {
163
- const selectedElement = editor.model.document.selection.getSelectedElement();
164
-
165
- if ( imageUtils.isImage( selectedElement ) ) {
166
- editor.execute( 'replaceImageSource', { source: imageInsertView.imageURLInputValue } );
167
- } else {
168
- editor.execute( 'insertImage', { source: imageInsertView.imageURLInputValue } );
169
- }
170
- }
171
-
172
- function closePanel() {
173
- editor.editing.view.focus();
174
- dropdownView.isOpen = false;
175
- }
176
-
177
- return dropdownView;
178
- }
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get pluginName() {
26
+ return 'ImageInsertUI';
27
+ }
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ init() {
32
+ const editor = this.editor;
33
+ const componentCreator = (locale) => {
34
+ return this._createDropdownView(locale);
35
+ };
36
+ // Register `insertImage` dropdown and add `imageInsert` dropdown as an alias for backward compatibility.
37
+ editor.ui.componentFactory.add('insertImage', componentCreator);
38
+ editor.ui.componentFactory.add('imageInsert', componentCreator);
39
+ }
40
+ /**
41
+ * Creates the dropdown view.
42
+ *
43
+ * @param locale The localization services instance.
44
+ */
45
+ _createDropdownView(locale) {
46
+ const editor = this.editor;
47
+ const t = locale.t;
48
+ const uploadImageCommand = editor.commands.get('uploadImage');
49
+ const insertImageCommand = editor.commands.get('insertImage');
50
+ this.dropdownView = createDropdown(locale, uploadImageCommand ? SplitButtonView : undefined);
51
+ const buttonView = this.dropdownView.buttonView;
52
+ const panelView = this.dropdownView.panelView;
53
+ buttonView.set({
54
+ label: t('Insert image'),
55
+ icon: icons.image,
56
+ tooltip: true
57
+ });
58
+ panelView.extendTemplate({
59
+ attributes: {
60
+ class: 'ck-image-insert__panel'
61
+ }
62
+ });
63
+ if (uploadImageCommand) {
64
+ const splitButtonView = this.dropdownView.buttonView;
65
+ // We are injecting custom button replacement to readonly field.
66
+ splitButtonView.actionView = editor.ui.componentFactory.create('uploadImage');
67
+ // After we replaced action button with `uploadImage` component,
68
+ // we have lost a proper styling and some minor visual quirks have appeared.
69
+ // Brining back original split button classes helps fix the button styling
70
+ // See https://github.com/ckeditor/ckeditor5/issues/7986.
71
+ splitButtonView.actionView.extendTemplate({
72
+ attributes: {
73
+ class: 'ck ck-button ck-splitbutton__action'
74
+ }
75
+ });
76
+ }
77
+ return this._setUpDropdown(uploadImageCommand || insertImageCommand);
78
+ }
79
+ /**
80
+ * Sets up the dropdown view.
81
+ *
82
+ * @param command An uploadImage or insertImage command.
83
+ */
84
+ _setUpDropdown(command) {
85
+ const editor = this.editor;
86
+ const t = editor.t;
87
+ const dropdownView = this.dropdownView;
88
+ const panelView = dropdownView.panelView;
89
+ const imageUtils = this.editor.plugins.get('ImageUtils');
90
+ const replaceImageSourceCommand = editor.commands.get('replaceImageSource');
91
+ let imageInsertView;
92
+ dropdownView.bind('isEnabled').to(command);
93
+ dropdownView.once('change:isOpen', () => {
94
+ imageInsertView = new ImageInsertPanelView(editor.locale, prepareIntegrations(editor));
95
+ imageInsertView.delegate('submit', 'cancel').to(dropdownView);
96
+ panelView.children.add(imageInsertView);
97
+ });
98
+ dropdownView.on('change:isOpen', () => {
99
+ const selectedElement = editor.model.document.selection.getSelectedElement();
100
+ const insertButtonView = imageInsertView.insertButtonView;
101
+ const insertImageViaUrlForm = imageInsertView.getIntegration('insertImageViaUrl');
102
+ if (dropdownView.isOpen) {
103
+ if (imageUtils.isImage(selectedElement)) {
104
+ imageInsertView.imageURLInputValue = replaceImageSourceCommand.value;
105
+ insertButtonView.label = t('Update');
106
+ insertImageViaUrlForm.label = t('Update image URL');
107
+ }
108
+ else {
109
+ imageInsertView.imageURLInputValue = '';
110
+ insertButtonView.label = t('Insert');
111
+ insertImageViaUrlForm.label = t('Insert image via URL');
112
+ }
113
+ }
114
+ // Note: Use the low priority to make sure the following listener starts working after the
115
+ // default action of the drop-down is executed (i.e. the panel showed up). Otherwise, the
116
+ // invisible form/input cannot be focused/selected.
117
+ }, { priority: 'low' });
118
+ this.delegate('cancel').to(dropdownView);
119
+ dropdownView.on('submit', () => {
120
+ closePanel();
121
+ onSubmit();
122
+ });
123
+ dropdownView.on('cancel', () => {
124
+ closePanel();
125
+ });
126
+ function onSubmit() {
127
+ const selectedElement = editor.model.document.selection.getSelectedElement();
128
+ if (imageUtils.isImage(selectedElement)) {
129
+ editor.execute('replaceImageSource', { source: imageInsertView.imageURLInputValue });
130
+ }
131
+ else {
132
+ editor.execute('insertImage', { source: imageInsertView.imageURLInputValue });
133
+ }
134
+ }
135
+ function closePanel() {
136
+ editor.editing.view.focus();
137
+ dropdownView.isOpen = false;
138
+ }
139
+ return dropdownView;
140
+ }
179
141
  }
@@ -0,0 +1,61 @@
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
+ * @module image/imageinsert/ui/imageinsertformrowview
7
+ */
8
+ import type { Locale } from 'ckeditor5/src/utils';
9
+ import { View, type ViewCollection, type LabelView } from 'ckeditor5/src/ui';
10
+ import '../../../theme/imageinsertformrowview.css';
11
+ /**
12
+ * The class representing a single row in a complex form,
13
+ * used by {@link module:image/imageinsert/ui/imageinsertpanelview~ImageInsertPanelView}.
14
+ *
15
+ * **Note**: For now this class is private. When more use cases appear (beyond `ckeditor5-table` and `ckeditor5-image`),
16
+ * it will become a component in `ckeditor5-ui`.
17
+ *
18
+ * @private
19
+ */
20
+ export default class ImageUploadFormRowView extends View {
21
+ /**
22
+ * An additional CSS class added to the {@link #element}.
23
+ *
24
+ * @observable
25
+ */
26
+ class: string | null;
27
+ /**
28
+ * A collection of row items (buttons, dropdowns, etc.).
29
+ */
30
+ readonly children: ViewCollection;
31
+ /**
32
+ * The role property reflected by the `role` DOM attribute of the {@link #element}.
33
+ *
34
+ * **Note**: Used only when a `labelView` is passed to constructor `options`.
35
+ *
36
+ * @observable
37
+ * @private
38
+ */
39
+ _role: string | null;
40
+ /**
41
+ * The ARIA property reflected by the `aria-labelledby` DOM attribute of the {@link #element}.
42
+ *
43
+ * **Note**: Used only when a `labelView` is passed to constructor `options`.
44
+ *
45
+ * @observable
46
+ * @private
47
+ */
48
+ _ariaLabelledBy: string | null;
49
+ /**
50
+ * Creates an instance of the form row class.
51
+ *
52
+ * @param locale The locale instance.
53
+ * @param options.labelView When passed, the row gets the `group` and `aria-labelledby`
54
+ * DOM attributes and gets described by the label.
55
+ */
56
+ constructor(locale: Locale, options?: {
57
+ children?: Array<View>;
58
+ class?: string;
59
+ labelView?: LabelView;
60
+ });
61
+ }
@@ -2,15 +2,8 @@
2
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
-
6
- /**
7
- * @module image/imageinsert/ui/imageinsertformrowview
8
- */
9
-
10
5
  import { View } from 'ckeditor5/src/ui';
11
-
12
6
  import '../../../theme/imageinsertformrowview.css';
13
-
14
7
  /**
15
8
  * The class representing a single row in a complex form,
16
9
  * used by {@link module:image/imageinsert/ui/imageinsertpanelview~ImageInsertPanelView}.
@@ -19,85 +12,43 @@ import '../../../theme/imageinsertformrowview.css';
19
12
  * it will become a component in `ckeditor5-ui`.
20
13
  *
21
14
  * @private
22
- * @extends module:ui/view~View
23
15
  */
24
16
  export default class ImageUploadFormRowView extends View {
25
- /**
26
- * Creates an instance of the form row class.
27
- *
28
- * @param {module:utils/locale~Locale} locale The locale instance.
29
- * @param {Object} options
30
- * @param {Array.<module:ui/view~View>} [options.children]
31
- * @param {String} [options.class]
32
- * @param {module:ui/view~View} [options.labelView] When passed, the row gets the `group` and `aria-labelledby`
33
- * DOM attributes and gets described by the label.
34
- */
35
- constructor( locale, options = {} ) {
36
- super( locale );
37
-
38
- const bind = this.bindTemplate;
39
-
40
- /**
41
- * An additional CSS class added to the {@link #element}.
42
- *
43
- * @observable
44
- * @member {String} #class
45
- */
46
- this.set( 'class', options.class || null );
47
-
48
- /**
49
- * A collection of row items (buttons, dropdowns, etc.).
50
- *
51
- * @readonly
52
- * @member {module:ui/viewcollection~ViewCollection}
53
- */
54
- this.children = this.createCollection();
55
-
56
- if ( options.children ) {
57
- options.children.forEach( child => this.children.add( child ) );
58
- }
59
-
60
- /**
61
- * The role property reflected by the `role` DOM attribute of the {@link #element}.
62
- *
63
- * **Note**: Used only when a `labelView` is passed to constructor `options`.
64
- *
65
- * @private
66
- * @observable
67
- * @member {String} #role
68
- */
69
- this.set( '_role', null );
70
-
71
- /**
72
- * The ARIA property reflected by the `aria-labelledby` DOM attribute of the {@link #element}.
73
- *
74
- * **Note**: Used only when a `labelView` is passed to constructor `options`.
75
- *
76
- * @private
77
- * @observable
78
- * @member {String} #ariaLabelledBy
79
- */
80
- this.set( '_ariaLabelledBy', null );
81
-
82
- if ( options.labelView ) {
83
- this.set( {
84
- _role: 'group',
85
- _ariaLabelledBy: options.labelView.id
86
- } );
87
- }
88
-
89
- this.setTemplate( {
90
- tag: 'div',
91
- attributes: {
92
- class: [
93
- 'ck',
94
- 'ck-form__row',
95
- bind.to( 'class' )
96
- ],
97
- role: bind.to( '_role' ),
98
- 'aria-labelledby': bind.to( '_ariaLabelledBy' )
99
- },
100
- children: this.children
101
- } );
102
- }
17
+ /**
18
+ * Creates an instance of the form row class.
19
+ *
20
+ * @param locale The locale instance.
21
+ * @param options.labelView When passed, the row gets the `group` and `aria-labelledby`
22
+ * DOM attributes and gets described by the label.
23
+ */
24
+ constructor(locale, options = {}) {
25
+ super(locale);
26
+ const bind = this.bindTemplate;
27
+ this.set('class', options.class || null);
28
+ this.children = this.createCollection();
29
+ if (options.children) {
30
+ options.children.forEach(child => this.children.add(child));
31
+ }
32
+ this.set('_role', null);
33
+ this.set('_ariaLabelledBy', null);
34
+ if (options.labelView) {
35
+ this.set({
36
+ _role: 'group',
37
+ _ariaLabelledBy: options.labelView.id
38
+ });
39
+ }
40
+ this.setTemplate({
41
+ tag: 'div',
42
+ attributes: {
43
+ class: [
44
+ 'ck',
45
+ 'ck-form__row',
46
+ bind.to('class')
47
+ ],
48
+ role: bind.to('_role'),
49
+ 'aria-labelledby': bind.to('_ariaLabelledBy')
50
+ },
51
+ children: this.children
52
+ });
53
+ }
103
54
  }