@ckeditor/ckeditor5-table 34.2.0 → 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.
Files changed (72) hide show
  1. package/CHANGELOG.md +261 -0
  2. package/LICENSE.md +4 -0
  3. package/build/table.js +1 -1
  4. package/build/translations/ar.js +1 -1
  5. package/build/translations/bg.js +1 -1
  6. package/build/translations/bn.js +1 -0
  7. package/build/translations/ca.js +1 -0
  8. package/build/translations/da.js +1 -1
  9. package/build/translations/et.js +1 -1
  10. package/build/translations/fi.js +1 -1
  11. package/build/translations/fr.js +1 -1
  12. package/build/translations/he.js +1 -0
  13. package/build/translations/hi.js +1 -1
  14. package/build/translations/id.js +1 -1
  15. package/build/translations/ja.js +1 -1
  16. package/build/translations/ko.js +1 -1
  17. package/build/translations/lt.js +1 -1
  18. package/build/translations/lv.js +1 -1
  19. package/build/translations/ms.js +1 -0
  20. package/build/translations/nl.js +1 -1
  21. package/build/translations/no.js +1 -1
  22. package/build/translations/pt.js +1 -1
  23. package/build/translations/sv.js +1 -1
  24. package/build/translations/th.js +1 -1
  25. package/build/translations/tr.js +1 -1
  26. package/build/translations/tt.js +1 -0
  27. package/build/translations/uk.js +1 -1
  28. package/build/translations/ur.js +1 -1
  29. package/build/translations/vi.js +1 -1
  30. package/lang/translations/ar.po +11 -11
  31. package/lang/translations/bg.po +43 -43
  32. package/lang/translations/bn.po +263 -0
  33. package/lang/translations/ca.po +261 -0
  34. package/lang/translations/da.po +6 -6
  35. package/lang/translations/et.po +3 -3
  36. package/lang/translations/fi.po +41 -41
  37. package/lang/translations/fr.po +3 -3
  38. package/lang/translations/he.po +261 -0
  39. package/lang/translations/hi.po +3 -3
  40. package/lang/translations/id.po +21 -21
  41. package/lang/translations/ja.po +45 -45
  42. package/lang/translations/ko.po +60 -60
  43. package/lang/translations/lt.po +43 -43
  44. package/lang/translations/lv.po +2 -2
  45. package/lang/translations/ms.po +261 -0
  46. package/lang/translations/nl.po +25 -25
  47. package/lang/translations/no.po +3 -3
  48. package/lang/translations/pt.po +59 -59
  49. package/lang/translations/sv.po +56 -56
  50. package/lang/translations/th.po +42 -42
  51. package/lang/translations/tr.po +3 -3
  52. package/lang/translations/tt.po +261 -0
  53. package/lang/translations/uk.po +3 -3
  54. package/lang/translations/ur.po +9 -9
  55. package/lang/translations/vi.po +28 -28
  56. package/package.json +27 -26
  57. package/src/tablecaption/tablecaptionui.js +2 -0
  58. package/src/tablecellproperties/ui/tablecellpropertiesview.js +2 -2
  59. package/src/tablecolumnresize/constants.js +0 -2
  60. package/src/tablecolumnresize/converters.js +29 -28
  61. package/src/tablecolumnresize/tablecolumnresizeediting.js +399 -425
  62. package/src/tablecolumnresize/tablecolumnwidthscommand.js +55 -0
  63. package/src/tablecolumnresize/tablewidthresizecommand.js +60 -0
  64. package/src/tablecolumnresize/utils.js +131 -167
  65. package/src/tablecolumnresize.js +2 -2
  66. package/src/tableproperties/ui/tablepropertiesview.js +1 -1
  67. package/src/tableui.js +6 -8
  68. package/src/ui/colorinputview.js +2 -1
  69. package/src/ui/inserttableview.js +81 -14
  70. package/src/utils/ui/contextualballoon.js +3 -3
  71. package/src/utils/ui/widget.js +7 -1
  72. package/theme/tablecolumnresize.css +13 -10
@@ -150,112 +150,112 @@ msgstr "Căn lề"
150
150
 
151
151
  msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the horizontal text alignment in a table cell."
152
152
  msgid "Horizontal text alignment toolbar"
153
- msgstr ""
153
+ msgstr "Thanh công cụ căn chỉnh văn bản theo chiều ngang"
154
154
 
155
155
  msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the vertical text alignment in a table cell."
156
156
  msgid "Vertical text alignment toolbar"
157
- msgstr ""
157
+ msgstr "Thanh công cụ căn chỉnh văn bản theo chiều dọc"
158
158
 
159
159
  msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the alignment of a table."
160
160
  msgid "Table alignment toolbar"
161
- msgstr ""
161
+ msgstr "Thanh công cụ căn chỉnh bảng"
162
162
 
163
163
  msgctxt "The label for the border style dropdown when no style is applied to a table or a table cell."
164
164
  msgid "None"
165
- msgstr ""
165
+ msgstr "Không có kiểu nào"
166
166
 
167
167
  msgctxt "The label for the border style dropdown when the solid border is applied to a table or a table cell."
168
168
  msgid "Solid"
169
- msgstr ""
169
+ msgstr "Dạng nét liền"
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 "Dạng chấm"
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 "Dạng đường đứt nét"
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 "Dạng nét đôi"
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"
185
- msgstr ""
185
+ msgstr "Dạng đường rãnh"
186
186
 
187
187
  msgctxt "The label for the border style dropdown when the ridge border is applied to a table or a table cell."
188
188
  msgid "Ridge"
189
- msgstr ""
189
+ msgstr "Dạng gờ"
190
190
 
191
191
  msgctxt "The label for the border style dropdown when the inset border is applied to a table or a table cell."
192
192
  msgid "Inset"
193
- msgstr ""
193
+ msgstr "Dạng chìm"
194
194
 
195
195
  msgctxt "The label for the border style dropdown when the outset border is applied to a table or a table cell."
196
196
  msgid "Outset"
197
- msgstr ""
197
+ msgstr "Dạng nổi"
198
198
 
199
199
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the left."
200
200
  msgid "Align cell text to the left"
201
- msgstr ""
201
+ msgstr "Căn chỉnh văn bản trong ô về bên trái"
202
202
 
203
203
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the center."
204
204
  msgid "Align cell text to the center"
205
- msgstr ""
205
+ msgstr "Căn chỉnh văn bản trong ô vào chính giữa"
206
206
 
207
207
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the right."
208
208
  msgid "Align cell text to the right"
209
- msgstr ""
209
+ msgstr "Căn chỉnh văn bản trong ô về bên phải"
210
210
 
211
211
  msgctxt "The label used by assistive technologies describing a button that justifies the table cell text."
212
212
  msgid "Justify cell text"
213
- msgstr ""
213
+ msgstr "Căn đều văn bản trong ô"
214
214
 
215
215
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the top."
216
216
  msgid "Align cell text to the top"
217
- msgstr ""
217
+ msgstr "Căn chỉnh văn bản trong ô lên trên cùng"
218
218
 
219
219
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the middle."
220
220
  msgid "Align cell text to the middle"
221
- msgstr ""
221
+ msgstr "Căn chỉnh văn bản trong ô vào giữa"
222
222
 
223
223
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the bottom."
224
224
  msgid "Align cell text to the bottom"
225
- msgstr ""
225
+ msgstr "Căn chỉnh văn bản trong ô xuống dưới cùng"
226
226
 
227
227
  msgctxt "The label used by assistive technologies describing a button that aligns the table to the left."
228
228
  msgid "Align table to the left"
229
- msgstr ""
229
+ msgstr "Căn chỉnh bảng về phía bên trái"
230
230
 
231
231
  msgctxt "The label used by assistive technologies describing a button that centers the table."
232
232
  msgid "Center table"
233
- msgstr ""
233
+ msgstr "Căn chỉnh bảng vào chính giữa"
234
234
 
235
235
  msgctxt "The label used by assistive technologies describing a button that aligns the table to the right."
236
236
  msgid "Align table to the right"
237
- msgstr ""
237
+ msgstr "Căn chỉnh bảng về phía bên phải"
238
238
 
239
239
  msgctxt "The localized error string that can be displayed next to color (background, border) fields that have an invalid value"
240
240
  msgid "The color is invalid. Try \"#FF0000\" or \"rgb(255,0,0)\" or \"red\"."
241
- msgstr ""
241
+ msgstr "Màu này không hợp lệ. Hãy thử \"#FF0000\" hoặc \"rgb(255,0,0)\" hoặc \"red\"."
242
242
 
243
243
  msgctxt "The localized error string that can be displayed next to length (padding, border width) fields that have an invalid value."
244
244
  msgid "The value is invalid. Try \"10px\" or \"2em\" or simply \"2\"."
245
- msgstr ""
245
+ msgstr "Giá trị này không hợp lệ. Hãy thử \"10px\" hoặc \"2em\" hoặc chỉ \"2\"."
246
246
 
247
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
248
  msgid "Color picker"
249
- msgstr ""
249
+ msgstr "Bộ chọn màu"
250
250
 
251
251
  msgctxt "The button label for the table toolbar hiding caption attached to the table."
252
252
  msgid "Toggle caption off"
253
- msgstr ""
253
+ msgstr "Ẩn chú thích"
254
254
 
255
255
  msgctxt "The button label for the table toolbar showing caption attached to the table."
256
256
  msgid "Toggle caption on"
257
- msgstr ""
257
+ msgstr "Hiện chú thích"
258
258
 
259
259
  msgctxt "The placeholder text for the table caption displayed when the caption is empty."
260
260
  msgid "Enter table caption"
261
- msgstr ""
261
+ msgstr "Nhập chú thích cho bảng"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-table",
3
- "version": "34.2.0",
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": "^34.2.0",
15
+ "ckeditor5": "^35.1.0",
16
16
  "lodash-es": "^4.17.15"
17
17
  },
18
18
  "devDependencies": {
19
- "@ckeditor/ckeditor5-alignment": "^34.2.0",
20
- "@ckeditor/ckeditor5-basic-styles": "^34.2.0",
21
- "@ckeditor/ckeditor5-block-quote": "^34.2.0",
22
- "@ckeditor/ckeditor5-clipboard": "^34.2.0",
23
- "@ckeditor/ckeditor5-core": "^34.2.0",
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": "^34.2.0",
26
- "@ckeditor/ckeditor5-engine": "^34.2.0",
27
- "@ckeditor/ckeditor5-highlight": "^34.2.0",
28
- "@ckeditor/ckeditor5-horizontal-line": "^34.2.0",
29
- "@ckeditor/ckeditor5-html-support": "^34.2.0",
30
- "@ckeditor/ckeditor5-image": "^34.2.0",
31
- "@ckeditor/ckeditor5-indent": "^34.2.0",
32
- "@ckeditor/ckeditor5-link": "^34.2.0",
33
- "@ckeditor/ckeditor5-list": "^34.2.0",
34
- "@ckeditor/ckeditor5-media-embed": "^34.2.0",
35
- "@ckeditor/ckeditor5-paragraph": "^34.2.0",
36
- "@ckeditor/ckeditor5-theme-lark": "^34.2.0",
37
- "@ckeditor/ckeditor5-typing": "^34.2.0",
38
- "@ckeditor/ckeditor5-ui": "^34.2.0",
39
- "@ckeditor/ckeditor5-undo": "^34.2.0",
40
- "@ckeditor/ckeditor5-utils": "^34.2.0",
41
- "@ckeditor/ckeditor5-widget": "^34.2.0",
42
- "@ckeditor/ckeditor5-source-editing": "^34.2.0",
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"
@@ -62,7 +62,8 @@
62
62
  "src",
63
63
  "theme",
64
64
  "build",
65
- "ckeditor5-metadata.json"
65
+ "ckeditor5-metadata.json",
66
+ "CHANGELOG.md"
66
67
  ],
67
68
  "scripts": {
68
69
  "dll:build": "webpack"
@@ -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;
@@ -247,7 +247,7 @@ export default class TableCellPropertiesView extends View {
247
247
  * A toolbar with buttons that allow changing the horizontal text alignment in a table cell.
248
248
  *
249
249
  * @readonly
250
- * @member {module:ui/toolbar/toolbar~ToolbarView}
250
+ * @member {module:ui/toolbar/toolbarview~ToolbarView}
251
251
  */
252
252
  this.horizontalAlignmentToolbar = horizontalAlignmentToolbar;
253
253
 
@@ -255,7 +255,7 @@ export default class TableCellPropertiesView extends View {
255
255
  * A toolbar with buttons that allow changing the vertical text alignment in a table cell.
256
256
  *
257
257
  * @readonly
258
- * @member {module:ui/toolbar/toolbar~ToolbarView}
258
+ * @member {module:ui/toolbar/toolbarview~ToolbarView}
259
259
  */
260
260
  this.verticalAlignmentToolbar = verticalAlignmentToolbar;
261
261
 
@@ -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
  }