@ckeditor/ckeditor5-table 29.1.0 → 31.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 (90) hide show
  1. package/build/table.js +1 -1
  2. package/build/translations/ar.js +1 -0
  3. package/build/translations/az.js +1 -0
  4. package/build/translations/bg.js +1 -0
  5. package/build/translations/cs.js +1 -0
  6. package/build/translations/da.js +1 -0
  7. package/build/translations/de-ch.js +1 -0
  8. package/build/translations/de.js +1 -0
  9. package/build/translations/en-au.js +1 -0
  10. package/build/translations/en-gb.js +1 -0
  11. package/build/translations/es.js +1 -0
  12. package/build/translations/et.js +1 -0
  13. package/build/translations/fa.js +1 -0
  14. package/build/translations/fi.js +1 -0
  15. package/build/translations/fr.js +1 -0
  16. package/build/translations/gl.js +1 -0
  17. package/build/translations/hi.js +1 -0
  18. package/build/translations/hr.js +1 -0
  19. package/build/translations/hu.js +1 -0
  20. package/build/translations/id.js +1 -0
  21. package/build/translations/it.js +1 -0
  22. package/build/translations/ja.js +1 -0
  23. package/build/translations/ko.js +1 -0
  24. package/build/translations/ku.js +1 -0
  25. package/build/translations/lt.js +1 -0
  26. package/build/translations/lv.js +1 -0
  27. package/build/translations/nb.js +1 -0
  28. package/build/translations/ne.js +1 -0
  29. package/build/translations/nl.js +1 -0
  30. package/build/translations/no.js +1 -0
  31. package/build/translations/pl.js +1 -0
  32. package/build/translations/pt-br.js +1 -0
  33. package/build/translations/ro.js +1 -0
  34. package/build/translations/ru.js +1 -0
  35. package/build/translations/sk.js +1 -0
  36. package/build/translations/sq.js +1 -0
  37. package/build/translations/sr-latn.js +1 -0
  38. package/build/translations/sr.js +1 -0
  39. package/build/translations/sv.js +1 -0
  40. package/build/translations/th.js +1 -0
  41. package/build/translations/tk.js +1 -0
  42. package/build/translations/tr.js +1 -0
  43. package/build/translations/ug.js +1 -0
  44. package/build/translations/uk.js +1 -0
  45. package/build/translations/uz.js +1 -0
  46. package/build/translations/vi.js +1 -0
  47. package/build/translations/zh-cn.js +1 -0
  48. package/build/translations/zh.js +1 -0
  49. package/lang/translations/es.po +11 -11
  50. package/lang/translations/id.po +10 -10
  51. package/lang/translations/nl.po +2 -2
  52. package/lang/translations/pl.po +3 -3
  53. package/lang/translations/pt-br.po +3 -3
  54. package/lang/translations/ru.po +3 -3
  55. package/lang/translations/sr-latn.po +3 -3
  56. package/lang/translations/sr.po +3 -3
  57. package/lang/translations/uz.po +261 -0
  58. package/lang/translations/zh.po +3 -3
  59. package/package.json +21 -21
  60. package/src/commands/selectcolumncommand.js +10 -0
  61. package/src/commands/selectrowcommand.js +10 -0
  62. package/src/converters/downcast.js +1 -18
  63. package/src/converters/table-heading-rows-refresh-post-fixer.js +23 -6
  64. package/src/converters/tableproperties.js +5 -4
  65. package/src/converters/upcasttable.js +6 -0
  66. package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +1 -1
  67. package/src/tablecellproperties/commands/tablecellbordercolorcommand.js +1 -1
  68. package/src/tablecellproperties/commands/tablecellborderstylecommand.js +1 -1
  69. package/src/tablecellproperties/commands/tablecellborderwidthcommand.js +1 -1
  70. package/src/tablecellproperties/commands/tablecellheightcommand.js +1 -1
  71. package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +1 -1
  72. package/src/tablecellproperties/commands/tablecellpaddingcommand.js +1 -1
  73. package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js +1 -1
  74. package/src/tablecellproperties/commands/tablecellwidthcommand.js +1 -1
  75. package/src/tablecellproperties/tablecellpropertiesediting.js +41 -34
  76. package/src/tablecellproperties/ui/tablecellpropertiesview.js +10 -1
  77. package/src/tablekeyboard.js +19 -4
  78. package/src/tableproperties/commands/tablealignmentcommand.js +1 -1
  79. package/src/tableproperties/commands/tablebackgroundcolorcommand.js +1 -1
  80. package/src/tableproperties/commands/tablebordercolorcommand.js +1 -1
  81. package/src/tableproperties/commands/tableborderstylecommand.js +1 -1
  82. package/src/tableproperties/commands/tableborderwidthcommand.js +1 -1
  83. package/src/tableproperties/commands/tableheightcommand.js +1 -1
  84. package/src/tableproperties/commands/tablewidthcommand.js +1 -1
  85. package/src/tableproperties/tablepropertiesediting.js +28 -20
  86. package/src/tableproperties/ui/tablepropertiesview.js +10 -1
  87. package/src/ui/colorinputview.js +2 -2
  88. package/src/utils/ui/contextualballoon.js +3 -8
  89. package/theme/colorinput.css +3 -0
  90. package/CHANGELOG.md +0 -261
@@ -29,14 +29,31 @@ function tableHeadingRowsRefreshPostFixer( model ) {
29
29
  const tablesToRefresh = new Set();
30
30
 
31
31
  for ( const change of differ.getChanges() ) {
32
- if ( change.type != 'attribute' ) {
33
- continue;
34
- }
32
+ if ( change.type === 'attribute' ) {
33
+ const element = change.range.start.nodeAfter;
34
+
35
+ if ( element && element.is( 'element', 'table' ) && change.attributeKey === 'headingRows' ) {
36
+ tablesToRefresh.add( element );
37
+ }
38
+ } else {
39
+ /* istanbul ignore else */
40
+ if ( change.type === 'insert' || change.type === 'remove' ) {
41
+ if ( change.name === 'tableRow' ) {
42
+ const table = change.position.findAncestor( 'table' );
43
+ const headingRows = table.getAttribute( 'headingRows' ) || 0;
35
44
 
36
- const element = change.range.start.nodeAfter;
45
+ if ( change.position.offset < headingRows ) {
46
+ tablesToRefresh.add( table );
47
+ }
48
+ } else if ( change.name === 'tableCell' ) {
49
+ const table = change.position.findAncestor( 'table' );
50
+ const headingColumns = table.getAttribute( 'headingColumns' ) || 0;
37
51
 
38
- if ( element && element.is( 'element', 'table' ) && change.attributeKey == 'headingRows' ) {
39
- tablesToRefresh.add( element );
52
+ if ( change.position.offset < headingColumns ) {
53
+ tablesToRefresh.add( table );
54
+ }
55
+ }
56
+ }
40
57
  }
41
58
  }
42
59
 
@@ -47,12 +47,13 @@ export function upcastStyleToAttribute( conversion, options ) {
47
47
  *
48
48
  * @param {module:engine/conversion/conversion~Conversion} conversion
49
49
  * @param {String} viewElementName
50
+ * @param {Object} modelAttributes
50
51
  * @param {Object} defaultBorder The default border values.
51
52
  * @param {String} defaultBorder.color The default `borderColor` value.
52
53
  * @param {String} defaultBorder.style The default `borderStyle` value.
53
54
  * @param {String} defaultBorder.width The default `borderWidth` value.
54
55
  */
55
- export function upcastBorderStyles( conversion, viewElementName, defaultBorder ) {
56
+ export function upcastBorderStyles( conversion, viewElementName, modelAttributes, defaultBorder ) {
56
57
  conversion.for( 'upcast' ).add( dispatcher => dispatcher.on( 'element:' + viewElementName, ( evt, data, conversionApi ) => {
57
58
  // If the element was not converted by element-to-element converter,
58
59
  // we should not try to convert the style. See #8393.
@@ -107,15 +108,15 @@ export function upcastBorderStyles( conversion, viewElementName, defaultBorder )
107
108
  };
108
109
 
109
110
  if ( reducedBorder.style !== defaultBorder.style ) {
110
- conversionApi.writer.setAttribute( 'borderStyle', reducedBorder.style, modelElement );
111
+ conversionApi.writer.setAttribute( modelAttributes.style, reducedBorder.style, modelElement );
111
112
  }
112
113
 
113
114
  if ( reducedBorder.color !== defaultBorder.color ) {
114
- conversionApi.writer.setAttribute( 'borderColor', reducedBorder.color, modelElement );
115
+ conversionApi.writer.setAttribute( modelAttributes.color, reducedBorder.color, modelElement );
115
116
  }
116
117
 
117
118
  if ( reducedBorder.width !== defaultBorder.width ) {
118
- conversionApi.writer.setAttribute( 'borderWidth', reducedBorder.width, modelElement );
119
+ conversionApi.writer.setAttribute( modelAttributes.width, reducedBorder.width, modelElement );
119
120
  }
120
121
  } ) );
121
122
  }
@@ -37,6 +37,9 @@ export function upcastTableFigure() {
37
37
  return;
38
38
  }
39
39
 
40
+ // Consume the figure to prevent other converters from processing it again.
41
+ conversionApi.consumable.consume( data.viewItem, { name: true, classes: 'table' } );
42
+
40
43
  // Convert view table to model table.
41
44
  const conversionResult = conversionApi.convertItem( viewTable, data.modelCursor );
42
45
 
@@ -45,6 +48,9 @@ export function upcastTableFigure() {
45
48
 
46
49
  // When table wasn't successfully converted then finish conversion.
47
50
  if ( !modelTable ) {
51
+ // Revert consumed figure so other features can convert it.
52
+ conversionApi.consumable.revert( data.viewItem, { name: true, classes: 'table' } );
53
+
48
54
  return;
49
55
  }
50
56
 
@@ -31,6 +31,6 @@ export default class TableCellBackgroundColorCommand extends TableCellPropertyCo
31
31
  * @param {String} defaultValue The default value of the attribute.
32
32
  */
33
33
  constructor( editor, defaultValue ) {
34
- super( editor, 'backgroundColor', defaultValue );
34
+ super( editor, 'tableCellBackgroundColor', defaultValue );
35
35
  }
36
36
  }
@@ -32,7 +32,7 @@ export default class TableCellBorderColorCommand extends TableCellPropertyComman
32
32
  * @param {String} defaultValue The default value of the attribute.
33
33
  */
34
34
  constructor( editor, defaultValue ) {
35
- super( editor, 'borderColor', defaultValue );
35
+ super( editor, 'tableCellBorderColor', defaultValue );
36
36
  }
37
37
 
38
38
  /**
@@ -32,7 +32,7 @@ export default class TableCellBorderStyleCommand extends TableCellPropertyComman
32
32
  * @param {String} defaultValue The default value of the attribute.
33
33
  */
34
34
  constructor( editor, defaultValue ) {
35
- super( editor, 'borderStyle', defaultValue );
35
+ super( editor, 'tableCellBorderStyle', defaultValue );
36
36
  }
37
37
 
38
38
  /**
@@ -40,7 +40,7 @@ export default class TableCellBorderWidthCommand extends TableCellPropertyComman
40
40
  * @param {String} defaultValue The default value of the attribute.
41
41
  */
42
42
  constructor( editor, defaultValue ) {
43
- super( editor, 'borderWidth', defaultValue );
43
+ super( editor, 'tableCellBorderWidth', defaultValue );
44
44
  }
45
45
 
46
46
  /**
@@ -40,7 +40,7 @@ export default class TableCellHeightCommand extends TableCellPropertyCommand {
40
40
  * @param {String} defaultValue The default value of the attribute.
41
41
  */
42
42
  constructor( editor, defaultValue ) {
43
- super( editor, 'height', defaultValue );
43
+ super( editor, 'tableCellHeight', defaultValue );
44
44
  }
45
45
 
46
46
  /**
@@ -31,6 +31,6 @@ export default class TableCellHorizontalAlignmentCommand extends TableCellProper
31
31
  * @param {String} defaultValue The default value for the "alignment" attribute.
32
32
  */
33
33
  constructor( editor, defaultValue ) {
34
- super( editor, 'horizontalAlignment', defaultValue );
34
+ super( editor, 'tableCellHorizontalAlignment', defaultValue );
35
35
  }
36
36
  }
@@ -40,7 +40,7 @@ export default class TableCellPaddingCommand extends TableCellPropertyCommand {
40
40
  * @param {String} defaultValue The default value of the attribute.
41
41
  */
42
42
  constructor( editor, defaultValue ) {
43
- super( editor, 'padding', defaultValue );
43
+ super( editor, 'tableCellPadding', defaultValue );
44
44
  }
45
45
 
46
46
  /**
@@ -39,6 +39,6 @@ export default class TableCellVerticalAlignmentCommand extends TableCellProperty
39
39
  * @param {String} defaultValue The default value for the "alignment" attribute.
40
40
  */
41
41
  constructor( editor, defaultValue ) {
42
- super( editor, 'verticalAlignment', defaultValue );
42
+ super( editor, 'tableCellVerticalAlignment', defaultValue );
43
43
  }
44
44
  }
@@ -40,7 +40,7 @@ export default class TableCellWidthCommand extends TableCellPropertyCommand {
40
40
  * @param {String} defaultValue The default value of the attribute.
41
41
  */
42
42
  constructor( editor, defaultValue ) {
43
- super( editor, 'width', defaultValue );
43
+ super( editor, 'tableCellWidth', defaultValue );
44
44
  }
45
45
 
46
46
  /**
@@ -31,11 +31,11 @@ const ALIGN_VALUES_REG_EXP = /^(left|center|right|justify)$/;
31
31
  *
32
32
  * Introduces table cell model attributes and their conversion:
33
33
  *
34
- * - border: `borderStyle`, `borderColor` and `borderWidth`
35
- * - background color: `backgroundColor`
36
- * - cell padding: `padding`
37
- * - horizontal and vertical alignment: `horizontalAlignment`, `verticalAlignment`
38
- * - cell width and height: `width`, `height`
34
+ * - border: `tableCellBorderStyle`, `tableCellBorderColor` and `tableCellBorderWidth`
35
+ * - background color: `tableCellBackgroundColor`
36
+ * - cell padding: `tableCellPadding`
37
+ * - horizontal and vertical alignment: `tableCellHorizontalAlignment`, `tableCellVerticalAlignment`
38
+ * - cell width and height: `tableCellWidth`, `tableCellHeight`
39
39
  *
40
40
  * It also registers commands used to manipulate the above attributes:
41
41
  *
@@ -92,21 +92,15 @@ export default class TableCellPropertiesEditing extends Plugin {
92
92
  editor.commands.add( 'tableCellBorderColor', new TableCellBorderColorCommand( editor, defaultTableCellProperties.borderColor ) );
93
93
  editor.commands.add( 'tableCellBorderWidth', new TableCellBorderWidthCommand( editor, defaultTableCellProperties.borderWidth ) );
94
94
 
95
- enableHorizontalAlignmentProperty( schema, conversion, defaultTableCellProperties.horizontalAlignment );
96
- editor.commands.add(
97
- 'tableCellHorizontalAlignment',
98
- new TableCellHorizontalAlignmentCommand( editor, defaultTableCellProperties.horizontalAlignment )
99
- );
100
-
101
95
  enableProperty( schema, conversion, {
102
- modelAttribute: 'width',
96
+ modelAttribute: 'tableCellWidth',
103
97
  styleName: 'width',
104
98
  defaultValue: defaultTableCellProperties.width
105
99
  } );
106
100
  editor.commands.add( 'tableCellWidth', new TableCellWidthCommand( editor, defaultTableCellProperties.width ) );
107
101
 
108
102
  enableProperty( schema, conversion, {
109
- modelAttribute: 'height',
103
+ modelAttribute: 'tableCellHeight',
110
104
  styleName: 'height',
111
105
  defaultValue: defaultTableCellProperties.height
112
106
  } );
@@ -114,7 +108,7 @@ export default class TableCellPropertiesEditing extends Plugin {
114
108
 
115
109
  editor.data.addStyleProcessorRules( addPaddingRules );
116
110
  enableProperty( schema, conversion, {
117
- modelAttribute: 'padding',
111
+ modelAttribute: 'tableCellPadding',
118
112
  styleName: 'padding',
119
113
  reduceBoxSides: true,
120
114
  defaultValue: defaultTableCellProperties.padding
@@ -123,7 +117,7 @@ export default class TableCellPropertiesEditing extends Plugin {
123
117
 
124
118
  editor.data.addStyleProcessorRules( addBackgroundRules );
125
119
  enableProperty( schema, conversion, {
126
- modelAttribute: 'backgroundColor',
120
+ modelAttribute: 'tableCellBackgroundColor',
127
121
  styleName: 'background-color',
128
122
  defaultValue: defaultTableCellProperties.backgroundColor
129
123
  } );
@@ -132,6 +126,12 @@ export default class TableCellPropertiesEditing extends Plugin {
132
126
  new TableCellBackgroundColorCommand( editor, defaultTableCellProperties.backgroundColor )
133
127
  );
134
128
 
129
+ enableHorizontalAlignmentProperty( schema, conversion, defaultTableCellProperties.horizontalAlignment );
130
+ editor.commands.add(
131
+ 'tableCellHorizontalAlignment',
132
+ new TableCellHorizontalAlignmentCommand( editor, defaultTableCellProperties.horizontalAlignment )
133
+ );
134
+
135
135
  enableVerticalAlignmentProperty( schema, conversion, defaultTableCellProperties.verticalAlignment );
136
136
  editor.commands.add(
137
137
  'tableCellVerticalAlignment',
@@ -140,26 +140,33 @@ export default class TableCellPropertiesEditing extends Plugin {
140
140
  }
141
141
  }
142
142
 
143
- // Enables the `'borderStyle'`, `'borderColor'` and `'borderWidth'` attributes for table cells.
143
+ // Enables the `'tableCellBorderStyle'`, `'tableCellBorderColor'` and `'tableCellBorderWidth'` attributes for table cells.
144
144
  //
145
145
  // @param {module:engine/model/schema~Schema} schema
146
146
  // @param {module:engine/conversion/conversion~Conversion} conversion
147
147
  // @param {Object} defaultBorder The default border values.
148
- // @param {String} defaultBorder.color The default `borderColor` value.
149
- // @param {String} defaultBorder.style The default `borderStyle` value.
150
- // @param {String} defaultBorder.width The default `borderWidth` value.
148
+ // @param {String} defaultBorder.color The default `tableCellBorderColor` value.
149
+ // @param {String} defaultBorder.style The default `tableCellBorderStyle` value.
150
+ // @param {String} defaultBorder.width The default `tableCellBorderWidth` value.
151
151
  function enableBorderProperties( schema, conversion, defaultBorder ) {
152
+ const modelAttributes = {
153
+ width: 'tableCellBorderWidth',
154
+ color: 'tableCellBorderColor',
155
+ style: 'tableCellBorderStyle'
156
+ };
157
+
152
158
  schema.extend( 'tableCell', {
153
- allowAttributes: [ 'borderWidth', 'borderColor', 'borderStyle' ]
159
+ allowAttributes: Object.values( modelAttributes )
154
160
  } );
155
- upcastBorderStyles( conversion, 'td', defaultBorder );
156
- upcastBorderStyles( conversion, 'th', defaultBorder );
157
- downcastAttributeToStyle( conversion, { modelElement: 'tableCell', modelAttribute: 'borderStyle', styleName: 'border-style' } );
158
- downcastAttributeToStyle( conversion, { modelElement: 'tableCell', modelAttribute: 'borderColor', styleName: 'border-color' } );
159
- downcastAttributeToStyle( conversion, { modelElement: 'tableCell', modelAttribute: 'borderWidth', styleName: 'border-width' } );
161
+
162
+ upcastBorderStyles( conversion, 'td', modelAttributes, defaultBorder );
163
+ upcastBorderStyles( conversion, 'th', modelAttributes, defaultBorder );
164
+ downcastAttributeToStyle( conversion, { modelElement: 'tableCell', modelAttribute: modelAttributes.style, styleName: 'border-style' } );
165
+ downcastAttributeToStyle( conversion, { modelElement: 'tableCell', modelAttribute: modelAttributes.color, styleName: 'border-color' } );
166
+ downcastAttributeToStyle( conversion, { modelElement: 'tableCell', modelAttribute: modelAttributes.width, styleName: 'border-width' } );
160
167
  }
161
168
 
162
- // Enables the `'horizontalAlignment'` attribute for table cells.
169
+ // Enables the `'tableCellHorizontalAlignment'` attribute for table cells.
163
170
  //
164
171
  // @param {module:engine/model/schema~Schema} schema
165
172
  // @param {module:engine/conversion/conversion~Conversion} conversion
@@ -167,14 +174,14 @@ function enableBorderProperties( schema, conversion, defaultBorder ) {
167
174
  // @param {String} defaultValue The default horizontal alignment value.
168
175
  function enableHorizontalAlignmentProperty( schema, conversion, defaultValue ) {
169
176
  schema.extend( 'tableCell', {
170
- allowAttributes: [ 'horizontalAlignment' ]
177
+ allowAttributes: [ 'tableCellHorizontalAlignment' ]
171
178
  } );
172
179
 
173
180
  conversion.for( 'downcast' )
174
181
  .attributeToAttribute( {
175
182
  model: {
176
183
  name: 'tableCell',
177
- key: 'horizontalAlignment'
184
+ key: 'tableCellHorizontalAlignment'
178
185
  },
179
186
  view: alignment => ( {
180
187
  key: 'style',
@@ -194,7 +201,7 @@ function enableHorizontalAlignmentProperty( schema, conversion, defaultValue ) {
194
201
  }
195
202
  },
196
203
  model: {
197
- key: 'horizontalAlignment',
204
+ key: 'tableCellHorizontalAlignment',
198
205
  value: viewElement => {
199
206
  const align = viewElement.getStyle( 'text-align' );
200
207
 
@@ -211,7 +218,7 @@ function enableHorizontalAlignmentProperty( schema, conversion, defaultValue ) {
211
218
  }
212
219
  },
213
220
  model: {
214
- key: 'horizontalAlignment',
221
+ key: 'tableCellHorizontalAlignment',
215
222
  value: viewElement => {
216
223
  const align = viewElement.getAttribute( 'align' );
217
224
 
@@ -228,14 +235,14 @@ function enableHorizontalAlignmentProperty( schema, conversion, defaultValue ) {
228
235
  // @param {String} defaultValue The default vertical alignment value.
229
236
  function enableVerticalAlignmentProperty( schema, conversion, defaultValue ) {
230
237
  schema.extend( 'tableCell', {
231
- allowAttributes: [ 'verticalAlignment' ]
238
+ allowAttributes: [ 'tableCellVerticalAlignment' ]
232
239
  } );
233
240
 
234
241
  conversion.for( 'downcast' )
235
242
  .attributeToAttribute( {
236
243
  model: {
237
244
  name: 'tableCell',
238
- key: 'verticalAlignment'
245
+ key: 'tableCellVerticalAlignment'
239
246
  },
240
247
  view: alignment => ( {
241
248
  key: 'style',
@@ -255,7 +262,7 @@ function enableVerticalAlignmentProperty( schema, conversion, defaultValue ) {
255
262
  }
256
263
  },
257
264
  model: {
258
- key: 'verticalAlignment',
265
+ key: 'tableCellVerticalAlignment',
259
266
  value: viewElement => {
260
267
  const align = viewElement.getStyle( 'vertical-align' );
261
268
 
@@ -272,7 +279,7 @@ function enableVerticalAlignmentProperty( schema, conversion, defaultValue ) {
272
279
  }
273
280
  },
274
281
  model: {
275
- key: 'verticalAlignment',
282
+ key: 'tableCellVerticalAlignment',
276
283
  value: viewElement => {
277
284
  const valign = viewElement.getAttribute( 'valign' );
278
285
 
@@ -430,6 +430,16 @@ export default class TableCellPropertiesView extends View {
430
430
  this.keystrokes.listenTo( this.element );
431
431
  }
432
432
 
433
+ /**
434
+ * @inheritDoc
435
+ */
436
+ destroy() {
437
+ super.destroy();
438
+
439
+ this.focusTracker.destroy();
440
+ this.keystrokes.destroy();
441
+ }
442
+
433
443
  /**
434
444
  * Focuses the fist focusable field in the form.
435
445
  */
@@ -799,7 +809,6 @@ export default class TableCellPropertiesView extends View {
799
809
  label: t( 'Cancel' ),
800
810
  icon: icons.cancel,
801
811
  class: 'ck-button-cancel',
802
- type: 'cancel',
803
812
  withText: true
804
813
  } );
805
814
 
@@ -218,10 +218,25 @@ export default class TableKeyboard extends Plugin {
218
218
  return false;
219
219
  }
220
220
 
221
- // Navigation is in the opposite direction than the selection direction so this is shrinking of the selection.
222
- // Selection for sure will not approach cell edge.
223
- if ( expandSelection && !selection.isCollapsed && selection.isBackward == isForward ) {
224
- return false;
221
+ // When the selection is not collapsed.
222
+ if ( !selection.isCollapsed ) {
223
+ if ( expandSelection ) {
224
+ // Navigation is in the opposite direction than the selection direction so this is shrinking of the selection.
225
+ // Selection for sure will not approach cell edge.
226
+ //
227
+ // With a special case when all cell content is selected - then selection should expand to the other cell.
228
+ // Note: When the entire cell gets selected using CTRL+A, the selection is always forward.
229
+ if ( selection.isBackward == isForward && !selection.containsEntireContent( tableCell ) ) {
230
+ return false;
231
+ }
232
+ } else {
233
+ const selectedElement = selection.getSelectedElement();
234
+
235
+ // It will collapse for non-object selected so it's not going to move to other cell.
236
+ if ( !selectedElement || !model.schema.isObject( selectedElement ) ) {
237
+ return false;
238
+ }
239
+ }
225
240
  }
226
241
 
227
242
  // Let's check if the selection is at the beginning/end of the cell.
@@ -31,6 +31,6 @@ export default class TableAlignmentCommand extends TablePropertyCommand {
31
31
  * @param {String} defaultValue The default value for the "alignment" attribute.
32
32
  */
33
33
  constructor( editor, defaultValue ) {
34
- super( editor, 'alignment', defaultValue );
34
+ super( editor, 'tableAlignment', defaultValue );
35
35
  }
36
36
  }
@@ -31,6 +31,6 @@ export default class TableBackgroundColorCommand extends TablePropertyCommand {
31
31
  * @param {String} defaultValue The default value of the attribute.
32
32
  */
33
33
  constructor( editor, defaultValue ) {
34
- super( editor, 'backgroundColor', defaultValue );
34
+ super( editor, 'tableBackgroundColor', defaultValue );
35
35
  }
36
36
  }
@@ -32,7 +32,7 @@ export default class TableBorderColorCommand extends TablePropertyCommand {
32
32
  * @param {String} defaultValue The default value of the attribute.
33
33
  */
34
34
  constructor( editor, defaultValue ) {
35
- super( editor, 'borderColor', defaultValue );
35
+ super( editor, 'tableBorderColor', defaultValue );
36
36
  }
37
37
 
38
38
  /**
@@ -32,7 +32,7 @@ export default class TableBorderStyleCommand extends TablePropertyCommand {
32
32
  * @param {String} defaultValue The default value of the attribute.
33
33
  */
34
34
  constructor( editor, defaultValue ) {
35
- super( editor, 'borderStyle', defaultValue );
35
+ super( editor, 'tableBorderStyle', defaultValue );
36
36
  }
37
37
 
38
38
  /**
@@ -40,7 +40,7 @@ export default class TableBorderWidthCommand extends TablePropertyCommand {
40
40
  * @param {String} defaultValue The default value of the attribute.
41
41
  */
42
42
  constructor( editor, defaultValue ) {
43
- super( editor, 'borderWidth', defaultValue );
43
+ super( editor, 'tableBorderWidth', defaultValue );
44
44
  }
45
45
 
46
46
  /**
@@ -40,7 +40,7 @@ export default class TableHeightCommand extends TablePropertyCommand {
40
40
  * @param {String} defaultValue The default value of the attribute.
41
41
  */
42
42
  constructor( editor, defaultValue ) {
43
- super( editor, 'height', defaultValue );
43
+ super( editor, 'tableHeight', defaultValue );
44
44
  }
45
45
 
46
46
  /**
@@ -40,7 +40,7 @@ export default class TableWidthCommand extends TablePropertyCommand {
40
40
  * @param {String} defaultValue The default value of the attribute.
41
41
  */
42
42
  constructor( editor, defaultValue ) {
43
- super( editor, 'width', defaultValue );
43
+ super( editor, 'tableWidth', defaultValue );
44
44
  }
45
45
 
46
46
  /**
@@ -34,10 +34,10 @@ const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
34
34
  *
35
35
  * Introduces table's model attributes and their conversion:
36
36
  *
37
- * - border: `borderStyle`, `borderColor` and `borderWidth`
38
- * - background color: `backgroundColor`
39
- * - horizontal alignment: `alignment`
40
- * - width & height: `width` & `height`
37
+ * - border: `tableBorderStyle`, `tableBorderColor` and `tableBorderWidth`
38
+ * - background color: `tableBackgroundColor`
39
+ * - horizontal alignment: `tableAlignment`
40
+ * - width & height: `tableWidth` & `tableHeight`
41
41
  *
42
42
  * It also registers commands used to manipulate the above attributes:
43
43
  *
@@ -91,14 +91,14 @@ export default class TablePropertiesEditing extends Plugin {
91
91
  editor.commands.add( 'tableAlignment', new TableAlignmentCommand( editor, defaultTableProperties.alignment ) );
92
92
 
93
93
  enableTableToFigureProperty( schema, conversion, {
94
- modelAttribute: 'width',
94
+ modelAttribute: 'tableWidth',
95
95
  styleName: 'width',
96
96
  defaultValue: defaultTableProperties.width
97
97
  } );
98
98
  editor.commands.add( 'tableWidth', new TableWidthCommand( editor, defaultTableProperties.width ) );
99
99
 
100
100
  enableTableToFigureProperty( schema, conversion, {
101
- modelAttribute: 'height',
101
+ modelAttribute: 'tableHeight',
102
102
  styleName: 'height',
103
103
  defaultValue: defaultTableProperties.height
104
104
  } );
@@ -106,7 +106,7 @@ export default class TablePropertiesEditing extends Plugin {
106
106
 
107
107
  editor.data.addStyleProcessorRules( addBackgroundRules );
108
108
  enableProperty( schema, conversion, {
109
- modelAttribute: 'backgroundColor',
109
+ modelAttribute: 'tableBackgroundColor',
110
110
  styleName: 'background-color',
111
111
  defaultValue: defaultTableProperties.backgroundColor
112
112
  } );
@@ -117,22 +117,30 @@ export default class TablePropertiesEditing extends Plugin {
117
117
  }
118
118
  }
119
119
 
120
- // Enables `'borderStyle'`, `'borderColor'` and `'borderWidth'` attributes for table.
120
+ // Enables `tableBorderStyle'`, `tableBorderColor'` and `tableBorderWidth'` attributes for table.
121
121
  //
122
122
  // @param {module:engine/model/schema~Schema} schema
123
123
  // @param {module:engine/conversion/conversion~Conversion} conversion
124
124
  // @param {Object} defaultBorder The default border values.
125
- // @param {String} defaultBorder.color The default `borderColor` value.
126
- // @param {String} defaultBorder.style The default `borderStyle` value.
127
- // @param {String} defaultBorder.width The default `borderWidth` value.
125
+ // @param {String} defaultBorder.color The default `tableBorderColor` value.
126
+ // @param {String} defaultBorder.style The default `tableBorderStyle` value.
127
+ // @param {String} defaultBorder.width The default `tableBorderWidth` value.
128
128
  function enableBorderProperties( schema, conversion, defaultBorder ) {
129
+ const modelAttributes = {
130
+ width: 'tableBorderWidth',
131
+ color: 'tableBorderColor',
132
+ style: 'tableBorderStyle'
133
+ };
134
+
129
135
  schema.extend( 'table', {
130
- allowAttributes: [ 'borderWidth', 'borderColor', 'borderStyle' ]
136
+ allowAttributes: Object.values( modelAttributes )
131
137
  } );
132
- upcastBorderStyles( conversion, 'table', defaultBorder );
133
- downcastTableAttribute( conversion, { modelAttribute: 'borderColor', styleName: 'border-color' } );
134
- downcastTableAttribute( conversion, { modelAttribute: 'borderStyle', styleName: 'border-style' } );
135
- downcastTableAttribute( conversion, { modelAttribute: 'borderWidth', styleName: 'border-width' } );
138
+
139
+ upcastBorderStyles( conversion, 'table', modelAttributes, defaultBorder );
140
+
141
+ downcastTableAttribute( conversion, { modelAttribute: modelAttributes.color, styleName: 'border-color' } );
142
+ downcastTableAttribute( conversion, { modelAttribute: modelAttributes.style, styleName: 'border-style' } );
143
+ downcastTableAttribute( conversion, { modelAttribute: modelAttributes.width, styleName: 'border-width' } );
136
144
  }
137
145
 
138
146
  // Enables the `'alignment'` attribute for table.
@@ -142,14 +150,14 @@ function enableBorderProperties( schema, conversion, defaultBorder ) {
142
150
  // @param {String} defaultValue The default alignment value.
143
151
  function enableAlignmentProperty( schema, conversion, defaultValue ) {
144
152
  schema.extend( 'table', {
145
- allowAttributes: [ 'alignment' ]
153
+ allowAttributes: [ 'tableAlignment' ]
146
154
  } );
147
155
 
148
156
  conversion.for( 'downcast' )
149
157
  .attributeToAttribute( {
150
158
  model: {
151
159
  name: 'table',
152
- key: 'alignment'
160
+ key: 'tableAlignment'
153
161
  },
154
162
  view: alignment => ( {
155
163
  key: 'style',
@@ -171,7 +179,7 @@ function enableAlignmentProperty( schema, conversion, defaultValue ) {
171
179
  }
172
180
  },
173
181
  model: {
174
- key: 'alignment',
182
+ key: 'tableAlignment',
175
183
  value: viewElement => {
176
184
  let align = viewElement.getStyle( 'float' );
177
185
 
@@ -193,7 +201,7 @@ function enableAlignmentProperty( schema, conversion, defaultValue ) {
193
201
  },
194
202
  model: {
195
203
  name: 'table',
196
- key: 'alignment',
204
+ key: 'tableAlignment',
197
205
  value: viewElement => {
198
206
  const align = viewElement.getAttribute( 'align' );
199
207
 
@@ -379,6 +379,16 @@ export default class TablePropertiesView extends View {
379
379
  this.keystrokes.listenTo( this.element );
380
380
  }
381
381
 
382
+ /**
383
+ * @inheritDoc
384
+ */
385
+ destroy() {
386
+ super.destroy();
387
+
388
+ this.focusTracker.destroy();
389
+ this.keystrokes.destroy();
390
+ }
391
+
382
392
  /**
383
393
  * Focuses the fist focusable field in the form.
384
394
  */
@@ -690,7 +700,6 @@ export default class TablePropertiesView extends View {
690
700
  label: t( 'Cancel' ),
691
701
  icon: icons.cancel,
692
702
  class: 'ck-button-cancel',
693
- type: 'cancel',
694
703
  withText: true
695
704
  } );
696
705
 
@@ -25,7 +25,7 @@ export default class ColorInputView extends View {
25
25
  *
26
26
  * @param {module:utils/locale~Locale} locale The locale instance.
27
27
  * @param {Object} options The input options.
28
- * @param {module:ui/colorgrid/colorgrid~ColorDefinition} options.colorDefinitions The colors to be displayed
28
+ * @param {Array.<module:ui/colorgrid/colorgrid~ColorDefinition>} options.colorDefinitions The colors to be displayed
29
29
  * in the palette inside the input's dropdown.
30
30
  * @param {Number} options.columns The number of columns in which the colors will be displayed.
31
31
  * @param {String} [options.defaultColorValue] If specified, the color input view will replace the "Remove color" button with
@@ -98,7 +98,7 @@ export default class ColorInputView extends View {
98
98
  * some error, it helps screen readers read the error text.
99
99
  *
100
100
  * @observable
101
- * @member {Boolean} #ariaDescribedById
101
+ * @member {String} #ariaDescribedById
102
102
  */
103
103
  this.set( 'ariaDescribedById' );
104
104