@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
@@ -5,13 +5,13 @@
5
5
  /**
6
6
  * @module table/tablecolumnresize/tablewidthscommand
7
7
  */
8
- import type { Element } from 'ckeditor5/src/engine.js';
8
+ import type { ModelElement } from 'ckeditor5/src/engine.js';
9
9
  import { Command } from 'ckeditor5/src/core.js';
10
10
  /**
11
11
  * Command used by the {@link module:table/tablecolumnresize~TableColumnResize Table column resize feature} that
12
12
  * updates the width of the whole table as well as its individual columns.
13
13
  */
14
- export default class TableWidthsCommand extends Command {
14
+ export declare class TableWidthsCommand extends Command {
15
15
  /**
16
16
  * @inheritDoc
17
17
  */
@@ -34,5 +34,5 @@ export interface TableWidthsCommandOptions {
34
34
  /**
35
35
  * The table that is having the columns resized.
36
36
  */
37
- table?: Element;
37
+ table?: ModelElement;
38
38
  }
@@ -8,7 +8,7 @@ import { normalizeColumnWidths } from './utils.js';
8
8
  * Command used by the {@link module:table/tablecolumnresize~TableColumnResize Table column resize feature} that
9
9
  * updates the width of the whole table as well as its individual columns.
10
10
  */
11
- export default class TableWidthsCommand extends Command {
11
+ export class TableWidthsCommand extends Command {
12
12
  /**
13
13
  * @inheritDoc
14
14
  */
@@ -6,37 +6,41 @@
6
6
  * @module table/tablecolumnresize/utils
7
7
  */
8
8
  import type { Editor } from 'ckeditor5/src/core.js';
9
- import type { Element, Model, Writer } from 'ckeditor5/src/engine.js';
10
- import type TableUtils from '../tableutils.js';
9
+ import type { ModelElement, Model, ModelWriter } from 'ckeditor5/src/engine.js';
10
+ import { type TableUtils } from '../tableutils.js';
11
11
  /**
12
12
  * Returns all the inserted or changed table model elements in a given change set. Only the tables
13
13
  * with 'columnsWidth' attribute are taken into account. The returned set may be empty.
14
14
  *
15
15
  * Most notably if an entire table is removed it will not be included in returned set.
16
16
  *
17
+ * @internal
17
18
  * @param model The model to collect the affected elements from.
18
19
  * @returns A set of table model elements.
19
20
  */
20
- export declare function getChangedResizedTables(model: Model): Set<Element>;
21
+ export declare function getChangedResizedTables(model: Model): Set<ModelElement>;
21
22
  /**
22
23
  * Calculates the percentage of the minimum column width given in pixels for a given table.
23
24
  *
25
+ * @internal
24
26
  * @param modelTable A table model element.
25
27
  * @param editor The editor instance.
26
28
  * @returns The minimal column width in percentage.
27
29
  */
28
- export declare function getColumnMinWidthAsPercentage(modelTable: Element, editor: Editor): number;
30
+ export declare function getColumnMinWidthAsPercentage(modelTable: ModelElement, editor: Editor): number;
29
31
  /**
30
32
  * Calculates the table width in pixels.
31
33
  *
34
+ * @internal
32
35
  * @param modelTable A table model element.
33
36
  * @param editor The editor instance.
34
37
  * @returns The width of the table in pixels.
35
38
  */
36
- export declare function getTableWidthInPixels(modelTable: Element, editor: Editor): number;
39
+ export declare function getTableWidthInPixels(modelTable: ModelElement, editor: Editor): number;
37
40
  /**
38
41
  * Returns the computed width (in pixels) of the DOM element without padding and borders.
39
42
  *
43
+ * @internal
40
44
  * @param domElement A DOM element.
41
45
  * @returns The width of the DOM element in pixels.
42
46
  */
@@ -45,17 +49,19 @@ export declare function getElementWidthInPixels(domElement: HTMLElement): number
45
49
  * Returns the column indexes on the left and right edges of a cell. They differ if the cell spans
46
50
  * across multiple columns.
47
51
  *
52
+ * @internal
48
53
  * @param cell A table cell model element.
49
54
  * @param tableUtils The Table Utils plugin instance.
50
55
  * @returns An object containing the indexes of the left and right edges of the cell.
51
56
  */
52
- export declare function getColumnEdgesIndexes(cell: Element, tableUtils: TableUtils): {
57
+ export declare function getColumnEdgesIndexes(cell: ModelElement, tableUtils: TableUtils): {
53
58
  leftEdge: number;
54
59
  rightEdge: number;
55
60
  };
56
61
  /**
57
62
  * Rounds the provided value to a fixed-point number with defined number of digits after the decimal point.
58
63
  *
64
+ * @internal
59
65
  * @param value A number to be rounded.
60
66
  * @returns The rounded number.
61
67
  */
@@ -64,6 +70,7 @@ export declare function toPrecision(value: number | string): number;
64
70
  * Clamps the number within the inclusive lower (min) and upper (max) bounds. Returned number is rounded using the
65
71
  * {@link ~toPrecision `toPrecision()`} function.
66
72
  *
73
+ * @internal
67
74
  * @param number A number to be clamped.
68
75
  * @param min A lower bound.
69
76
  * @param max An upper bound.
@@ -73,6 +80,7 @@ export declare function clamp(number: number, min: number, max: number): number;
73
80
  /**
74
81
  * Creates an array with defined length and fills all elements with defined value.
75
82
  *
83
+ * @internal
76
84
  * @param length The length of the array.
77
85
  * @param value The value to fill the array with.
78
86
  * @returns An array with defined length and filled with defined value.
@@ -81,6 +89,7 @@ export declare function createFilledArray<T>(length: number, value: T): Array<T>
81
89
  /**
82
90
  * Sums all array values that can be parsed to a float.
83
91
  *
92
+ * @internal
84
93
  * @param array An array of numbers.
85
94
  * @returns The sum of all array values.
86
95
  */
@@ -90,6 +99,7 @@ export declare function sumArray(array: Array<number | string>): number;
90
99
  * changed proportionally so that they all sum back to 100%. If there are columns without specified width, the amount remaining
91
100
  * after assigning the known widths will be distributed equally between them.
92
101
  *
102
+ * @internal
93
103
  * @param columnWidths An array of column widths.
94
104
  * @returns An array of column widths guaranteed to sum up to 100%.
95
105
  */
@@ -100,6 +110,7 @@ export declare function normalizeColumnWidths(columnWidths: Array<string>): Arra
100
110
  * * left and red padding,
101
111
  * * border width.
102
112
  *
113
+ * @internal
103
114
  * @param domCell A DOM cell element.
104
115
  * @returns Width in pixels without `px` at the end.
105
116
  */
@@ -107,12 +118,13 @@ export declare function getDomCellOuterWidth(domCell: HTMLElement): number;
107
118
  /**
108
119
  * Updates column elements to match columns widths.
109
120
  *
121
+ * @internal
110
122
  * @param columns
111
123
  * @param tableColumnGroup
112
124
  * @param normalizedWidths
113
125
  * @param writer
114
126
  */
115
- export declare function updateColumnElements(columns: Array<Element>, tableColumnGroup: Element, normalizedWidths: Array<string>, writer: Writer): void;
127
+ export declare function updateColumnElements(columns: Array<ModelElement>, tableColumnGroup: ModelElement, normalizedWidths: Array<string>, writer: ModelWriter): void;
116
128
  /**
117
129
  * Returns a 'tableColumnGroup' element from the 'table'.
118
130
  *
@@ -120,7 +132,7 @@ export declare function updateColumnElements(columns: Array<Element>, tableColum
120
132
  * @param element A 'table' or 'tableColumnGroup' element.
121
133
  * @returns A 'tableColumnGroup' element.
122
134
  */
123
- export declare function getColumnGroupElement(element: Element): Element;
135
+ export declare function getColumnGroupElement(element: ModelElement): ModelElement;
124
136
  /**
125
137
  * Returns an array of 'tableColumn' elements. It may be empty if there's no `tableColumnGroup` element.
126
138
  *
@@ -128,7 +140,7 @@ export declare function getColumnGroupElement(element: Element): Element;
128
140
  * @param element A 'table' or 'tableColumnGroup' element.
129
141
  * @returns An array of 'tableColumn' elements.
130
142
  */
131
- export declare function getTableColumnElements(element: Element): Array<Element>;
143
+ export declare function getTableColumnElements(element: ModelElement): Array<ModelElement>;
132
144
  /**
133
145
  * Returns an array of table column widths.
134
146
  *
@@ -136,7 +148,7 @@ export declare function getTableColumnElements(element: Element): Array<Element>
136
148
  * @param element A 'table' or 'tableColumnGroup' element.
137
149
  * @returns An array of table column widths.
138
150
  */
139
- export declare function getTableColumnsWidths(element: Element): Array<string>;
151
+ export declare function getTableColumnsWidths(element: ModelElement): Array<string>;
140
152
  /**
141
153
  * Translates the `colSpan` model attribute into additional column widths and returns the resulting array.
142
154
  *
@@ -145,4 +157,4 @@ export declare function getTableColumnsWidths(element: Element): Array<string>;
145
157
  * @param writer A writer instance.
146
158
  * @returns An array of table column widths.
147
159
  */
148
- export declare function translateColSpanAttribute(element: Element, writer: Writer): Array<string>;
160
+ export declare function translateColSpanAttribute(element: ModelElement, writer: ModelWriter): Array<string>;
@@ -10,6 +10,7 @@ import { COLUMN_WIDTH_PRECISION, COLUMN_MIN_WIDTH_AS_PERCENTAGE, COLUMN_MIN_WIDT
10
10
  *
11
11
  * Most notably if an entire table is removed it will not be included in returned set.
12
12
  *
13
+ * @internal
13
14
  * @param model The model to collect the affected elements from.
14
15
  * @returns A set of table model elements.
15
16
  */
@@ -61,6 +62,7 @@ export function getChangedResizedTables(model) {
61
62
  /**
62
63
  * Calculates the percentage of the minimum column width given in pixels for a given table.
63
64
  *
65
+ * @internal
64
66
  * @param modelTable A table model element.
65
67
  * @param editor The editor instance.
66
68
  * @returns The minimal column width in percentage.
@@ -71,6 +73,7 @@ export function getColumnMinWidthAsPercentage(modelTable, editor) {
71
73
  /**
72
74
  * Calculates the table width in pixels.
73
75
  *
76
+ * @internal
74
77
  * @param modelTable A table model element.
75
78
  * @param editor The editor instance.
76
79
  * @returns The width of the table in pixels.
@@ -98,6 +101,7 @@ function getChildrenViewElement(modelTable, elementName, editor) {
98
101
  /**
99
102
  * Returns the computed width (in pixels) of the DOM element without padding and borders.
100
103
  *
104
+ * @internal
101
105
  * @param domElement A DOM element.
102
106
  * @returns The width of the DOM element in pixels.
103
107
  */
@@ -120,6 +124,7 @@ export function getElementWidthInPixels(domElement) {
120
124
  * Returns the column indexes on the left and right edges of a cell. They differ if the cell spans
121
125
  * across multiple columns.
122
126
  *
127
+ * @internal
123
128
  * @param cell A table cell model element.
124
129
  * @param tableUtils The Table Utils plugin instance.
125
130
  * @returns An object containing the indexes of the left and right edges of the cell.
@@ -135,6 +140,7 @@ export function getColumnEdgesIndexes(cell, tableUtils) {
135
140
  /**
136
141
  * Rounds the provided value to a fixed-point number with defined number of digits after the decimal point.
137
142
  *
143
+ * @internal
138
144
  * @param value A number to be rounded.
139
145
  * @returns The rounded number.
140
146
  */
@@ -147,6 +153,7 @@ export function toPrecision(value) {
147
153
  * Clamps the number within the inclusive lower (min) and upper (max) bounds. Returned number is rounded using the
148
154
  * {@link ~toPrecision `toPrecision()`} function.
149
155
  *
156
+ * @internal
150
157
  * @param number A number to be clamped.
151
158
  * @param min A lower bound.
152
159
  * @param max An upper bound.
@@ -164,6 +171,7 @@ export function clamp(number, min, max) {
164
171
  /**
165
172
  * Creates an array with defined length and fills all elements with defined value.
166
173
  *
174
+ * @internal
167
175
  * @param length The length of the array.
168
176
  * @param value The value to fill the array with.
169
177
  * @returns An array with defined length and filled with defined value.
@@ -174,6 +182,7 @@ export function createFilledArray(length, value) {
174
182
  /**
175
183
  * Sums all array values that can be parsed to a float.
176
184
  *
185
+ * @internal
177
186
  * @param array An array of numbers.
178
187
  * @returns The sum of all array values.
179
188
  */
@@ -188,13 +197,14 @@ export function sumArray(array) {
188
197
  * changed proportionally so that they all sum back to 100%. If there are columns without specified width, the amount remaining
189
198
  * after assigning the known widths will be distributed equally between them.
190
199
  *
200
+ * @internal
191
201
  * @param columnWidths An array of column widths.
192
202
  * @returns An array of column widths guaranteed to sum up to 100%.
193
203
  */
194
204
  export function normalizeColumnWidths(columnWidths) {
195
205
  const widths = columnWidths.map(width => {
196
- if (width === 'auto') {
197
- return width;
206
+ if (width === 'auto' || width === undefined) {
207
+ return 'auto';
198
208
  }
199
209
  return parseFloat(width.replace('%', ''));
200
210
  });
@@ -246,6 +256,7 @@ function calculateMissingColumnWidths(columnWidths) {
246
256
  * * left and red padding,
247
257
  * * border width.
248
258
  *
259
+ * @internal
249
260
  * @param domCell A DOM cell element.
250
261
  * @returns Width in pixels without `px` at the end.
251
262
  */
@@ -266,6 +277,7 @@ export function getDomCellOuterWidth(domCell) {
266
277
  /**
267
278
  * Updates column elements to match columns widths.
268
279
  *
280
+ * @internal
269
281
  * @param columns
270
282
  * @param tableColumnGroup
271
283
  * @param normalizedWidths
@@ -6,15 +6,15 @@
6
6
  * @module table/tablecolumnresize
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import TableColumnResizeEditing from './tablecolumnresize/tablecolumnresizeediting.js';
10
- import TableCellWidthEditing from './tablecellwidth/tablecellwidthediting.js';
9
+ import { TableColumnResizeEditing } from './tablecolumnresize/tablecolumnresizeediting.js';
10
+ import { TableCellWidthEditing } from './tablecellwidth/tablecellwidthediting.js';
11
11
  import '../theme/tablecolumnresize.css';
12
12
  /**
13
13
  * The table column resize feature.
14
14
  *
15
15
  * It provides the possibility to set the width of each column in a table using a resize handler.
16
16
  */
17
- export default class TableColumnResize extends Plugin {
17
+ export declare class TableColumnResize extends Plugin {
18
18
  /**
19
19
  * @inheritDoc
20
20
  */
@@ -6,15 +6,15 @@
6
6
  * @module table/tablecolumnresize
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import TableColumnResizeEditing from './tablecolumnresize/tablecolumnresizeediting.js';
10
- import TableCellWidthEditing from './tablecellwidth/tablecellwidthediting.js';
9
+ import { TableColumnResizeEditing } from './tablecolumnresize/tablecolumnresizeediting.js';
10
+ import { TableCellWidthEditing } from './tablecellwidth/tablecellwidthediting.js';
11
11
  import '../theme/tablecolumnresize.css';
12
12
  /**
13
13
  * The table column resize feature.
14
14
  *
15
15
  * It provides the possibility to set the width of each column in a table using a resize handler.
16
16
  */
17
- export default class TableColumnResize extends Plugin {
17
+ export class TableColumnResize extends Plugin {
18
18
  /**
19
19
  * @inheritDoc
20
20
  */
@@ -20,10 +20,12 @@ import type { ColorOption, ColorPickerConfig } from 'ckeditor5/src/ui.js';
20
20
  * ```
21
21
  *
22
22
  * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
23
+ *
24
+ * @internal
23
25
  */
24
26
  export interface TableConfig {
25
27
  /**
26
- * Number of rows and columns to render by default as table heading when inserting new tables.
28
+ * Number of rows and columns to render by table heading when inserting new tables.
27
29
  *
28
30
  * You can configure it like this:
29
31
  *
@@ -6,13 +6,13 @@
6
6
  * @module table/tableediting
7
7
  */
8
8
  import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9
- import type { PositionOffset, SlotFilter } from 'ckeditor5/src/engine.js';
10
- import TableUtils from '../src/tableutils.js';
9
+ import type { ModelPositionOffset, DowncastSlotFilter } from 'ckeditor5/src/engine.js';
10
+ import { TableUtils } from '../src/tableutils.js';
11
11
  import '../theme/tableediting.css';
12
12
  /**
13
13
  * The table editing feature.
14
14
  */
15
- export default class TableEditing extends Plugin {
15
+ export declare class TableEditing extends Plugin {
16
16
  /**
17
17
  * Handlers for creating additional slots in the table.
18
18
  */
@@ -40,7 +40,7 @@ export default class TableEditing extends Plugin {
40
40
  /**
41
41
  * Registers downcast handler for the additional table slot.
42
42
  */
43
- registerAdditionalSlot(slotHandler: AdditionalSlot): void;
43
+ registerAdditionalSlot(slotHandler: TableConversionAdditionalSlot): void;
44
44
  }
45
45
  /**
46
46
  * By default, only the `tableRow` elements from the `table` model are downcast inside the `<table>` and
@@ -90,13 +90,13 @@ export default class TableEditing extends Plugin {
90
90
  * </table>
91
91
  * ```
92
92
  */
93
- export interface AdditionalSlot {
93
+ export interface TableConversionAdditionalSlot {
94
94
  /**
95
95
  * Filter for elements that should be placed inside given slot.
96
96
  */
97
- filter: SlotFilter;
97
+ filter: DowncastSlotFilter;
98
98
  /**
99
99
  * Position of the slot within the table.
100
100
  */
101
- positionOffset: PositionOffset;
101
+ positionOffset: ModelPositionOffset;
102
102
  }
@@ -6,30 +6,30 @@
6
6
  * @module table/tableediting
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import upcastTable, { ensureParagraphInTableCell, skipEmptyTableRow, upcastTableFigure } from './converters/upcasttable.js';
9
+ import { upcastTable, ensureParagraphInTableCell, skipEmptyTableRow, upcastTableFigure } from './converters/upcasttable.js';
10
10
  import { convertParagraphInTableCell, downcastCell, downcastRow, downcastTable } from './converters/downcast.js';
11
- import InsertTableCommand from './commands/inserttablecommand.js';
12
- import InsertRowCommand from './commands/insertrowcommand.js';
13
- import InsertColumnCommand from './commands/insertcolumncommand.js';
14
- import SplitCellCommand from './commands/splitcellcommand.js';
15
- import MergeCellCommand from './commands/mergecellcommand.js';
16
- import RemoveRowCommand from './commands/removerowcommand.js';
17
- import RemoveColumnCommand from './commands/removecolumncommand.js';
18
- import SetHeaderRowCommand from './commands/setheaderrowcommand.js';
19
- import SetHeaderColumnCommand from './commands/setheadercolumncommand.js';
20
- import MergeCellsCommand from './commands/mergecellscommand.js';
21
- import SelectRowCommand from './commands/selectrowcommand.js';
22
- import SelectColumnCommand from './commands/selectcolumncommand.js';
23
- import TableUtils from '../src/tableutils.js';
24
- import injectTableLayoutPostFixer from './converters/table-layout-post-fixer.js';
25
- import injectTableCellParagraphPostFixer from './converters/table-cell-paragraph-post-fixer.js';
26
- import tableHeadingsRefreshHandler from './converters/table-headings-refresh-handler.js';
27
- import tableCellRefreshHandler from './converters/table-cell-refresh-handler.js';
11
+ import { InsertTableCommand } from './commands/inserttablecommand.js';
12
+ import { InsertRowCommand } from './commands/insertrowcommand.js';
13
+ import { InsertColumnCommand } from './commands/insertcolumncommand.js';
14
+ import { SplitCellCommand } from './commands/splitcellcommand.js';
15
+ import { MergeCellCommand } from './commands/mergecellcommand.js';
16
+ import { RemoveRowCommand } from './commands/removerowcommand.js';
17
+ import { RemoveColumnCommand } from './commands/removecolumncommand.js';
18
+ import { SetHeaderRowCommand } from './commands/setheaderrowcommand.js';
19
+ import { SetHeaderColumnCommand } from './commands/setheadercolumncommand.js';
20
+ import { MergeCellsCommand } from './commands/mergecellscommand.js';
21
+ import { SelectRowCommand } from './commands/selectrowcommand.js';
22
+ import { SelectColumnCommand } from './commands/selectcolumncommand.js';
23
+ import { TableUtils } from '../src/tableutils.js';
24
+ import { injectTableLayoutPostFixer } from './converters/table-layout-post-fixer.js';
25
+ import { injectTableCellParagraphPostFixer } from './converters/table-cell-paragraph-post-fixer.js';
26
+ import { tableHeadingsRefreshHandler } from './converters/table-headings-refresh-handler.js';
27
+ import { tableCellRefreshHandler } from './converters/table-cell-refresh-handler.js';
28
28
  import '../theme/tableediting.css';
29
29
  /**
30
30
  * The table editing feature.
31
31
  */
32
- export default class TableEditing extends Plugin {
32
+ export class TableEditing extends Plugin {
33
33
  /**
34
34
  * Handlers for creating additional slots in the table.
35
35
  */
@@ -5,16 +5,16 @@
5
5
  /**
6
6
  * @module table/tablekeyboard
7
7
  */
8
- import TableSelection from './tableselection.js';
9
- import TableUtils from './tableutils.js';
8
+ import { TableSelection } from './tableselection.js';
9
+ import { TableUtils } from './tableutils.js';
10
10
  import { Plugin } from 'ckeditor5/src/core.js';
11
11
  import { type ArrowKeyCodeDirection } from 'ckeditor5/src/utils.js';
12
- import type { Element } from 'ckeditor5/src/engine.js';
12
+ import type { ModelElement } from 'ckeditor5/src/engine.js';
13
13
  /**
14
14
  * This plugin enables keyboard navigation for tables.
15
15
  * It is loaded automatically by the {@link module:table/table~Table} plugin.
16
16
  */
17
- export default class TableKeyboard extends Plugin {
17
+ export declare class TableKeyboard extends Plugin {
18
18
  /**
19
19
  * @inheritDoc
20
20
  */
@@ -32,17 +32,17 @@ export default class TableKeyboard extends Plugin {
32
32
  */
33
33
  init(): void;
34
34
  /**
35
- * Handles {@link module:engine/view/document~Document#event:tab tab} events for the <kbd>Tab</kbd> key executed
35
+ * Handles {@link module:engine/view/document~ViewDocument#event:tab tab} events for the <kbd>Tab</kbd> key executed
36
36
  * when the table widget is selected.
37
37
  */
38
38
  private _handleTabOnSelectedTable;
39
39
  /**
40
- * Handles {@link module:engine/view/document~Document#event:tab tab} events for the <kbd>Tab</kbd> key executed
40
+ * Handles {@link module:engine/view/document~ViewDocument#event:tab tab} events for the <kbd>Tab</kbd> key executed
41
41
  * inside table cells.
42
42
  */
43
43
  private _handleTab;
44
44
  /**
45
- * Handles {@link module:engine/view/document~Document#event:keydown keydown} events.
45
+ * Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events.
46
46
  */
47
47
  private _onArrowKey;
48
48
  /**
@@ -68,5 +68,5 @@ export default class TableKeyboard extends Plugin {
68
68
  * @param direction Direction in which selection should move.
69
69
  * @param expandSelection If the current selection should be expanded. Default value is false.
70
70
  */
71
- protected _navigateFromCellInDirection(focusCell: Element, direction: ArrowKeyCodeDirection, expandSelection?: boolean): void;
71
+ protected _navigateFromCellInDirection(focusCell: ModelElement, direction: ArrowKeyCodeDirection, expandSelection?: boolean): void;
72
72
  }
@@ -5,16 +5,16 @@
5
5
  /**
6
6
  * @module table/tablekeyboard
7
7
  */
8
- import TableSelection from './tableselection.js';
9
- import TableWalker from './tablewalker.js';
10
- import TableUtils from './tableutils.js';
8
+ import { TableSelection } from './tableselection.js';
9
+ import { TableWalker } from './tablewalker.js';
10
+ import { TableUtils } from './tableutils.js';
11
11
  import { Plugin } from 'ckeditor5/src/core.js';
12
12
  import { getLocalizedArrowKeyCodeDirection } from 'ckeditor5/src/utils.js';
13
13
  /**
14
14
  * This plugin enables keyboard navigation for tables.
15
15
  * It is loaded automatically by the {@link module:table/table~Table} plugin.
16
16
  */
17
- export default class TableKeyboard extends Plugin {
17
+ export class TableKeyboard extends Plugin {
18
18
  /**
19
19
  * @inheritDoc
20
20
  */
@@ -69,7 +69,7 @@ export default class TableKeyboard extends Plugin {
69
69
  });
70
70
  }
71
71
  /**
72
- * Handles {@link module:engine/view/document~Document#event:tab tab} events for the <kbd>Tab</kbd> key executed
72
+ * Handles {@link module:engine/view/document~ViewDocument#event:tab tab} events for the <kbd>Tab</kbd> key executed
73
73
  * when the table widget is selected.
74
74
  */
75
75
  _handleTabOnSelectedTable(bubblingEventInfo, domEventData) {
@@ -87,7 +87,7 @@ export default class TableKeyboard extends Plugin {
87
87
  });
88
88
  }
89
89
  /**
90
- * Handles {@link module:engine/view/document~Document#event:tab tab} events for the <kbd>Tab</kbd> key executed
90
+ * Handles {@link module:engine/view/document~ViewDocument#event:tab tab} events for the <kbd>Tab</kbd> key executed
91
91
  * inside table cells.
92
92
  */
93
93
  _handleTab(bubblingEventInfo, domEventData) {
@@ -151,7 +151,7 @@ export default class TableKeyboard extends Plugin {
151
151
  });
152
152
  }
153
153
  /**
154
- * Handles {@link module:engine/view/document~Document#event:keydown keydown} events.
154
+ * Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events.
155
155
  */
156
156
  _onArrowKey(eventInfo, domEventData) {
157
157
  const editor = this.editor;
@@ -19,7 +19,7 @@ import type { TableType } from '../../tableconfig.js';
19
19
  * editor.execute( 'tableType', 'layout' );
20
20
  * ```
21
21
  */
22
- export default class TableTypeCommand extends Command {
22
+ export declare class TableTypeCommand extends Command {
23
23
  /**
24
24
  * The table type of selected table.
25
25
  *
@@ -19,7 +19,7 @@ import { getSelectionAffectedTable } from '../../utils/common.js';
19
19
  * editor.execute( 'tableType', 'layout' );
20
20
  * ```
21
21
  */
22
- export default class TableTypeCommand extends Command {
22
+ export class TableTypeCommand extends Command {
23
23
  /**
24
24
  * @inheritDoc
25
25
  */
@@ -6,12 +6,12 @@
6
6
  * @module table/tablelayout/tablelayoutediting
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import TableColumnResize from '../tablecolumnresize.js';
9
+ import { TableColumnResize } from '../tablecolumnresize.js';
10
10
  import '../../theme/tablelayout.css';
11
11
  /**
12
12
  * The table layout editing plugin.
13
13
  */
14
- export default class TableLayoutEditing extends Plugin {
14
+ export declare class TableLayoutEditing extends Plugin {
15
15
  /**
16
16
  * @inheritDoc
17
17
  */
@@ -6,16 +6,16 @@
6
6
  * @module table/tablelayout/tablelayoutediting
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import InsertTableLayoutCommand from './../commands/inserttablelayoutcommand.js';
10
- import TableColumnResize from '../tablecolumnresize.js';
11
- import TableTypeCommand from './commands/tabletypecommand.js';
9
+ import { InsertTableLayoutCommand } from './../commands/inserttablelayoutcommand.js';
10
+ import { TableColumnResize } from '../tablecolumnresize.js';
11
+ import { TableTypeCommand } from './commands/tabletypecommand.js';
12
12
  import { createEmptyTableCell } from '../utils/common.js';
13
13
  import '../../theme/tablelayout.css';
14
14
  const TABLE_TYPES = ['content', 'layout'];
15
15
  /**
16
16
  * The table layout editing plugin.
17
17
  */
18
- export default class TableLayoutEditing extends Plugin {
18
+ export class TableLayoutEditing extends Plugin {
19
19
  /**
20
20
  * @inheritDoc
21
21
  */
@@ -12,7 +12,7 @@ import { Plugin } from 'ckeditor5/src/core.js';
12
12
  * * The `'insertTableLayout'` dropdown,
13
13
  * * The `'menuBar:insertTableLayout'` menu bar menu.
14
14
  */
15
- export default class TableLayoutUI extends Plugin {
15
+ export declare class TableLayoutUI extends Plugin {
16
16
  /**
17
17
  * @inheritDoc
18
18
  */
@@ -7,16 +7,16 @@
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { IconTableLayout, IconTableProperties } from 'ckeditor5/src/icons.js';
10
- import { createDropdown, addListToDropdown, MenuBarMenuView, SplitButtonView, DropdownButtonView, ViewModel } from 'ckeditor5/src/ui.js';
10
+ import { createDropdown, addListToDropdown, MenuBarMenuView, SplitButtonView, DropdownButtonView, UIModel } from 'ckeditor5/src/ui.js';
11
11
  import { Collection } from 'ckeditor5/src/utils.js';
12
- import InsertTableView from '../ui/inserttableview.js';
12
+ import { InsertTableView } from '../ui/inserttableview.js';
13
13
  /**
14
14
  * The table layout UI plugin. It introduces:
15
15
  *
16
16
  * * The `'insertTableLayout'` dropdown,
17
17
  * * The `'menuBar:insertTableLayout'` menu bar menu.
18
18
  */
19
- export default class TableLayoutUI extends Plugin {
19
+ export class TableLayoutUI extends Plugin {
20
20
  /**
21
21
  * @inheritDoc
22
22
  */
@@ -174,7 +174,7 @@ function createTableLayoutTypeDropdownItems(editor) {
174
174
  * @returns The dropdown item definition.
175
175
  */
176
176
  function createTableTypeDropdownItem(tableTypeCommand, type, label) {
177
- const model = new ViewModel({
177
+ const model = new UIModel({
178
178
  label,
179
179
  role: 'menuitemradio',
180
180
  withText: true,
@@ -6,16 +6,16 @@
6
6
  * @module table/tablelayout
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import TableLayoutUI from './tablelayout/tablelayoutui.js';
10
- import TableLayoutEditing from './tablelayout/tablelayoutediting.js';
11
- import PlainTableOutput from './plaintableoutput.js';
12
- import TableColumnResize from './tablecolumnresize.js';
9
+ import { TableLayoutUI } from './tablelayout/tablelayoutui.js';
10
+ import { TableLayoutEditing } from './tablelayout/tablelayoutediting.js';
11
+ import { PlainTableOutput } from './plaintableoutput.js';
12
+ import { TableColumnResize } from './tablecolumnresize.js';
13
13
  /**
14
14
  * The table plugin.
15
15
  *
16
16
  * For a detailed overview, check the {@glink features/tables/layout-tables Layout table feature documentation}.
17
17
  */
18
- export default class TableLayout extends Plugin {
18
+ export declare class TableLayout extends Plugin {
19
19
  /**
20
20
  * @inheritDoc
21
21
  */