@ckeditor/ckeditor5-table 35.0.1 → 35.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.
@@ -0,0 +1 @@
1
+ !function(e){const t=e.tt=e.tt||{};t.dictionary=Object.assign(t.dictionary||{},{"Align cell text to the bottom":"","Align cell text to the center":"","Align cell text to the left":"","Align cell text to the middle":"","Align cell text to the right":"","Align cell text to the top":"","Align table to the left":"","Align table to the right":"",Alignment:"",Background:"",Border:"","Cell properties":"","Center table":"",Color:"Төс","Color picker":"",Column:"",Dashed:"","Delete column":"","Delete row":"",Dimensions:"",Dotted:"",Double:"","Enter table caption":"",Groove:"","Header column":"","Header row":"",Height:"","Horizontal text alignment toolbar":"","Insert column left":"","Insert column right":"","Insert row above":"","Insert row below":"","Insert table":"",Inset:"","Justify cell text":"","Merge cell down":"","Merge cell left":"","Merge cell right":"","Merge cell up":"","Merge cells":"",None:"",Outset:"",Padding:"",Ridge:"",Row:"","Select column":"","Select row":"",Solid:"","Split cell horizontally":"","Split cell vertically":"",Style:"","Table alignment toolbar":"","Table cell text alignment":"","Table properties":"","Table toolbar":"",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':"",'The value is invalid. Try "10px" or "2em" or simply "2".':"","Toggle caption off":"","Toggle caption on":"","Vertical text alignment toolbar":"",Width:""})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
@@ -1 +1 @@
1
- !function(e){const t=e.ur=e.ur||{};t.dictionary=Object.assign(t.dictionary||{},{"Align cell text to the bottom":"","Align cell text to the center":"","Align cell text to the left":"","Align cell text to the middle":"","Align cell text to the right":"","Align cell text to the top":"","Align table to the left":"","Align table to the right":"",Alignment:"",Background:"",Border:"","Cell properties":"","Center table":"",Color:"","Color picker":"",Column:"ستون",Dashed:"","Delete column":"ستون حذف کریں","Delete row":"قطار حذف کریں",Dimensions:"",Dotted:"",Double:"","Enter table caption":"",Groove:"","Header column":"سر ستون","Header row":"سر قطار",Height:"","Horizontal text alignment toolbar":"","Insert column left":"","Insert column right":"","Insert row above":"قطار بالا نصب کریں","Insert row below":"قطار زیریں نصب کریں","Insert table":"جدول داخل کریں",Inset:"","Justify cell text":"","Merge cell down":"سیل نچلی طرف یکجا کریں","Merge cell left":"سیل بائیں طرف یکجا کریں","Merge cell right":"سیل دائیں طرف یکجا کریں","Merge cell up":"سیل اوپر یکجا کریں","Merge cells":"سیل یکجا کریں",None:"",Outset:"",Padding:"",Ridge:"",Row:"قطار","Select column":"","Select row":"",Solid:"","Split cell horizontally":"سیل کی افقی تقسیم","Split cell vertically":"سیل کی عمودی تقسیم",Style:"","Table alignment toolbar":"","Table cell text alignment":"","Table properties":"","Table toolbar":"آلہ جات برائے جدول",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':"",'The value is invalid. Try "10px" or "2em" or simply "2".':"","Toggle caption off":"","Toggle caption on":"","Vertical text alignment toolbar":"",Width:""})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
1
+ !function(e){const t=e.ur=e.ur||{};t.dictionary=Object.assign(t.dictionary||{},{"Align cell text to the bottom":"","Align cell text to the center":"","Align cell text to the left":"","Align cell text to the middle":"","Align cell text to the right":"","Align cell text to the top":"","Align table to the left":"","Align table to the right":"",Alignment:"",Background:"",Border:"حاشیہ","Cell properties":"","Center table":"",Color:"رنگ","Color picker":"",Column:"ستون",Dashed:"قطعہ دار","Delete column":"ستون حذف کریں","Delete row":"قطار حذف کریں",Dimensions:"",Dotted:"نقطہ دار",Double:"دو گنا","Enter table caption":"",Groove:"","Header column":"سر ستون","Header row":"سر قطار",Height:"اونچائی","Horizontal text alignment toolbar":"","Insert column left":"بائیں جانب کالم بنائیں","Insert column right":"دائیں جانب کالم بنائیں","Insert row above":"قطار بالا نصب کریں","Insert row below":"قطار زیریں نصب کریں","Insert table":"جدول داخل کریں",Inset:"","Justify cell text":"","Merge cell down":"سیل نچلی طرف یکجا کریں","Merge cell left":"سیل بائیں طرف یکجا کریں","Merge cell right":"سیل دائیں طرف یکجا کریں","Merge cell up":"سیل اوپر یکجا کریں","Merge cells":"سیل یکجا کریں",None:"",Outset:"",Padding:"",Ridge:"",Row:"قطار","Select column":"","Select row":"",Solid:"","Split cell horizontally":"سیل کی افقی تقسیم","Split cell vertically":"سیل کی عمودی تقسیم",Style:"","Table alignment toolbar":"","Table cell text alignment":"","Table properties":"","Table toolbar":"آلہ جات برائے جدول",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':"",'The value is invalid. Try "10px" or "2em" or simply "2".':"","Toggle caption off":"","Toggle caption on":"","Vertical text alignment toolbar":"",Width:"چوڑائی"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
@@ -0,0 +1,261 @@
1
+ # Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language-Team: Tatar (https://www.transifex.com/ckeditor/teams/11143/tt/)\n"
16
+ "Language: tt\n"
17
+ "Plural-Forms: nplurals=1; plural=0;\n"
18
+
19
+ msgctxt "Label for the insert table toolbar button."
20
+ msgid "Insert table"
21
+ msgstr ""
22
+
23
+ msgctxt "Label for the set/unset table header column button."
24
+ msgid "Header column"
25
+ msgstr ""
26
+
27
+ msgctxt "Label for the insert table column to the left of the current one button."
28
+ msgid "Insert column left"
29
+ msgstr ""
30
+
31
+ msgctxt "Label for the insert table column to the right of the current one button."
32
+ msgid "Insert column right"
33
+ msgstr ""
34
+
35
+ msgctxt "Label for the delete table column button."
36
+ msgid "Delete column"
37
+ msgstr ""
38
+
39
+ msgctxt "Label for the select the entire table column button."
40
+ msgid "Select column"
41
+ msgstr ""
42
+
43
+ msgctxt "Label for the table column dropdown button."
44
+ msgid "Column"
45
+ msgstr ""
46
+
47
+ msgctxt "Label for the set/unset table header row button."
48
+ msgid "Header row"
49
+ msgstr ""
50
+
51
+ msgctxt "Label for the insert row below button."
52
+ msgid "Insert row below"
53
+ msgstr ""
54
+
55
+ msgctxt "Label for the insert row above button."
56
+ msgid "Insert row above"
57
+ msgstr ""
58
+
59
+ msgctxt "Label for the delete table row button."
60
+ msgid "Delete row"
61
+ msgstr ""
62
+
63
+ msgctxt "Label for the select the entire table row button."
64
+ msgid "Select row"
65
+ msgstr ""
66
+
67
+ msgctxt "Label for the table row dropdown button."
68
+ msgid "Row"
69
+ msgstr ""
70
+
71
+ msgctxt "Label for the merge table cell up button."
72
+ msgid "Merge cell up"
73
+ msgstr ""
74
+
75
+ msgctxt "Label for the merge table cell right button."
76
+ msgid "Merge cell right"
77
+ msgstr ""
78
+
79
+ msgctxt "Label for the merge table cell down button."
80
+ msgid "Merge cell down"
81
+ msgstr ""
82
+
83
+ msgctxt "Label for the merge table cell left button."
84
+ msgid "Merge cell left"
85
+ msgstr ""
86
+
87
+ msgctxt "Label for the split table cell vertically button."
88
+ msgid "Split cell vertically"
89
+ msgstr ""
90
+
91
+ msgctxt "Label for the split table cell horizontally button."
92
+ msgid "Split cell horizontally"
93
+ msgstr ""
94
+
95
+ msgctxt "Label for the merge table cells button."
96
+ msgid "Merge cells"
97
+ msgstr ""
98
+
99
+ msgctxt "The label used by assistive technologies describing a table toolbar attached to a table widget."
100
+ msgid "Table toolbar"
101
+ msgstr ""
102
+
103
+ msgctxt "The label describing the form allowing to specify the properties of a selected table."
104
+ msgid "Table properties"
105
+ msgstr ""
106
+
107
+ msgctxt "The label describing the form allowing to specify the properties of a selected table cell."
108
+ msgid "Cell properties"
109
+ msgstr ""
110
+
111
+ msgctxt "The label describing a group of border–related form fields (border style, color, etc.)."
112
+ msgid "Border"
113
+ msgstr ""
114
+
115
+ msgctxt "The label for the dropdown that allows configuring the border style of a table or a table cell."
116
+ msgid "Style"
117
+ msgstr ""
118
+
119
+ msgctxt "The label for the input that allows configuring the width of a table or a table cell or the width of a border."
120
+ msgid "Width"
121
+ msgstr ""
122
+
123
+ msgctxt "The label for the input that allows configuring the height of a table or a table cell."
124
+ msgid "Height"
125
+ msgstr ""
126
+
127
+ msgctxt "The label for the input that allows configuring the border color of a table or a table cell."
128
+ msgid "Color"
129
+ msgstr "Төс"
130
+
131
+ msgctxt "The label for the input that allows configuring the background color of a table or a table cell."
132
+ msgid "Background"
133
+ msgstr ""
134
+
135
+ msgctxt "The label for the input that allows configuring the padding of a table cell."
136
+ msgid "Padding"
137
+ msgstr ""
138
+
139
+ msgctxt "The label describing a group of form fields that allows setting dimensions of a table or a table cell."
140
+ msgid "Dimensions"
141
+ msgstr ""
142
+
143
+ msgctxt "The label for the group of toolbars that allows configuring the text alignment in a table cell."
144
+ msgid "Table cell text alignment"
145
+ msgstr ""
146
+
147
+ msgctxt "The label for the toolbar that allows configuring the alignment of a table."
148
+ msgid "Alignment"
149
+ msgstr ""
150
+
151
+ msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the horizontal text alignment in a table cell."
152
+ msgid "Horizontal text alignment toolbar"
153
+ msgstr ""
154
+
155
+ msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the vertical text alignment in a table cell."
156
+ msgid "Vertical text alignment toolbar"
157
+ msgstr ""
158
+
159
+ msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the alignment of a table."
160
+ msgid "Table alignment toolbar"
161
+ msgstr ""
162
+
163
+ msgctxt "The label for the border style dropdown when no style is applied to a table or a table cell."
164
+ msgid "None"
165
+ msgstr ""
166
+
167
+ msgctxt "The label for the border style dropdown when the solid border is applied to a table or a table cell."
168
+ msgid "Solid"
169
+ msgstr ""
170
+
171
+ msgctxt "The label for the border style dropdown when the dotted border is applied to a table or a table cell."
172
+ msgid "Dotted"
173
+ msgstr ""
174
+
175
+ msgctxt "The label for the border style dropdown when the dashed border is applied to a table or a table cell."
176
+ msgid "Dashed"
177
+ msgstr ""
178
+
179
+ msgctxt "The label for the border style dropdown when the double border is applied to a table or a table cell."
180
+ msgid "Double"
181
+ msgstr ""
182
+
183
+ msgctxt "The label for the border style dropdown when the groove border is applied to a table or a table cell."
184
+ msgid "Groove"
185
+ msgstr ""
186
+
187
+ msgctxt "The label for the border style dropdown when the ridge border is applied to a table or a table cell."
188
+ msgid "Ridge"
189
+ msgstr ""
190
+
191
+ msgctxt "The label for the border style dropdown when the inset border is applied to a table or a table cell."
192
+ msgid "Inset"
193
+ msgstr ""
194
+
195
+ msgctxt "The label for the border style dropdown when the outset border is applied to a table or a table cell."
196
+ msgid "Outset"
197
+ msgstr ""
198
+
199
+ msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the left."
200
+ msgid "Align cell text to the left"
201
+ msgstr ""
202
+
203
+ msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the center."
204
+ msgid "Align cell text to the center"
205
+ msgstr ""
206
+
207
+ msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the right."
208
+ msgid "Align cell text to the right"
209
+ msgstr ""
210
+
211
+ msgctxt "The label used by assistive technologies describing a button that justifies the table cell text."
212
+ msgid "Justify cell text"
213
+ msgstr ""
214
+
215
+ msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the top."
216
+ msgid "Align cell text to the top"
217
+ msgstr ""
218
+
219
+ msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the middle."
220
+ msgid "Align cell text to the middle"
221
+ msgstr ""
222
+
223
+ msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the bottom."
224
+ msgid "Align cell text to the bottom"
225
+ msgstr ""
226
+
227
+ msgctxt "The label used by assistive technologies describing a button that aligns the table to the left."
228
+ msgid "Align table to the left"
229
+ msgstr ""
230
+
231
+ msgctxt "The label used by assistive technologies describing a button that centers the table."
232
+ msgid "Center table"
233
+ msgstr ""
234
+
235
+ msgctxt "The label used by assistive technologies describing a button that aligns the table to the right."
236
+ msgid "Align table to the right"
237
+ msgstr ""
238
+
239
+ msgctxt "The localized error string that can be displayed next to color (background, border) fields that have an invalid value"
240
+ msgid "The color is invalid. Try \"#FF0000\" or \"rgb(255,0,0)\" or \"red\"."
241
+ msgstr ""
242
+
243
+ msgctxt "The localized error string that can be displayed next to length (padding, border width) fields that have an invalid value."
244
+ msgid "The value is invalid. Try \"10px\" or \"2em\" or simply \"2\"."
245
+ msgstr ""
246
+
247
+ msgctxt "The label used by assistive technologies describing a button that opens a color picker, where user can choose a configured color for a certain properties (eg.: background color, color, border-color etc.)."
248
+ msgid "Color picker"
249
+ msgstr ""
250
+
251
+ msgctxt "The button label for the table toolbar hiding caption attached to the table."
252
+ msgid "Toggle caption off"
253
+ msgstr ""
254
+
255
+ msgctxt "The button label for the table toolbar showing caption attached to the table."
256
+ msgid "Toggle caption on"
257
+ msgstr ""
258
+
259
+ msgctxt "The placeholder text for the table caption displayed when the caption is empty."
260
+ msgid "Enter table caption"
261
+ msgstr ""
@@ -26,11 +26,11 @@ msgstr "سر ستون"
26
26
 
27
27
  msgctxt "Label for the insert table column to the left of the current one button."
28
28
  msgid "Insert column left"
29
- msgstr ""
29
+ msgstr "بائیں جانب کالم بنائیں"
30
30
 
31
31
  msgctxt "Label for the insert table column to the right of the current one button."
32
32
  msgid "Insert column right"
33
- msgstr ""
33
+ msgstr "دائیں جانب کالم بنائیں"
34
34
 
35
35
  msgctxt "Label for the delete table column button."
36
36
  msgid "Delete column"
@@ -110,7 +110,7 @@ msgstr ""
110
110
 
111
111
  msgctxt "The label describing a group of border–related form fields (border style, color, etc.)."
112
112
  msgid "Border"
113
- msgstr ""
113
+ msgstr "حاشیہ"
114
114
 
115
115
  msgctxt "The label for the dropdown that allows configuring the border style of a table or a table cell."
116
116
  msgid "Style"
@@ -118,15 +118,15 @@ msgstr ""
118
118
 
119
119
  msgctxt "The label for the input that allows configuring the width of a table or a table cell or the width of a border."
120
120
  msgid "Width"
121
- msgstr ""
121
+ msgstr "چوڑائی"
122
122
 
123
123
  msgctxt "The label for the input that allows configuring the height of a table or a table cell."
124
124
  msgid "Height"
125
- msgstr ""
125
+ msgstr "اونچائی"
126
126
 
127
127
  msgctxt "The label for the input that allows configuring the border color of a table or a table cell."
128
128
  msgid "Color"
129
- msgstr ""
129
+ msgstr "رنگ"
130
130
 
131
131
  msgctxt "The label for the input that allows configuring the background color of a table or a table cell."
132
132
  msgid "Background"
@@ -170,15 +170,15 @@ msgstr ""
170
170
 
171
171
  msgctxt "The label for the border style dropdown when the dotted border is applied to a table or a table cell."
172
172
  msgid "Dotted"
173
- msgstr ""
173
+ msgstr "نقطہ دار"
174
174
 
175
175
  msgctxt "The label for the border style dropdown when the dashed border is applied to a table or a table cell."
176
176
  msgid "Dashed"
177
- msgstr ""
177
+ msgstr "قطعہ دار"
178
178
 
179
179
  msgctxt "The label for the border style dropdown when the double border is applied to a table or a table cell."
180
180
  msgid "Double"
181
- msgstr ""
181
+ msgstr "دو گنا"
182
182
 
183
183
  msgctxt "The label for the border style dropdown when the groove border is applied to a table or a table cell."
184
184
  msgid "Groove"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-table",
3
- "version": "35.0.1",
3
+ "version": "35.1.0",
4
4
  "description": "Table feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,34 +12,34 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "^35.0.1",
15
+ "ckeditor5": "^35.1.0",
16
16
  "lodash-es": "^4.17.15"
17
17
  },
18
18
  "devDependencies": {
19
- "@ckeditor/ckeditor5-alignment": "^35.0.1",
20
- "@ckeditor/ckeditor5-basic-styles": "^35.0.1",
21
- "@ckeditor/ckeditor5-block-quote": "^35.0.1",
22
- "@ckeditor/ckeditor5-clipboard": "^35.0.1",
23
- "@ckeditor/ckeditor5-core": "^35.0.1",
19
+ "@ckeditor/ckeditor5-alignment": "^35.1.0",
20
+ "@ckeditor/ckeditor5-basic-styles": "^35.1.0",
21
+ "@ckeditor/ckeditor5-block-quote": "^35.1.0",
22
+ "@ckeditor/ckeditor5-clipboard": "^35.1.0",
23
+ "@ckeditor/ckeditor5-core": "^35.1.0",
24
24
  "@ckeditor/ckeditor5-dev-utils": "^30.0.0",
25
- "@ckeditor/ckeditor5-editor-classic": "^35.0.1",
26
- "@ckeditor/ckeditor5-engine": "^35.0.1",
27
- "@ckeditor/ckeditor5-highlight": "^35.0.1",
28
- "@ckeditor/ckeditor5-horizontal-line": "^35.0.1",
29
- "@ckeditor/ckeditor5-html-support": "^35.0.1",
30
- "@ckeditor/ckeditor5-image": "^35.0.1",
31
- "@ckeditor/ckeditor5-indent": "^35.0.1",
32
- "@ckeditor/ckeditor5-link": "^35.0.1",
33
- "@ckeditor/ckeditor5-list": "^35.0.1",
34
- "@ckeditor/ckeditor5-media-embed": "^35.0.1",
35
- "@ckeditor/ckeditor5-paragraph": "^35.0.1",
36
- "@ckeditor/ckeditor5-theme-lark": "^35.0.1",
37
- "@ckeditor/ckeditor5-typing": "^35.0.1",
38
- "@ckeditor/ckeditor5-ui": "^35.0.1",
39
- "@ckeditor/ckeditor5-undo": "^35.0.1",
40
- "@ckeditor/ckeditor5-utils": "^35.0.1",
41
- "@ckeditor/ckeditor5-widget": "^35.0.1",
42
- "@ckeditor/ckeditor5-source-editing": "^35.0.1",
25
+ "@ckeditor/ckeditor5-editor-classic": "^35.1.0",
26
+ "@ckeditor/ckeditor5-engine": "^35.1.0",
27
+ "@ckeditor/ckeditor5-highlight": "^35.1.0",
28
+ "@ckeditor/ckeditor5-horizontal-line": "^35.1.0",
29
+ "@ckeditor/ckeditor5-html-support": "^35.1.0",
30
+ "@ckeditor/ckeditor5-image": "^35.1.0",
31
+ "@ckeditor/ckeditor5-indent": "^35.1.0",
32
+ "@ckeditor/ckeditor5-link": "^35.1.0",
33
+ "@ckeditor/ckeditor5-list": "^35.1.0",
34
+ "@ckeditor/ckeditor5-media-embed": "^35.1.0",
35
+ "@ckeditor/ckeditor5-paragraph": "^35.1.0",
36
+ "@ckeditor/ckeditor5-theme-lark": "^35.1.0",
37
+ "@ckeditor/ckeditor5-typing": "^35.1.0",
38
+ "@ckeditor/ckeditor5-ui": "^35.1.0",
39
+ "@ckeditor/ckeditor5-undo": "^35.1.0",
40
+ "@ckeditor/ckeditor5-utils": "^35.1.0",
41
+ "@ckeditor/ckeditor5-widget": "^35.1.0",
42
+ "@ckeditor/ckeditor5-source-editing": "^35.1.0",
43
43
  "json-diff": "^0.5.4",
44
44
  "webpack": "^5.58.1",
45
45
  "webpack-cli": "^4.9.0"
@@ -63,6 +63,8 @@ export default class TableCaptionUI extends Plugin {
63
63
  writer.addClass( 'table__caption_highlighted', figcaptionElement );
64
64
  } );
65
65
  }
66
+
67
+ editor.editing.view.focus();
66
68
  } );
67
69
 
68
70
  return view;
@@ -7,8 +7,6 @@
7
7
  * @module table/tablecolumnresize/constants
8
8
  */
9
9
 
10
- /* istanbul ignore file */
11
-
12
10
  /**
13
11
  * The minimum column width given as a percentage value. Used in situations when the table is not yet rendered, so it is impossible to
14
12
  * calculate how many percentage of the table width would be {@link ~COLUMN_MIN_WIDTH_IN_PIXELS minimum column width in pixels}.
@@ -7,35 +7,34 @@
7
7
  * @module table/tablecolumnresize/converters
8
8
  */
9
9
 
10
- /* istanbul ignore file */
11
-
12
- import { getNumberOfColumn } from './utils';
10
+ import { normalizeColumnWidths } from './utils';
13
11
 
14
12
  /**
15
13
  * Returns a helper for converting a view `<colgroup>` and `<col>` elements to the model table `columnWidths` attribute.
16
14
  *
17
15
  * Only the inline width, provided as a percentage value, in the `<col>` element is taken into account. If there are not enough `<col>`
18
- * elements matching this condition, the special value 'auto' is returned. It indicates that the width of a column will be automatically
16
+ * elements matching this condition, the special value `auto` is returned. It indicates that the width of a column will be automatically
19
17
  * calculated in the
20
- * {@link module:table/tablecolumnresize/tablecolumnresizeediting~TableColumnResizeEditing#_setupPostFixer post-fixer}, depending
18
+ * {@link module:table/tablecolumnresize/tablecolumnresizeediting~TableColumnResizeEditing#_registerPostFixer post-fixer}, depending
21
19
  * on the available table space.
22
20
  *
23
- * @param {module:core/editor/editor~Editor} editor The editor instance.
21
+ * @param {module:core/plugin~Plugin} tableUtilsPlugin The {@link module:table/tableutils~TableUtils} plugin instance.
24
22
  * @returns {Function} Conversion helper.
25
23
  */
26
- export function upcastColgroupElement( editor ) {
24
+ export function upcastColgroupElement( tableUtilsPlugin ) {
27
25
  return dispatcher => dispatcher.on( 'element:colgroup', ( evt, data, conversionApi ) => {
28
- const modelTable = data.modelCursor.findAncestor( 'table' );
26
+ const viewColgroupElement = data.viewItem;
29
27
 
30
- if ( !modelTable ) {
28
+ if ( !conversionApi.consumable.test( viewColgroupElement, { name: true } ) ) {
31
29
  return;
32
30
  }
33
31
 
34
- const modelWriter = conversionApi.writer;
35
- const viewColgroupElement = data.viewItem;
36
- const numberOfColumns = getNumberOfColumn( modelTable, editor );
32
+ conversionApi.consumable.consume( viewColgroupElement, { name: true } );
37
33
 
38
- const columnWidthsAttribute = [ ...Array( numberOfColumns ).keys() ]
34
+ const modelTable = data.modelCursor.findAncestor( 'table' );
35
+ const numberOfColumns = tableUtilsPlugin.getColumns( modelTable );
36
+
37
+ let columnWidths = [ ...Array( numberOfColumns ).keys() ]
39
38
  .map( columnIndex => {
40
39
  const viewChild = viewColgroupElement.getChild( columnIndex );
41
40
 
@@ -50,10 +49,13 @@ export function upcastColgroupElement( editor ) {
50
49
  }
51
50
 
52
51
  return viewColWidth;
53
- } )
54
- .join( ',' );
52
+ } );
53
+
54
+ if ( columnWidths.includes( 'auto' ) ) {
55
+ columnWidths = normalizeColumnWidths( columnWidths ).map( width => width + '%' );
56
+ }
55
57
 
56
- modelWriter.setAttribute( 'columnWidths', columnWidthsAttribute, modelTable );
58
+ conversionApi.writer.setAttribute( 'columnWidths', columnWidths.join( ',' ), modelTable );
57
59
  } );
58
60
  }
59
61
 
@@ -71,11 +73,14 @@ export function downcastTableColumnWidthsAttribute() {
71
73
  .find( viewChild => viewChild.is( 'element', 'table' ) );
72
74
 
73
75
  if ( data.attributeNewValue ) {
74
- if ( data.attributeNewValue !== data.attributeOldValue ) {
75
- insertColgroupElement( viewWriter, viewTable, data.attributeNewValue );
76
- }
76
+ // If new value is the same as the old, the operation is not applied (see the `writer.setAttributeOnItem()`).
77
+ // OTOH the model element has the attribute already applied, so we can't compare the values.
78
+ // Hence we need to just recreate the <colgroup> element every time.
79
+ insertColgroupElement( viewWriter, viewTable, data.attributeNewValue );
80
+ viewWriter.addClass( 'ck-table-resized', viewTable );
77
81
  } else {
78
82
  removeColgroupElement( viewWriter, viewTable );
83
+ viewWriter.removeClass( 'ck-table-resized', viewTable );
79
84
  }
80
85
  } );
81
86
  }
@@ -86,7 +91,7 @@ export function downcastTableColumnWidthsAttribute() {
86
91
  // @private
87
92
  // @param {module:engine/view/downcastwriter~DowncastWriter} viewWriter View writer instance.
88
93
  // @param {module:engine/view/element~Element} viewTable View table.
89
- // @param {String} columnWidthsAttribute Column width attribute from model table.
94
+ // @param {String} columnWidthsAttribute Column widths attribute from model table.
90
95
  function insertColgroupElement( viewWriter, viewTable, columnWidthsAttribute ) {
91
96
  const columnWidths = columnWidthsAttribute.split( ',' );
92
97
 
@@ -94,10 +99,10 @@ function insertColgroupElement( viewWriter, viewTable, columnWidthsAttribute ) {
94
99
 
95
100
  if ( !viewColgroupElement ) {
96
101
  viewColgroupElement = viewWriter.createContainerElement( 'colgroup' );
97
- }
98
-
99
- for ( const viewChild of [ ...viewColgroupElement.getChildren() ] ) {
100
- viewWriter.remove( viewChild );
102
+ } else {
103
+ for ( const viewChild of [ ...viewColgroupElement.getChildren() ] ) {
104
+ viewWriter.remove( viewChild );
105
+ }
101
106
  }
102
107
 
103
108
  for ( const columnIndex of Array( columnWidths.length ).keys() ) {
@@ -118,9 +123,5 @@ function insertColgroupElement( viewWriter, viewTable, columnWidthsAttribute ) {
118
123
  function removeColgroupElement( viewWriter, viewTable ) {
119
124
  const viewColgroupElement = [ ...viewTable.getChildren() ].find( viewElement => viewElement.is( 'element', 'colgroup' ) );
120
125
 
121
- if ( !viewColgroupElement ) {
122
- return;
123
- }
124
-
125
126
  viewWriter.remove( viewColgroupElement );
126
127
  }