@ckeditor/ckeditor5-table 41.3.1 → 41.4.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.
- package/build/table.js +1 -1
- package/dist/index-content.css +55 -0
- package/dist/index-editor.css +147 -0
- package/dist/index.css +377 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +10464 -0
- package/dist/index.js.map +1 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/ar.umd.js +11 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/az.umd.js +11 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bg.umd.js +11 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/bn.umd.js +11 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/ca.umd.js +11 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/cs.umd.js +11 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/da.umd.js +11 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +5 -0
- package/dist/translations/de-ch.umd.js +11 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/de.umd.js +11 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/el.umd.js +11 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en-au.umd.js +11 -0
- package/dist/translations/en-gb.d.ts +8 -0
- package/dist/translations/en-gb.js +5 -0
- package/dist/translations/en-gb.umd.js +11 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/en.umd.js +11 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/es.umd.js +11 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/et.umd.js +11 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fa.umd.js +11 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fi.umd.js +11 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/fr.umd.js +11 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/gl.umd.js +11 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/he.umd.js +11 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hi.umd.js +11 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hr.umd.js +11 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/hu.umd.js +11 -0
- package/dist/translations/hy.d.ts +8 -0
- package/dist/translations/hy.js +5 -0
- package/dist/translations/hy.umd.js +11 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/id.umd.js +11 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/it.umd.js +11 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/ja.umd.js +11 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/ko.umd.js +11 -0
- package/dist/translations/ku.d.ts +8 -0
- package/dist/translations/ku.js +5 -0
- package/dist/translations/ku.umd.js +11 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lt.umd.js +11 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/lv.umd.js +11 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/ms.umd.js +11 -0
- package/dist/translations/nb.d.ts +8 -0
- package/dist/translations/nb.js +5 -0
- package/dist/translations/nb.umd.js +11 -0
- package/dist/translations/ne.d.ts +8 -0
- package/dist/translations/ne.js +5 -0
- package/dist/translations/ne.umd.js +11 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/nl.umd.js +11 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/no.umd.js +11 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pl.umd.js +11 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt-br.umd.js +11 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/pt.umd.js +11 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ro.umd.js +11 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/ru.umd.js +11 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sk.umd.js +11 -0
- package/dist/translations/sl.d.ts +8 -0
- package/dist/translations/sl.js +5 -0
- package/dist/translations/sl.umd.js +11 -0
- package/dist/translations/sq.d.ts +8 -0
- package/dist/translations/sq.js +5 -0
- package/dist/translations/sq.umd.js +11 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr-latn.umd.js +11 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sr.umd.js +11 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/sv.umd.js +11 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/th.umd.js +11 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +5 -0
- package/dist/translations/tk.umd.js +11 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/tr.umd.js +11 -0
- package/dist/translations/tt.d.ts +8 -0
- package/dist/translations/tt.js +5 -0
- package/dist/translations/tt.umd.js +11 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/ug.umd.js +11 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/uk.umd.js +11 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/ur.umd.js +11 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/uz.umd.js +11 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/vi.umd.js +11 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh-cn.umd.js +11 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/translations/zh.umd.js +11 -0
- package/dist/types/augmentation.d.ts +80 -0
- package/dist/types/commands/insertcolumncommand.d.ts +59 -0
- package/dist/types/commands/insertrowcommand.d.ts +58 -0
- package/dist/types/commands/inserttablecommand.d.ts +48 -0
- package/dist/types/commands/mergecellcommand.d.ts +72 -0
- package/dist/types/commands/mergecellscommand.d.ts +32 -0
- package/dist/types/commands/removecolumncommand.d.ts +33 -0
- package/dist/types/commands/removerowcommand.d.ts +33 -0
- package/dist/types/commands/selectcolumncommand.d.ts +37 -0
- package/dist/types/commands/selectrowcommand.d.ts +37 -0
- package/dist/types/commands/setheadercolumncommand.d.ts +54 -0
- package/dist/types/commands/setheaderrowcommand.d.ts +57 -0
- package/dist/types/commands/splitcellcommand.d.ts +47 -0
- package/dist/types/converters/downcast.d.ts +67 -0
- package/dist/types/converters/table-caption-post-fixer.d.ts +24 -0
- package/dist/types/converters/table-cell-paragraph-post-fixer.d.ts +36 -0
- package/dist/types/converters/table-cell-refresh-handler.d.ts +22 -0
- package/dist/types/converters/table-headings-refresh-handler.d.ts +21 -0
- package/dist/types/converters/table-layout-post-fixer.d.ts +230 -0
- package/dist/types/converters/tableproperties.d.ts +58 -0
- package/dist/types/converters/upcasttable.d.ts +53 -0
- package/dist/types/index.d.ts +64 -0
- package/dist/types/plaintableoutput.d.ts +30 -0
- package/dist/types/table.d.ts +44 -0
- package/dist/types/tablecaption/tablecaptionediting.d.ts +67 -0
- package/dist/types/tablecaption/tablecaptionui.d.ts +25 -0
- package/dist/types/tablecaption/toggletablecaptioncommand.d.ts +72 -0
- package/dist/types/tablecaption/utils.d.ts +42 -0
- package/dist/types/tablecaption.d.ts +28 -0
- package/dist/types/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +36 -0
- package/dist/types/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +41 -0
- package/dist/types/tablecellproperties/commands/tablecellborderstylecommand.d.ts +41 -0
- package/dist/types/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +55 -0
- package/dist/types/tablecellproperties/commands/tablecellheightcommand.d.ts +50 -0
- package/dist/types/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +36 -0
- package/dist/types/tablecellproperties/commands/tablecellpaddingcommand.d.ts +55 -0
- package/dist/types/tablecellproperties/commands/tablecellpropertycommand.d.ts +66 -0
- package/dist/types/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +44 -0
- package/dist/types/tablecellproperties/tablecellpropertiesediting.d.ts +47 -0
- package/dist/types/tablecellproperties/tablecellpropertiesui.d.ts +116 -0
- package/dist/types/tablecellproperties/ui/tablecellpropertiesview.d.ts +232 -0
- package/dist/types/tablecellproperties.d.ts +34 -0
- package/dist/types/tablecellwidth/commands/tablecellwidthcommand.d.ts +50 -0
- package/dist/types/tablecellwidth/tablecellwidthediting.d.ts +33 -0
- package/dist/types/tableclipboard.d.ts +74 -0
- package/dist/types/tablecolumnresize/constants.d.ts +24 -0
- package/dist/types/tablecolumnresize/converters.d.ts +22 -0
- package/dist/types/tablecolumnresize/tablecolumnresizeediting.d.ts +143 -0
- package/dist/types/tablecolumnresize/tablewidthscommand.d.ts +42 -0
- package/dist/types/tablecolumnresize/utils.d.ts +152 -0
- package/dist/types/tablecolumnresize.d.ts +30 -0
- package/dist/types/tableconfig.d.ts +347 -0
- package/dist/types/tableediting.d.ts +102 -0
- package/dist/types/tablekeyboard.d.ts +72 -0
- package/dist/types/tablemouse/mouseeventsobserver.d.ts +66 -0
- package/dist/types/tablemouse.d.ts +52 -0
- package/dist/types/tableproperties/commands/tablealignmentcommand.d.ts +36 -0
- package/dist/types/tableproperties/commands/tablebackgroundcolorcommand.d.ts +36 -0
- package/dist/types/tableproperties/commands/tablebordercolorcommand.d.ts +41 -0
- package/dist/types/tableproperties/commands/tableborderstylecommand.d.ts +41 -0
- package/dist/types/tableproperties/commands/tableborderwidthcommand.d.ts +55 -0
- package/dist/types/tableproperties/commands/tableheightcommand.d.ts +50 -0
- package/dist/types/tableproperties/commands/tablepropertycommand.d.ts +65 -0
- package/dist/types/tableproperties/commands/tablewidthcommand.d.ts +50 -0
- package/dist/types/tableproperties/tablepropertiesediting.d.ts +44 -0
- package/dist/types/tableproperties/tablepropertiesui.d.ts +118 -0
- package/dist/types/tableproperties/ui/tablepropertiesview.d.ts +211 -0
- package/dist/types/tableproperties.d.ts +34 -0
- package/dist/types/tableselection.d.ts +111 -0
- package/dist/types/tabletoolbar.d.ts +36 -0
- package/dist/types/tableui.d.ts +58 -0
- package/dist/types/tableutils.d.ts +452 -0
- package/dist/types/tablewalker.d.ts +366 -0
- package/dist/types/ui/colorinputview.d.ts +144 -0
- package/dist/types/ui/formrowview.d.ts +65 -0
- package/dist/types/ui/inserttableview.d.ts +85 -0
- package/dist/types/utils/common.d.ts +50 -0
- package/dist/types/utils/structure.d.ts +249 -0
- package/dist/types/utils/table-properties.d.ts +71 -0
- package/dist/types/utils/ui/contextualballoon.d.ts +38 -0
- package/dist/types/utils/ui/table-properties.d.ts +199 -0
- package/dist/types/utils/ui/widget.d.ts +24 -0
- package/package.json +4 -2
- package/theme/tablecaption.css +12 -2
|
@@ -0,0 +1,21 @@
|
|
|
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/converters/table-headings-refresh-handler
|
|
11
|
+
*/
|
|
12
|
+
import type { EditingController, Model } from 'ckeditor5/src/engine.js';
|
|
13
|
+
/**
|
|
14
|
+
* A table headings refresh handler which marks the table cells or rows in the differ to have it re-rendered
|
|
15
|
+
* if the headings attribute changed.
|
|
16
|
+
*
|
|
17
|
+
* Table heading rows and heading columns are represented in the model by a `headingRows` and `headingColumns` attributes.
|
|
18
|
+
*
|
|
19
|
+
* When table headings attribute changes, all the cells/rows are marked to re-render to change between `<td>` and `<th>`.
|
|
20
|
+
*/
|
|
21
|
+
export default function tableHeadingsRefreshHandler(model: Model, editing: EditingController): void;
|
|
@@ -0,0 +1,230 @@
|
|
|
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/converters/table-layout-post-fixer
|
|
11
|
+
*/
|
|
12
|
+
import type { Model } from 'ckeditor5/src/engine.js';
|
|
13
|
+
/**
|
|
14
|
+
* Injects a table layout post-fixer into the model.
|
|
15
|
+
*
|
|
16
|
+
* The role of the table layout post-fixer is to ensure that the table rows have the correct structure
|
|
17
|
+
* after a {@link module:engine/model/model~Model#change `change()`} block was executed.
|
|
18
|
+
*
|
|
19
|
+
* The correct structure means that:
|
|
20
|
+
*
|
|
21
|
+
* * All table rows have the same size.
|
|
22
|
+
* * None of the table cells extend vertically beyond their section (either header or body).
|
|
23
|
+
* * A table cell has always at least one element as a child.
|
|
24
|
+
*
|
|
25
|
+
* If the table structure is not correct, the post-fixer will automatically correct it in two steps:
|
|
26
|
+
*
|
|
27
|
+
* 1. It will clip table cells that extend beyond their section.
|
|
28
|
+
* 2. It will add empty table cells to the rows that are narrower than the widest table row.
|
|
29
|
+
*
|
|
30
|
+
* ## Clipping overlapping table cells
|
|
31
|
+
*
|
|
32
|
+
* Such situation may occur when pasting a table (or a part of a table) to the editor from external sources.
|
|
33
|
+
*
|
|
34
|
+
* For example, see the following table which has a cell (FOO) with the rowspan attribute (2):
|
|
35
|
+
*
|
|
36
|
+
* ```xml
|
|
37
|
+
* <table headingRows="1">
|
|
38
|
+
* <tableRow>
|
|
39
|
+
* <tableCell rowspan="2"><paragraph>FOO</paragraph></tableCell>
|
|
40
|
+
* <tableCell colspan="2"><paragraph>BAR</paragraph></tableCell>
|
|
41
|
+
* </tableRow>
|
|
42
|
+
* <tableRow>
|
|
43
|
+
* <tableCell><paragraph>BAZ</paragraph></tableCell>
|
|
44
|
+
* <tableCell><paragraph>XYZ</paragraph></tableCell>
|
|
45
|
+
* </tableRow>
|
|
46
|
+
* </table>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* It will be rendered in the view as:
|
|
50
|
+
*
|
|
51
|
+
* ```xml
|
|
52
|
+
* <table>
|
|
53
|
+
* <thead>
|
|
54
|
+
* <tr>
|
|
55
|
+
* <td rowspan="2">FOO</td>
|
|
56
|
+
* <td colspan="2">BAR</td>
|
|
57
|
+
* </tr>
|
|
58
|
+
* </thead>
|
|
59
|
+
* <tbody>
|
|
60
|
+
* <tr>
|
|
61
|
+
* <td>BAZ</td>
|
|
62
|
+
* <td>XYZ</td>
|
|
63
|
+
* </tr>
|
|
64
|
+
* </tbody>
|
|
65
|
+
* </table>
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* In the above example the table will be rendered as a table with two rows: one in the header and second one in the body.
|
|
69
|
+
* The table cell (FOO) cannot span over multiple rows as it would extend from the header to the body section.
|
|
70
|
+
* The `rowspan` attribute must be changed to (1). The value (1) is the default value of the `rowspan` attribute
|
|
71
|
+
* so the `rowspan` attribute will be removed from the model.
|
|
72
|
+
*
|
|
73
|
+
* The table cell with BAZ in the content will be in the first column of the table.
|
|
74
|
+
*
|
|
75
|
+
* ## Adding missing table cells
|
|
76
|
+
*
|
|
77
|
+
* The table post-fixer will insert empty table cells to equalize table row sizes (the number of columns).
|
|
78
|
+
* The size of a table row is calculated by counting column spans of table cells, both horizontal (from the same row) and
|
|
79
|
+
* vertical (from the rows above).
|
|
80
|
+
*
|
|
81
|
+
* In the above example, the table row in the body section of the table is narrower then the row from the header: it has two cells
|
|
82
|
+
* with the default colspan (1). The header row has one cell with colspan (1) and the second with colspan (2).
|
|
83
|
+
* The table cell (FOO) does not extend beyond the head section (and as such will be fixed in the first step of this post-fixer).
|
|
84
|
+
* The post-fixer will add a missing table cell to the row in the body section of the table.
|
|
85
|
+
*
|
|
86
|
+
* The table from the above example will be fixed and rendered to the view as below:
|
|
87
|
+
*
|
|
88
|
+
* ```xml
|
|
89
|
+
* <table>
|
|
90
|
+
* <thead>
|
|
91
|
+
* <tr>
|
|
92
|
+
* <td rowspan="2">FOO</td>
|
|
93
|
+
* <td colspan="2">BAR</td>
|
|
94
|
+
* </tr>
|
|
95
|
+
* </thead>
|
|
96
|
+
* <tbody>
|
|
97
|
+
* <tr>
|
|
98
|
+
* <td>BAZ</td>
|
|
99
|
+
* <td>XYZ</td>
|
|
100
|
+
* </tr>
|
|
101
|
+
* </tbody>
|
|
102
|
+
* </table>
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* ## Collaboration and undo - Expectations vs post-fixer results
|
|
106
|
+
*
|
|
107
|
+
* The table post-fixer only ensures proper structure without a deeper analysis of the nature of the change. As such, it might lead
|
|
108
|
+
* to a structure which was not intended by the user. In particular, it will also fix undo steps (in conjunction with collaboration)
|
|
109
|
+
* in which the editor content might not return to the original state.
|
|
110
|
+
*
|
|
111
|
+
* This will usually happen when one or more users change the size of the table.
|
|
112
|
+
*
|
|
113
|
+
* As an example see the table below:
|
|
114
|
+
*
|
|
115
|
+
* ```xml
|
|
116
|
+
* <table>
|
|
117
|
+
* <tbody>
|
|
118
|
+
* <tr>
|
|
119
|
+
* <td>11</td>
|
|
120
|
+
* <td>12</td>
|
|
121
|
+
* </tr>
|
|
122
|
+
* <tr>
|
|
123
|
+
* <td>21</td>
|
|
124
|
+
* <td>22</td>
|
|
125
|
+
* </tr>
|
|
126
|
+
* </tbody>
|
|
127
|
+
* </table>
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* and the user actions:
|
|
131
|
+
*
|
|
132
|
+
* 1. Both users have a table with two rows and two columns.
|
|
133
|
+
* 2. User A adds a column at the end of the table. This will insert empty table cells to two rows.
|
|
134
|
+
* 3. User B adds a row at the end of the table. This will insert a row with two empty table cells.
|
|
135
|
+
* 4. Both users will have a table as below:
|
|
136
|
+
*
|
|
137
|
+
* ```xml
|
|
138
|
+
* <table>
|
|
139
|
+
* <tbody>
|
|
140
|
+
* <tr>
|
|
141
|
+
* <td>11</td>
|
|
142
|
+
* <td>12</td>
|
|
143
|
+
* <td>(empty, inserted by A)</td>
|
|
144
|
+
* </tr>
|
|
145
|
+
* <tr>
|
|
146
|
+
* <td>21</td>
|
|
147
|
+
* <td>22</td>
|
|
148
|
+
* <td>(empty, inserted by A)</td>
|
|
149
|
+
* </tr>
|
|
150
|
+
* <tr>
|
|
151
|
+
* <td>(empty, inserted by B)</td>
|
|
152
|
+
* <td>(empty, inserted by B)</td>
|
|
153
|
+
* </tr>
|
|
154
|
+
* </tbody>
|
|
155
|
+
* </table>
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* The last row is shorter then others so the table post-fixer will add an empty row to the last row:
|
|
159
|
+
*
|
|
160
|
+
* ```xml
|
|
161
|
+
* <table>
|
|
162
|
+
* <tbody>
|
|
163
|
+
* <tr>
|
|
164
|
+
* <td>11</td>
|
|
165
|
+
* <td>12</td>
|
|
166
|
+
* <td>(empty, inserted by A)</td>
|
|
167
|
+
* </tr>
|
|
168
|
+
* <tr>
|
|
169
|
+
* <td>21</td>
|
|
170
|
+
* <td>22</td>
|
|
171
|
+
* <td>(empty, inserted by A)</td>
|
|
172
|
+
* </tr>
|
|
173
|
+
* <tr>
|
|
174
|
+
* <td>(empty, inserted by B)</td>
|
|
175
|
+
* <td>(empty, inserted by B)</td>
|
|
176
|
+
* <td>(empty, inserted by the post-fixer)</td>
|
|
177
|
+
* </tr>
|
|
178
|
+
* </tbody>
|
|
179
|
+
* </table>
|
|
180
|
+
* ```
|
|
181
|
+
*
|
|
182
|
+
* Unfortunately undo does not know the nature of the changes and depending on which user applies the post-fixer changes, undoing them
|
|
183
|
+
* might lead to a broken table. If User B undoes inserting the column to the table, the undo engine will undo only the operations of
|
|
184
|
+
* inserting empty cells to rows from the initial table state (row 1 and 2) but the cell in the post-fixed row will remain:
|
|
185
|
+
*
|
|
186
|
+
* ```xml
|
|
187
|
+
* <table>
|
|
188
|
+
* <tbody>
|
|
189
|
+
* <tr>
|
|
190
|
+
* <td>11</td>
|
|
191
|
+
* <td>12</td>
|
|
192
|
+
* </tr>
|
|
193
|
+
* <tr>
|
|
194
|
+
* <td>21</td>
|
|
195
|
+
* <td>22</td>
|
|
196
|
+
* </tr>
|
|
197
|
+
* <tr>
|
|
198
|
+
* <td>(empty, inserted by B)</td>
|
|
199
|
+
* <td>(empty, inserted by B)</td>
|
|
200
|
+
* <td>(empty, inserted by a post-fixer)</td>
|
|
201
|
+
* </tr>
|
|
202
|
+
* </tbody>
|
|
203
|
+
* </table>
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* After undo, the table post-fixer will detect that two rows are shorter than others and will fix the table to:
|
|
207
|
+
*
|
|
208
|
+
* ```xml
|
|
209
|
+
* <table>
|
|
210
|
+
* <tbody>
|
|
211
|
+
* <tr>
|
|
212
|
+
* <td>11</td>
|
|
213
|
+
* <td>12</td>
|
|
214
|
+
* <td>(empty, inserted by a post-fixer after undo)</td>
|
|
215
|
+
* </tr>
|
|
216
|
+
* <tr>
|
|
217
|
+
* <td>21</td>
|
|
218
|
+
* <td>22</td>
|
|
219
|
+
* <td>(empty, inserted by a post-fixer after undo)</td>
|
|
220
|
+
* </tr>
|
|
221
|
+
* <tr>
|
|
222
|
+
* <td>(empty, inserted by B)</td>
|
|
223
|
+
* <td>(empty, inserted by B)</td>
|
|
224
|
+
* <td>(empty, inserted by a post-fixer)</td>
|
|
225
|
+
* </tr>
|
|
226
|
+
* </tbody>
|
|
227
|
+
* </table>
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
export default function injectTableLayoutPostFixer(model: Model): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
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/converters/tableproperties
|
|
11
|
+
*/
|
|
12
|
+
import type { Conversion, ViewElement } from 'ckeditor5/src/engine.js';
|
|
13
|
+
/**
|
|
14
|
+
* Conversion helper for upcasting attributes using normalized styles.
|
|
15
|
+
*
|
|
16
|
+
* @param options.modelAttribute The attribute to set.
|
|
17
|
+
* @param options.styleName The style name to convert.
|
|
18
|
+
* @param options.viewElement The view element name that should be converted.
|
|
19
|
+
* @param options.defaultValue The default value for the specified `modelAttribute`.
|
|
20
|
+
* @param options.shouldUpcast The function which returns `true` if style should be upcasted from this element.
|
|
21
|
+
*/
|
|
22
|
+
export declare function upcastStyleToAttribute(conversion: Conversion, options: {
|
|
23
|
+
modelAttribute: string;
|
|
24
|
+
styleName: string;
|
|
25
|
+
viewElement: string | RegExp;
|
|
26
|
+
defaultValue: string;
|
|
27
|
+
reduceBoxSides?: boolean;
|
|
28
|
+
shouldUpcast?: (viewElement: ViewElement) => boolean;
|
|
29
|
+
}): void;
|
|
30
|
+
export interface StyleValues {
|
|
31
|
+
color: string;
|
|
32
|
+
style: string;
|
|
33
|
+
width: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Conversion helper for upcasting border styles for view elements.
|
|
37
|
+
*
|
|
38
|
+
* @param defaultBorder The default border values.
|
|
39
|
+
* @param defaultBorder.color The default `borderColor` value.
|
|
40
|
+
* @param defaultBorder.style The default `borderStyle` value.
|
|
41
|
+
* @param defaultBorder.width The default `borderWidth` value.
|
|
42
|
+
*/
|
|
43
|
+
export declare function upcastBorderStyles(conversion: Conversion, viewElementName: string, modelAttributes: StyleValues, defaultBorder: StyleValues): void;
|
|
44
|
+
/**
|
|
45
|
+
* Conversion helper for downcasting an attribute to a style.
|
|
46
|
+
*/
|
|
47
|
+
export declare function downcastAttributeToStyle(conversion: Conversion, options: {
|
|
48
|
+
modelElement: string;
|
|
49
|
+
modelAttribute: string;
|
|
50
|
+
styleName: string;
|
|
51
|
+
}): void;
|
|
52
|
+
/**
|
|
53
|
+
* Conversion helper for downcasting attributes from the model table to a view table (not to `<figure>`).
|
|
54
|
+
*/
|
|
55
|
+
export declare function downcastTableAttribute(conversion: Conversion, options: {
|
|
56
|
+
modelAttribute: string;
|
|
57
|
+
styleName: string;
|
|
58
|
+
}): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
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/converters/upcasttable
|
|
11
|
+
*/
|
|
12
|
+
import type { UpcastDispatcher } from 'ckeditor5/src/engine.js';
|
|
13
|
+
/**
|
|
14
|
+
* Returns a function that converts the table view representation:
|
|
15
|
+
*
|
|
16
|
+
* ```xml
|
|
17
|
+
* <figure class="table"><table>...</table></figure>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* to the model representation:
|
|
21
|
+
*
|
|
22
|
+
* ```xml
|
|
23
|
+
* <table></table>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function upcastTableFigure(): (dispatcher: UpcastDispatcher) => void;
|
|
27
|
+
/**
|
|
28
|
+
* View table element to model table element conversion helper.
|
|
29
|
+
*
|
|
30
|
+
* This conversion helper converts the table element as well as table rows.
|
|
31
|
+
*
|
|
32
|
+
* @returns Conversion helper.
|
|
33
|
+
*/
|
|
34
|
+
export default function upcastTable(): (dispatcher: UpcastDispatcher) => void;
|
|
35
|
+
/**
|
|
36
|
+
* A conversion helper that skips empty <tr> elements from upcasting at the beginning of the table.
|
|
37
|
+
*
|
|
38
|
+
* An empty row is considered a table model error but when handling clipboard data there could be rows that contain only row-spanned cells
|
|
39
|
+
* and empty TR-s are used to maintain the table structure (also {@link module:table/tablewalker~TableWalker} assumes that there are only
|
|
40
|
+
* rows that have related `tableRow` elements).
|
|
41
|
+
*
|
|
42
|
+
* *Note:* Only the first empty rows are removed because they have no meaning and it solves the issue
|
|
43
|
+
* of an improper table with all empty rows.
|
|
44
|
+
*
|
|
45
|
+
* @returns Conversion helper.
|
|
46
|
+
*/
|
|
47
|
+
export declare function skipEmptyTableRow(): (dispatcher: UpcastDispatcher) => void;
|
|
48
|
+
/**
|
|
49
|
+
* A converter that ensures an empty paragraph is inserted in a table cell if no other content was converted.
|
|
50
|
+
*
|
|
51
|
+
* @returns Conversion helper.
|
|
52
|
+
*/
|
|
53
|
+
export declare function ensureParagraphInTableCell(elementName: string): (dispatcher: UpcastDispatcher) => void;
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
|
11
|
+
*/
|
|
12
|
+
export { default as PlainTableOutput } from './plaintableoutput.js';
|
|
13
|
+
export { default as Table } from './table.js';
|
|
14
|
+
export { default as TableEditing } from './tableediting.js';
|
|
15
|
+
export { default as TableUI } from './tableui.js';
|
|
16
|
+
export { default as TableToolbar } from './tabletoolbar.js';
|
|
17
|
+
export { default as TableCellProperties } from './tablecellproperties.js';
|
|
18
|
+
export { default as TableCellPropertiesEditing } from './tablecellproperties/tablecellpropertiesediting.js';
|
|
19
|
+
export { default as TableCellPropertiesUI } from './tablecellproperties/tablecellpropertiesui.js';
|
|
20
|
+
export { default as TableCellWidthEditing } from './tablecellwidth/tablecellwidthediting.js';
|
|
21
|
+
export { default as TableProperties } from './tableproperties.js';
|
|
22
|
+
export { default as TablePropertiesEditing } from './tableproperties/tablepropertiesediting.js';
|
|
23
|
+
export { default as TablePropertiesUI } from './tableproperties/tablepropertiesui.js';
|
|
24
|
+
export { default as TableCaption } from './tablecaption.js';
|
|
25
|
+
export { default as TableCaptionEditing } from './tablecaption/tablecaptionediting.js';
|
|
26
|
+
export { default as TableCaptionUI } from './tablecaption/tablecaptionui.js';
|
|
27
|
+
export { default as TableClipboard } from './tableclipboard.js';
|
|
28
|
+
export { default as TableMouse } from './tablemouse.js';
|
|
29
|
+
export { default as TableKeyboard } from './tablekeyboard.js';
|
|
30
|
+
export { default as TableSelection } from './tableselection.js';
|
|
31
|
+
export { default as TableUtils } from './tableutils.js';
|
|
32
|
+
export { default as TableColumnResize } from './tablecolumnresize.js';
|
|
33
|
+
export { default as TableColumnResizeEditing } from './tablecolumnresize/tablecolumnresizeediting.js';
|
|
34
|
+
export type { TableConfig } from './tableconfig.js';
|
|
35
|
+
export type { default as InsertColumnCommand } from './commands/insertcolumncommand.js';
|
|
36
|
+
export type { default as InsertRowCommand } from './commands/insertrowcommand.js';
|
|
37
|
+
export type { default as InsertTableCommand } from './commands/inserttablecommand.js';
|
|
38
|
+
export type { default as MergeCellCommand } from './commands/mergecellcommand.js';
|
|
39
|
+
export type { default as MergeCellsCommand } from './commands/mergecellscommand.js';
|
|
40
|
+
export type { default as RemoveColumnCommand } from './commands/removecolumncommand.js';
|
|
41
|
+
export type { default as RemoveRowCommand } from './commands/removerowcommand.js';
|
|
42
|
+
export type { default as SelectColumnCommand } from './commands/selectcolumncommand.js';
|
|
43
|
+
export type { default as SelectRowCommand } from './commands/selectrowcommand.js';
|
|
44
|
+
export type { default as SetHeaderColumnCommand } from './commands/setheadercolumncommand.js';
|
|
45
|
+
export type { default as SetHeaderRowCommand } from './commands/setheaderrowcommand.js';
|
|
46
|
+
export type { default as SplitCellCommand } from './commands/splitcellcommand.js';
|
|
47
|
+
export type { default as ToggleTableCaptionCommand } from './tablecaption/toggletablecaptioncommand.js';
|
|
48
|
+
export type { default as TableCellBackgroundColorCommand } from './tablecellproperties/commands/tablecellbackgroundcolorcommand.js';
|
|
49
|
+
export type { default as TableCellBorderColorCommand } from './tablecellproperties/commands/tablecellbordercolorcommand.js';
|
|
50
|
+
export type { default as TableCellBorderStyleCommand } from './tablecellproperties/commands/tablecellborderstylecommand.js';
|
|
51
|
+
export type { default as TableCellBorderWidthCommand } from './tablecellproperties/commands/tablecellborderwidthcommand.js';
|
|
52
|
+
export type { default as TableCellHeightCommand } from './tablecellproperties/commands/tablecellheightcommand.js';
|
|
53
|
+
export type { default as TableCellHorizontalAlignmentCommand } from './tablecellproperties/commands/tablecellhorizontalalignmentcommand.js';
|
|
54
|
+
export type { default as TableCellPaddingCommand } from './tablecellproperties/commands/tablecellpaddingcommand.js';
|
|
55
|
+
export type { default as TableCellVerticalAlignmentCommand } from './tablecellproperties/commands/tablecellverticalalignmentcommand.js';
|
|
56
|
+
export type { default as TableCellWidthCommand } from './tablecellwidth/commands/tablecellwidthcommand.js';
|
|
57
|
+
export type { default as TableAlignmentCommand } from './tableproperties/commands/tablealignmentcommand.js';
|
|
58
|
+
export type { default as TableBackgroundColorCommand } from './tableproperties/commands/tablebackgroundcolorcommand.js';
|
|
59
|
+
export type { default as TableBorderColorCommand } from './tableproperties/commands/tablebordercolorcommand.js';
|
|
60
|
+
export type { default as TableBorderStyleCommand } from './tableproperties/commands/tableborderstylecommand.js';
|
|
61
|
+
export type { default as TableBorderWidthCommand } from './tableproperties/commands/tableborderwidthcommand.js';
|
|
62
|
+
export type { default as TableHeightCommand } from './tableproperties/commands/tableheightcommand.js';
|
|
63
|
+
export type { default as TableWidthCommand } from './tableproperties/commands/tablewidthcommand.js';
|
|
64
|
+
import './augmentation.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
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/plaintableoutput
|
|
11
|
+
*/
|
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
+
import Table from './table.js';
|
|
14
|
+
/**
|
|
15
|
+
* The plain table output feature.
|
|
16
|
+
*/
|
|
17
|
+
export default class PlainTableOutput extends Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get pluginName(): "PlainTableOutput";
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get requires(): readonly [typeof Table];
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
init(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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/table
|
|
11
|
+
*/
|
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
+
import { Widget } from 'ckeditor5/src/widget.js';
|
|
14
|
+
import TableEditing from './tableediting.js';
|
|
15
|
+
import TableUI from './tableui.js';
|
|
16
|
+
import TableSelection from './tableselection.js';
|
|
17
|
+
import TableClipboard from './tableclipboard.js';
|
|
18
|
+
import TableKeyboard from './tablekeyboard.js';
|
|
19
|
+
import TableMouse from './tablemouse.js';
|
|
20
|
+
import '../theme/table.css';
|
|
21
|
+
/**
|
|
22
|
+
* The table plugin.
|
|
23
|
+
*
|
|
24
|
+
* For a detailed overview, check the {@glink features/tables/tables Table feature documentation}.
|
|
25
|
+
*
|
|
26
|
+
* This is a "glue" plugin that loads the following table features:
|
|
27
|
+
*
|
|
28
|
+
* * {@link module:table/tableediting~TableEditing editing feature},
|
|
29
|
+
* * {@link module:table/tableselection~TableSelection selection feature},
|
|
30
|
+
* * {@link module:table/tablekeyboard~TableKeyboard keyboard navigation feature},
|
|
31
|
+
* * {@link module:table/tablemouse~TableMouse mouse selection feature},
|
|
32
|
+
* * {@link module:table/tableclipboard~TableClipboard clipboard feature},
|
|
33
|
+
* * {@link module:table/tableui~TableUI UI feature}.
|
|
34
|
+
*/
|
|
35
|
+
export default class Table extends Plugin {
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
static get requires(): readonly [typeof TableEditing, typeof TableUI, typeof TableSelection, typeof TableMouse, typeof TableKeyboard, typeof TableClipboard, typeof Widget];
|
|
40
|
+
/**
|
|
41
|
+
* @inheritDoc
|
|
42
|
+
*/
|
|
43
|
+
static get pluginName(): "Table";
|
|
44
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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/tablecaption/tablecaptionediting
|
|
11
|
+
*/
|
|
12
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
13
|
+
import { Element } from 'ckeditor5/src/engine.js';
|
|
14
|
+
/**
|
|
15
|
+
* The table caption editing plugin.
|
|
16
|
+
*/
|
|
17
|
+
export default class TableCaptionEditing extends Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* A map that keeps saved JSONified table captions and table model elements they are
|
|
20
|
+
* associated with.
|
|
21
|
+
*
|
|
22
|
+
* To learn more about this system, see {@link #_saveCaption}.
|
|
23
|
+
*/
|
|
24
|
+
private _savedCaptionsMap;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get pluginName(): "TableCaptionEditing";
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
constructor(editor: Editor);
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
init(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the saved {@link module:engine/model/element~Element#toJSON JSONified} caption
|
|
39
|
+
* of a table model element.
|
|
40
|
+
*
|
|
41
|
+
* See {@link #_saveCaption}.
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
* @param tableModelElement The model element the caption should be returned for.
|
|
45
|
+
* @returns The model caption element or `null` if there is none.
|
|
46
|
+
*/
|
|
47
|
+
_getSavedCaption(tableModelElement: Element): Element | null;
|
|
48
|
+
/**
|
|
49
|
+
* Saves a {@link module:engine/model/element~Element#toJSON JSONified} caption for
|
|
50
|
+
* a table element to allow restoring it in the future.
|
|
51
|
+
*
|
|
52
|
+
* A caption is saved every time it gets hidden. The
|
|
53
|
+
* user should be able to restore it on demand.
|
|
54
|
+
*
|
|
55
|
+
* **Note**: The caption cannot be stored in the table model element attribute because,
|
|
56
|
+
* for instance, when the model state propagates to collaborators, the attribute would get
|
|
57
|
+
* lost (mainly because it does not convert to anything when the caption is hidden) and
|
|
58
|
+
* the states of collaborators' models would de-synchronize causing numerous issues.
|
|
59
|
+
*
|
|
60
|
+
* See {@link #_getSavedCaption}.
|
|
61
|
+
*
|
|
62
|
+
* @internal
|
|
63
|
+
* @param tableModelElement The model element the caption is saved for.
|
|
64
|
+
* @param caption The caption model element to be saved.
|
|
65
|
+
*/
|
|
66
|
+
_saveCaption(tableModelElement: Element, caption: Element): void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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/tablecaption/tablecaptionui
|
|
11
|
+
*/
|
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
+
/**
|
|
14
|
+
* The table caption UI plugin. It introduces the `'toggleTableCaption'` UI button.
|
|
15
|
+
*/
|
|
16
|
+
export default class TableCaptionUI extends Plugin {
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get pluginName(): "TableCaptionUI";
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
init(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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/tablecaption/toggletablecaptioncommand
|
|
11
|
+
*/
|
|
12
|
+
import { Command } from 'ckeditor5/src/core.js';
|
|
13
|
+
/**
|
|
14
|
+
* The toggle table caption command.
|
|
15
|
+
*
|
|
16
|
+
* This command is registered by {@link module:table/tablecaption/tablecaptionediting~TableCaptionEditing} as the
|
|
17
|
+
* `'toggleTableCaption'` editor command.
|
|
18
|
+
*
|
|
19
|
+
* Executing this command:
|
|
20
|
+
*
|
|
21
|
+
* * either adds or removes the table caption of a selected table (depending on whether the caption is present or not),
|
|
22
|
+
* * removes the table caption if the selection is anchored in one.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* // Toggle the presence of the caption.
|
|
26
|
+
* editor.execute( 'toggleTableCaption' );
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* **Note**: You can move the selection to the caption right away as it shows up upon executing this command by using
|
|
30
|
+
* the `focusCaptionOnShow` option:
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* editor.execute( 'toggleTableCaption', { focusCaptionOnShow: true } );
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export default class ToggleTableCaptionCommand extends Command {
|
|
37
|
+
value: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
refresh(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Executes the command.
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* editor.execute( 'toggleTableCaption' );
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param options Options for the executed command.
|
|
50
|
+
* @param options.focusCaptionOnShow When true and the caption shows up, the selection will be moved into it straight away.
|
|
51
|
+
* @fires execute
|
|
52
|
+
*/
|
|
53
|
+
execute({ focusCaptionOnShow }?: {
|
|
54
|
+
focusCaptionOnShow?: boolean;
|
|
55
|
+
}): void;
|
|
56
|
+
/**
|
|
57
|
+
* Shows the table caption. Also:
|
|
58
|
+
*
|
|
59
|
+
* * it attempts to restore the caption content from the `TableCaptionEditing` caption registry,
|
|
60
|
+
* * it moves the selection to the caption right away, it the `focusCaptionOnShow` option was set.
|
|
61
|
+
*
|
|
62
|
+
* @param focusCaptionOnShow Default focus behavior when showing the caption.
|
|
63
|
+
*/
|
|
64
|
+
private _showTableCaption;
|
|
65
|
+
/**
|
|
66
|
+
* Hides the caption of a selected table (or an table caption the selection is anchored to).
|
|
67
|
+
*
|
|
68
|
+
* The content of the caption is stored in the `TableCaptionEditing` caption registry to make this
|
|
69
|
+
* a reversible action.
|
|
70
|
+
*/
|
|
71
|
+
private _hideTableCaption;
|
|
72
|
+
}
|