@ckeditor/ckeditor5-table 35.3.2 → 36.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/LICENSE.md +1 -1
  2. package/build/table.js +2 -2
  3. package/package.json +26 -26
  4. package/src/commands/insertcolumncommand.js +1 -1
  5. package/src/commands/insertrowcommand.js +1 -1
  6. package/src/commands/inserttablecommand.js +1 -1
  7. package/src/commands/mergecellcommand.js +1 -1
  8. package/src/commands/mergecellscommand.js +1 -1
  9. package/src/commands/removecolumncommand.js +1 -1
  10. package/src/commands/removerowcommand.js +1 -1
  11. package/src/commands/selectcolumncommand.js +1 -1
  12. package/src/commands/selectrowcommand.js +1 -1
  13. package/src/commands/setheadercolumncommand.js +1 -1
  14. package/src/commands/setheaderrowcommand.js +1 -1
  15. package/src/commands/splitcellcommand.js +1 -1
  16. package/src/converters/downcast.js +8 -5
  17. package/src/converters/table-caption-post-fixer.js +1 -1
  18. package/src/converters/table-cell-paragraph-post-fixer.js +1 -1
  19. package/src/converters/table-cell-refresh-handler.js +1 -1
  20. package/src/converters/table-headings-refresh-handler.js +1 -1
  21. package/src/converters/table-layout-post-fixer.js +1 -1
  22. package/src/converters/tableproperties.js +7 -2
  23. package/src/converters/upcasttable.js +21 -6
  24. package/src/index.js +1 -1
  25. package/src/plaintableoutput.js +1 -1
  26. package/src/table.js +1 -1
  27. package/src/tablecaption/tablecaptionediting.js +1 -1
  28. package/src/tablecaption/tablecaptionui.js +1 -1
  29. package/src/tablecaption/toggletablecaptioncommand.js +1 -1
  30. package/src/tablecaption/utils.js +1 -1
  31. package/src/tablecaption.js +1 -1
  32. package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +1 -1
  33. package/src/tablecellproperties/commands/tablecellbordercolorcommand.js +1 -1
  34. package/src/tablecellproperties/commands/tablecellborderstylecommand.js +1 -1
  35. package/src/tablecellproperties/commands/tablecellborderwidthcommand.js +1 -1
  36. package/src/tablecellproperties/commands/tablecellheightcommand.js +1 -1
  37. package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +1 -1
  38. package/src/tablecellproperties/commands/tablecellpaddingcommand.js +1 -1
  39. package/src/tablecellproperties/commands/tablecellpropertycommand.js +1 -1
  40. package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js +1 -1
  41. package/src/tablecellproperties/tablecellpropertiesediting.js +1 -1
  42. package/src/tablecellproperties/tablecellpropertiesui.js +53 -32
  43. package/src/tablecellproperties/ui/tablecellpropertiesview.js +1 -1
  44. package/src/tablecellproperties.js +1 -1
  45. package/src/tablecellwidth/commands/tablecellwidthcommand.js +1 -1
  46. package/src/tablecellwidth/tablecellwidthediting.js +1 -1
  47. package/src/tableclipboard.js +1 -1
  48. package/src/tablecolumnresize/constants.js +1 -1
  49. package/src/tablecolumnresize/converters.js +5 -3
  50. package/src/tablecolumnresize/tablecolumnresizeediting.js +13 -15
  51. package/src/tablecolumnresize/tablecolumnwidthscommand.js +1 -1
  52. package/src/tablecolumnresize/tablewidthresizecommand.js +9 -4
  53. package/src/tablecolumnresize/utils.js +1 -25
  54. package/src/tablecolumnresize.js +1 -1
  55. package/src/tableediting.js +1 -40
  56. package/src/tablekeyboard.js +1 -1
  57. package/src/tablemouse/mouseeventsobserver.js +1 -1
  58. package/src/tablemouse.js +1 -1
  59. package/src/tableproperties/commands/tablealignmentcommand.js +1 -1
  60. package/src/tableproperties/commands/tablebackgroundcolorcommand.js +1 -1
  61. package/src/tableproperties/commands/tablebordercolorcommand.js +1 -1
  62. package/src/tableproperties/commands/tableborderstylecommand.js +1 -1
  63. package/src/tableproperties/commands/tableborderwidthcommand.js +1 -1
  64. package/src/tableproperties/commands/tableheightcommand.js +1 -1
  65. package/src/tableproperties/commands/tablepropertycommand.js +1 -1
  66. package/src/tableproperties/commands/tablewidthcommand.js +1 -1
  67. package/src/tableproperties/tablepropertiesediting.js +8 -2
  68. package/src/tableproperties/tablepropertiesui.js +32 -17
  69. package/src/tableproperties/ui/tablepropertiesview.js +1 -1
  70. package/src/tableproperties.js +1 -1
  71. package/src/tableselection.js +1 -1
  72. package/src/tabletoolbar.js +1 -1
  73. package/src/tableui.js +2 -2
  74. package/src/tableutils.js +1 -1
  75. package/src/tablewalker.js +2 -2
  76. package/src/ui/colorinputview.js +1 -1
  77. package/src/ui/formrowview.js +1 -1
  78. package/src/ui/inserttableview.js +3 -2
  79. package/src/utils/common.js +1 -1
  80. package/src/utils/structure.js +1 -1
  81. package/src/utils/table-properties.js +1 -1
  82. package/src/utils/ui/contextualballoon.js +1 -1
  83. package/src/utils/ui/table-properties.js +1 -1
  84. package/src/utils/ui/widget.js +1 -1
  85. package/theme/colorinput.css +1 -1
  86. package/theme/form.css +1 -1
  87. package/theme/formrow.css +1 -1
  88. package/theme/inserttable.css +1 -1
  89. package/theme/table.css +1 -1
  90. package/theme/tablecaption.css +1 -1
  91. package/theme/tablecellproperties.css +1 -1
  92. package/theme/tablecolumnresize.css +1 -1
  93. package/theme/tableediting.css +1 -1
  94. package/theme/tableform.css +1 -1
  95. package/theme/tableproperties.css +1 -1
  96. package/theme/tableselection.css +1 -1
  97. package/build/table.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -105,7 +105,7 @@ export default class TablePropertiesUI extends Plugin {
105
105
  *
106
106
  * @member {module:table/tableproperties/ui/tablepropertiesview~TablePropertiesView}
107
107
  */
108
- this.view = this._createPropertiesView();
108
+ this.view = null;
109
109
 
110
110
  /**
111
111
  * The batch used to undo all changes made by the form (which are live, as the user types)
@@ -116,6 +116,15 @@ export default class TablePropertiesUI extends Plugin {
116
116
  */
117
117
  this._undoStepBatch = null;
118
118
 
119
+ /**
120
+ * Flag used to indicate whether view is ready to execute update commands
121
+ * (it finished loading initial data).
122
+ *
123
+ * @private
124
+ * @member {Boolean}
125
+ */
126
+ this._isReady = false;
127
+
119
128
  editor.ui.componentFactory.add( 'tableProperties', locale => {
120
129
  const view = new ButtonView( locale );
121
130
 
@@ -146,7 +155,9 @@ export default class TablePropertiesUI extends Plugin {
146
155
 
147
156
  // Destroy created UI components as they are not automatically destroyed.
148
157
  // See https://github.com/ckeditor/ckeditor5/issues/1341.
149
- this.view.destroy();
158
+ if ( this.view ) {
159
+ this.view.destroy();
160
+ }
150
161
  }
151
162
 
152
163
  /**
@@ -290,6 +301,8 @@ export default class TablePropertiesUI extends Plugin {
290
301
 
291
302
  this.view.set( property, value );
292
303
  } );
304
+
305
+ this._isReady = true;
293
306
  }
294
307
 
295
308
  /**
@@ -304,6 +317,10 @@ export default class TablePropertiesUI extends Plugin {
304
317
  _showView() {
305
318
  const editor = this.editor;
306
319
 
320
+ if ( !this.view ) {
321
+ this.view = this._createPropertiesView();
322
+ }
323
+
307
324
  this.listenTo( editor.ui, 'update', () => {
308
325
  this._updateView();
309
326
  } );
@@ -333,6 +350,8 @@ export default class TablePropertiesUI extends Plugin {
333
350
 
334
351
  this.stopListening( editor.ui, 'update' );
335
352
 
353
+ this._isReady = false;
354
+
336
355
  // Blur any input element before removing it from DOM to prevent issues in some browsers.
337
356
  // See https://github.com/ckeditor/ckeditor5/issues/1501.
338
357
  this.view.saveButtonView.focus();
@@ -367,7 +386,7 @@ export default class TablePropertiesUI extends Plugin {
367
386
  * @type {Boolean}
368
387
  */
369
388
  get _isViewVisible() {
370
- return this._balloon.visibleView === this.view;
389
+ return !!this.view && this._balloon.visibleView === this.view;
371
390
  }
372
391
 
373
392
  /**
@@ -377,7 +396,7 @@ export default class TablePropertiesUI extends Plugin {
377
396
  * @type {Boolean}
378
397
  */
379
398
  get _isViewInBalloon() {
380
- return this._balloon.hasView( this.view );
399
+ return !!this.view && this._balloon.hasView( this.view );
381
400
  }
382
401
 
383
402
  /**
@@ -388,14 +407,12 @@ export default class TablePropertiesUI extends Plugin {
388
407
  *
389
408
  * @private
390
409
  * @param {String} commandName The command that will be executed.
391
- * @param {String} defaultValue The default value of the command.
392
410
  * @returns {Function}
393
411
  */
394
- _getPropertyChangeCallback( commandName, defaultValue ) {
395
- return ( evt, propertyName, newValue, oldValue ) => {
396
- // If the "oldValue" is missing and "newValue" is set to the default value, do not execute the command.
397
- // It is an initial call (when opening the table properties view).
398
- if ( !oldValue && defaultValue === newValue ) {
412
+ _getPropertyChangeCallback( commandName ) {
413
+ return ( evt, propertyName, newValue ) => {
414
+ // Do not execute the command on initial call (opening the table properties view).
415
+ if ( !this._isReady ) {
399
416
  return;
400
417
  }
401
418
 
@@ -417,21 +434,19 @@ export default class TablePropertiesUI extends Plugin {
417
434
  * @param {module:ui/view~View} options.viewField
418
435
  * @param {Function} options.validator
419
436
  * @param {String} options.errorText
420
- * @param {String} options.defaultValue
421
437
  * @returns {Function}
422
438
  */
423
439
  _getValidatedPropertyChangeCallback( options ) {
424
- const { commandName, viewField, validator, errorText, defaultValue } = options;
440
+ const { commandName, viewField, validator, errorText } = options;
425
441
  const setErrorTextDebounced = debounce( () => {
426
442
  viewField.errorText = errorText;
427
443
  }, ERROR_TEXT_TIMEOUT );
428
444
 
429
- return ( evt, propertyName, newValue, oldValue ) => {
445
+ return ( evt, propertyName, newValue ) => {
430
446
  setErrorTextDebounced.cancel();
431
447
 
432
- // If the "oldValue" is missing and "newValue" is set to the default value, do not execute the command.
433
- // It is an initial call (when opening the table properties view).
434
- if ( !oldValue && defaultValue === newValue ) {
448
+ // Do not execute the command on initial call (opening the table properties view).
449
+ if ( !this._isReady ) {
435
450
  return;
436
451
  }
437
452
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
package/src/tableui.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -327,7 +327,7 @@ export default class TableUI extends Plugin {
327
327
  addListOption( option, editor, commands, itemDefinitions );
328
328
  }
329
329
 
330
- addListToDropdown( dropdownView, itemDefinitions, editor.ui.componentFactory );
330
+ addListToDropdown( dropdownView, itemDefinitions );
331
331
 
332
332
  return commands;
333
333
  }
package/src/tableutils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -7,7 +7,7 @@
7
7
  * @module table/tablewalker
8
8
  */
9
9
 
10
- // @if CK_DEBUG // import { CKEditorError } from 'ckeditor5/src/utils';
10
+ // @if CK_DEBUG // const { CKEditorError } = require( 'ckeditor5/src/utils' );
11
11
 
12
12
  /**
13
13
  * The table iterator class. It allows to iterate over table cells. For each cell the iterator yields
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -158,7 +158,8 @@ export default class InsertTableView extends View {
158
158
  keystrokeHandler: this.keystrokes,
159
159
  focusTracker: this.focusTracker,
160
160
  gridItems: this.items,
161
- numberOfColumns: 10
161
+ numberOfColumns: 10,
162
+ uiLanguageDirection: this.locale && this.locale.uiLanguageDirection
162
163
  } );
163
164
 
164
165
  for ( const item of this.items ) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
package/theme/form.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
package/theme/formrow.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
package/theme/table.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5