@ckeditor/ckeditor5-table 41.3.0 → 41.4.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 (205) hide show
  1. package/dist/index-content.css +55 -0
  2. package/dist/index-editor.css +150 -0
  3. package/dist/index.css +362 -0
  4. package/dist/index.css.map +1 -0
  5. package/dist/index.js +10464 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/translations/ar.d.ts +8 -0
  8. package/dist/translations/ar.js +5 -0
  9. package/dist/translations/az.d.ts +8 -0
  10. package/dist/translations/az.js +5 -0
  11. package/dist/translations/bg.d.ts +8 -0
  12. package/dist/translations/bg.js +5 -0
  13. package/dist/translations/bn.d.ts +8 -0
  14. package/dist/translations/bn.js +5 -0
  15. package/dist/translations/ca.d.ts +8 -0
  16. package/dist/translations/ca.js +5 -0
  17. package/dist/translations/cs.d.ts +8 -0
  18. package/dist/translations/cs.js +5 -0
  19. package/dist/translations/da.d.ts +8 -0
  20. package/dist/translations/da.js +5 -0
  21. package/dist/translations/de-ch.d.ts +8 -0
  22. package/dist/translations/de-ch.js +5 -0
  23. package/dist/translations/de.d.ts +8 -0
  24. package/dist/translations/de.js +5 -0
  25. package/dist/translations/el.d.ts +8 -0
  26. package/dist/translations/el.js +5 -0
  27. package/dist/translations/en-au.d.ts +8 -0
  28. package/dist/translations/en-au.js +5 -0
  29. package/dist/translations/en-gb.d.ts +8 -0
  30. package/dist/translations/en-gb.js +5 -0
  31. package/dist/translations/en.d.ts +8 -0
  32. package/dist/translations/en.js +5 -0
  33. package/dist/translations/es.d.ts +8 -0
  34. package/dist/translations/es.js +5 -0
  35. package/dist/translations/et.d.ts +8 -0
  36. package/dist/translations/et.js +5 -0
  37. package/dist/translations/fa.d.ts +8 -0
  38. package/dist/translations/fa.js +5 -0
  39. package/dist/translations/fi.d.ts +8 -0
  40. package/dist/translations/fi.js +5 -0
  41. package/dist/translations/fr.d.ts +8 -0
  42. package/dist/translations/fr.js +5 -0
  43. package/dist/translations/gl.d.ts +8 -0
  44. package/dist/translations/gl.js +5 -0
  45. package/dist/translations/he.d.ts +8 -0
  46. package/dist/translations/he.js +5 -0
  47. package/dist/translations/hi.d.ts +8 -0
  48. package/dist/translations/hi.js +5 -0
  49. package/dist/translations/hr.d.ts +8 -0
  50. package/dist/translations/hr.js +5 -0
  51. package/dist/translations/hu.d.ts +8 -0
  52. package/dist/translations/hu.js +5 -0
  53. package/dist/translations/hy.d.ts +8 -0
  54. package/dist/translations/hy.js +5 -0
  55. package/dist/translations/id.d.ts +8 -0
  56. package/dist/translations/id.js +5 -0
  57. package/dist/translations/it.d.ts +8 -0
  58. package/dist/translations/it.js +5 -0
  59. package/dist/translations/ja.d.ts +8 -0
  60. package/dist/translations/ja.js +5 -0
  61. package/dist/translations/ko.d.ts +8 -0
  62. package/dist/translations/ko.js +5 -0
  63. package/dist/translations/ku.d.ts +8 -0
  64. package/dist/translations/ku.js +5 -0
  65. package/dist/translations/lt.d.ts +8 -0
  66. package/dist/translations/lt.js +5 -0
  67. package/dist/translations/lv.d.ts +8 -0
  68. package/dist/translations/lv.js +5 -0
  69. package/dist/translations/ms.d.ts +8 -0
  70. package/dist/translations/ms.js +5 -0
  71. package/dist/translations/nb.d.ts +8 -0
  72. package/dist/translations/nb.js +5 -0
  73. package/dist/translations/ne.d.ts +8 -0
  74. package/dist/translations/ne.js +5 -0
  75. package/dist/translations/nl.d.ts +8 -0
  76. package/dist/translations/nl.js +5 -0
  77. package/dist/translations/no.d.ts +8 -0
  78. package/dist/translations/no.js +5 -0
  79. package/dist/translations/pl.d.ts +8 -0
  80. package/dist/translations/pl.js +5 -0
  81. package/dist/translations/pt-br.d.ts +8 -0
  82. package/dist/translations/pt-br.js +5 -0
  83. package/dist/translations/pt.d.ts +8 -0
  84. package/dist/translations/pt.js +5 -0
  85. package/dist/translations/ro.d.ts +8 -0
  86. package/dist/translations/ro.js +5 -0
  87. package/dist/translations/ru.d.ts +8 -0
  88. package/dist/translations/ru.js +5 -0
  89. package/dist/translations/sk.d.ts +8 -0
  90. package/dist/translations/sk.js +5 -0
  91. package/dist/translations/sl.d.ts +8 -0
  92. package/dist/translations/sl.js +5 -0
  93. package/dist/translations/sq.d.ts +8 -0
  94. package/dist/translations/sq.js +5 -0
  95. package/dist/translations/sr-latn.d.ts +8 -0
  96. package/dist/translations/sr-latn.js +5 -0
  97. package/dist/translations/sr.d.ts +8 -0
  98. package/dist/translations/sr.js +5 -0
  99. package/dist/translations/sv.d.ts +8 -0
  100. package/dist/translations/sv.js +5 -0
  101. package/dist/translations/th.d.ts +8 -0
  102. package/dist/translations/th.js +5 -0
  103. package/dist/translations/tk.d.ts +8 -0
  104. package/dist/translations/tk.js +5 -0
  105. package/dist/translations/tr.d.ts +8 -0
  106. package/dist/translations/tr.js +5 -0
  107. package/dist/translations/tt.d.ts +8 -0
  108. package/dist/translations/tt.js +5 -0
  109. package/dist/translations/ug.d.ts +8 -0
  110. package/dist/translations/ug.js +5 -0
  111. package/dist/translations/uk.d.ts +8 -0
  112. package/dist/translations/uk.js +5 -0
  113. package/dist/translations/ur.d.ts +8 -0
  114. package/dist/translations/ur.js +5 -0
  115. package/dist/translations/uz.d.ts +8 -0
  116. package/dist/translations/uz.js +5 -0
  117. package/dist/translations/vi.d.ts +8 -0
  118. package/dist/translations/vi.js +5 -0
  119. package/dist/translations/zh-cn.d.ts +8 -0
  120. package/dist/translations/zh-cn.js +5 -0
  121. package/dist/translations/zh.d.ts +8 -0
  122. package/dist/translations/zh.js +5 -0
  123. package/dist/types/augmentation.d.ts +80 -0
  124. package/dist/types/commands/insertcolumncommand.d.ts +59 -0
  125. package/dist/types/commands/insertrowcommand.d.ts +58 -0
  126. package/dist/types/commands/inserttablecommand.d.ts +48 -0
  127. package/dist/types/commands/mergecellcommand.d.ts +72 -0
  128. package/dist/types/commands/mergecellscommand.d.ts +32 -0
  129. package/dist/types/commands/removecolumncommand.d.ts +33 -0
  130. package/dist/types/commands/removerowcommand.d.ts +33 -0
  131. package/dist/types/commands/selectcolumncommand.d.ts +37 -0
  132. package/dist/types/commands/selectrowcommand.d.ts +37 -0
  133. package/dist/types/commands/setheadercolumncommand.d.ts +54 -0
  134. package/dist/types/commands/setheaderrowcommand.d.ts +57 -0
  135. package/dist/types/commands/splitcellcommand.d.ts +47 -0
  136. package/dist/types/converters/downcast.d.ts +67 -0
  137. package/dist/types/converters/table-caption-post-fixer.d.ts +24 -0
  138. package/dist/types/converters/table-cell-paragraph-post-fixer.d.ts +36 -0
  139. package/dist/types/converters/table-cell-refresh-handler.d.ts +22 -0
  140. package/dist/types/converters/table-headings-refresh-handler.d.ts +21 -0
  141. package/dist/types/converters/table-layout-post-fixer.d.ts +230 -0
  142. package/dist/types/converters/tableproperties.d.ts +58 -0
  143. package/dist/types/converters/upcasttable.d.ts +53 -0
  144. package/dist/types/index.d.ts +64 -0
  145. package/dist/types/plaintableoutput.d.ts +30 -0
  146. package/dist/types/table.d.ts +44 -0
  147. package/dist/types/tablecaption/tablecaptionediting.d.ts +67 -0
  148. package/dist/types/tablecaption/tablecaptionui.d.ts +25 -0
  149. package/dist/types/tablecaption/toggletablecaptioncommand.d.ts +72 -0
  150. package/dist/types/tablecaption/utils.d.ts +42 -0
  151. package/dist/types/tablecaption.d.ts +28 -0
  152. package/dist/types/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +36 -0
  153. package/dist/types/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +41 -0
  154. package/dist/types/tablecellproperties/commands/tablecellborderstylecommand.d.ts +41 -0
  155. package/dist/types/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +55 -0
  156. package/dist/types/tablecellproperties/commands/tablecellheightcommand.d.ts +50 -0
  157. package/dist/types/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +36 -0
  158. package/dist/types/tablecellproperties/commands/tablecellpaddingcommand.d.ts +55 -0
  159. package/dist/types/tablecellproperties/commands/tablecellpropertycommand.d.ts +66 -0
  160. package/dist/types/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +44 -0
  161. package/dist/types/tablecellproperties/tablecellpropertiesediting.d.ts +47 -0
  162. package/dist/types/tablecellproperties/tablecellpropertiesui.d.ts +116 -0
  163. package/dist/types/tablecellproperties/ui/tablecellpropertiesview.d.ts +232 -0
  164. package/dist/types/tablecellproperties.d.ts +34 -0
  165. package/dist/types/tablecellwidth/commands/tablecellwidthcommand.d.ts +50 -0
  166. package/dist/types/tablecellwidth/tablecellwidthediting.d.ts +33 -0
  167. package/dist/types/tableclipboard.d.ts +74 -0
  168. package/dist/types/tablecolumnresize/constants.d.ts +24 -0
  169. package/dist/types/tablecolumnresize/converters.d.ts +22 -0
  170. package/dist/types/tablecolumnresize/tablecolumnresizeediting.d.ts +143 -0
  171. package/dist/types/tablecolumnresize/tablewidthscommand.d.ts +42 -0
  172. package/dist/types/tablecolumnresize/utils.d.ts +152 -0
  173. package/dist/types/tablecolumnresize.d.ts +30 -0
  174. package/dist/types/tableconfig.d.ts +347 -0
  175. package/dist/types/tableediting.d.ts +102 -0
  176. package/dist/types/tablekeyboard.d.ts +72 -0
  177. package/dist/types/tablemouse/mouseeventsobserver.d.ts +66 -0
  178. package/dist/types/tablemouse.d.ts +52 -0
  179. package/dist/types/tableproperties/commands/tablealignmentcommand.d.ts +36 -0
  180. package/dist/types/tableproperties/commands/tablebackgroundcolorcommand.d.ts +36 -0
  181. package/dist/types/tableproperties/commands/tablebordercolorcommand.d.ts +41 -0
  182. package/dist/types/tableproperties/commands/tableborderstylecommand.d.ts +41 -0
  183. package/dist/types/tableproperties/commands/tableborderwidthcommand.d.ts +55 -0
  184. package/dist/types/tableproperties/commands/tableheightcommand.d.ts +50 -0
  185. package/dist/types/tableproperties/commands/tablepropertycommand.d.ts +65 -0
  186. package/dist/types/tableproperties/commands/tablewidthcommand.d.ts +50 -0
  187. package/dist/types/tableproperties/tablepropertiesediting.d.ts +44 -0
  188. package/dist/types/tableproperties/tablepropertiesui.d.ts +118 -0
  189. package/dist/types/tableproperties/ui/tablepropertiesview.d.ts +211 -0
  190. package/dist/types/tableproperties.d.ts +34 -0
  191. package/dist/types/tableselection.d.ts +111 -0
  192. package/dist/types/tabletoolbar.d.ts +36 -0
  193. package/dist/types/tableui.d.ts +58 -0
  194. package/dist/types/tableutils.d.ts +452 -0
  195. package/dist/types/tablewalker.d.ts +366 -0
  196. package/dist/types/ui/colorinputview.d.ts +144 -0
  197. package/dist/types/ui/formrowview.d.ts +65 -0
  198. package/dist/types/ui/inserttableview.d.ts +85 -0
  199. package/dist/types/utils/common.d.ts +50 -0
  200. package/dist/types/utils/structure.d.ts +249 -0
  201. package/dist/types/utils/table-properties.d.ts +71 -0
  202. package/dist/types/utils/ui/contextualballoon.d.ts +38 -0
  203. package/dist/types/utils/ui/table-properties.d.ts +199 -0
  204. package/dist/types/utils/ui/widget.d.ts +24 -0
  205. package/package.json +3 -2
@@ -0,0 +1,232 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module table/tablecellproperties/ui/tablecellpropertiesview
11
+ */
12
+ import { ButtonView, FocusCycler, LabeledFieldView, ToolbarView, View, ViewCollection, type FocusableView, type NormalizedColorOption, type ColorPickerConfig } from 'ckeditor5/src/ui.js';
13
+ import { KeystrokeHandler, FocusTracker, type Locale } from 'ckeditor5/src/utils.js';
14
+ import type ColorInputView from '../../ui/colorinputview.js';
15
+ import type { TableCellPropertiesOptions } from '../../tableconfig.js';
16
+ import '../../../theme/form.css';
17
+ import '../../../theme/tableform.css';
18
+ import '../../../theme/tablecellproperties.css';
19
+ export interface TableCellPropertiesViewOptions {
20
+ borderColors: Array<NormalizedColorOption>;
21
+ backgroundColors: Array<NormalizedColorOption>;
22
+ defaultTableCellProperties: TableCellPropertiesOptions;
23
+ colorPickerConfig: false | ColorPickerConfig;
24
+ }
25
+ /**
26
+ * The class representing a table cell properties form, allowing users to customize
27
+ * certain style aspects of a table cell, for instance, border, padding, text alignment, etc..
28
+ */
29
+ export default class TableCellPropertiesView extends View {
30
+ /**
31
+ * The value of the cell border style.
32
+ *
33
+ * @observable
34
+ * @default ''
35
+ */
36
+ borderStyle: string;
37
+ /**
38
+ * The value of the cell border width style.
39
+ *
40
+ * @observable
41
+ * @default ''
42
+ */
43
+ borderWidth: string;
44
+ /**
45
+ * The value of the cell border color style.
46
+ *
47
+ * @observable
48
+ * @default ''
49
+ */
50
+ borderColor: string;
51
+ /**
52
+ * The value of the cell padding style.
53
+ *
54
+ * @observable
55
+ * @default ''
56
+ */
57
+ padding: string;
58
+ /**
59
+ * The value of the cell background color style.
60
+ *
61
+ * @observable
62
+ * @default ''
63
+ */
64
+ backgroundColor: string;
65
+ /**
66
+ * The value of the table cell width style.
67
+ *
68
+ * @observable
69
+ * @default ''
70
+ */
71
+ width: string;
72
+ /**
73
+ * The value of the table cell height style.
74
+ *
75
+ * @observable
76
+ * @default ''
77
+ */
78
+ height: string;
79
+ /**
80
+ * The value of the horizontal text alignment style.
81
+ *
82
+ * @observable
83
+ * @default ''
84
+ */
85
+ horizontalAlignment: string;
86
+ /**
87
+ * The value of the vertical text alignment style.
88
+ *
89
+ * @observable
90
+ * @default ''
91
+ */
92
+ verticalAlignment: string;
93
+ /**
94
+ * Options passed to the view. See {@link #constructor} to learn more.
95
+ */
96
+ readonly options: TableCellPropertiesViewOptions;
97
+ /**
98
+ * Tracks information about the DOM focus in the form.
99
+ */
100
+ readonly focusTracker: FocusTracker;
101
+ /**
102
+ * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
103
+ */
104
+ readonly keystrokes: KeystrokeHandler;
105
+ /**
106
+ * A collection of child views in the form.
107
+ */
108
+ readonly children: ViewCollection;
109
+ /**
110
+ * A dropdown that allows selecting the style of the table cell border.
111
+ */
112
+ readonly borderStyleDropdown: LabeledFieldView<FocusableView>;
113
+ /**
114
+ * An input that allows specifying the width of the table cell border.
115
+ */
116
+ readonly borderWidthInput: LabeledFieldView<FocusableView>;
117
+ /**
118
+ * An input that allows specifying the color of the table cell border.
119
+ */
120
+ readonly borderColorInput: LabeledFieldView<ColorInputView>;
121
+ /**
122
+ * An input that allows specifying the table cell background color.
123
+ */
124
+ readonly backgroundInput: LabeledFieldView<ColorInputView>;
125
+ /**
126
+ * An input that allows specifying the table cell padding.
127
+ */
128
+ readonly paddingInput: LabeledFieldView;
129
+ /**
130
+ * An input that allows specifying the table cell width.
131
+ */
132
+ readonly widthInput: LabeledFieldView<FocusableView>;
133
+ /**
134
+ * An input that allows specifying the table cell height.
135
+ */
136
+ readonly heightInput: LabeledFieldView<FocusableView>;
137
+ /**
138
+ * A toolbar with buttons that allow changing the horizontal text alignment in a table cell.
139
+ */
140
+ readonly horizontalAlignmentToolbar: ToolbarView;
141
+ /**
142
+ * A toolbar with buttons that allow changing the vertical text alignment in a table cell.
143
+ */
144
+ readonly verticalAlignmentToolbar: ToolbarView;
145
+ /**
146
+ * The "Save" button view.
147
+ */
148
+ saveButtonView: ButtonView;
149
+ /**
150
+ * The "Cancel" button view.
151
+ */
152
+ cancelButtonView: ButtonView;
153
+ /**
154
+ * A collection of views that can be focused in the form.
155
+ */
156
+ protected readonly _focusables: ViewCollection<FocusableView>;
157
+ /**
158
+ * Helps cycling over {@link #_focusables} in the form.
159
+ */
160
+ protected readonly _focusCycler: FocusCycler;
161
+ /**
162
+ * @param locale The {@link module:core/editor/editor~Editor#locale} instance.
163
+ * @param options Additional configuration of the view.
164
+ * @param options.borderColors A configuration of the border color palette used by the
165
+ * {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView#borderColorInput}.
166
+ * @param options.backgroundColors A configuration of the background color palette used by the
167
+ * {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView#backgroundInput}.
168
+ * @param options.defaultTableCellProperties The default table cell properties.
169
+ */
170
+ constructor(locale: Locale, options: TableCellPropertiesViewOptions);
171
+ /**
172
+ * @inheritDoc
173
+ */
174
+ render(): void;
175
+ /**
176
+ * @inheritDoc
177
+ */
178
+ destroy(): void;
179
+ /**
180
+ * Focuses the fist focusable field in the form.
181
+ */
182
+ focus(): void;
183
+ /**
184
+ * Creates the following form fields:
185
+ *
186
+ * * {@link #borderStyleDropdown},
187
+ * * {@link #borderWidthInput},
188
+ * * {@link #borderColorInput}.
189
+ */
190
+ private _createBorderFields;
191
+ /**
192
+ * Creates the following form fields:
193
+ *
194
+ * * {@link #backgroundInput}.
195
+ */
196
+ private _createBackgroundFields;
197
+ /**
198
+ * Creates the following form fields:
199
+ *
200
+ * * {@link #widthInput}.
201
+ * * {@link #heightInput}.
202
+ */
203
+ private _createDimensionFields;
204
+ /**
205
+ * Creates the following form fields:
206
+ *
207
+ * * {@link #paddingInput}.
208
+ */
209
+ private _createPaddingField;
210
+ /**
211
+ * Creates the following form fields:
212
+ *
213
+ * * {@link #horizontalAlignmentToolbar},
214
+ * * {@link #verticalAlignmentToolbar}.
215
+ */
216
+ private _createAlignmentFields;
217
+ /**
218
+ * Creates the following form controls:
219
+ *
220
+ * * {@link #saveButtonView},
221
+ * * {@link #cancelButtonView}.
222
+ */
223
+ private _createActionButtons;
224
+ /**
225
+ * Provides localized labels for {@link #horizontalAlignmentToolbar} buttons.
226
+ */
227
+ private get _horizontalAlignmentLabels();
228
+ /**
229
+ * Provides localized labels for {@link #verticalAlignmentToolbar} buttons.
230
+ */
231
+ private get _verticalAlignmentLabels();
232
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module table/tablecellproperties
11
+ */
12
+ import { Plugin } from 'ckeditor5/src/core.js';
13
+ import TableCellPropertiesUI from './tablecellproperties/tablecellpropertiesui.js';
14
+ import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertiesediting.js';
15
+ /**
16
+ * The table cell properties feature. Enables support for setting properties of table cells (size, border, background, etc.).
17
+ *
18
+ * Read more in the {@glink features/tables/tables-styling Table and cell styling tools} section.
19
+ * See also the {@link module:table/tableproperties~TableProperties} plugin.
20
+ *
21
+ * This is a "glue" plugin that loads the
22
+ * {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing table cell properties editing feature} and
23
+ * the {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI table cell properties UI feature}.
24
+ */
25
+ export default class TableCellProperties extends Plugin {
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get pluginName(): "TableCellProperties";
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ static get requires(): readonly [typeof TableCellPropertiesEditing, typeof TableCellPropertiesUI];
34
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module table/tablecellwidth/commands/tablecellwidthcommand
11
+ */
12
+ import type { Editor } from 'ckeditor5/src/core.js';
13
+ import TableCellPropertyCommand from '../../tablecellproperties/commands/tablecellpropertycommand.js';
14
+ /**
15
+ * The table cell width command.
16
+ *
17
+ * The command is registered by the {@link module:table/tablecellwidth/tablecellwidthediting~TableCellWidthEditing} as
18
+ * the `'tableCellWidth'` editor command.
19
+ *
20
+ * To change the width of selected cells, execute the command:
21
+ *
22
+ * ```ts
23
+ * editor.execute( 'tableCellWidth', {
24
+ * value: '50px'
25
+ * } );
26
+ * ```
27
+ *
28
+ * **Note**: This command adds a default `'px'` unit to numeric values. Executing:
29
+ *
30
+ * ```ts
31
+ * editor.execute( 'tableCellWidth', {
32
+ * value: '50'
33
+ * } );
34
+ * ```
35
+ *
36
+ * will set the `width` attribute to `'50px'` in the model.
37
+ */
38
+ export default class TableCellWidthCommand extends TableCellPropertyCommand {
39
+ /**
40
+ * Creates a new `TableCellWidthCommand` instance.
41
+ *
42
+ * @param editor An editor in which this command will be used.
43
+ * @param defaultValue The default value of the attribute.
44
+ */
45
+ constructor(editor: Editor, defaultValue: string);
46
+ /**
47
+ * @inheritDoc
48
+ */
49
+ _getValueToSet(value: string | number | undefined): unknown;
50
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module table/tablecellwidth/tablecellwidthediting
11
+ */
12
+ import { Plugin } from 'ckeditor5/src/core.js';
13
+ import TableEditing from './../tableediting.js';
14
+ /**
15
+ * The table cell width editing feature.
16
+ *
17
+ * Introduces `tableCellWidth` table cell model attribute alongside with its converters
18
+ * and a command.
19
+ */
20
+ export default class TableCellWidthEditing extends Plugin {
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get pluginName(): "TableCellWidthEditing";
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ static get requires(): readonly [typeof TableEditing];
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ init(): void;
33
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ import { ClipboardPipeline, ClipboardMarkersUtils } from 'ckeditor5/src/clipboard.js';
10
+ import { Plugin } from 'ckeditor5/src/core.js';
11
+ import type { DocumentFragment, Element, Item, Model, Position, Writer } from 'ckeditor5/src/engine.js';
12
+ import TableSelection from './tableselection.js';
13
+ import { type TableSlot } from './tablewalker.js';
14
+ import TableUtils from './tableutils.js';
15
+ /**
16
+ * This plugin adds support for copying/cutting/pasting fragments of tables.
17
+ * It is loaded automatically by the {@link module:table/table~Table} plugin.
18
+ */
19
+ export default class TableClipboard extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get pluginName(): "TableClipboard";
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get requires(): readonly [typeof ClipboardMarkersUtils, typeof ClipboardPipeline, typeof TableSelection, typeof TableUtils];
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ init(): void;
32
+ /**
33
+ * Copies table content to a clipboard on "copy" & "cut" events.
34
+ *
35
+ * @param evt An object containing information about the handled event.
36
+ * @param data Clipboard event data.
37
+ */
38
+ private _onCopyCut;
39
+ /**
40
+ * Overrides default {@link module:engine/model/model~Model#insertContent `model.insertContent()`} method to handle pasting table inside
41
+ * selected table fragment.
42
+ *
43
+ * Depending on selected table fragment:
44
+ * - If a selected table fragment is smaller than paste table it will crop pasted table to match dimensions.
45
+ * - If dimensions are equal it will replace selected table fragment with a pasted table contents.
46
+ *
47
+ * @param content The content to insert.
48
+ * @param selectable The selection into which the content should be inserted.
49
+ * If not provided the current model document selection will be used.
50
+ */
51
+ private _onInsertContent;
52
+ /**
53
+ * Inserts provided `selectedTableCells` into `pastedTable`.
54
+ */
55
+ private _replaceSelectedCells;
56
+ /**
57
+ * Replaces the part of selectedTable with pastedTable.
58
+ */
59
+ private _replaceSelectedCellsWithPasted;
60
+ /**
61
+ * Replaces a single table slot.
62
+ *
63
+ * @returns Inserted table cell or null if slot should remain empty.
64
+ * @private
65
+ */
66
+ _replaceTableSlotCell(tableSlot: TableSlot, cellToInsert: Element | null, insertPosition: Position, writer: Writer): Element | null;
67
+ /**
68
+ * Extracts the table for pasting into a table.
69
+ *
70
+ * @param content The content to insert.
71
+ * @param model The editor model.
72
+ */
73
+ getTableIfOnlyTableInContent(content: DocumentFragment | Item, model: Model): Element | null;
74
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module table/tablecolumnresize/constants
11
+ */
12
+ /**
13
+ * The minimum column width given as a percentage value. Used in situations when the table is not yet rendered, so it is impossible to
14
+ * calculate how many percentage of the table width would be {@link ~COLUMN_MIN_WIDTH_IN_PIXELS minimum column width in pixels}.
15
+ */
16
+ export declare const COLUMN_MIN_WIDTH_AS_PERCENTAGE = 5;
17
+ /**
18
+ * The minimum column width in pixels when the maximum table width is known.
19
+ */
20
+ export declare const COLUMN_MIN_WIDTH_IN_PIXELS = 40;
21
+ /**
22
+ * Determines how many digits after the decimal point are used to store the column width as a percentage value.
23
+ */
24
+ export declare const COLUMN_WIDTH_PRECISION = 2;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module table/tablecolumnresize/converters
11
+ */
12
+ import type { DowncastDispatcher, UpcastDispatcher } from 'ckeditor5/src/engine.js';
13
+ import type TableUtils from '../tableutils.js';
14
+ /**
15
+ * Returns a upcast helper that ensures the number of `<tableColumn>` elements corresponds to the actual number of columns in the table,
16
+ * because the input data might have too few or too many <col> elements.
17
+ */
18
+ export declare function upcastColgroupElement(tableUtilsPlugin: TableUtils): (dispatcher: UpcastDispatcher) => void;
19
+ /**
20
+ * Returns downcast helper for adding `ck-table-resized` class if there is a `<tableColumnGroup>` element inside the table.
21
+ */
22
+ export declare function downcastTableResizedClass(): (dispatcher: DowncastDispatcher) => void;
@@ -0,0 +1,143 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
10
+ import type { Element } from 'ckeditor5/src/engine.js';
11
+ import TableEditing from '../tableediting.js';
12
+ import TableUtils from '../tableutils.js';
13
+ /**
14
+ * The table column resize editing plugin.
15
+ */
16
+ export default class TableColumnResizeEditing extends Plugin {
17
+ /**
18
+ * A flag indicating if the column resizing is in progress.
19
+ */
20
+ private _isResizingActive;
21
+ /**
22
+ * A flag indicating if the column resizing is allowed. It is not allowed if the editor is in read-only
23
+ * or comments-only mode or the `TableColumnResize` plugin is disabled.
24
+ *
25
+ * @observable
26
+ * @internal
27
+ */
28
+ _isResizingAllowed: boolean;
29
+ /**
30
+ * A temporary storage for the required data needed to correctly calculate the widths of the resized columns. This storage is
31
+ * initialized when column resizing begins, and is purged upon completion.
32
+ */
33
+ private _resizingData;
34
+ /**
35
+ * DOM emitter.
36
+ */
37
+ private _domEmitter;
38
+ /**
39
+ * A local reference to the {@link module:table/tableutils~TableUtils} plugin.
40
+ */
41
+ private _tableUtilsPlugin;
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ static get requires(): readonly [typeof TableEditing, typeof TableUtils];
46
+ /**
47
+ * @inheritDoc
48
+ */
49
+ static get pluginName(): "TableColumnResizeEditing";
50
+ /**
51
+ * @inheritDoc
52
+ */
53
+ constructor(editor: Editor);
54
+ /**
55
+ * @inheritDoc
56
+ */
57
+ init(): void;
58
+ /**
59
+ * @inheritDoc
60
+ */
61
+ destroy(): void;
62
+ /**
63
+ * Returns a 'tableColumnGroup' element from the 'table'.
64
+ *
65
+ * @param element A 'table' or 'tableColumnGroup' element.
66
+ * @returns A 'tableColumnGroup' element.
67
+ */
68
+ getColumnGroupElement(element: Element): Element | undefined;
69
+ /**
70
+ * Returns an array of 'tableColumn' elements.
71
+ *
72
+ * @param element A 'table' or 'tableColumnGroup' element.
73
+ * @returns An array of 'tableColumn' elements.
74
+ */
75
+ getTableColumnElements(element: Element): Array<Element>;
76
+ /**
77
+ * Returns an array of table column widths.
78
+ *
79
+ * @param element A 'table' or 'tableColumnGroup' element.
80
+ * @returns An array of table column widths.
81
+ */
82
+ getTableColumnsWidths(element: Element): Array<string>;
83
+ /**
84
+ * Registers new attributes for a table model element.
85
+ */
86
+ private _extendSchema;
87
+ /**
88
+ * Registers table column resize post-fixer.
89
+ *
90
+ * It checks if the change from the differ concerns a table-related element or attribute. For detected changes it:
91
+ * * Adjusts the `columnWidths` attribute to guarantee that the sum of the widths from all columns is 100%.
92
+ * * Checks if the `columnWidths` attribute gets updated accordingly after columns have been added or removed.
93
+ */
94
+ private _registerPostFixer;
95
+ /**
96
+ * Registers table column resize converters.
97
+ */
98
+ private _registerConverters;
99
+ /**
100
+ * Registers listeners to handle resizing process.
101
+ */
102
+ private _registerResizingListeners;
103
+ /**
104
+ * Handles the `mousedown` event on column resizer element:
105
+ * * calculates the initial column pixel widths,
106
+ * * inserts the `<colgroup>` element if it is not present in the `<table>`,
107
+ * * puts the necessary data in the temporary storage,
108
+ * * applies the attributes to the `<table>` view element.
109
+ *
110
+ * @param eventInfo An object containing information about the fired event.
111
+ * @param domEventData The data related to the DOM event.
112
+ */
113
+ private _onMouseDownHandler;
114
+ /**
115
+ * Handles the `mousemove` event.
116
+ * * If resizing process is not in progress, it does nothing.
117
+ * * If resizing is active but not allowed, it stops the resizing process instantly calling the `mousedown` event handler.
118
+ * * Otherwise it dynamically updates the widths of the resized columns.
119
+ *
120
+ * @param eventInfo An object containing information about the fired event.
121
+ * @param mouseEventData The native DOM event.
122
+ */
123
+ private _onMouseMoveHandler;
124
+ /**
125
+ * Handles the `mouseup` event.
126
+ * * If resizing process is not in progress, it does nothing.
127
+ * * If resizing is active but not allowed, it cancels the resizing process restoring the original widths.
128
+ * * Otherwise it propagates the changes from view to the model by executing the adequate commands.
129
+ */
130
+ private _onMouseUpHandler;
131
+ /**
132
+ * Retrieves and returns required data needed for the resizing process.
133
+ *
134
+ * @param domEventData The data of the `mousedown` event.
135
+ * @param columnWidths The current widths of the columns.
136
+ * @returns The data needed for the resizing process.
137
+ */
138
+ private _getResizingData;
139
+ /**
140
+ * Registers a listener ensuring that each resizable cell have a resizer handle.
141
+ */
142
+ private _registerResizerInserter;
143
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module table/tablecolumnresize/tablewidthscommand
11
+ */
12
+ import type { Element } from 'ckeditor5/src/engine.js';
13
+ import { Command } from 'ckeditor5/src/core.js';
14
+ /**
15
+ * Command used by the {@link module:table/tablecolumnresize~TableColumnResize Table column resize feature} that
16
+ * updates the width of the whole table as well as its individual columns.
17
+ */
18
+ export default class TableWidthsCommand extends Command {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ refresh(): void;
23
+ /**
24
+ * Updated the `tableWidth` attribute of the table and the `columnWidth` attribute of the columns of that table.
25
+ */
26
+ execute(options?: TableWidthsCommandOptions): void;
27
+ }
28
+ export interface TableWidthsCommandOptions {
29
+ /**
30
+ * New value of the `columnWidths` attribute. Must be array of strings or string with comma-separated values.
31
+ * If skipped, the column widths information will be deleted.
32
+ */
33
+ columnWidths?: Array<string> | string;
34
+ /**
35
+ * The new table width. If skipped, the model attribute will be removed.
36
+ */
37
+ tableWidth?: string;
38
+ /**
39
+ * The table that is having the columns resized.
40
+ */
41
+ table?: Element;
42
+ }