@ckeditor/ckeditor5-table 0.0.0-nightly-next-20260108.0 → 0.0.0-nightly-20260109.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 (274) hide show
  1. package/build/table.js +5 -0
  2. package/build/translations/af.js +1 -0
  3. package/build/translations/ar.js +1 -0
  4. package/build/translations/ast.js +1 -0
  5. package/build/translations/az.js +1 -0
  6. package/build/translations/be.js +1 -0
  7. package/build/translations/bg.js +1 -0
  8. package/build/translations/bn.js +1 -0
  9. package/build/translations/bs.js +1 -0
  10. package/build/translations/ca.js +1 -0
  11. package/build/translations/cs.js +1 -0
  12. package/build/translations/da.js +1 -0
  13. package/build/translations/de-ch.js +1 -0
  14. package/build/translations/de.js +1 -0
  15. package/build/translations/el.js +1 -0
  16. package/build/translations/en-au.js +1 -0
  17. package/build/translations/en-gb.js +1 -0
  18. package/build/translations/eo.js +1 -0
  19. package/build/translations/es-co.js +1 -0
  20. package/build/translations/es.js +1 -0
  21. package/build/translations/et.js +1 -0
  22. package/build/translations/eu.js +1 -0
  23. package/build/translations/fa.js +1 -0
  24. package/build/translations/fi.js +1 -0
  25. package/build/translations/fr.js +1 -0
  26. package/build/translations/gl.js +1 -0
  27. package/build/translations/gu.js +1 -0
  28. package/build/translations/he.js +1 -0
  29. package/build/translations/hi.js +1 -0
  30. package/build/translations/hr.js +1 -0
  31. package/build/translations/hu.js +1 -0
  32. package/build/translations/hy.js +1 -0
  33. package/build/translations/id.js +1 -0
  34. package/build/translations/it.js +1 -0
  35. package/build/translations/ja.js +1 -0
  36. package/build/translations/jv.js +1 -0
  37. package/build/translations/kk.js +1 -0
  38. package/build/translations/km.js +1 -0
  39. package/build/translations/kn.js +1 -0
  40. package/build/translations/ko.js +1 -0
  41. package/build/translations/ku.js +1 -0
  42. package/build/translations/lt.js +1 -0
  43. package/build/translations/lv.js +1 -0
  44. package/build/translations/ms.js +1 -0
  45. package/build/translations/nb.js +1 -0
  46. package/build/translations/ne.js +1 -0
  47. package/build/translations/nl.js +1 -0
  48. package/build/translations/no.js +1 -0
  49. package/build/translations/oc.js +1 -0
  50. package/build/translations/pl.js +1 -0
  51. package/build/translations/pt-br.js +1 -0
  52. package/build/translations/pt.js +1 -0
  53. package/build/translations/ro.js +1 -0
  54. package/build/translations/ru.js +1 -0
  55. package/build/translations/si.js +1 -0
  56. package/build/translations/sk.js +1 -0
  57. package/build/translations/sl.js +1 -0
  58. package/build/translations/sq.js +1 -0
  59. package/build/translations/sr-latn.js +1 -0
  60. package/build/translations/sr.js +1 -0
  61. package/build/translations/sv.js +1 -0
  62. package/build/translations/th.js +1 -0
  63. package/build/translations/ti.js +1 -0
  64. package/build/translations/tk.js +1 -0
  65. package/build/translations/tr.js +1 -0
  66. package/build/translations/tt.js +1 -0
  67. package/build/translations/ug.js +1 -0
  68. package/build/translations/uk.js +1 -0
  69. package/build/translations/ur.js +1 -0
  70. package/build/translations/uz.js +1 -0
  71. package/build/translations/vi.js +1 -0
  72. package/build/translations/zh-cn.js +1 -0
  73. package/build/translations/zh.js +1 -0
  74. package/ckeditor5-metadata.json +7 -16
  75. package/dist/index-content.css +30 -30
  76. package/dist/index-editor.css +170 -104
  77. package/dist/index.css +237 -147
  78. package/dist/index.css.map +1 -1
  79. package/dist/index.js +2433 -448
  80. package/dist/index.js.map +1 -1
  81. package/lang/contexts.json +4 -2
  82. package/package.json +35 -25
  83. package/{dist → src}/augmentation.d.ts +15 -4
  84. package/src/augmentation.js +5 -0
  85. package/{dist → src}/commands/insertcolumncommand.d.ts +1 -5
  86. package/src/commands/insertcolumncommand.js +71 -0
  87. package/{dist → src}/commands/insertrowcommand.d.ts +1 -5
  88. package/src/commands/insertrowcommand.js +70 -0
  89. package/{dist → src}/commands/inserttablecommand.d.ts +1 -5
  90. package/src/commands/inserttablecommand.js +69 -0
  91. package/{dist → src}/commands/inserttablelayoutcommand.d.ts +1 -5
  92. package/src/commands/inserttablelayoutcommand.js +65 -0
  93. package/{dist → src}/commands/mergecellcommand.d.ts +3 -7
  94. package/src/commands/mergecellcommand.js +206 -0
  95. package/{dist → src}/commands/mergecellscommand.d.ts +1 -5
  96. package/src/commands/mergecellscommand.js +94 -0
  97. package/{dist → src}/commands/removecolumncommand.d.ts +1 -5
  98. package/src/commands/removecolumncommand.js +109 -0
  99. package/{dist → src}/commands/removerowcommand.d.ts +1 -5
  100. package/src/commands/removerowcommand.js +82 -0
  101. package/{dist → src}/commands/selectcolumncommand.d.ts +1 -5
  102. package/src/commands/selectcolumncommand.js +60 -0
  103. package/{dist → src}/commands/selectrowcommand.d.ts +1 -5
  104. package/src/commands/selectrowcommand.js +56 -0
  105. package/{dist → src}/commands/setheadercolumncommand.d.ts +1 -5
  106. package/src/commands/setheadercolumncommand.js +76 -0
  107. package/{dist → src}/commands/setheaderrowcommand.d.ts +1 -5
  108. package/src/commands/setheaderrowcommand.js +83 -0
  109. package/{dist → src}/commands/splitcellcommand.d.ts +1 -5
  110. package/src/commands/splitcellcommand.js +58 -0
  111. package/{dist → src}/converters/downcast.d.ts +2 -6
  112. package/src/converters/downcast.js +298 -0
  113. package/{dist → src}/converters/table-caption-post-fixer.d.ts +1 -5
  114. package/src/converters/table-caption-post-fixer.js +55 -0
  115. package/{dist → src}/converters/table-cell-paragraph-post-fixer.d.ts +1 -5
  116. package/src/converters/table-cell-paragraph-post-fixer.js +109 -0
  117. package/{dist → src}/converters/table-cell-refresh-handler.d.ts +1 -5
  118. package/src/converters/table-cell-refresh-handler.js +47 -0
  119. package/{dist → src}/converters/table-headings-refresh-handler.d.ts +1 -5
  120. package/src/converters/table-headings-refresh-handler.js +51 -0
  121. package/{dist → src}/converters/table-layout-post-fixer.d.ts +1 -5
  122. package/src/converters/table-layout-post-fixer.js +369 -0
  123. package/{dist → src}/converters/tableproperties.d.ts +2 -6
  124. package/src/converters/tableproperties.js +444 -0
  125. package/{dist → src}/converters/upcasttable.d.ts +1 -5
  126. package/src/converters/upcasttable.js +385 -0
  127. package/{dist → src}/index.d.ts +5 -6
  128. package/src/index.js +98 -0
  129. package/{dist → src}/plaintableoutput.d.ts +1 -5
  130. package/src/plaintableoutput.js +49 -0
  131. package/{dist → src}/table.d.ts +2 -6
  132. package/src/table.js +50 -0
  133. package/{dist → src}/tablecaption/tablecaptionediting.d.ts +2 -6
  134. package/src/tablecaption/tablecaptionediting.js +136 -0
  135. package/{dist → src}/tablecaption/tablecaptionui.d.ts +1 -5
  136. package/src/tablecaption/tablecaptionui.js +64 -0
  137. package/{dist → src}/tablecaption/toggletablecaptioncommand.d.ts +1 -5
  138. package/src/tablecaption/toggletablecaptioncommand.js +105 -0
  139. package/{dist → src}/tablecaption/utils.d.ts +1 -5
  140. package/src/tablecaption/utils.js +61 -0
  141. package/{dist → src}/tablecaption.d.ts +1 -5
  142. package/src/tablecaption.js +34 -0
  143. package/{dist → src}/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +1 -5
  144. package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +30 -0
  145. package/{dist → src}/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +2 -6
  146. package/src/tablecellproperties/commands/tablecellbordercolorcommand.js +44 -0
  147. package/{dist → src}/tablecellproperties/commands/tablecellborderstylecommand.d.ts +2 -6
  148. package/src/tablecellproperties/commands/tablecellborderstylecommand.js +44 -0
  149. package/{dist → src}/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +2 -6
  150. package/src/tablecellproperties/commands/tablecellborderwidthcommand.js +64 -0
  151. package/{dist → src}/tablecellproperties/commands/tablecellheightcommand.d.ts +1 -5
  152. package/src/tablecellproperties/commands/tablecellheightcommand.js +51 -0
  153. package/{dist → src}/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +1 -5
  154. package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +30 -0
  155. package/{dist → src}/tablecellproperties/commands/tablecellpaddingcommand.d.ts +2 -6
  156. package/src/tablecellproperties/commands/tablecellpaddingcommand.js +64 -0
  157. package/{dist → src}/tablecellproperties/commands/tablecellpropertycommand.d.ts +2 -6
  158. package/src/tablecellproperties/commands/tablecellpropertycommand.js +138 -0
  159. package/{dist → src}/tablecellproperties/commands/tablecelltypecommand.d.ts +6 -6
  160. package/src/tablecellproperties/commands/tablecelltypecommand.js +167 -0
  161. package/{dist → src}/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +1 -5
  162. package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js +38 -0
  163. package/{dist → src}/tablecellproperties/tablecellpropertiesediting.d.ts +1 -5
  164. package/src/tablecellproperties/tablecellpropertiesediting.js +412 -0
  165. package/{dist → src}/tablecellproperties/tablecellpropertiesui.d.ts +2 -6
  166. package/src/tablecellproperties/tablecellpropertiesui.js +385 -0
  167. package/src/tablecellproperties/tablecellpropertiesuiexperimental.d.ts +128 -0
  168. package/src/tablecellproperties/tablecellpropertiesuiexperimental.js +408 -0
  169. package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +229 -0
  170. package/src/tablecellproperties/ui/tablecellpropertiesview.js +612 -0
  171. package/{dist/tablecellproperties/ui/tablecellpropertiesview.d.ts → src/tablecellproperties/ui/tablecellpropertiesviewexperimental.d.ts} +12 -15
  172. package/src/tablecellproperties/ui/tablecellpropertiesviewexperimental.js +744 -0
  173. package/{dist → src}/tablecellproperties.d.ts +1 -5
  174. package/src/tablecellproperties.js +40 -0
  175. package/{dist → src}/tablecellwidth/commands/tablecellwidthcommand.d.ts +1 -5
  176. package/src/tablecellwidth/commands/tablecellwidthcommand.js +51 -0
  177. package/{dist → src}/tablecellwidth/tablecellwidthediting.d.ts +1 -5
  178. package/src/tablecellwidth/tablecellwidthediting.js +53 -0
  179. package/{dist → src}/tableclipboard.d.ts +3 -7
  180. package/src/tableclipboard.js +500 -0
  181. package/{dist → src}/tablecolumnresize/constants.d.ts +0 -4
  182. package/src/tablecolumnresize/constants.js +33 -0
  183. package/{dist → src}/tablecolumnresize/converters.d.ts +1 -5
  184. package/src/tablecolumnresize/converters.js +62 -0
  185. package/{dist → src}/tablecolumnresize/tablecolumnresizeediting.d.ts +2 -6
  186. package/src/tablecolumnresize/tablecolumnresizeediting.js +729 -0
  187. package/{dist → src}/tablecolumnresize/tablewidthscommand.d.ts +2 -6
  188. package/src/tablecolumnresize/tablewidthscommand.js +61 -0
  189. package/{dist → src}/tablecolumnresize/utils.d.ts +2 -6
  190. package/src/tablecolumnresize/utils.js +370 -0
  191. package/{dist → src}/tablecolumnresize.d.ts +1 -5
  192. package/src/tablecolumnresize.js +36 -0
  193. package/{dist → src}/tableconfig.d.ts +6 -30
  194. package/src/tableconfig.js +5 -0
  195. package/{dist → src}/tableediting.d.ts +2 -6
  196. package/src/tableediting.js +246 -0
  197. package/{dist → src}/tablekeyboard.d.ts +3 -7
  198. package/src/tablekeyboard.js +273 -0
  199. package/{dist → src}/tablelayout/commands/tabletypecommand.d.ts +1 -5
  200. package/src/tablelayout/commands/tabletypecommand.js +68 -0
  201. package/{dist → src}/tablelayout/tablelayoutediting.d.ts +1 -5
  202. package/src/tablelayout/tablelayoutediting.js +295 -0
  203. package/{dist → src}/tablelayout/tablelayoutui.d.ts +1 -5
  204. package/src/tablelayout/tablelayoutui.js +196 -0
  205. package/{dist → src}/tablelayout.d.ts +1 -5
  206. package/src/tablelayout.js +37 -0
  207. package/{dist → src}/tablemouse/mouseeventsobserver.d.ts +1 -5
  208. package/src/tablemouse/mouseeventsobserver.js +34 -0
  209. package/{dist → src}/tablemouse.d.ts +1 -5
  210. package/src/tablemouse.js +178 -0
  211. package/{dist → src}/tableproperties/commands/tablealignmentcommand.d.ts +1 -5
  212. package/src/tableproperties/commands/tablealignmentcommand.js +30 -0
  213. package/{dist → src}/tableproperties/commands/tablebackgroundcolorcommand.d.ts +1 -5
  214. package/src/tableproperties/commands/tablebackgroundcolorcommand.js +30 -0
  215. package/{dist → src}/tableproperties/commands/tablebordercolorcommand.d.ts +2 -6
  216. package/src/tableproperties/commands/tablebordercolorcommand.js +44 -0
  217. package/{dist → src}/tableproperties/commands/tableborderstylecommand.d.ts +2 -6
  218. package/src/tableproperties/commands/tableborderstylecommand.js +44 -0
  219. package/{dist → src}/tableproperties/commands/tableborderwidthcommand.d.ts +2 -6
  220. package/src/tableproperties/commands/tableborderwidthcommand.js +64 -0
  221. package/{dist → src}/tableproperties/commands/tableheightcommand.d.ts +1 -5
  222. package/src/tableproperties/commands/tableheightcommand.js +54 -0
  223. package/{dist → src}/tableproperties/commands/tablepropertycommand.d.ts +2 -6
  224. package/src/tableproperties/commands/tablepropertycommand.js +103 -0
  225. package/{dist → src}/tableproperties/commands/tablewidthcommand.d.ts +1 -5
  226. package/src/tableproperties/commands/tablewidthcommand.js +54 -0
  227. package/{dist → src}/tableproperties/tablepropertiesediting.d.ts +1 -5
  228. package/src/tableproperties/tablepropertiesediting.js +546 -0
  229. package/{dist → src}/tableproperties/tablepropertiesui.d.ts +2 -6
  230. package/src/tableproperties/tablepropertiesui.js +374 -0
  231. package/src/tableproperties/tablepropertiesuiexperimental.d.ts +136 -0
  232. package/src/tableproperties/tablepropertiesuiexperimental.js +375 -0
  233. package/{dist → src}/tableproperties/ui/tablepropertiesview.d.ts +2 -14
  234. package/src/tableproperties/ui/tablepropertiesview.js +520 -0
  235. package/src/tableproperties/ui/tablepropertiesviewexperimental.d.ts +216 -0
  236. package/src/tableproperties/ui/tablepropertiesviewexperimental.js +544 -0
  237. package/{dist → src}/tableproperties.d.ts +1 -5
  238. package/src/tableproperties.js +40 -0
  239. package/{dist → src}/tableselection.d.ts +2 -6
  240. package/src/tableselection.js +323 -0
  241. package/{dist → src}/tabletoolbar.d.ts +2 -6
  242. package/src/tabletoolbar.js +63 -0
  243. package/{dist → src}/tableui.d.ts +1 -5
  244. package/src/tableui.js +335 -0
  245. package/{dist → src}/tableutils.d.ts +2 -6
  246. package/src/tableutils.js +1282 -0
  247. package/{dist → src}/tablewalker.d.ts +1 -5
  248. package/src/tablewalker.js +489 -0
  249. package/{dist → src}/ui/colorinputview.d.ts +2 -6
  250. package/src/ui/colorinputview.js +305 -0
  251. package/{dist → src}/ui/inserttableview.d.ts +2 -6
  252. package/src/ui/inserttableview.js +192 -0
  253. package/{dist → src}/utils/common.d.ts +2 -6
  254. package/src/utils/common.js +118 -0
  255. package/{dist → src}/utils/structure.d.ts +1 -5
  256. package/src/utils/structure.js +452 -0
  257. package/{dist → src}/utils/table-properties.d.ts +1 -5
  258. package/src/utils/table-properties.js +121 -0
  259. package/{dist → src}/utils/ui/contextualballoon.d.ts +2 -6
  260. package/src/utils/ui/contextualballoon.js +111 -0
  261. package/{dist → src}/utils/ui/table-properties.d.ts +2 -6
  262. package/src/utils/ui/table-properties.js +390 -0
  263. package/src/utils/ui/table-propertiesexperimental.d.ts +215 -0
  264. package/src/utils/ui/table-propertiesexperimental.js +391 -0
  265. package/{dist → src}/utils/ui/widget.d.ts +1 -5
  266. package/src/utils/ui/widget.js +56 -0
  267. package/theme/formrow-experimental.css +15 -0
  268. package/theme/formrow.css +0 -2
  269. package/theme/tablecellproperties-experimental.css +4 -0
  270. package/theme/tableform-experimental.css +61 -0
  271. package/theme/tableform.css +5 -1
  272. package/theme/tableproperties-experimental.css +78 -0
  273. package/theme/tableproperties.css +0 -60
  274. package/dist/tablecellproperties/tablecellpropertiesutils.d.ts +0 -22
@@ -0,0 +1,385 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ import { createEmptyTableCell } from '../utils/common.js';
6
+ import { getViewTableFromWrapper } from '../utils/structure.js';
7
+ import { first } from 'ckeditor5/src/utils.js';
8
+ /**
9
+ * Returns a function that converts the table view representation:
10
+ *
11
+ * ```xml
12
+ * <figure class="table"><table>...</table></figure>
13
+ * ```
14
+ *
15
+ * to the model representation:
16
+ *
17
+ * ```xml
18
+ * <table></table>
19
+ * ```
20
+ *
21
+ * @internal
22
+ */
23
+ export function upcastTableFigure() {
24
+ return (dispatcher) => {
25
+ dispatcher.on('element:figure', (evt, data, conversionApi) => {
26
+ // Do not convert if this is not a "table figure".
27
+ if (!conversionApi.consumable.test(data.viewItem, { name: true, classes: 'table' })) {
28
+ return;
29
+ }
30
+ // Find a table element inside the figure element.
31
+ const viewTable = getViewTableFromWrapper(data.viewItem);
32
+ // Do not convert if table element is absent or was already converted.
33
+ if (!viewTable || !conversionApi.consumable.test(viewTable, { name: true })) {
34
+ return;
35
+ }
36
+ // Consume the figure to prevent other converters from processing it again.
37
+ conversionApi.consumable.consume(data.viewItem, { name: true, classes: 'table' });
38
+ // Convert view table to model table.
39
+ const conversionResult = conversionApi.convertItem(viewTable, data.modelCursor);
40
+ // Get table element from conversion result.
41
+ const modelTable = first(conversionResult.modelRange.getItems());
42
+ // When table wasn't successfully converted then finish conversion.
43
+ if (!modelTable || !modelTable.is('element', 'table')) {
44
+ // Revert consumed figure so other features can convert it.
45
+ conversionApi.consumable.revert(data.viewItem, { name: true, classes: 'table' });
46
+ // If anyway some table content was converted, we have to pass the model range and cursor.
47
+ if (conversionResult.modelRange && !conversionResult.modelRange.isCollapsed) {
48
+ data.modelRange = conversionResult.modelRange;
49
+ data.modelCursor = conversionResult.modelCursor;
50
+ }
51
+ return;
52
+ }
53
+ conversionApi.convertChildren(data.viewItem, conversionApi.writer.createPositionAt(modelTable, 'end'));
54
+ conversionApi.updateConversionResult(modelTable, data);
55
+ });
56
+ };
57
+ }
58
+ /**
59
+ * View table element to model table element conversion helper.
60
+ *
61
+ * This conversion helper converts the table element as well as table rows.
62
+ *
63
+ * @returns Conversion helper.
64
+ * @internal
65
+ */
66
+ export function upcastTable() {
67
+ return (dispatcher) => {
68
+ dispatcher.on('element:table', (evt, data, conversionApi) => {
69
+ const viewTable = data.viewItem;
70
+ // When element was already consumed then skip it.
71
+ if (!conversionApi.consumable.test(viewTable, { name: true })) {
72
+ return;
73
+ }
74
+ const { rows, headingRows, headingColumns } = scanTable(viewTable);
75
+ // Only set attributes if values is greater then 0.
76
+ const attributes = {};
77
+ if (headingColumns) {
78
+ attributes.headingColumns = headingColumns;
79
+ }
80
+ if (headingRows) {
81
+ attributes.headingRows = headingRows;
82
+ }
83
+ const table = conversionApi.writer.createElement('table', attributes);
84
+ if (!conversionApi.safeInsert(table, data.modelCursor)) {
85
+ return;
86
+ }
87
+ conversionApi.consumable.consume(viewTable, { name: true });
88
+ // Upcast table rows in proper order (heading rows first).
89
+ rows.forEach(row => conversionApi.convertItem(row, conversionApi.writer.createPositionAt(table, 'end')));
90
+ // Convert everything else.
91
+ conversionApi.convertChildren(viewTable, conversionApi.writer.createPositionAt(table, 'end'));
92
+ // Create one row and one table cell for empty table.
93
+ if (table.isEmpty) {
94
+ const row = conversionApi.writer.createElement('tableRow');
95
+ conversionApi.writer.insert(row, conversionApi.writer.createPositionAt(table, 'end'));
96
+ createEmptyTableCell(conversionApi.writer, conversionApi.writer.createPositionAt(row, 'end'));
97
+ }
98
+ conversionApi.updateConversionResult(table, data);
99
+ });
100
+ };
101
+ }
102
+ /**
103
+ * A conversion helper that skips empty <tr> elements from upcasting at the beginning of the table.
104
+ *
105
+ * An empty row is considered a table model error but when handling clipboard data there could be rows that contain only row-spanned cells
106
+ * and empty TR-s are used to maintain the table structure (also {@link module:table/tablewalker~TableWalker} assumes that there are only
107
+ * rows that have related `tableRow` elements).
108
+ *
109
+ * *Note:* Only the first empty rows are removed because they have no meaning and it solves the issue
110
+ * of an improper table with all empty rows.
111
+ *
112
+ * @internal
113
+ * @returns Conversion helper.
114
+ */
115
+ export function skipEmptyTableRow() {
116
+ return (dispatcher) => {
117
+ dispatcher.on('element:tr', (evt, data) => {
118
+ if (data.viewItem.isEmpty && data.modelCursor.index == 0) {
119
+ evt.stop();
120
+ }
121
+ }, { priority: 'high' });
122
+ };
123
+ }
124
+ /**
125
+ * A converter that ensures an empty paragraph is inserted in a table cell if no other content was converted.
126
+ *
127
+ * @internal
128
+ * @returns Conversion helper.
129
+ */
130
+ export function ensureParagraphInTableCell(elementName) {
131
+ return (dispatcher) => {
132
+ dispatcher.on(`element:${elementName}`, (evt, data, { writer }) => {
133
+ // The default converter will create a model range on converted table cell.
134
+ if (!data.modelRange) {
135
+ return;
136
+ }
137
+ const tableCell = data.modelRange.start.nodeAfter;
138
+ const modelCursor = writer.createPositionAt(tableCell, 0);
139
+ // Ensure a paragraph in the model for empty table cells for converted table cells.
140
+ if (data.viewItem.isEmpty) {
141
+ writer.insertElement('paragraph', modelCursor);
142
+ return;
143
+ }
144
+ const childNodes = Array.from(tableCell.getChildren());
145
+ // In case there are only markers inside the table cell then move them to the paragraph.
146
+ if (childNodes.every(node => node.is('element', '$marker'))) {
147
+ const paragraph = writer.createElement('paragraph');
148
+ writer.insert(paragraph, writer.createPositionAt(tableCell, 0));
149
+ for (const node of childNodes) {
150
+ writer.move(writer.createRangeOn(node), writer.createPositionAt(paragraph, 'end'));
151
+ }
152
+ }
153
+ }, { priority: 'low' });
154
+ };
155
+ }
156
+ /**
157
+ * Scans table rows and extracts required metadata from the table:
158
+ *
159
+ * headingRows - The number of rows that go as table headers.
160
+ * headingColumns - The maximum number of row headings.
161
+ * rows - Sorted `<tr>` elements as they should go into the model - ie. if `<thead>` is inserted after `<tbody>` in the view.
162
+ *
163
+ * @param viewTable The view table element.
164
+ * @returns The table metadata.
165
+ */
166
+ function scanTable(viewTable) {
167
+ let headingColumns = undefined;
168
+ let shouldAccumulateHeadingRows = true;
169
+ // The `<tbody>` and `<thead>` sections in the DOM do not have to be in order `<thead>` -> `<tbody>` and there might be more than one
170
+ // of them.
171
+ // As the model does not have these sections, rows from different sections must be sorted.
172
+ // For example, below is a valid HTML table:
173
+ //
174
+ // <table>
175
+ // <tbody><tr><td>2</td></tr></tbody>
176
+ // <thead><tr><td>1</td></tr></thead>
177
+ // <tbody><tr><td>3</td></tr></tbody>
178
+ // </table>
179
+ //
180
+ // But browsers will render rows in order as: 1 as the heading and 2 and 3 as the body.
181
+ const headRows = [];
182
+ const bodyRows = [];
183
+ // Currently the editor does not support more then one <thead> section.
184
+ // Only the first <thead> from the view will be used as a heading row and the others will be converted to body rows.
185
+ let firstTheadElement;
186
+ for (const tableChild of Array.from(viewTable.getChildren())) {
187
+ // Only `<thead>`, `<tbody>` & `<tfoot>` from allowed table children can have `<tr>`s.
188
+ // The else is for future purposes (mainly `<caption>`).
189
+ if (tableChild.name !== 'tbody' && tableChild.name !== 'thead' && tableChild.name !== 'tfoot') {
190
+ continue;
191
+ }
192
+ // Save the first `<thead>` in the table as table header - all other ones will be converted to table body rows.
193
+ if (tableChild.name === 'thead' && !firstTheadElement) {
194
+ shouldAccumulateHeadingRows = true;
195
+ firstTheadElement = tableChild;
196
+ }
197
+ // There might be some extra empty text nodes between the `<tr>`s.
198
+ // Make sure further code operates on `tr`s only. (#145)
199
+ const trs = Array.from(tableChild.getChildren()).filter((el) => el.is('element', 'tr'));
200
+ // Keep tracking of the previous row columns count to improve detection of heading rows.
201
+ let maxPrevColumns = null;
202
+ for (const tr of trs) {
203
+ const trColumns = Array
204
+ .from(tr.getChildren())
205
+ .filter(el => el.is('element', 'td') || el.is('element', 'th'));
206
+ // This <tr> is a child of a first <thead> element.
207
+ if ((firstTheadElement && tableChild === firstTheadElement) ||
208
+ (tableChild.name === 'tbody' &&
209
+ trColumns.length > 0 &&
210
+ // These conditions handles the case when the first column is a <th> element and it's the only column in the row.
211
+ // This case is problematic because it's not clear if this row should be a heading row or not, as it may be result
212
+ // of the cell span from the previous row.
213
+ // Issue: https://github.com/ckeditor/ckeditor5/issues/17556
214
+ (maxPrevColumns === null || trColumns.length === maxPrevColumns) &&
215
+ trColumns.every(e => e.is('element', 'th')) &&
216
+ // If there is at least one "normal" table row between heading rows, then stop accumulating heading rows.
217
+ shouldAccumulateHeadingRows)) {
218
+ headRows.push(tr);
219
+ shouldAccumulateHeadingRows = true;
220
+ }
221
+ else {
222
+ bodyRows.push(tr);
223
+ shouldAccumulateHeadingRows = false;
224
+ }
225
+ // We use the maximum number of columns to avoid false positives when detecting
226
+ // multiple rows with single column within `rowspan`. Without it the last row of `rowspan=3`
227
+ // would be detected as a heading row because it has only one column (identical to the previous row).
228
+ maxPrevColumns = Math.max(maxPrevColumns || 0, trColumns.length);
229
+ }
230
+ }
231
+ // Generate the cell matrix so we can calculate the heading columns.
232
+ const bodyMatrix = generateCellMatrix(bodyRows);
233
+ for (const rowSlots of bodyMatrix) {
234
+ // Look for the first non-`<th>` entry (either a `<td>` or a missing cell).
235
+ let index = 0;
236
+ while (index < rowSlots.length) {
237
+ if (rowSlots[index]?.name !== 'th') {
238
+ break;
239
+ }
240
+ index += 1;
241
+ }
242
+ // Update headingColumns.
243
+ if (headingColumns === undefined || index < headingColumns) {
244
+ headingColumns = index;
245
+ }
246
+ }
247
+ return {
248
+ headingRows: headRows.length,
249
+ headingColumns: headingColumns || 0,
250
+ rows: [...headRows, ...bodyRows]
251
+ };
252
+ }
253
+ /**
254
+ * Takes an array of `<tr>` elements and generates a "matrix" (square
255
+ * two-dimensional array) describing which `<th>`s and `<td>`s fill which
256
+ * "slots", factoring in `rowspan`s and `colspan`s. For example, given
257
+ *
258
+ * ```xml
259
+ * <table>
260
+ * <tr> <td>11</td> <td rowspan="2">12-22</td> <td>13</td> </tr>
261
+ * <tr> <td>21</td> <td>23</td> </tr>
262
+ * <tr> <td colspan="2">31-32</td> <td>33</rd> </tr>
263
+ * </table>
264
+ * ```
265
+ *
266
+ * The result would be (with cell elements' text content in place of the element
267
+ * objects for readability):
268
+ *
269
+ * ```js
270
+ * [
271
+ * [ '11', '12-22', '13' ],
272
+ * [ '21', '12-22', '23' ],
273
+ * [ '31-32', '31-32', '33' ],
274
+ * ]
275
+ * ```
276
+ *
277
+ * This allows for a computation of heading columns that factors in the case
278
+ * where a cell from a previous rows with a `rowspan` attribute effectively adds
279
+ * an additional header cell to a subsequent row.
280
+ *
281
+ * There are also cases where cells are "missing" from a row. A simple one is
282
+ * the case where a row simply has fewer cells than another row in the same
283
+ * table. But another is one where a row has a cell with a `rowspan` that
284
+ * effectively adds a cell to a subsequent row "off the end" of the row. In this
285
+ * case, there will be a `null` value instead of an element object in that
286
+ * position. For example,
287
+ *
288
+ * ```xml
289
+ * <table>
290
+ * <tr> <td>11</td> <td>12</td> <td rowspan="2">13-23</td> </tr>
291
+ * <tr> <td>21</td> </tr>
292
+ * <tr> <td>31</td> </tr>
293
+ * </table>
294
+ * ```
295
+ *
296
+ * would result in
297
+ *
298
+ * ```js
299
+ * [
300
+ * [ '11', '12', '13-23' ],
301
+ * [ '21', null, '13-23' ],
302
+ * [ '31', null, null ]
303
+ * ]
304
+ * ```
305
+ *
306
+ * @param trs the array of `<tr>` elements
307
+ * @returns the cell matrix
308
+ */
309
+ function generateCellMatrix(trs) {
310
+ // As we iterate, we keep track of cells with rowspans >1 so later rows can
311
+ // factor them in. This trackes any such cells from previous rows.
312
+ let prevRowspans = new Map();
313
+ // This is the maximum number of columns we've encountered.
314
+ let maxColumns = 0;
315
+ const slots = trs.map(tr => {
316
+ // This will be the slots that are in this row, including cells from
317
+ // previous rows with a big enough "rowspan" to affect this row.
318
+ const curSlots = [];
319
+ // Get the cell elements
320
+ const children = Array.from(tr.getChildren())
321
+ .filter(child => child.name === 'th' || child.name === 'td');
322
+ // This will be any cells in this row that have a rowspan >1, so we can
323
+ // combine it with `prevRowspans` when we're done processing this row.
324
+ const curRowspans = new Map();
325
+ // We need to process all the cells in this row, but also previous rows'
326
+ // cells with rowspans might add additional slots to the end of this row, so
327
+ // we need to iterate until we've both consumed all the children _and_
328
+ // filled out slots to the max number of columns we've encountered so far.
329
+ while (children.length || curSlots.length < maxColumns) {
330
+ const rowSpan = prevRowspans.get(curSlots.length);
331
+ if (rowSpan && rowSpan.remaining > 0) {
332
+ // We have a cell at this index in a previous row whose rowspan extends
333
+ // it into this row, so we insert a copy of it here.
334
+ curSlots.push(rowSpan.cell);
335
+ }
336
+ else {
337
+ // See if we have more cells in the row.
338
+ const cell = children.shift();
339
+ if (cell) {
340
+ // We do, so process it
341
+ const colspan = parseInt(cell.getAttribute('colspan') || '1');
342
+ const rowspan = parseInt(cell.getAttribute('rowspan') || '1');
343
+ // Process this cell as many times as needed according to its colspan.
344
+ for (let i = 0; i < colspan; i++) {
345
+ // if we have a >1 rowspan, create a record in the rowSpans map for
346
+ // this column index keeping track of it.
347
+ if (rowspan > 1) {
348
+ curRowspans.set(curSlots.length, { cell, remaining: rowspan - 1 });
349
+ }
350
+ curSlots.push(cell);
351
+ }
352
+ }
353
+ else {
354
+ // No remaining children in this row, so no cell in this slot.
355
+ curSlots.push(null);
356
+ continue;
357
+ }
358
+ }
359
+ }
360
+ // Now update the row spans. In weird edge cases where colspan and rowspan
361
+ // conflict, we can end up with a cell in a column in this row that
362
+ // "truncates" a row-spanning cell from a previous column, so make sure in
363
+ // those cases, the value in `curRowspans` always "wins". We do this by
364
+ // copying (and decrementing) values from `prevRowspans` into `curRowspans`
365
+ // as long as there is no conflict, and then re-assigning `prevRowspans`.
366
+ for (const [index, entry] of prevRowspans.entries()) {
367
+ entry.remaining -= 1;
368
+ if (entry.remaining > 0 && !curRowspans.has(index)) {
369
+ curRowspans.set(index, entry);
370
+ }
371
+ }
372
+ prevRowspans = curRowspans;
373
+ // Finally, update `maxColumns`.
374
+ maxColumns = Math.max(maxColumns, curSlots.length);
375
+ return curSlots;
376
+ });
377
+ // Now expand any rows that have fewer than `maxColumns` with nulls so we have
378
+ // a proper matrix.
379
+ for (const rowSlots of slots) {
380
+ while (rowSlots.length < maxColumns) {
381
+ rowSlots.push(null);
382
+ }
383
+ }
384
+ return slots;
385
+ }
@@ -1,7 +1,3 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
1
  /**
6
2
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
7
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
@@ -38,6 +34,10 @@ export { TableUtils, type TableIndexesObject } from './tableutils.js';
38
34
  export { TableColumnResize } from './tablecolumnresize.js';
39
35
  export { TableColumnResizeEditing } from './tablecolumnresize/tablecolumnresizeediting.js';
40
36
  export { TableWidthsCommand, type TableWidthsCommandOptions } from './tablecolumnresize/tablewidthscommand.js';
37
+ export { TablePropertiesUIExperimental } from './tableproperties/tablepropertiesuiexperimental.js';
38
+ export { TablePropertiesViewExperimental, type TablePropertiesViewOptionsExperimental } from './tableproperties/ui/tablepropertiesviewexperimental.js';
39
+ export { TableCellPropertiesUIExperimental } from './tablecellproperties/tablecellpropertiesuiexperimental.js';
40
+ export { TableCellPropertiesViewExperimental, type TableCellPropertiesViewOptionsExperimental } from './tablecellproperties/ui/tablecellpropertiesviewexperimental.js';
41
41
  export { InsertColumnCommand } from './commands/insertcolumncommand.js';
42
42
  export { InsertRowCommand } from './commands/insertrowcommand.js';
43
43
  export { InsertTableCommand } from './commands/inserttablecommand.js';
@@ -70,8 +70,7 @@ export { TableBorderWidthCommand } from './tableproperties/commands/tableborderw
70
70
  export { TableHeightCommand } from './tableproperties/commands/tableheightcommand.js';
71
71
  export { TableWidthCommand } from './tableproperties/commands/tablewidthcommand.js';
72
72
  export { TablePropertyCommand, type TablePropertyCommandExecuteOptions } from './tableproperties/commands/tablepropertycommand.js';
73
- export { TableCellTypeCommand } from './tablecellproperties/commands/tablecelltypecommand.js';
74
- export { isTableHeaderCellType, type TableCellType } from './tablecellproperties/tablecellpropertiesutils.js';
73
+ export { TableCellTypeCommand, type TableCellType } from './tablecellproperties/commands/tablecelltypecommand.js';
75
74
  export { TableCellPropertyCommand, type TableCellPropertyCommandAfterExecuteEvent, type TableCellPropertyCommandAfterExecuteEventData } from './tablecellproperties/commands/tablecellpropertycommand.js';
76
75
  export type { ViewDocumentTableMouseMoveEvent, ViewDocumentTableMouseLeaveEvent } from './tablemouse/mouseeventsobserver.js';
77
76
  export type { TableConfig, TableAlignmentConfig, TablePropertiesConfig, TablePropertiesOptions, TableCellPropertiesConfig, TableColorConfig, TableCellPropertiesOptions, TableLayoutConfig, TableCaptionConfig, TableType } from './tableconfig.js';
package/src/index.js ADDED
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module table
7
+ */
8
+ export { PlainTableOutput } from './plaintableoutput.js';
9
+ export { Table } from './table.js';
10
+ export { TableWalker } from './tablewalker.js';
11
+ export { TableEditing } from './tableediting.js';
12
+ export { TableUI } from './tableui.js';
13
+ export { TableToolbar } from './tabletoolbar.js';
14
+ export { TableCellProperties } from './tablecellproperties.js';
15
+ export { TableCellPropertiesEditing } from './tablecellproperties/tablecellpropertiesediting.js';
16
+ export { TableCellPropertiesUI } from './tablecellproperties/tablecellpropertiesui.js';
17
+ export { TableCellPropertiesView } from './tablecellproperties/ui/tablecellpropertiesview.js';
18
+ export { TableCellWidthEditing } from './tablecellwidth/tablecellwidthediting.js';
19
+ export { TableLayout } from './tablelayout.js';
20
+ export { TableLayoutEditing } from './tablelayout/tablelayoutediting.js';
21
+ export { TableLayoutUI } from './tablelayout/tablelayoutui.js';
22
+ export { TableProperties } from './tableproperties.js';
23
+ export { TablePropertiesEditing } from './tableproperties/tablepropertiesediting.js';
24
+ export { TablePropertiesUI } from './tableproperties/tablepropertiesui.js';
25
+ export { TablePropertiesView } from './tableproperties/ui/tablepropertiesview.js';
26
+ export { TableCaption } from './tablecaption.js';
27
+ export { TableCaptionEditing } from './tablecaption/tablecaptionediting.js';
28
+ export { TableCaptionUI } from './tablecaption/tablecaptionui.js';
29
+ export { TableClipboard } from './tableclipboard.js';
30
+ export { TableMouse } from './tablemouse.js';
31
+ export { TableKeyboard } from './tablekeyboard.js';
32
+ export { TableSelection } from './tableselection.js';
33
+ export { TableUtils } from './tableutils.js';
34
+ export { TableColumnResize } from './tablecolumnresize.js';
35
+ export { TableColumnResizeEditing } from './tablecolumnresize/tablecolumnresizeediting.js';
36
+ export { TableWidthsCommand } from './tablecolumnresize/tablewidthscommand.js';
37
+ // [experimental] Remove in the v48.
38
+ export { TablePropertiesUIExperimental } from './tableproperties/tablepropertiesuiexperimental.js';
39
+ export { TablePropertiesViewExperimental } from './tableproperties/ui/tablepropertiesviewexperimental.js';
40
+ export { TableCellPropertiesUIExperimental } from './tablecellproperties/tablecellpropertiesuiexperimental.js';
41
+ export { TableCellPropertiesViewExperimental } from './tablecellproperties/ui/tablecellpropertiesviewexperimental.js';
42
+ export { InsertColumnCommand } from './commands/insertcolumncommand.js';
43
+ export { InsertRowCommand } from './commands/insertrowcommand.js';
44
+ export { InsertTableCommand } from './commands/inserttablecommand.js';
45
+ export { InsertTableLayoutCommand } from './commands/inserttablelayoutcommand.js';
46
+ export { TableTypeCommand } from './tablelayout/commands/tabletypecommand.js';
47
+ export { MergeCellCommand } from './commands/mergecellcommand.js';
48
+ export { MergeCellsCommand } from './commands/mergecellscommand.js';
49
+ export { RemoveColumnCommand } from './commands/removecolumncommand.js';
50
+ export { RemoveRowCommand } from './commands/removerowcommand.js';
51
+ export { SelectColumnCommand } from './commands/selectcolumncommand.js';
52
+ export { SelectRowCommand } from './commands/selectrowcommand.js';
53
+ export { SetHeaderColumnCommand } from './commands/setheadercolumncommand.js';
54
+ export { SetHeaderRowCommand } from './commands/setheaderrowcommand.js';
55
+ export { SplitCellCommand } from './commands/splitcellcommand.js';
56
+ export { ToggleTableCaptionCommand } from './tablecaption/toggletablecaptioncommand.js';
57
+ export { TableCellBackgroundColorCommand } from './tablecellproperties/commands/tablecellbackgroundcolorcommand.js';
58
+ export { TableCellBorderColorCommand } from './tablecellproperties/commands/tablecellbordercolorcommand.js';
59
+ export { TableCellBorderStyleCommand } from './tablecellproperties/commands/tablecellborderstylecommand.js';
60
+ export { TableCellBorderWidthCommand } from './tablecellproperties/commands/tablecellborderwidthcommand.js';
61
+ export { TableCellHeightCommand } from './tablecellproperties/commands/tablecellheightcommand.js';
62
+ export { TableCellHorizontalAlignmentCommand } from './tablecellproperties/commands/tablecellhorizontalalignmentcommand.js';
63
+ export { TableCellPaddingCommand } from './tablecellproperties/commands/tablecellpaddingcommand.js';
64
+ export { TableCellVerticalAlignmentCommand } from './tablecellproperties/commands/tablecellverticalalignmentcommand.js';
65
+ export { TableCellWidthCommand } from './tablecellwidth/commands/tablecellwidthcommand.js';
66
+ export { TableAlignmentCommand } from './tableproperties/commands/tablealignmentcommand.js';
67
+ export { TableBackgroundColorCommand } from './tableproperties/commands/tablebackgroundcolorcommand.js';
68
+ export { TableBorderColorCommand } from './tableproperties/commands/tablebordercolorcommand.js';
69
+ export { TableBorderStyleCommand } from './tableproperties/commands/tableborderstylecommand.js';
70
+ export { TableBorderWidthCommand } from './tableproperties/commands/tableborderwidthcommand.js';
71
+ export { TableHeightCommand } from './tableproperties/commands/tableheightcommand.js';
72
+ export { TableWidthCommand } from './tableproperties/commands/tablewidthcommand.js';
73
+ export { TablePropertyCommand } from './tableproperties/commands/tablepropertycommand.js';
74
+ export { TableCellTypeCommand } from './tablecellproperties/commands/tablecelltypecommand.js';
75
+ export { TableCellPropertyCommand } from './tablecellproperties/commands/tablecellpropertycommand.js';
76
+ // Internal exports.
77
+ export { downcastTable as _downcastTable, downcastRow as _downcastTableRow, downcastCell as _downcastTableCell, convertParagraphInTableCell as _convertParagraphInTableCell, isSingleParagraphWithoutAttributes as _isSingleTableParagraphWithoutAttributes } from './converters/downcast.js';
78
+ export { injectTableCaptionPostFixer as _injectTableCaptionPostFixer } from './converters/table-caption-post-fixer.js';
79
+ export { injectTableCellParagraphPostFixer as _injectTableCellParagraphPostFixer } from './converters/table-cell-paragraph-post-fixer.js';
80
+ export { tableCellRefreshHandler as _tableCellRefreshHandler } from './converters/table-cell-refresh-handler.js';
81
+ export { tableHeadingsRefreshHandler as _tableHeadingsRefreshHandler } from './converters/table-headings-refresh-handler.js';
82
+ export { injectTableLayoutPostFixer as _injectTableLayoutPostFixer } from './converters/table-layout-post-fixer.js';
83
+ export { upcastStyleToAttribute as _upcastNormalizedTableStyleToAttribute, upcastBorderStyles as _upcastTableBorderStyles, downcastAttributeToStyle as _downcastTableAttributeToStyle, downcastTableAttribute as _downcastTableAttribute, getDefaultValueAdjusted as _getDefaultTableValueAdjusted } from './converters/tableproperties.js';
84
+ export { upcastTableFigure as _upcastTableFigure, upcastTable as _upcastTable, skipEmptyTableRow as _skipEmptyTableRow, ensureParagraphInTableCell as _ensureParagraphInTableCell } from './converters/upcasttable.js';
85
+ export { isTable as _isTableModelElement, getCaptionFromTableModelElement as _getTableCaptionFromModelElement, getCaptionFromModelSelection as _getTableCaptionFromModelSelection, matchTableCaptionViewElement as _matchTableCaptionViewElement } from './tablecaption/utils.js';
86
+ export { COLUMN_MIN_WIDTH_AS_PERCENTAGE as _TABLE_COLUMN_MIN_WIDTH_AS_PERCENTAGE, COLUMN_MIN_WIDTH_IN_PIXELS as _TABLE_COLUMN_MIN_WIDTH_IN_PIXELS, COLUMN_WIDTH_PRECISION as _TABLE_COLUMN_WIDTH_PRECISION, COLUMN_RESIZE_DISTANCE_THRESHOLD as _TABLE_COLUMN_RESIZE_DISTANCE_THRESHOLD } from './tablecolumnresize/constants.js';
87
+ export { upcastColgroupElement as _upcastTableColgroupElement, downcastTableResizedClass as _downcastTableResizedClass } from './tablecolumnresize/converters.js';
88
+ export { getChangedResizedTables as _getChangedResizedTables, getColumnMinWidthAsPercentage as _getTableColumnMinWidthAsPercentage, getTableWidthInPixels as _getTableWidthInPixels, getElementWidthInPixels as _getElementWidthInPixels, getColumnEdgesIndexes as _getTableColumnEdgesIndexes, toPrecision as _toPrecision, clamp as _clamp, createFilledArray as _createFilledArray, sumArray as _sumArray, normalizeColumnWidths as _normalizeTableColumnWidths, getDomCellOuterWidth as _getDomTableCellOuterWidth, updateColumnElements as _updateTableColumnElements, getColumnGroupElement as _getTableColumnGroupElement, getTableColumnElements as _getTableColumnElements, getTableColumnsWidths as _getTableColumnsWidths, translateColSpanAttribute as _translateTableColspanAttribute } from './tablecolumnresize/utils.js';
89
+ export { MouseEventsObserver as _TableMouseEventsObserver } from './tablemouse/mouseeventsobserver.js';
90
+ export { ColorInputView as _TableColorInputView } from './ui/colorinputview.js';
91
+ export { InsertTableView as _InsertTableView } from './ui/inserttableview.js';
92
+ export { updateNumericAttribute as _updateTableNumericAttribute, createEmptyTableCell as _createEmptyTableCell, isHeadingColumnCell as _isTableHeadingColumnCell, enableProperty as _enableTableCellProperty, getSelectionAffectedTable as _getSelectionAffectedTable } from './utils/common.js';
93
+ export { cropTableToDimensions as _cropTableToDimensions, getVerticallyOverlappingCells as _getVerticallyOverlappingTableCells, splitHorizontally as _splitTableCellHorizontally, getHorizontallyOverlappingCells as _getHorizontallyOverlappingTableCells, splitVertically as _splitTableCellVertically, trimTableCellIfNeeded as _trimTableCellIfNeeded, removeEmptyColumns as _removeEmptyTableColumns, removeEmptyRows as _removeEmptyTableRows, removeEmptyRowsColumns as _removeEmptyTableRowsColumns, adjustLastRowIndex as _adjustLastTableRowIndex, adjustLastColumnIndex as _adjustLastTableColumnIndex } from './utils/structure.js';
94
+ export { getSingleValue as _getTableBorderBoxSingleValue, addDefaultUnitToNumericValue as _addDefaultUnitToNumericValue, getNormalizedDefaultProperties as _getNormalizedDefaultTableBaseProperties, getNormalizedDefaultTableProperties as _getNormalizedDefaultTableProperties, getNormalizedDefaultCellProperties as _getNormalizedDefaultTableCellProperties } from './utils/table-properties.js';
95
+ export { repositionContextualBalloon as _repositionTableContextualBalloon, getBalloonTablePositionData as _getBalloonTablePositionData, getBalloonCellPositionData as _getBalloonTableCellPositionData } from './utils/ui/contextualballoon.js';
96
+ export { getBorderStyleLabels as _getBorderTableStyleLabels, getLocalizedColorErrorText as _getLocalizedTableColorErrorText, getLocalizedLengthErrorText as _getLocalizedTableLengthErrorText, colorFieldValidator as _colorTableFieldValidator, lengthFieldValidator as _lengthTableFieldValidator, lineWidthFieldValidator as _lineWidthTableFieldValidator, getBorderStyleDefinitions as _getTableOrCellBorderStyleDefinitions, fillToolbar as _fillTableOrCellToolbar, defaultColors as _TABLE_DEFAULT_COLORS, getLabeledColorInputCreator as _getLabeledTableColorInputCreator } from './utils/ui/table-properties.js';
97
+ export { getSelectionAffectedTableWidget as _getSelectionAffectedTableWidget, getSelectedTableWidget as _getSelectedTableWidget, getTableWidgetAncestor as _getTableWidgetAncestor } from './utils/ui/widget.js';
98
+ import './augmentation.js';
@@ -1,7 +1,3 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
1
  /**
6
2
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
7
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
@@ -9,7 +5,7 @@
9
5
  /**
10
6
  * @module table/plaintableoutput
11
7
  */
12
- import { Plugin } from '@ckeditor/ckeditor5-core';
8
+ import { Plugin } from 'ckeditor5/src/core.js';
13
9
  import { Table } from './table.js';
14
10
  /**
15
11
  * The plain table output feature.
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module table/plaintableoutput
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { Table } from './table.js';
10
+ /**
11
+ * The plain table output feature.
12
+ *
13
+ * This feature strips the `<figure>` tag from the table data. This is because this tag is not supported
14
+ * by most popular email clients and removing it ensures compatibility.
15
+ */
16
+ export class PlainTableOutput extends Plugin {
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get pluginName() {
21
+ return 'PlainTableOutput';
22
+ }
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get isOfficialPlugin() {
27
+ return true;
28
+ }
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ static get requires() {
33
+ return [Table];
34
+ }
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ init() {
39
+ const editor = this.editor;
40
+ editor.conversion.for('upcast').add(dispatcher => {
41
+ dispatcher.on('element:table', (evt, data, conversionApi) => {
42
+ // It's not necessary to upcast the `table` class. This class was only added in data downcast
43
+ // to center a plain table in the editor output.
44
+ // See: https://github.com/ckeditor/ckeditor5/issues/17888.
45
+ conversionApi.consumable.consume(data.viewItem, { classes: 'table' });
46
+ });
47
+ });
48
+ }
49
+ }
@@ -1,7 +1,3 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
1
  /**
6
2
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
7
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
@@ -9,8 +5,8 @@
9
5
  /**
10
6
  * @module table/table
11
7
  */
12
- import { Plugin } from '@ckeditor/ckeditor5-core';
13
- import { Widget } from '@ckeditor/ckeditor5-widget';
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { Widget } from 'ckeditor5/src/widget.js';
14
10
  import { TableEditing } from './tableediting.js';
15
11
  import { TableUI } from './tableui.js';
16
12
  import { TableSelection } from './tableselection.js';
package/src/table.js ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module table/table
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { Widget } from 'ckeditor5/src/widget.js';
10
+ import { TableEditing } from './tableediting.js';
11
+ import { TableUI } from './tableui.js';
12
+ import { TableSelection } from './tableselection.js';
13
+ import { TableClipboard } from './tableclipboard.js';
14
+ import { TableKeyboard } from './tablekeyboard.js';
15
+ import { TableMouse } from './tablemouse.js';
16
+ import '../theme/table.css';
17
+ /**
18
+ * The table plugin.
19
+ *
20
+ * For a detailed overview, check the {@glink features/tables/tables Table feature documentation}.
21
+ *
22
+ * This is a "glue" plugin that loads the following table features:
23
+ *
24
+ * * {@link module:table/tableediting~TableEditing editing feature},
25
+ * * {@link module:table/tableselection~TableSelection selection feature},
26
+ * * {@link module:table/tablekeyboard~TableKeyboard keyboard navigation feature},
27
+ * * {@link module:table/tablemouse~TableMouse mouse selection feature},
28
+ * * {@link module:table/tableclipboard~TableClipboard clipboard feature},
29
+ * * {@link module:table/tableui~TableUI UI feature}.
30
+ */
31
+ export class Table extends Plugin {
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ static get requires() {
36
+ return [TableEditing, TableUI, TableSelection, TableMouse, TableKeyboard, TableClipboard, Widget];
37
+ }
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ static get pluginName() {
42
+ return 'Table';
43
+ }
44
+ /**
45
+ * @inheritDoc
46
+ */
47
+ static get isOfficialPlugin() {
48
+ return true;
49
+ }
50
+ }