@ckeditor/ckeditor5-table 41.2.0 → 41.3.0-alpha.1
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/dist/content-index.css +55 -0
- package/dist/editor-index.css +150 -0
- package/dist/index.css +362 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +11660 -0
- package/dist/index.js.map +1 -0
- package/dist/types/augmentation.d.ts +76 -0
- package/dist/types/commands/insertcolumncommand.d.ts +55 -0
- package/dist/types/commands/insertrowcommand.d.ts +54 -0
- package/dist/types/commands/inserttablecommand.d.ts +44 -0
- package/dist/types/commands/mergecellcommand.d.ts +68 -0
- package/dist/types/commands/mergecellscommand.d.ts +28 -0
- package/dist/types/commands/removecolumncommand.d.ts +29 -0
- package/dist/types/commands/removerowcommand.d.ts +29 -0
- package/dist/types/commands/selectcolumncommand.d.ts +33 -0
- package/dist/types/commands/selectrowcommand.d.ts +33 -0
- package/dist/types/commands/setheadercolumncommand.d.ts +50 -0
- package/dist/types/commands/setheaderrowcommand.d.ts +53 -0
- package/dist/types/commands/splitcellcommand.d.ts +43 -0
- package/dist/types/converters/downcast.d.ts +63 -0
- package/dist/types/converters/table-caption-post-fixer.d.ts +20 -0
- package/dist/types/converters/table-cell-paragraph-post-fixer.d.ts +32 -0
- package/dist/types/converters/table-cell-refresh-handler.d.ts +18 -0
- package/dist/types/converters/table-headings-refresh-handler.d.ts +17 -0
- package/dist/types/converters/table-layout-post-fixer.d.ts +226 -0
- package/dist/types/converters/tableproperties.d.ts +54 -0
- package/dist/types/converters/upcasttable.d.ts +49 -0
- package/dist/types/index.d.ts +60 -0
- package/dist/types/plaintableoutput.d.ts +26 -0
- package/dist/types/table.d.ts +40 -0
- package/dist/types/tablecaption/tablecaptionediting.d.ts +63 -0
- package/dist/types/tablecaption/tablecaptionui.d.ts +21 -0
- package/dist/types/tablecaption/toggletablecaptioncommand.d.ts +68 -0
- package/dist/types/tablecaption/utils.d.ts +38 -0
- package/dist/types/tablecaption.d.ts +24 -0
- package/dist/types/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +32 -0
- package/dist/types/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +37 -0
- package/dist/types/tablecellproperties/commands/tablecellborderstylecommand.d.ts +37 -0
- package/dist/types/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +51 -0
- package/dist/types/tablecellproperties/commands/tablecellheightcommand.d.ts +46 -0
- package/dist/types/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +32 -0
- package/dist/types/tablecellproperties/commands/tablecellpaddingcommand.d.ts +51 -0
- package/dist/types/tablecellproperties/commands/tablecellpropertycommand.d.ts +62 -0
- package/dist/types/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +40 -0
- package/dist/types/tablecellproperties/tablecellpropertiesediting.d.ts +43 -0
- package/dist/types/tablecellproperties/tablecellpropertiesui.d.ts +112 -0
- package/dist/types/tablecellproperties/ui/tablecellpropertiesview.d.ts +228 -0
- package/dist/types/tablecellproperties.d.ts +30 -0
- package/dist/types/tablecellwidth/commands/tablecellwidthcommand.d.ts +46 -0
- package/dist/types/tablecellwidth/tablecellwidthediting.d.ts +29 -0
- package/dist/types/tableclipboard.d.ts +70 -0
- package/dist/types/tablecolumnresize/constants.d.ts +20 -0
- package/dist/types/tablecolumnresize/converters.d.ts +18 -0
- package/dist/types/tablecolumnresize/tablecolumnresizeediting.d.ts +139 -0
- package/dist/types/tablecolumnresize/tablewidthscommand.d.ts +38 -0
- package/dist/types/tablecolumnresize/utils.d.ts +148 -0
- package/dist/types/tablecolumnresize.d.ts +26 -0
- package/dist/types/tableconfig.d.ts +343 -0
- package/dist/types/tableediting.d.ts +98 -0
- package/dist/types/tablekeyboard.d.ts +68 -0
- package/dist/types/tablemouse/mouseeventsobserver.d.ts +62 -0
- package/dist/types/tablemouse.d.ts +48 -0
- package/dist/types/tableproperties/commands/tablealignmentcommand.d.ts +32 -0
- package/dist/types/tableproperties/commands/tablebackgroundcolorcommand.d.ts +32 -0
- package/dist/types/tableproperties/commands/tablebordercolorcommand.d.ts +37 -0
- package/dist/types/tableproperties/commands/tableborderstylecommand.d.ts +37 -0
- package/dist/types/tableproperties/commands/tableborderwidthcommand.d.ts +51 -0
- package/dist/types/tableproperties/commands/tableheightcommand.d.ts +46 -0
- package/dist/types/tableproperties/commands/tablepropertycommand.d.ts +61 -0
- package/dist/types/tableproperties/commands/tablewidthcommand.d.ts +46 -0
- package/dist/types/tableproperties/tablepropertiesediting.d.ts +40 -0
- package/dist/types/tableproperties/tablepropertiesui.d.ts +114 -0
- package/dist/types/tableproperties/ui/tablepropertiesview.d.ts +207 -0
- package/dist/types/tableproperties.d.ts +30 -0
- package/dist/types/tableselection.d.ts +107 -0
- package/dist/types/tabletoolbar.d.ts +32 -0
- package/dist/types/tableui.d.ts +53 -0
- package/dist/types/tableutils.d.ts +448 -0
- package/dist/types/tablewalker.d.ts +362 -0
- package/dist/types/ui/colorinputview.d.ts +140 -0
- package/dist/types/ui/formrowview.d.ts +61 -0
- package/dist/types/ui/inserttableview.d.ts +77 -0
- package/dist/types/utils/common.d.ts +46 -0
- package/dist/types/utils/structure.d.ts +245 -0
- package/dist/types/utils/table-properties.d.ts +67 -0
- package/dist/types/utils/ui/contextualballoon.d.ts +34 -0
- package/dist/types/utils/ui/table-properties.d.ts +195 -0
- package/dist/types/utils/ui/widget.d.ts +20 -0
- package/package.json +3 -2
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
* @module table/tablecellproperties/tablecellpropertiesui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { ContextualBalloon } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import TableCellPropertiesView from './ui/tablecellpropertiesview.js';
|
|
11
|
+
/**
|
|
12
|
+
* The table cell properties UI plugin. It introduces the `'tableCellProperties'` button
|
|
13
|
+
* that opens a form allowing to specify the visual styling of a table cell.
|
|
14
|
+
*
|
|
15
|
+
* It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
|
|
16
|
+
*/
|
|
17
|
+
export default class TableCellPropertiesUI extends Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* The default table cell properties.
|
|
20
|
+
*/
|
|
21
|
+
private _defaultTableCellProperties;
|
|
22
|
+
/**
|
|
23
|
+
* The contextual balloon plugin instance.
|
|
24
|
+
*/
|
|
25
|
+
private _balloon?;
|
|
26
|
+
/**
|
|
27
|
+
* The cell properties form view displayed inside the balloon.
|
|
28
|
+
*/
|
|
29
|
+
view?: TableCellPropertiesView | null;
|
|
30
|
+
/**
|
|
31
|
+
* The batch used to undo all changes made by the form (which are live, as the user types)
|
|
32
|
+
* when "Cancel" was pressed. Each time the view is shown, a new batch is created.
|
|
33
|
+
*/
|
|
34
|
+
private _undoStepBatch?;
|
|
35
|
+
/**
|
|
36
|
+
* Flag used to indicate whether view is ready to execute update commands
|
|
37
|
+
* (it finished loading initial data).
|
|
38
|
+
*/
|
|
39
|
+
private _isReady?;
|
|
40
|
+
/**
|
|
41
|
+
* @inheritDoc
|
|
42
|
+
*/
|
|
43
|
+
static get requires(): readonly [typeof ContextualBalloon];
|
|
44
|
+
/**
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
static get pluginName(): "TableCellPropertiesUI";
|
|
48
|
+
/**
|
|
49
|
+
* @inheritDoc
|
|
50
|
+
*/
|
|
51
|
+
constructor(editor: Editor);
|
|
52
|
+
/**
|
|
53
|
+
* @inheritDoc
|
|
54
|
+
*/
|
|
55
|
+
init(): void;
|
|
56
|
+
/**
|
|
57
|
+
* @inheritDoc
|
|
58
|
+
*/
|
|
59
|
+
destroy(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Creates the {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView} instance.
|
|
62
|
+
*
|
|
63
|
+
* @returns The cell properties form view instance.
|
|
64
|
+
*/
|
|
65
|
+
private _createPropertiesView;
|
|
66
|
+
/**
|
|
67
|
+
* In this method the "editor data -> UI" binding is happening.
|
|
68
|
+
*
|
|
69
|
+
* When executed, this method obtains selected cell property values from various table commands
|
|
70
|
+
* and passes them to the {@link #view}.
|
|
71
|
+
*
|
|
72
|
+
* This way, the UI stays up–to–date with the editor data.
|
|
73
|
+
*/
|
|
74
|
+
private _fillViewFormFromCommandValues;
|
|
75
|
+
/**
|
|
76
|
+
* Shows the {@link #view} in the {@link #_balloon}.
|
|
77
|
+
*
|
|
78
|
+
* **Note**: Each time a view is shown, a new {@link #_undoStepBatch} is created. It contains
|
|
79
|
+
* all changes made to the document when the view is visible, allowing a single undo step
|
|
80
|
+
* for all of them.
|
|
81
|
+
*/
|
|
82
|
+
protected _showView(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Removes the {@link #view} from the {@link #_balloon}.
|
|
85
|
+
*/
|
|
86
|
+
protected _hideView(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Repositions the {@link #_balloon} or hides the {@link #view} if a table cell is no longer selected.
|
|
89
|
+
*/
|
|
90
|
+
protected _updateView(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Returns `true` when the {@link #view} is visible in the {@link #_balloon}.
|
|
93
|
+
*/
|
|
94
|
+
private get _isViewVisible();
|
|
95
|
+
/**
|
|
96
|
+
* Returns `true` when the {@link #view} is in the {@link #_balloon}.
|
|
97
|
+
*/
|
|
98
|
+
private get _isViewInBalloon();
|
|
99
|
+
/**
|
|
100
|
+
* Creates a callback that when executed upon the {@link #view view's} property change
|
|
101
|
+
* executes a related editor command with the new property value.
|
|
102
|
+
*
|
|
103
|
+
* @param defaultValue The default value of the command.
|
|
104
|
+
*/
|
|
105
|
+
private _getPropertyChangeCallback;
|
|
106
|
+
/**
|
|
107
|
+
* Creates a callback that when executed upon the {@link #view view's} property change:
|
|
108
|
+
* * Executes a related editor command with the new property value if the value is valid,
|
|
109
|
+
* * Or sets the error text next to the invalid field, if the value did not pass the validation.
|
|
110
|
+
*/
|
|
111
|
+
private _getValidatedPropertyChangeCallback;
|
|
112
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
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
|
+
* @module table/tablecellproperties/ui/tablecellpropertiesview
|
|
7
|
+
*/
|
|
8
|
+
import { ButtonView, FocusCycler, LabeledFieldView, ToolbarView, View, ViewCollection, type FocusableView, type NormalizedColorOption, type ColorPickerConfig } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { KeystrokeHandler, FocusTracker, type Locale } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import type ColorInputView from '../../ui/colorinputview.js';
|
|
11
|
+
import type { TableCellPropertiesOptions } from '../../tableconfig.js';
|
|
12
|
+
import '../../../theme/form.css';
|
|
13
|
+
import '../../../theme/tableform.css';
|
|
14
|
+
import '../../../theme/tablecellproperties.css';
|
|
15
|
+
export interface TableCellPropertiesViewOptions {
|
|
16
|
+
borderColors: Array<NormalizedColorOption>;
|
|
17
|
+
backgroundColors: Array<NormalizedColorOption>;
|
|
18
|
+
defaultTableCellProperties: TableCellPropertiesOptions;
|
|
19
|
+
colorPickerConfig: false | ColorPickerConfig;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The class representing a table cell properties form, allowing users to customize
|
|
23
|
+
* certain style aspects of a table cell, for instance, border, padding, text alignment, etc..
|
|
24
|
+
*/
|
|
25
|
+
export default class TableCellPropertiesView extends View {
|
|
26
|
+
/**
|
|
27
|
+
* The value of the cell border style.
|
|
28
|
+
*
|
|
29
|
+
* @observable
|
|
30
|
+
* @default ''
|
|
31
|
+
*/
|
|
32
|
+
borderStyle: string;
|
|
33
|
+
/**
|
|
34
|
+
* The value of the cell border width style.
|
|
35
|
+
*
|
|
36
|
+
* @observable
|
|
37
|
+
* @default ''
|
|
38
|
+
*/
|
|
39
|
+
borderWidth: string;
|
|
40
|
+
/**
|
|
41
|
+
* The value of the cell border color style.
|
|
42
|
+
*
|
|
43
|
+
* @observable
|
|
44
|
+
* @default ''
|
|
45
|
+
*/
|
|
46
|
+
borderColor: string;
|
|
47
|
+
/**
|
|
48
|
+
* The value of the cell padding style.
|
|
49
|
+
*
|
|
50
|
+
* @observable
|
|
51
|
+
* @default ''
|
|
52
|
+
*/
|
|
53
|
+
padding: string;
|
|
54
|
+
/**
|
|
55
|
+
* The value of the cell background color style.
|
|
56
|
+
*
|
|
57
|
+
* @observable
|
|
58
|
+
* @default ''
|
|
59
|
+
*/
|
|
60
|
+
backgroundColor: string;
|
|
61
|
+
/**
|
|
62
|
+
* The value of the table cell width style.
|
|
63
|
+
*
|
|
64
|
+
* @observable
|
|
65
|
+
* @default ''
|
|
66
|
+
*/
|
|
67
|
+
width: string;
|
|
68
|
+
/**
|
|
69
|
+
* The value of the table cell height style.
|
|
70
|
+
*
|
|
71
|
+
* @observable
|
|
72
|
+
* @default ''
|
|
73
|
+
*/
|
|
74
|
+
height: string;
|
|
75
|
+
/**
|
|
76
|
+
* The value of the horizontal text alignment style.
|
|
77
|
+
*
|
|
78
|
+
* @observable
|
|
79
|
+
* @default ''
|
|
80
|
+
*/
|
|
81
|
+
horizontalAlignment: string;
|
|
82
|
+
/**
|
|
83
|
+
* The value of the vertical text alignment style.
|
|
84
|
+
*
|
|
85
|
+
* @observable
|
|
86
|
+
* @default ''
|
|
87
|
+
*/
|
|
88
|
+
verticalAlignment: string;
|
|
89
|
+
/**
|
|
90
|
+
* Options passed to the view. See {@link #constructor} to learn more.
|
|
91
|
+
*/
|
|
92
|
+
readonly options: TableCellPropertiesViewOptions;
|
|
93
|
+
/**
|
|
94
|
+
* Tracks information about the DOM focus in the form.
|
|
95
|
+
*/
|
|
96
|
+
readonly focusTracker: FocusTracker;
|
|
97
|
+
/**
|
|
98
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
99
|
+
*/
|
|
100
|
+
readonly keystrokes: KeystrokeHandler;
|
|
101
|
+
/**
|
|
102
|
+
* A collection of child views in the form.
|
|
103
|
+
*/
|
|
104
|
+
readonly children: ViewCollection;
|
|
105
|
+
/**
|
|
106
|
+
* A dropdown that allows selecting the style of the table cell border.
|
|
107
|
+
*/
|
|
108
|
+
readonly borderStyleDropdown: LabeledFieldView<FocusableView>;
|
|
109
|
+
/**
|
|
110
|
+
* An input that allows specifying the width of the table cell border.
|
|
111
|
+
*/
|
|
112
|
+
readonly borderWidthInput: LabeledFieldView<FocusableView>;
|
|
113
|
+
/**
|
|
114
|
+
* An input that allows specifying the color of the table cell border.
|
|
115
|
+
*/
|
|
116
|
+
readonly borderColorInput: LabeledFieldView<ColorInputView>;
|
|
117
|
+
/**
|
|
118
|
+
* An input that allows specifying the table cell background color.
|
|
119
|
+
*/
|
|
120
|
+
readonly backgroundInput: LabeledFieldView<ColorInputView>;
|
|
121
|
+
/**
|
|
122
|
+
* An input that allows specifying the table cell padding.
|
|
123
|
+
*/
|
|
124
|
+
readonly paddingInput: LabeledFieldView;
|
|
125
|
+
/**
|
|
126
|
+
* An input that allows specifying the table cell width.
|
|
127
|
+
*/
|
|
128
|
+
readonly widthInput: LabeledFieldView<FocusableView>;
|
|
129
|
+
/**
|
|
130
|
+
* An input that allows specifying the table cell height.
|
|
131
|
+
*/
|
|
132
|
+
readonly heightInput: LabeledFieldView<FocusableView>;
|
|
133
|
+
/**
|
|
134
|
+
* A toolbar with buttons that allow changing the horizontal text alignment in a table cell.
|
|
135
|
+
*/
|
|
136
|
+
readonly horizontalAlignmentToolbar: ToolbarView;
|
|
137
|
+
/**
|
|
138
|
+
* A toolbar with buttons that allow changing the vertical text alignment in a table cell.
|
|
139
|
+
*/
|
|
140
|
+
readonly verticalAlignmentToolbar: ToolbarView;
|
|
141
|
+
/**
|
|
142
|
+
* The "Save" button view.
|
|
143
|
+
*/
|
|
144
|
+
saveButtonView: ButtonView;
|
|
145
|
+
/**
|
|
146
|
+
* The "Cancel" button view.
|
|
147
|
+
*/
|
|
148
|
+
cancelButtonView: ButtonView;
|
|
149
|
+
/**
|
|
150
|
+
* A collection of views that can be focused in the form.
|
|
151
|
+
*/
|
|
152
|
+
protected readonly _focusables: ViewCollection<FocusableView>;
|
|
153
|
+
/**
|
|
154
|
+
* Helps cycling over {@link #_focusables} in the form.
|
|
155
|
+
*/
|
|
156
|
+
protected readonly _focusCycler: FocusCycler;
|
|
157
|
+
/**
|
|
158
|
+
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
159
|
+
* @param options Additional configuration of the view.
|
|
160
|
+
* @param options.borderColors A configuration of the border color palette used by the
|
|
161
|
+
* {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView#borderColorInput}.
|
|
162
|
+
* @param options.backgroundColors A configuration of the background color palette used by the
|
|
163
|
+
* {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView#backgroundInput}.
|
|
164
|
+
* @param options.defaultTableCellProperties The default table cell properties.
|
|
165
|
+
*/
|
|
166
|
+
constructor(locale: Locale, options: TableCellPropertiesViewOptions);
|
|
167
|
+
/**
|
|
168
|
+
* @inheritDoc
|
|
169
|
+
*/
|
|
170
|
+
render(): void;
|
|
171
|
+
/**
|
|
172
|
+
* @inheritDoc
|
|
173
|
+
*/
|
|
174
|
+
destroy(): void;
|
|
175
|
+
/**
|
|
176
|
+
* Focuses the fist focusable field in the form.
|
|
177
|
+
*/
|
|
178
|
+
focus(): void;
|
|
179
|
+
/**
|
|
180
|
+
* Creates the following form fields:
|
|
181
|
+
*
|
|
182
|
+
* * {@link #borderStyleDropdown},
|
|
183
|
+
* * {@link #borderWidthInput},
|
|
184
|
+
* * {@link #borderColorInput}.
|
|
185
|
+
*/
|
|
186
|
+
private _createBorderFields;
|
|
187
|
+
/**
|
|
188
|
+
* Creates the following form fields:
|
|
189
|
+
*
|
|
190
|
+
* * {@link #backgroundInput}.
|
|
191
|
+
*/
|
|
192
|
+
private _createBackgroundFields;
|
|
193
|
+
/**
|
|
194
|
+
* Creates the following form fields:
|
|
195
|
+
*
|
|
196
|
+
* * {@link #widthInput}.
|
|
197
|
+
* * {@link #heightInput}.
|
|
198
|
+
*/
|
|
199
|
+
private _createDimensionFields;
|
|
200
|
+
/**
|
|
201
|
+
* Creates the following form fields:
|
|
202
|
+
*
|
|
203
|
+
* * {@link #paddingInput}.
|
|
204
|
+
*/
|
|
205
|
+
private _createPaddingField;
|
|
206
|
+
/**
|
|
207
|
+
* Creates the following form fields:
|
|
208
|
+
*
|
|
209
|
+
* * {@link #horizontalAlignmentToolbar},
|
|
210
|
+
* * {@link #verticalAlignmentToolbar}.
|
|
211
|
+
*/
|
|
212
|
+
private _createAlignmentFields;
|
|
213
|
+
/**
|
|
214
|
+
* Creates the following form controls:
|
|
215
|
+
*
|
|
216
|
+
* * {@link #saveButtonView},
|
|
217
|
+
* * {@link #cancelButtonView}.
|
|
218
|
+
*/
|
|
219
|
+
private _createActionButtons;
|
|
220
|
+
/**
|
|
221
|
+
* Provides localized labels for {@link #horizontalAlignmentToolbar} buttons.
|
|
222
|
+
*/
|
|
223
|
+
private get _horizontalAlignmentLabels();
|
|
224
|
+
/**
|
|
225
|
+
* Provides localized labels for {@link #verticalAlignmentToolbar} buttons.
|
|
226
|
+
*/
|
|
227
|
+
private get _verticalAlignmentLabels();
|
|
228
|
+
}
|
|
@@ -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
|
+
* @module table/tablecellproperties
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import TableCellPropertiesUI from './tablecellproperties/tablecellpropertiesui.js';
|
|
10
|
+
import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertiesediting.js';
|
|
11
|
+
/**
|
|
12
|
+
* The table cell properties feature. Enables support for setting properties of table cells (size, border, background, etc.).
|
|
13
|
+
*
|
|
14
|
+
* Read more in the {@glink features/tables/tables-styling Table and cell styling tools} section.
|
|
15
|
+
* See also the {@link module:table/tableproperties~TableProperties} plugin.
|
|
16
|
+
*
|
|
17
|
+
* This is a "glue" plugin that loads the
|
|
18
|
+
* {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing table cell properties editing feature} and
|
|
19
|
+
* the {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI table cell properties UI feature}.
|
|
20
|
+
*/
|
|
21
|
+
export default class TableCellProperties extends Plugin {
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get pluginName(): "TableCellProperties";
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get requires(): readonly [typeof TableCellPropertiesEditing, typeof TableCellPropertiesUI];
|
|
30
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
* @module table/tablecellwidth/commands/tablecellwidthcommand
|
|
7
|
+
*/
|
|
8
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
9
|
+
import TableCellPropertyCommand from '../../tablecellproperties/commands/tablecellpropertycommand.js';
|
|
10
|
+
/**
|
|
11
|
+
* The table cell width command.
|
|
12
|
+
*
|
|
13
|
+
* The command is registered by the {@link module:table/tablecellwidth/tablecellwidthediting~TableCellWidthEditing} as
|
|
14
|
+
* the `'tableCellWidth'` editor command.
|
|
15
|
+
*
|
|
16
|
+
* To change the width of selected cells, execute the command:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* editor.execute( 'tableCellWidth', {
|
|
20
|
+
* value: '50px'
|
|
21
|
+
* } );
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* **Note**: This command adds a default `'px'` unit to numeric values. Executing:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* editor.execute( 'tableCellWidth', {
|
|
28
|
+
* value: '50'
|
|
29
|
+
* } );
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* will set the `width` attribute to `'50px'` in the model.
|
|
33
|
+
*/
|
|
34
|
+
export default class TableCellWidthCommand extends TableCellPropertyCommand {
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new `TableCellWidthCommand` instance.
|
|
37
|
+
*
|
|
38
|
+
* @param editor An editor in which this command will be used.
|
|
39
|
+
* @param defaultValue The default value of the attribute.
|
|
40
|
+
*/
|
|
41
|
+
constructor(editor: Editor, defaultValue: string);
|
|
42
|
+
/**
|
|
43
|
+
* @inheritDoc
|
|
44
|
+
*/
|
|
45
|
+
_getValueToSet(value: string | number | undefined): unknown;
|
|
46
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
* @module table/tablecellwidth/tablecellwidthediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import TableEditing from './../tableediting.js';
|
|
10
|
+
/**
|
|
11
|
+
* The table cell width editing feature.
|
|
12
|
+
*
|
|
13
|
+
* Introduces `tableCellWidth` table cell model attribute alongside with its converters
|
|
14
|
+
* and a command.
|
|
15
|
+
*/
|
|
16
|
+
export default class TableCellWidthEditing extends Plugin {
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get pluginName(): "TableCellWidthEditing";
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get requires(): readonly [typeof TableEditing];
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
init(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
import { ClipboardPipeline, ClipboardMarkersUtils } from 'ckeditor5/src/clipboard.js';
|
|
6
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
7
|
+
import type { DocumentFragment, Element, Item, Model, Position, Writer } from 'ckeditor5/src/engine.js';
|
|
8
|
+
import TableSelection from './tableselection.js';
|
|
9
|
+
import { type TableSlot } from './tablewalker.js';
|
|
10
|
+
import TableUtils from './tableutils.js';
|
|
11
|
+
/**
|
|
12
|
+
* This plugin adds support for copying/cutting/pasting fragments of tables.
|
|
13
|
+
* It is loaded automatically by the {@link module:table/table~Table} plugin.
|
|
14
|
+
*/
|
|
15
|
+
export default class TableClipboard extends Plugin {
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
static get pluginName(): "TableClipboard";
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get requires(): readonly [typeof ClipboardMarkersUtils, typeof ClipboardPipeline, typeof TableSelection, typeof TableUtils];
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
init(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Copies table content to a clipboard on "copy" & "cut" events.
|
|
30
|
+
*
|
|
31
|
+
* @param evt An object containing information about the handled event.
|
|
32
|
+
* @param data Clipboard event data.
|
|
33
|
+
*/
|
|
34
|
+
private _onCopyCut;
|
|
35
|
+
/**
|
|
36
|
+
* Overrides default {@link module:engine/model/model~Model#insertContent `model.insertContent()`} method to handle pasting table inside
|
|
37
|
+
* selected table fragment.
|
|
38
|
+
*
|
|
39
|
+
* Depending on selected table fragment:
|
|
40
|
+
* - If a selected table fragment is smaller than paste table it will crop pasted table to match dimensions.
|
|
41
|
+
* - If dimensions are equal it will replace selected table fragment with a pasted table contents.
|
|
42
|
+
*
|
|
43
|
+
* @param content The content to insert.
|
|
44
|
+
* @param selectable The selection into which the content should be inserted.
|
|
45
|
+
* If not provided the current model document selection will be used.
|
|
46
|
+
*/
|
|
47
|
+
private _onInsertContent;
|
|
48
|
+
/**
|
|
49
|
+
* Inserts provided `selectedTableCells` into `pastedTable`.
|
|
50
|
+
*/
|
|
51
|
+
private _replaceSelectedCells;
|
|
52
|
+
/**
|
|
53
|
+
* Replaces the part of selectedTable with pastedTable.
|
|
54
|
+
*/
|
|
55
|
+
private _replaceSelectedCellsWithPasted;
|
|
56
|
+
/**
|
|
57
|
+
* Replaces a single table slot.
|
|
58
|
+
*
|
|
59
|
+
* @returns Inserted table cell or null if slot should remain empty.
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
_replaceTableSlotCell(tableSlot: TableSlot, cellToInsert: Element | null, insertPosition: Position, writer: Writer): Element | null;
|
|
63
|
+
/**
|
|
64
|
+
* Extracts the table for pasting into a table.
|
|
65
|
+
*
|
|
66
|
+
* @param content The content to insert.
|
|
67
|
+
* @param model The editor model.
|
|
68
|
+
*/
|
|
69
|
+
getTableIfOnlyTableInContent(content: DocumentFragment | Item, model: Model): Element | null;
|
|
70
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
* @module table/tablecolumnresize/constants
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The minimum column width given as a percentage value. Used in situations when the table is not yet rendered, so it is impossible to
|
|
10
|
+
* calculate how many percentage of the table width would be {@link ~COLUMN_MIN_WIDTH_IN_PIXELS minimum column width in pixels}.
|
|
11
|
+
*/
|
|
12
|
+
export declare const COLUMN_MIN_WIDTH_AS_PERCENTAGE = 5;
|
|
13
|
+
/**
|
|
14
|
+
* The minimum column width in pixels when the maximum table width is known.
|
|
15
|
+
*/
|
|
16
|
+
export declare const COLUMN_MIN_WIDTH_IN_PIXELS = 40;
|
|
17
|
+
/**
|
|
18
|
+
* Determines how many digits after the decimal point are used to store the column width as a percentage value.
|
|
19
|
+
*/
|
|
20
|
+
export declare const COLUMN_WIDTH_PRECISION = 2;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
* @module table/tablecolumnresize/converters
|
|
7
|
+
*/
|
|
8
|
+
import type { DowncastDispatcher, UpcastDispatcher } from 'ckeditor5/src/engine.js';
|
|
9
|
+
import type TableUtils from '../tableutils.js';
|
|
10
|
+
/**
|
|
11
|
+
* Returns a upcast helper that ensures the number of `<tableColumn>` elements corresponds to the actual number of columns in the table,
|
|
12
|
+
* because the input data might have too few or too many <col> elements.
|
|
13
|
+
*/
|
|
14
|
+
export declare function upcastColgroupElement(tableUtilsPlugin: TableUtils): (dispatcher: UpcastDispatcher) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Returns downcast helper for adding `ck-table-resized` class if there is a `<tableColumnGroup>` element inside the table.
|
|
17
|
+
*/
|
|
18
|
+
export declare function downcastTableResizedClass(): (dispatcher: DowncastDispatcher) => void;
|