@ckeditor/ckeditor5-table 45.2.1 → 46.0.0-alpha.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 (179) hide show
  1. package/build/table.js +1 -1
  2. package/dist/index-content.css +6 -5
  3. package/dist/index-editor.css +46 -46
  4. package/dist/index.css +63 -62
  5. package/dist/index.css.map +1 -1
  6. package/dist/index.js +305 -49
  7. package/dist/index.js.map +1 -1
  8. package/package.json +10 -10
  9. package/src/commands/insertcolumncommand.d.ts +1 -1
  10. package/src/commands/insertcolumncommand.js +1 -1
  11. package/src/commands/insertrowcommand.d.ts +1 -1
  12. package/src/commands/insertrowcommand.js +1 -1
  13. package/src/commands/inserttablecommand.d.ts +1 -1
  14. package/src/commands/inserttablecommand.js +1 -1
  15. package/src/commands/inserttablelayoutcommand.d.ts +1 -1
  16. package/src/commands/inserttablelayoutcommand.js +1 -1
  17. package/src/commands/mergecellcommand.d.ts +3 -3
  18. package/src/commands/mergecellcommand.js +2 -2
  19. package/src/commands/mergecellscommand.d.ts +1 -1
  20. package/src/commands/mergecellscommand.js +2 -2
  21. package/src/commands/removecolumncommand.d.ts +1 -1
  22. package/src/commands/removecolumncommand.js +2 -2
  23. package/src/commands/removerowcommand.d.ts +1 -1
  24. package/src/commands/removerowcommand.js +1 -1
  25. package/src/commands/selectcolumncommand.d.ts +1 -1
  26. package/src/commands/selectcolumncommand.js +2 -2
  27. package/src/commands/selectrowcommand.d.ts +1 -1
  28. package/src/commands/selectrowcommand.js +1 -1
  29. package/src/commands/setheadercolumncommand.d.ts +2 -2
  30. package/src/commands/setheadercolumncommand.js +1 -1
  31. package/src/commands/setheaderrowcommand.d.ts +2 -2
  32. package/src/commands/setheaderrowcommand.js +1 -1
  33. package/src/commands/splitcellcommand.d.ts +1 -1
  34. package/src/commands/splitcellcommand.js +1 -1
  35. package/src/converters/downcast.d.ts +21 -9
  36. package/src/converters/downcast.js +11 -3
  37. package/src/converters/table-caption-post-fixer.d.ts +3 -1
  38. package/src/converters/table-caption-post-fixer.js +3 -1
  39. package/src/converters/table-cell-paragraph-post-fixer.d.ts +3 -1
  40. package/src/converters/table-cell-paragraph-post-fixer.js +3 -1
  41. package/src/converters/table-cell-refresh-handler.d.ts +3 -1
  42. package/src/converters/table-cell-refresh-handler.js +3 -1
  43. package/src/converters/table-headings-refresh-handler.d.ts +3 -1
  44. package/src/converters/table-headings-refresh-handler.js +4 -2
  45. package/src/converters/table-layout-post-fixer.d.ts +3 -1
  46. package/src/converters/table-layout-post-fixer.js +4 -2
  47. package/src/converters/tableproperties.d.ts +17 -1
  48. package/src/converters/tableproperties.js +49 -2
  49. package/src/converters/upcasttable.d.ts +6 -1
  50. package/src/converters/upcasttable.js +6 -1
  51. package/src/index.d.ts +89 -56
  52. package/src/index.js +84 -24
  53. package/src/plaintableoutput.d.ts +2 -2
  54. package/src/plaintableoutput.js +2 -2
  55. package/src/table.d.ts +7 -7
  56. package/src/table.js +7 -7
  57. package/src/tablecaption/tablecaptionediting.d.ts +6 -6
  58. package/src/tablecaption/tablecaptionediting.js +8 -8
  59. package/src/tablecaption/tablecaptionui.d.ts +1 -1
  60. package/src/tablecaption/tablecaptionui.js +1 -1
  61. package/src/tablecaption/toggletablecaptioncommand.d.ts +1 -1
  62. package/src/tablecaption/toggletablecaptioncommand.js +1 -1
  63. package/src/tablecaption/utils.d.ts +8 -4
  64. package/src/tablecaption/utils.js +4 -0
  65. package/src/tablecaption.d.ts +3 -3
  66. package/src/tablecaption.js +3 -3
  67. package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +2 -2
  68. package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +2 -2
  69. package/src/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +4 -4
  70. package/src/tablecellproperties/commands/tablecellbordercolorcommand.js +2 -2
  71. package/src/tablecellproperties/commands/tablecellborderstylecommand.d.ts +4 -4
  72. package/src/tablecellproperties/commands/tablecellborderstylecommand.js +2 -2
  73. package/src/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +4 -4
  74. package/src/tablecellproperties/commands/tablecellborderwidthcommand.js +2 -2
  75. package/src/tablecellproperties/commands/tablecellheightcommand.d.ts +2 -2
  76. package/src/tablecellproperties/commands/tablecellheightcommand.js +2 -2
  77. package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +2 -2
  78. package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +2 -2
  79. package/src/tablecellproperties/commands/tablecellpaddingcommand.d.ts +4 -4
  80. package/src/tablecellproperties/commands/tablecellpaddingcommand.js +2 -2
  81. package/src/tablecellproperties/commands/tablecellpropertycommand.d.ts +3 -3
  82. package/src/tablecellproperties/commands/tablecellpropertycommand.js +1 -1
  83. package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +2 -2
  84. package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js +2 -2
  85. package/src/tablecellproperties/tablecellpropertiesediting.d.ts +3 -3
  86. package/src/tablecellproperties/tablecellpropertiesediting.js +44 -19
  87. package/src/tablecellproperties/tablecellpropertiesui.d.ts +2 -2
  88. package/src/tablecellproperties/tablecellpropertiesui.js +2 -2
  89. package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +2 -2
  90. package/src/tablecellproperties/ui/tablecellpropertiesview.js +1 -1
  91. package/src/tablecellproperties.d.ts +3 -3
  92. package/src/tablecellproperties.js +3 -3
  93. package/src/tablecellwidth/commands/tablecellwidthcommand.d.ts +2 -2
  94. package/src/tablecellwidth/commands/tablecellwidthcommand.js +2 -2
  95. package/src/tablecellwidth/tablecellwidthediting.d.ts +2 -2
  96. package/src/tablecellwidth/tablecellwidthediting.js +5 -3
  97. package/src/tableclipboard.d.ts +6 -6
  98. package/src/tableclipboard.js +4 -4
  99. package/src/tablecolumnresize/constants.d.ts +9 -0
  100. package/src/tablecolumnresize/constants.js +9 -0
  101. package/src/tablecolumnresize/converters.d.ts +11 -1
  102. package/src/tablecolumnresize/converters.js +16 -0
  103. package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +7 -7
  104. package/src/tablecolumnresize/tablecolumnresizeediting.js +13 -11
  105. package/src/tablecolumnresize/tablewidthscommand.d.ts +3 -3
  106. package/src/tablecolumnresize/tablewidthscommand.js +1 -1
  107. package/src/tablecolumnresize/utils.d.ts +23 -11
  108. package/src/tablecolumnresize/utils.js +14 -2
  109. package/src/tablecolumnresize.d.ts +3 -3
  110. package/src/tablecolumnresize.js +3 -3
  111. package/src/tableconfig.d.ts +3 -1
  112. package/src/tableediting.d.ts +7 -7
  113. package/src/tableediting.js +19 -19
  114. package/src/tablekeyboard.d.ts +8 -8
  115. package/src/tablekeyboard.js +7 -7
  116. package/src/tablelayout/commands/tabletypecommand.d.ts +1 -1
  117. package/src/tablelayout/commands/tabletypecommand.js +1 -1
  118. package/src/tablelayout/tablelayoutediting.d.ts +2 -2
  119. package/src/tablelayout/tablelayoutediting.js +4 -4
  120. package/src/tablelayout/tablelayoutui.d.ts +1 -1
  121. package/src/tablelayout/tablelayoutui.js +4 -4
  122. package/src/tablelayout.d.ts +5 -5
  123. package/src/tablelayout.js +5 -5
  124. package/src/tablemouse/mouseeventsobserver.d.ts +13 -11
  125. package/src/tablemouse/mouseeventsobserver.js +4 -2
  126. package/src/tablemouse.d.ts +3 -3
  127. package/src/tablemouse.js +4 -4
  128. package/src/tableproperties/commands/tablealignmentcommand.d.ts +2 -2
  129. package/src/tableproperties/commands/tablealignmentcommand.js +2 -2
  130. package/src/tableproperties/commands/tablebackgroundcolorcommand.d.ts +2 -2
  131. package/src/tableproperties/commands/tablebackgroundcolorcommand.js +2 -2
  132. package/src/tableproperties/commands/tablebordercolorcommand.d.ts +4 -4
  133. package/src/tableproperties/commands/tablebordercolorcommand.js +2 -2
  134. package/src/tableproperties/commands/tableborderstylecommand.d.ts +4 -4
  135. package/src/tableproperties/commands/tableborderstylecommand.js +2 -2
  136. package/src/tableproperties/commands/tableborderwidthcommand.d.ts +4 -4
  137. package/src/tableproperties/commands/tableborderwidthcommand.js +2 -2
  138. package/src/tableproperties/commands/tableheightcommand.d.ts +2 -2
  139. package/src/tableproperties/commands/tableheightcommand.js +2 -2
  140. package/src/tableproperties/commands/tablepropertycommand.d.ts +4 -4
  141. package/src/tableproperties/commands/tablepropertycommand.js +1 -1
  142. package/src/tableproperties/commands/tablewidthcommand.d.ts +2 -2
  143. package/src/tableproperties/commands/tablewidthcommand.js +2 -2
  144. package/src/tableproperties/tablepropertiesediting.d.ts +2 -2
  145. package/src/tableproperties/tablepropertiesediting.js +49 -21
  146. package/src/tableproperties/tablepropertiesui.d.ts +2 -2
  147. package/src/tableproperties/tablepropertiesui.js +2 -2
  148. package/src/tableproperties/ui/tablepropertiesview.d.ts +2 -2
  149. package/src/tableproperties/ui/tablepropertiesview.js +1 -1
  150. package/src/tableproperties.d.ts +3 -3
  151. package/src/tableproperties.js +3 -3
  152. package/src/tableselection.d.ts +9 -9
  153. package/src/tableselection.js +4 -4
  154. package/src/tabletoolbar.d.ts +1 -1
  155. package/src/tabletoolbar.js +1 -1
  156. package/src/tableui.d.ts +1 -1
  157. package/src/tableui.js +4 -4
  158. package/src/tableutils.d.ts +25 -26
  159. package/src/tableutils.js +4 -4
  160. package/src/tablewalker.d.ts +8 -8
  161. package/src/tablewalker.js +2 -2
  162. package/src/ui/colorinputview.d.ts +6 -1
  163. package/src/ui/colorinputview.js +1 -1
  164. package/src/ui/inserttableview.d.ts +3 -1
  165. package/src/ui/inserttableview.js +3 -1
  166. package/src/utils/common.d.ts +16 -7
  167. package/src/utils/common.js +9 -1
  168. package/src/utils/structure.d.ts +24 -14
  169. package/src/utils/structure.js +11 -1
  170. package/src/utils/table-properties.d.ts +15 -2
  171. package/src/utils/table-properties.js +6 -0
  172. package/src/utils/ui/contextualballoon.d.ts +4 -3
  173. package/src/utils/ui/contextualballoon.js +1 -0
  174. package/src/utils/ui/table-properties.d.ts +20 -7
  175. package/src/utils/ui/table-properties.js +24 -11
  176. package/src/utils/ui/widget.d.ts +6 -0
  177. package/src/utils/ui/widget.js +6 -0
  178. package/theme/tablecaption.css +9 -8
  179. package/theme/tablecolumnresize.css +2 -2
@@ -6,18 +6,18 @@
6
6
  * @module table/tablecellproperties/tablecellpropertiesediting
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import { addBorderRules, addPaddingRules, addBackgroundRules } from 'ckeditor5/src/engine.js';
9
+ import { addBorderStylesRules, addPaddingStylesRules, addBackgroundStylesRules } from 'ckeditor5/src/engine.js';
10
10
  import { downcastAttributeToStyle, getDefaultValueAdjusted, upcastBorderStyles } from '../converters/tableproperties.js';
11
- import TableEditing from './../tableediting.js';
12
- import TableCellWidthEditing from '../tablecellwidth/tablecellwidthediting.js';
13
- import TableCellPaddingCommand from './commands/tablecellpaddingcommand.js';
14
- import TableCellHeightCommand from './commands/tablecellheightcommand.js';
15
- import TableCellBackgroundColorCommand from './commands/tablecellbackgroundcolorcommand.js';
16
- import TableCellVerticalAlignmentCommand from './commands/tablecellverticalalignmentcommand.js';
17
- import TableCellHorizontalAlignmentCommand from './commands/tablecellhorizontalalignmentcommand.js';
18
- import TableCellBorderStyleCommand from './commands/tablecellborderstylecommand.js';
19
- import TableCellBorderColorCommand from './commands/tablecellbordercolorcommand.js';
20
- import TableCellBorderWidthCommand from './commands/tablecellborderwidthcommand.js';
11
+ import { TableEditing } from './../tableediting.js';
12
+ import { TableCellWidthEditing } from '../tablecellwidth/tablecellwidthediting.js';
13
+ import { TableCellPaddingCommand } from './commands/tablecellpaddingcommand.js';
14
+ import { TableCellHeightCommand } from './commands/tablecellheightcommand.js';
15
+ import { TableCellBackgroundColorCommand } from './commands/tablecellbackgroundcolorcommand.js';
16
+ import { TableCellVerticalAlignmentCommand } from './commands/tablecellverticalalignmentcommand.js';
17
+ import { TableCellHorizontalAlignmentCommand } from './commands/tablecellhorizontalalignmentcommand.js';
18
+ import { TableCellBorderStyleCommand } from './commands/tablecellborderstylecommand.js';
19
+ import { TableCellBorderColorCommand } from './commands/tablecellbordercolorcommand.js';
20
+ import { TableCellBorderWidthCommand } from './commands/tablecellborderwidthcommand.js';
21
21
  import { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';
22
22
  import { enableProperty } from '../utils/common.js';
23
23
  const VALIGN_VALUES_REG_EXP = /^(top|middle|bottom)$/;
@@ -41,7 +41,7 @@ const ALIGN_VALUES_REG_EXP = /^(left|center|right|justify)$/;
41
41
  * - horizontal and vertical alignment: the `'tableCellHorizontalAlignment'` and `'tableCellVerticalAlignment'` commands
42
42
  * - width and height: the `'tableCellWidth'` and `'tableCellHeight'` commands
43
43
  */
44
- export default class TableCellPropertiesEditing extends Plugin {
44
+ export class TableCellPropertiesEditing extends Plugin {
45
45
  /**
46
46
  * @inheritDoc
47
47
  */
@@ -74,7 +74,7 @@ export default class TableCellPropertiesEditing extends Plugin {
74
74
  includePaddingProperty: true,
75
75
  isRightToLeftContent: editor.locale.contentLanguageDirection === 'rtl'
76
76
  });
77
- editor.data.addStyleProcessorRules(addBorderRules);
77
+ editor.data.addStyleProcessorRules(addBorderStylesRules);
78
78
  enableBorderProperties(schema, conversion, {
79
79
  color: defaultTableCellProperties.borderColor,
80
80
  style: defaultTableCellProperties.borderStyle,
@@ -86,10 +86,12 @@ export default class TableCellPropertiesEditing extends Plugin {
86
86
  enableProperty(schema, conversion, {
87
87
  modelAttribute: 'tableCellHeight',
88
88
  styleName: 'height',
89
+ attributeName: 'height',
90
+ attributeType: 'length',
89
91
  defaultValue: defaultTableCellProperties.height
90
92
  });
91
93
  editor.commands.add('tableCellHeight', new TableCellHeightCommand(editor, defaultTableCellProperties.height));
92
- editor.data.addStyleProcessorRules(addPaddingRules);
94
+ editor.data.addStyleProcessorRules(addPaddingStylesRules);
93
95
  enableProperty(schema, conversion, {
94
96
  modelAttribute: 'tableCellPadding',
95
97
  styleName: 'padding',
@@ -97,10 +99,12 @@ export default class TableCellPropertiesEditing extends Plugin {
97
99
  defaultValue: defaultTableCellProperties.padding
98
100
  });
99
101
  editor.commands.add('tableCellPadding', new TableCellPaddingCommand(editor, defaultTableCellProperties.padding));
100
- editor.data.addStyleProcessorRules(addBackgroundRules);
102
+ editor.data.addStyleProcessorRules(addBackgroundStylesRules);
101
103
  enableProperty(schema, conversion, {
102
104
  modelAttribute: 'tableCellBackgroundColor',
103
105
  styleName: 'background-color',
106
+ attributeName: 'bgcolor',
107
+ attributeType: 'color',
104
108
  defaultValue: defaultTableCellProperties.backgroundColor
105
109
  });
106
110
  editor.commands.add('tableCellBackgroundColor', new TableCellBackgroundColorCommand(editor, defaultTableCellProperties.backgroundColor));
@@ -127,6 +131,9 @@ function enableBorderProperties(schema, conversion, defaultBorder) {
127
131
  schema.extend('tableCell', {
128
132
  allowAttributes: Object.values(modelAttributes)
129
133
  });
134
+ for (const modelAttribute of Object.values(modelAttributes)) {
135
+ schema.setAttributeProperties(modelAttribute, { isFormatting: true });
136
+ }
130
137
  upcastBorderStyles(conversion, 'td', modelAttributes, defaultBorder);
131
138
  upcastBorderStyles(conversion, 'th', modelAttributes, defaultBorder);
132
139
  downcastAttributeToStyle(conversion, { modelElement: 'tableCell', modelAttribute: modelAttributes.style, styleName: 'border-style' });
@@ -142,6 +149,7 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
142
149
  schema.extend('tableCell', {
143
150
  allowAttributes: ['tableCellHorizontalAlignment']
144
151
  });
152
+ schema.setAttributeProperties('tableCellHorizontalAlignment', { isFormatting: true });
145
153
  conversion.for('downcast')
146
154
  .attributeToAttribute({
147
155
  model: {
@@ -169,7 +177,11 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
169
177
  value: (viewElement, conversionApi, data) => {
170
178
  const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);
171
179
  const align = viewElement.getStyle('text-align');
172
- return align === localDefaultValue ? null : align;
180
+ if (align !== localDefaultValue) {
181
+ return align;
182
+ }
183
+ // Consume the style even if not applied to the element so it won't be processed by other converters.
184
+ conversionApi.consumable.consume(viewElement, { styles: 'text-align' });
173
185
  }
174
186
  }
175
187
  })
@@ -186,7 +198,11 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
186
198
  value: (viewElement, conversionApi, data) => {
187
199
  const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);
188
200
  const align = viewElement.getAttribute('align');
189
- return align === localDefaultValue ? null : align;
201
+ if (align !== localDefaultValue) {
202
+ return align;
203
+ }
204
+ // Consume the style even if not applied to the element so it won't be processed by other converters.
205
+ conversionApi.consumable.consume(viewElement, { attributes: 'align' });
190
206
  }
191
207
  }
192
208
  });
@@ -200,6 +216,7 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
200
216
  schema.extend('tableCell', {
201
217
  allowAttributes: ['tableCellVerticalAlignment']
202
218
  });
219
+ schema.setAttributeProperties('tableCellVerticalAlignment', { isFormatting: true });
203
220
  conversion.for('downcast')
204
221
  .attributeToAttribute({
205
222
  model: {
@@ -227,7 +244,11 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
227
244
  value: (viewElement, conversionApi, data) => {
228
245
  const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);
229
246
  const align = viewElement.getStyle('vertical-align');
230
- return align === localDefaultValue ? null : align;
247
+ if (align !== localDefaultValue) {
248
+ return align;
249
+ }
250
+ // Consume the style even if not applied to the element so it won't be processed by other converters.
251
+ conversionApi.consumable.consume(viewElement, { styles: 'vertical-align' });
231
252
  }
232
253
  }
233
254
  })
@@ -244,7 +265,11 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
244
265
  value: (viewElement, conversionApi, data) => {
245
266
  const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);
246
267
  const valign = viewElement.getAttribute('valign');
247
- return valign === localDefaultValue ? null : valign;
268
+ if (valign !== localDefaultValue) {
269
+ return valign;
270
+ }
271
+ // Consume the attribute even if not applied to the element so it won't be processed by other converters.
272
+ conversionApi.consumable.consume(viewElement, { attributes: 'valign' });
248
273
  }
249
274
  }
250
275
  });
@@ -7,14 +7,14 @@
7
7
  */
8
8
  import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9
9
  import { ContextualBalloon } from 'ckeditor5/src/ui.js';
10
- import TableCellPropertiesView from './ui/tablecellpropertiesview.js';
10
+ import { TableCellPropertiesView } from './ui/tablecellpropertiesview.js';
11
11
  /**
12
12
  * The table cell properties UI plugin. It introduces the `'tableCellProperties'` button
13
13
  * that opens a form allowing to specify the visual styling of a table cell.
14
14
  *
15
15
  * It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
16
16
  */
17
- export default class TableCellPropertiesUI extends Plugin {
17
+ export declare class TableCellPropertiesUI extends Plugin {
18
18
  /**
19
19
  * The default table cell properties.
20
20
  */
@@ -8,7 +8,7 @@
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { IconTableCellProperties } from 'ckeditor5/src/icons.js';
10
10
  import { ButtonView, clickOutsideHandler, ContextualBalloon, getLocalizedColorOptions, normalizeColorOptions } from 'ckeditor5/src/ui.js';
11
- import TableCellPropertiesView from './ui/tablecellpropertiesview.js';
11
+ import { TableCellPropertiesView } from './ui/tablecellpropertiesview.js';
12
12
  import { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, defaultColors, lengthFieldValidator, lineWidthFieldValidator } from '../utils/ui/table-properties.js';
13
13
  import { debounce } from 'es-toolkit/compat';
14
14
  import { getSelectionAffectedTableWidget, getTableWidgetAncestor } from '../utils/ui/widget.js';
@@ -33,7 +33,7 @@ const propertyToCommandMap = {
33
33
  *
34
34
  * It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
35
35
  */
36
- export default class TableCellPropertiesUI extends Plugin {
36
+ export class TableCellPropertiesUI extends Plugin {
37
37
  /**
38
38
  * The default table cell properties.
39
39
  */
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { ButtonView, FocusCycler, LabeledFieldView, ToolbarView, View, ViewCollection, type FocusableView, type NormalizedColorOption, type ColorPickerConfig } from 'ckeditor5/src/ui.js';
9
9
  import { KeystrokeHandler, FocusTracker, type Locale } from 'ckeditor5/src/utils.js';
10
- import type ColorInputView from '../../ui/colorinputview.js';
10
+ import { type ColorInputView } from '../../ui/colorinputview.js';
11
11
  import type { TableCellPropertiesOptions } from '../../tableconfig.js';
12
12
  import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
13
13
  import '../../../theme/formrow.css';
@@ -23,7 +23,7 @@ export interface TableCellPropertiesViewOptions {
23
23
  * The class representing a table cell properties form, allowing users to customize
24
24
  * certain style aspects of a table cell, for instance, border, padding, text alignment, etc..
25
25
  */
26
- export default class TableCellPropertiesView extends View {
26
+ export declare class TableCellPropertiesView extends View {
27
27
  /**
28
28
  * The value of the cell border style.
29
29
  *
@@ -18,7 +18,7 @@ import '../../../theme/tablecellproperties.css';
18
18
  * The class representing a table cell properties form, allowing users to customize
19
19
  * certain style aspects of a table cell, for instance, border, padding, text alignment, etc..
20
20
  */
21
- export default class TableCellPropertiesView extends View {
21
+ export class TableCellPropertiesView extends View {
22
22
  /**
23
23
  * Options passed to the view. See {@link #constructor} to learn more.
24
24
  */
@@ -6,8 +6,8 @@
6
6
  * @module table/tablecellproperties
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import TableCellPropertiesUI from './tablecellproperties/tablecellpropertiesui.js';
10
- import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertiesediting.js';
9
+ import { TableCellPropertiesUI } from './tablecellproperties/tablecellpropertiesui.js';
10
+ import { TableCellPropertiesEditing } from './tablecellproperties/tablecellpropertiesediting.js';
11
11
  /**
12
12
  * The table cell properties feature. Enables support for setting properties of table cells (size, border, background, etc.).
13
13
  *
@@ -18,7 +18,7 @@ import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertie
18
18
  * {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing table cell properties editing feature} and
19
19
  * the {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI table cell properties UI feature}.
20
20
  */
21
- export default class TableCellProperties extends Plugin {
21
+ export declare class TableCellProperties extends Plugin {
22
22
  /**
23
23
  * @inheritDoc
24
24
  */
@@ -6,8 +6,8 @@
6
6
  * @module table/tablecellproperties
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import TableCellPropertiesUI from './tablecellproperties/tablecellpropertiesui.js';
10
- import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertiesediting.js';
9
+ import { TableCellPropertiesUI } from './tablecellproperties/tablecellpropertiesui.js';
10
+ import { TableCellPropertiesEditing } from './tablecellproperties/tablecellpropertiesediting.js';
11
11
  /**
12
12
  * The table cell properties feature. Enables support for setting properties of table cells (size, border, background, etc.).
13
13
  *
@@ -18,7 +18,7 @@ import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertie
18
18
  * {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing table cell properties editing feature} and
19
19
  * the {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI table cell properties UI feature}.
20
20
  */
21
- export default class TableCellProperties extends Plugin {
21
+ export class TableCellProperties extends Plugin {
22
22
  /**
23
23
  * @inheritDoc
24
24
  */
@@ -6,7 +6,7 @@
6
6
  * @module table/tablecellwidth/commands/tablecellwidthcommand
7
7
  */
8
8
  import type { Editor } from 'ckeditor5/src/core.js';
9
- import TableCellPropertyCommand from '../../tablecellproperties/commands/tablecellpropertycommand.js';
9
+ import { TableCellPropertyCommand } from '../../tablecellproperties/commands/tablecellpropertycommand.js';
10
10
  /**
11
11
  * The table cell width command.
12
12
  *
@@ -31,7 +31,7 @@ import TableCellPropertyCommand from '../../tablecellproperties/commands/tablece
31
31
  *
32
32
  * will set the `width` attribute to `'50px'` in the model.
33
33
  */
34
- export default class TableCellWidthCommand extends TableCellPropertyCommand {
34
+ export declare class TableCellWidthCommand extends TableCellPropertyCommand {
35
35
  /**
36
36
  * Creates a new `TableCellWidthCommand` instance.
37
37
  *
@@ -2,7 +2,7 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- import TableCellPropertyCommand from '../../tablecellproperties/commands/tablecellpropertycommand.js';
5
+ import { TableCellPropertyCommand } from '../../tablecellproperties/commands/tablecellpropertycommand.js';
6
6
  import { addDefaultUnitToNumericValue } from '../../utils/table-properties.js';
7
7
  /**
8
8
  * The table cell width command.
@@ -28,7 +28,7 @@ import { addDefaultUnitToNumericValue } from '../../utils/table-properties.js';
28
28
  *
29
29
  * will set the `width` attribute to `'50px'` in the model.
30
30
  */
31
- export default class TableCellWidthCommand extends TableCellPropertyCommand {
31
+ export class TableCellWidthCommand extends TableCellPropertyCommand {
32
32
  /**
33
33
  * Creates a new `TableCellWidthCommand` instance.
34
34
  *
@@ -6,14 +6,14 @@
6
6
  * @module table/tablecellwidth/tablecellwidthediting
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import TableEditing from './../tableediting.js';
9
+ import { TableEditing } from './../tableediting.js';
10
10
  /**
11
11
  * The table cell width editing feature.
12
12
  *
13
13
  * Introduces `tableCellWidth` table cell model attribute alongside with its converters
14
14
  * and a command.
15
15
  */
16
- export default class TableCellWidthEditing extends Plugin {
16
+ export declare class TableCellWidthEditing extends Plugin {
17
17
  /**
18
18
  * @inheritDoc
19
19
  */
@@ -6,8 +6,8 @@
6
6
  * @module table/tablecellwidth/tablecellwidthediting
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import TableEditing from './../tableediting.js';
10
- import TableCellWidthCommand from './commands/tablecellwidthcommand.js';
9
+ import { TableEditing } from './../tableediting.js';
10
+ import { TableCellWidthCommand } from './commands/tablecellwidthcommand.js';
11
11
  import { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';
12
12
  import { enableProperty } from '../utils/common.js';
13
13
  /**
@@ -16,7 +16,7 @@ import { enableProperty } from '../utils/common.js';
16
16
  * Introduces `tableCellWidth` table cell model attribute alongside with its converters
17
17
  * and a command.
18
18
  */
19
- export default class TableCellWidthEditing extends Plugin {
19
+ export class TableCellWidthEditing extends Plugin {
20
20
  /**
21
21
  * @inheritDoc
22
22
  */
@@ -44,6 +44,8 @@ export default class TableCellWidthEditing extends Plugin {
44
44
  enableProperty(editor.model.schema, editor.conversion, {
45
45
  modelAttribute: 'tableCellWidth',
46
46
  styleName: 'width',
47
+ attributeName: 'width',
48
+ attributeType: 'length',
47
49
  defaultValue: defaultTableCellProperties.width
48
50
  });
49
51
  editor.commands.add('tableCellWidth', new TableCellWidthCommand(editor, defaultTableCellProperties.width));
@@ -4,15 +4,15 @@
4
4
  */
5
5
  import { ClipboardPipeline, ClipboardMarkersUtils } from 'ckeditor5/src/clipboard.js';
6
6
  import { Plugin } from 'ckeditor5/src/core.js';
7
- import type { DocumentFragment, Element, Item, Model, Position, Writer } from 'ckeditor5/src/engine.js';
8
- import TableSelection from './tableselection.js';
7
+ import type { ModelDocumentFragment, ModelElement, ModelItem, Model, ModelPosition, ModelWriter } from 'ckeditor5/src/engine.js';
8
+ import { TableSelection } from './tableselection.js';
9
9
  import { type TableSlot } from './tablewalker.js';
10
- import TableUtils from './tableutils.js';
10
+ import { TableUtils } from './tableutils.js';
11
11
  /**
12
12
  * This plugin adds support for copying/cutting/pasting fragments of tables.
13
13
  * It is loaded automatically by the {@link module:table/table~Table} plugin.
14
14
  */
15
- export default class TableClipboard extends Plugin {
15
+ export declare class TableClipboard extends Plugin {
16
16
  /**
17
17
  * @inheritDoc
18
18
  */
@@ -72,12 +72,12 @@ export default class TableClipboard extends Plugin {
72
72
  * @returns Inserted table cell or null if slot should remain empty.
73
73
  * @private
74
74
  */
75
- _replaceTableSlotCell(tableSlot: TableSlot, cellToInsert: Element | null, insertPosition: Position, writer: Writer): Element | null;
75
+ _replaceTableSlotCell(tableSlot: TableSlot, cellToInsert: ModelElement | null, insertPosition: ModelPosition, writer: ModelWriter): ModelElement | null;
76
76
  /**
77
77
  * Extracts the table for pasting into a table.
78
78
  *
79
79
  * @param content The content to insert.
80
80
  * @param model The editor model.
81
81
  */
82
- getTableIfOnlyTableInContent(content: DocumentFragment | Item, model: Model): Element | null;
82
+ getTableIfOnlyTableInContent(content: ModelDocumentFragment | ModelItem, model: Model): ModelElement | null;
83
83
  }
@@ -4,15 +4,15 @@
4
4
  */
5
5
  import { ClipboardPipeline, ClipboardMarkersUtils } from 'ckeditor5/src/clipboard.js';
6
6
  import { Plugin } from 'ckeditor5/src/core.js';
7
- import TableSelection from './tableselection.js';
8
- import TableWalker from './tablewalker.js';
9
- import TableUtils from './tableutils.js';
7
+ import { TableSelection } from './tableselection.js';
8
+ import { TableWalker } from './tablewalker.js';
9
+ import { TableUtils } from './tableutils.js';
10
10
  import { cropTableToDimensions, getHorizontallyOverlappingCells, getVerticallyOverlappingCells, removeEmptyRowsColumns, splitHorizontally, splitVertically, trimTableCellIfNeeded, adjustLastRowIndex, adjustLastColumnIndex } from './utils/structure.js';
11
11
  /**
12
12
  * This plugin adds support for copying/cutting/pasting fragments of tables.
13
13
  * It is loaded automatically by the {@link module:table/table~Table} plugin.
14
14
  */
15
- export default class TableClipboard extends Plugin {
15
+ export class TableClipboard extends Plugin {
16
16
  /**
17
17
  * @inheritDoc
18
18
  */
@@ -8,17 +8,26 @@
8
8
  /**
9
9
  * The minimum column width given as a percentage value. Used in situations when the table is not yet rendered, so it is impossible to
10
10
  * calculate how many percentage of the table width would be {@link ~COLUMN_MIN_WIDTH_IN_PIXELS minimum column width in pixels}.
11
+ *
12
+ * @internal
11
13
  */
12
14
  export declare const COLUMN_MIN_WIDTH_AS_PERCENTAGE = 5;
13
15
  /**
14
16
  * The minimum column width in pixels when the maximum table width is known.
17
+ * This value is an equivalent of `10%` of the default editor width (600px).
18
+ *
19
+ * @internal
15
20
  */
16
21
  export declare const COLUMN_MIN_WIDTH_IN_PIXELS = 40;
17
22
  /**
18
23
  * Determines how many digits after the decimal point are used to store the column width as a percentage value.
24
+ *
25
+ * @internal
19
26
  */
20
27
  export declare const COLUMN_WIDTH_PRECISION = 2;
21
28
  /**
22
29
  * The distance in pixels that the mouse has to move to start resizing the column.
30
+ *
31
+ * @internal
23
32
  */
24
33
  export declare const COLUMN_RESIZE_DISTANCE_THRESHOLD = 3;
@@ -8,17 +8,26 @@
8
8
  /**
9
9
  * The minimum column width given as a percentage value. Used in situations when the table is not yet rendered, so it is impossible to
10
10
  * calculate how many percentage of the table width would be {@link ~COLUMN_MIN_WIDTH_IN_PIXELS minimum column width in pixels}.
11
+ *
12
+ * @internal
11
13
  */
12
14
  export const COLUMN_MIN_WIDTH_AS_PERCENTAGE = 5;
13
15
  /**
14
16
  * The minimum column width in pixels when the maximum table width is known.
17
+ * This value is an equivalent of `10%` of the default editor width (600px).
18
+ *
19
+ * @internal
15
20
  */
16
21
  export const COLUMN_MIN_WIDTH_IN_PIXELS = 40;
17
22
  /**
18
23
  * Determines how many digits after the decimal point are used to store the column width as a percentage value.
24
+ *
25
+ * @internal
19
26
  */
20
27
  export const COLUMN_WIDTH_PRECISION = 2;
21
28
  /**
22
29
  * The distance in pixels that the mouse has to move to start resizing the column.
30
+ *
31
+ * @internal
23
32
  */
24
33
  export const COLUMN_RESIZE_DISTANCE_THRESHOLD = 3;
@@ -6,13 +6,23 @@
6
6
  * @module table/tablecolumnresize/converters
7
7
  */
8
8
  import type { DowncastDispatcher, UpcastDispatcher } from 'ckeditor5/src/engine.js';
9
- import type TableUtils from '../tableutils.js';
9
+ import { type TableUtils } from '../tableutils.js';
10
10
  /**
11
11
  * Returns a upcast helper that ensures the number of `<tableColumn>` elements corresponds to the actual number of columns in the table,
12
12
  * because the input data might have too few or too many <col> elements.
13
+ *
14
+ * @internal
13
15
  */
14
16
  export declare function upcastColgroupElement(tableUtilsPlugin: TableUtils): (dispatcher: UpcastDispatcher) => void;
15
17
  /**
16
18
  * Returns downcast helper for adding `ck-table-resized` class if there is a `<tableColumnGroup>` element inside the table.
19
+ *
20
+ * @internal
17
21
  */
18
22
  export declare function downcastTableResizedClass(): (dispatcher: DowncastDispatcher) => void;
23
+ /**
24
+ * Returns a upcast helper that removes the `ck-table-resized` class from the table element.
25
+ *
26
+ * @internal
27
+ */
28
+ export declare function upcastTableResizedClass(): (dispatcher: UpcastDispatcher) => void;
@@ -6,6 +6,8 @@ import { normalizeColumnWidths, updateColumnElements, getColumnGroupElement, get
6
6
  /**
7
7
  * Returns a upcast helper that ensures the number of `<tableColumn>` elements corresponds to the actual number of columns in the table,
8
8
  * because the input data might have too few or too many <col> elements.
9
+ *
10
+ * @internal
9
11
  */
10
12
  export function upcastColgroupElement(tableUtilsPlugin) {
11
13
  return dispatcher => dispatcher.on('element:colgroup', (evt, data, conversionApi) => {
@@ -26,6 +28,8 @@ export function upcastColgroupElement(tableUtilsPlugin) {
26
28
  }
27
29
  /**
28
30
  * Returns downcast helper for adding `ck-table-resized` class if there is a `<tableColumnGroup>` element inside the table.
31
+ *
32
+ * @internal
29
33
  */
30
34
  export function downcastTableResizedClass() {
31
35
  return dispatcher => dispatcher.on('insert:table', (evt, data, conversionApi) => {
@@ -44,3 +48,15 @@ export function downcastTableResizedClass() {
44
48
  }
45
49
  }, { priority: 'low' });
46
50
  }
51
+ /**
52
+ * Returns a upcast helper that removes the `ck-table-resized` class from the table element.
53
+ *
54
+ * @internal
55
+ */
56
+ export function upcastTableResizedClass() {
57
+ return (dispatcher) => {
58
+ dispatcher.on('element:table', (evt, data, conversionApi) => {
59
+ conversionApi.consumable.consume(data.viewItem, { classes: 'ck-table-resized' });
60
+ });
61
+ };
62
+ }
@@ -3,13 +3,13 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  import { Plugin, type Editor } from 'ckeditor5/src/core.js';
6
- import type { Element } from 'ckeditor5/src/engine.js';
7
- import TableEditing from '../tableediting.js';
8
- import TableUtils from '../tableutils.js';
6
+ import type { ModelElement } from 'ckeditor5/src/engine.js';
7
+ import { TableEditing } from '../tableediting.js';
8
+ import { TableUtils } from '../tableutils.js';
9
9
  /**
10
10
  * The table column resize editing plugin.
11
11
  */
12
- export default class TableColumnResizeEditing extends Plugin {
12
+ export declare class TableColumnResizeEditing extends Plugin {
13
13
  /**
14
14
  * A flag indicating if the column resizing is in progress.
15
15
  */
@@ -69,21 +69,21 @@ export default class TableColumnResizeEditing extends Plugin {
69
69
  * @param element A 'table' or 'tableColumnGroup' element.
70
70
  * @returns A 'tableColumnGroup' element.
71
71
  */
72
- getColumnGroupElement(element: Element): Element | undefined;
72
+ getColumnGroupElement(element: ModelElement): ModelElement | undefined;
73
73
  /**
74
74
  * Returns an array of 'tableColumn' elements.
75
75
  *
76
76
  * @param element A 'table' or 'tableColumnGroup' element.
77
77
  * @returns An array of 'tableColumn' elements.
78
78
  */
79
- getTableColumnElements(element: Element): Array<Element>;
79
+ getTableColumnElements(element: ModelElement): Array<ModelElement>;
80
80
  /**
81
81
  * Returns an array of table column widths.
82
82
  *
83
83
  * @param element A 'table' or 'tableColumnGroup' element.
84
84
  * @returns An array of table column widths.
85
85
  */
86
- getTableColumnsWidths(element: Element): Array<string>;
86
+ getTableColumnsWidths(element: ModelElement): Array<string>;
87
87
  /**
88
88
  * Registers new attributes for a table model element.
89
89
  */
@@ -8,19 +8,19 @@
8
8
  import { throttle, isEqual } from 'es-toolkit/compat';
9
9
  import { global, DomEmitterMixin, Rect, toUnit } from 'ckeditor5/src/utils.js';
10
10
  import { Plugin } from 'ckeditor5/src/core.js';
11
- import MouseEventsObserver from '../../src/tablemouse/mouseeventsobserver.js';
12
- import TableEditing from '../tableediting.js';
13
- import TableUtils from '../tableutils.js';
14
- import TableWalker from '../tablewalker.js';
15
- import TableWidthsCommand from './tablewidthscommand.js';
16
- import { downcastTableResizedClass, upcastColgroupElement } from './converters.js';
11
+ import { MouseEventsObserver } from '../../src/tablemouse/mouseeventsobserver.js';
12
+ import { TableEditing } from '../tableediting.js';
13
+ import { TableUtils } from '../tableutils.js';
14
+ import { TableWalker } from '../tablewalker.js';
15
+ import { TableWidthsCommand } from './tablewidthscommand.js';
16
+ import { downcastTableResizedClass, upcastColgroupElement, upcastTableResizedClass } from './converters.js';
17
17
  import { clamp, createFilledArray, sumArray, getColumnEdgesIndexes, getChangedResizedTables, getColumnMinWidthAsPercentage, getElementWidthInPixels, getTableWidthInPixels, normalizeColumnWidths, toPrecision, getDomCellOuterWidth, updateColumnElements, getColumnGroupElement, getTableColumnElements, getTableColumnsWidths } from './utils.js';
18
18
  import { COLUMN_MIN_WIDTH_IN_PIXELS, COLUMN_RESIZE_DISTANCE_THRESHOLD } from './constants.js';
19
19
  const toPx = /* #__PURE__ */ toUnit('px');
20
20
  /**
21
21
  * The table column resize editing plugin.
22
22
  */
23
- export default class TableColumnResizeEditing extends Plugin {
23
+ export class TableColumnResizeEditing extends Plugin {
24
24
  /**
25
25
  * A flag indicating if the column resizing is in progress.
26
26
  */
@@ -144,18 +144,20 @@ export default class TableColumnResizeEditing extends Plugin {
144
144
  * Registers new attributes for a table model element.
145
145
  */
146
146
  _extendSchema() {
147
- this.editor.model.schema.extend('table', {
147
+ const schema = this.editor.model.schema;
148
+ schema.extend('table', {
148
149
  allowAttributes: ['tableWidth']
149
150
  });
150
- this.editor.model.schema.register('tableColumnGroup', {
151
+ schema.register('tableColumnGroup', {
151
152
  allowIn: 'table',
152
153
  isLimit: true
153
154
  });
154
- this.editor.model.schema.register('tableColumn', {
155
+ schema.register('tableColumn', {
155
156
  allowIn: 'tableColumnGroup',
156
157
  allowAttributes: ['columnWidth', 'colSpan'],
157
158
  isLimit: true
158
159
  });
160
+ schema.setAttributeProperties('columnWidth', { isFormatting: true });
159
161
  }
160
162
  /**
161
163
  * Registers table column resize post-fixer.
@@ -261,7 +263,6 @@ export default class TableColumnResizeEditing extends Plugin {
261
263
  }
262
264
  },
263
265
  model: {
264
- name: 'table',
265
266
  key: 'tableWidth',
266
267
  value: (viewElement) => {
267
268
  const parent = viewElement.parent;
@@ -288,6 +289,7 @@ export default class TableColumnResizeEditing extends Plugin {
288
289
  conversion.elementToElement({ model: 'tableColumnGroup', view: 'colgroup' });
289
290
  conversion.elementToElement({ model: 'tableColumn', view: 'col' });
290
291
  conversion.for('downcast').add(downcastTableResizedClass());
292
+ conversion.for('upcast').add(upcastTableResizedClass());
291
293
  conversion.for('upcast').add(upcastColgroupElement(this._tableUtilsPlugin));
292
294
  conversion.for('upcast').attributeToAttribute({
293
295
  view: {