@ckeditor/ckeditor5-table 36.0.1 → 37.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/table.js +1 -1
- package/package.json +34 -29
- package/src/commands/insertcolumncommand.d.ts +61 -0
- package/src/commands/insertcolumncommand.js +45 -60
- package/src/commands/insertrowcommand.d.ts +60 -0
- package/src/commands/insertrowcommand.js +44 -59
- package/src/commands/inserttablecommand.d.ts +50 -0
- package/src/commands/inserttablecommand.js +51 -68
- package/src/commands/mergecellcommand.d.ts +76 -0
- package/src/commands/mergecellcommand.js +169 -244
- package/src/commands/mergecellscommand.d.ts +33 -0
- package/src/commands/mergecellscommand.js +72 -101
- package/src/commands/removecolumncommand.d.ts +34 -0
- package/src/commands/removecolumncommand.js +88 -102
- package/src/commands/removerowcommand.d.ts +34 -0
- package/src/commands/removerowcommand.js +63 -80
- package/src/commands/selectcolumncommand.d.ts +38 -0
- package/src/commands/selectcolumncommand.js +41 -54
- package/src/commands/selectrowcommand.d.ts +38 -0
- package/src/commands/selectrowcommand.js +38 -48
- package/src/commands/setheadercolumncommand.d.ts +55 -0
- package/src/commands/setheadercolumncommand.js +48 -73
- package/src/commands/setheaderrowcommand.d.ts +58 -0
- package/src/commands/setheaderrowcommand.js +56 -85
- package/src/commands/splitcellcommand.d.ts +49 -0
- package/src/commands/splitcellcommand.js +35 -49
- package/src/converters/downcast.d.ts +63 -0
- package/src/converters/downcast.js +98 -130
- package/src/converters/table-caption-post-fixer.d.ts +20 -0
- package/src/converters/table-caption-post-fixer.js +36 -52
- package/src/converters/table-cell-paragraph-post-fixer.d.ts +32 -0
- package/src/converters/table-cell-paragraph-post-fixer.js +88 -119
- package/src/converters/table-cell-refresh-handler.d.ts +18 -0
- package/src/converters/table-cell-refresh-handler.js +29 -48
- package/src/converters/table-headings-refresh-handler.d.ts +17 -0
- package/src/converters/table-headings-refresh-handler.js +35 -54
- package/src/converters/table-layout-post-fixer.d.ts +226 -0
- package/src/converters/table-layout-post-fixer.js +276 -313
- package/src/converters/tableproperties.d.ts +54 -0
- package/src/converters/tableproperties.js +136 -168
- package/src/converters/upcasttable.d.ts +49 -0
- package/src/converters/upcasttable.js +196 -251
- package/src/index.d.ts +29 -0
- package/src/index.js +0 -2
- package/src/plaintableoutput.d.ts +30 -0
- package/src/plaintableoutput.js +107 -135
- package/src/table.d.ts +38 -0
- package/src/table.js +12 -88
- package/src/tablecaption/tablecaptionediting.d.ts +68 -0
- package/src/tablecaption/tablecaptionediting.js +104 -135
- package/src/tablecaption/tablecaptionui.d.ts +26 -0
- package/src/tablecaption/tablecaptionui.js +42 -58
- package/src/tablecaption/toggletablecaptioncommand.d.ts +73 -0
- package/src/tablecaption/toggletablecaptioncommand.js +77 -92
- package/src/tablecaption/utils.d.ts +42 -0
- package/src/tablecaption/utils.js +35 -61
- package/src/tablecaption.d.ts +27 -0
- package/src/tablecaption.js +12 -19
- package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +37 -0
- package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +14 -20
- package/src/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +42 -0
- package/src/tablecellproperties/commands/tablecellbordercolorcommand.js +27 -37
- package/src/tablecellproperties/commands/tablecellborderstylecommand.d.ts +42 -0
- package/src/tablecellproperties/commands/tablecellborderstylecommand.js +27 -37
- package/src/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +56 -0
- package/src/tablecellproperties/commands/tablecellborderwidthcommand.js +42 -53
- package/src/tablecellproperties/commands/tablecellheightcommand.d.ts +51 -0
- package/src/tablecellproperties/commands/tablecellheightcommand.js +29 -36
- package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +37 -0
- package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +14 -20
- package/src/tablecellproperties/commands/tablecellpaddingcommand.d.ts +56 -0
- package/src/tablecellproperties/commands/tablecellpaddingcommand.js +42 -53
- package/src/tablecellproperties/commands/tablecellpropertycommand.d.ts +62 -0
- package/src/tablecellproperties/commands/tablecellpropertycommand.js +77 -122
- package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +45 -0
- package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js +14 -20
- package/src/tablecellproperties/tablecellpropertiesediting.d.ts +47 -0
- package/src/tablecellproperties/tablecellpropertiesediting.js +194 -236
- package/src/tablecellproperties/tablecellpropertiesui.d.ts +117 -0
- package/src/tablecellproperties/tablecellpropertiesui.js +303 -456
- package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +227 -0
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +509 -844
- package/src/tablecellproperties.d.ts +33 -0
- package/src/tablecellproperties.js +12 -98
- package/src/tablecellwidth/commands/tablecellwidthcommand.d.ts +51 -0
- package/src/tablecellwidth/commands/tablecellwidthcommand.js +29 -35
- package/src/tablecellwidth/tablecellwidthediting.d.ts +34 -0
- package/src/tablecellwidth/tablecellwidthediting.js +26 -38
- package/src/tableclipboard.d.ts +68 -0
- package/src/tableclipboard.js +429 -568
- package/src/tablecolumnresize/constants.d.ts +20 -0
- package/src/tablecolumnresize/constants.js +0 -10
- package/src/tablecolumnresize/converters.d.ts +18 -0
- package/src/tablecolumnresize/converters.js +35 -119
- package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +142 -0
- package/src/tablecolumnresize/tablecolumnresizeediting.js +545 -711
- package/src/tablecolumnresize/tablewidthscommand.d.ts +38 -0
- package/src/tablecolumnresize/tablewidthscommand.js +61 -0
- package/src/tablecolumnresize/utils.d.ts +141 -0
- package/src/tablecolumnresize/utils.js +256 -233
- package/src/tablecolumnresize.d.ts +29 -0
- package/src/tablecolumnresize.js +12 -19
- package/src/tableconfig.d.ts +341 -0
- package/src/tableconfig.js +5 -0
- package/src/tableediting.d.ts +102 -0
- package/src/tableediting.js +157 -176
- package/src/tablekeyboard.d.ts +68 -0
- package/src/tablekeyboard.js +261 -344
- package/src/tablemouse/mouseeventsobserver.d.ts +62 -0
- package/src/tablemouse/mouseeventsobserver.js +12 -49
- package/src/tablemouse.d.ts +51 -0
- package/src/tablemouse.js +154 -202
- package/src/tableproperties/commands/tablealignmentcommand.d.ts +37 -0
- package/src/tableproperties/commands/tablealignmentcommand.js +14 -20
- package/src/tableproperties/commands/tablebackgroundcolorcommand.d.ts +37 -0
- package/src/tableproperties/commands/tablebackgroundcolorcommand.js +14 -20
- package/src/tableproperties/commands/tablebordercolorcommand.d.ts +42 -0
- package/src/tableproperties/commands/tablebordercolorcommand.js +27 -37
- package/src/tableproperties/commands/tableborderstylecommand.d.ts +42 -0
- package/src/tableproperties/commands/tableborderstylecommand.js +27 -37
- package/src/tableproperties/commands/tableborderwidthcommand.d.ts +56 -0
- package/src/tableproperties/commands/tableborderwidthcommand.js +42 -53
- package/src/tableproperties/commands/tableheightcommand.d.ts +51 -0
- package/src/tableproperties/commands/tableheightcommand.js +29 -33
- package/src/tableproperties/commands/tablepropertycommand.d.ts +61 -0
- package/src/tableproperties/commands/tablepropertycommand.js +68 -112
- package/src/tableproperties/commands/tablewidthcommand.d.ts +51 -0
- package/src/tableproperties/commands/tablewidthcommand.js +29 -33
- package/src/tableproperties/tablepropertiesediting.d.ts +45 -0
- package/src/tableproperties/tablepropertiesediting.js +164 -210
- package/src/tableproperties/tablepropertiesui.d.ts +119 -0
- package/src/tableproperties/tablepropertiesui.js +294 -439
- package/src/tableproperties/ui/tablepropertiesview.d.ts +203 -0
- package/src/tableproperties/ui/tablepropertiesview.js +427 -718
- package/src/tableproperties.d.ts +33 -0
- package/src/tableproperties.js +12 -95
- package/src/tableselection.d.ts +111 -0
- package/src/tableselection.js +279 -376
- package/src/tabletoolbar.d.ts +37 -0
- package/src/tabletoolbar.js +39 -92
- package/src/tableui.d.ts +58 -0
- package/src/tableui.js +281 -338
- package/src/tableutils.d.ts +453 -0
- package/src/tableutils.js +1015 -1229
- package/src/tablewalker.d.ts +323 -0
- package/src/tablewalker.js +308 -548
- package/src/ui/colorinputview.d.ts +143 -0
- package/src/ui/colorinputview.js +229 -366
- package/src/ui/formrowview.d.ts +61 -0
- package/src/ui/formrowview.js +38 -84
- package/src/ui/inserttableview.d.ts +77 -0
- package/src/ui/inserttableview.js +152 -242
- package/src/utils/common.d.ts +42 -0
- package/src/utils/common.js +33 -57
- package/src/utils/structure.d.ts +245 -0
- package/src/utils/structure.js +261 -379
- package/src/utils/table-properties.d.ts +67 -0
- package/src/utils/table-properties.js +60 -81
- package/src/utils/ui/contextualballoon.d.ts +34 -0
- package/src/utils/ui/contextualballoon.js +70 -89
- package/src/utils/ui/table-properties.d.ts +193 -0
- package/src/utils/ui/table-properties.js +259 -319
- package/src/utils/ui/widget.d.ts +16 -0
- package/src/utils/ui/widget.js +24 -46
- package/src/tablecolumnresize/tablecolumnwidthscommand.js +0 -55
- package/src/tablecolumnresize/tablewidthresizecommand.js +0 -65
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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, type PluginDependencies } from 'ckeditor5/src/core';
|
|
9
|
+
/**
|
|
10
|
+
* The table cell properties feature. Enables support for setting properties of table cells (size, border, background, etc.).
|
|
11
|
+
*
|
|
12
|
+
* Read more in the {@glink features/table#table-and-cell-styling-tools Table and cell styling tools} section.
|
|
13
|
+
* See also the {@link module:table/tableproperties~TableProperties} plugin.
|
|
14
|
+
*
|
|
15
|
+
* This is a "glue" plugin that loads the
|
|
16
|
+
* {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing table cell properties editing feature} and
|
|
17
|
+
* the {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI table cell properties UI feature}.
|
|
18
|
+
*/
|
|
19
|
+
export default class TableCellProperties extends Plugin {
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get pluginName(): 'TableCellProperties';
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get requires(): PluginDependencies;
|
|
28
|
+
}
|
|
29
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
30
|
+
interface PluginsMap {
|
|
31
|
+
[TableCellProperties.pluginName]: TableCellProperties;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module table/tablecellproperties
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import TableCellPropertiesUI from './tablecellproperties/tablecellpropertiesui';
|
|
12
10
|
import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertiesediting';
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* The table cell properties feature. Enables support for setting properties of table cells (size, border, background, etc.).
|
|
16
13
|
*
|
|
@@ -20,101 +17,18 @@ import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertie
|
|
|
20
17
|
* This is a "glue" plugin that loads the
|
|
21
18
|
* {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing table cell properties editing feature} and
|
|
22
19
|
* the {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI table cell properties UI feature}.
|
|
23
|
-
*
|
|
24
|
-
* @extends module:core/plugin~Plugin
|
|
25
20
|
*/
|
|
26
21
|
export default class TableCellProperties extends Plugin {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get pluginName() {
|
|
26
|
+
return 'TableCellProperties';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
static get requires() {
|
|
32
|
+
return [TableCellPropertiesEditing, TableCellPropertiesUI];
|
|
33
|
+
}
|
|
40
34
|
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The configuration of the table cell properties user interface (balloon). It allows to define:
|
|
44
|
-
*
|
|
45
|
-
* * The color palette for the cell border color style field (`tableCellProperties.borderColors`),
|
|
46
|
-
* * The color palette for the cell background style field (`tableCellProperties.backgroundColors`).
|
|
47
|
-
*
|
|
48
|
-
* const tableConfig = {
|
|
49
|
-
* tableCellProperties: {
|
|
50
|
-
* borderColors: [
|
|
51
|
-
* {
|
|
52
|
-
* color: 'hsl(0, 0%, 90%)',
|
|
53
|
-
* label: 'Light grey'
|
|
54
|
-
* },
|
|
55
|
-
* // ...
|
|
56
|
-
* ],
|
|
57
|
-
* backgroundColors: [
|
|
58
|
-
* {
|
|
59
|
-
* color: 'hsl(120, 75%, 60%)',
|
|
60
|
-
* label: 'Green'
|
|
61
|
-
* },
|
|
62
|
-
* // ...
|
|
63
|
-
* ]
|
|
64
|
-
* }
|
|
65
|
-
* };
|
|
66
|
-
*
|
|
67
|
-
* * The default styles for table cells (`tableCellProperties.defaultProperties`):
|
|
68
|
-
*
|
|
69
|
-
* const tableConfig = {
|
|
70
|
-
* tableCellProperties: {
|
|
71
|
-
* defaultProperties: {
|
|
72
|
-
* horizontalAlignment: 'right',
|
|
73
|
-
* verticalAlignment: 'bottom',
|
|
74
|
-
* padding: '5px'
|
|
75
|
-
* }
|
|
76
|
-
* }
|
|
77
|
-
* }
|
|
78
|
-
*
|
|
79
|
-
* {@link module:table/tableproperties~TablePropertiesOptions Read more about the supported properties.}
|
|
80
|
-
*
|
|
81
|
-
* **Note**: The `borderColors` and `backgroundColors` options do not impact the data loaded into the editor,
|
|
82
|
-
* i.e. they do not limit or filter the colors in the data. They are used only in the user interface
|
|
83
|
-
* allowing users to pick colors in a more convenient way. The `defaultProperties` option does impact the data.
|
|
84
|
-
* Default values will not be kept in the editor model.
|
|
85
|
-
*
|
|
86
|
-
* The default color palettes for the cell background and the cell border are the same
|
|
87
|
-
* ({@link module:table/utils/ui/table-properties~defaultColors check out their content}).
|
|
88
|
-
*
|
|
89
|
-
* Both color palette configurations must follow the
|
|
90
|
-
* {@link module:table/table~TableColorConfig table color configuration format}.
|
|
91
|
-
*
|
|
92
|
-
* Read more about configuring the table feature in {@link module:table/table~TableConfig}.
|
|
93
|
-
*
|
|
94
|
-
* @member {Object} module:table/table~TableConfig#tableCellProperties
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* The configuration of the table cell default properties feature.
|
|
99
|
-
*
|
|
100
|
-
* @typedef {Object} module:table/tablecellproperties~TableCellPropertiesOptions
|
|
101
|
-
*
|
|
102
|
-
* @property {String} width The default `width` of the table cell.
|
|
103
|
-
*
|
|
104
|
-
* @property {String} height The default `height` of the table cell.
|
|
105
|
-
*
|
|
106
|
-
* @property {String} padding The default `padding` of the table cell.
|
|
107
|
-
*
|
|
108
|
-
* @property {String} backgroundColor The default `background-color` of the table cell.
|
|
109
|
-
*
|
|
110
|
-
* @property {String} borderColor The default `border-color` of the table cell.
|
|
111
|
-
*
|
|
112
|
-
* @property {String} borderWidth The default `border-width` of the table cell.
|
|
113
|
-
*
|
|
114
|
-
* @property {String} [borderStyle='none'] The default `border-style` of the table cell.
|
|
115
|
-
*
|
|
116
|
-
* @property {String} [horizontalAlignment='center'] The default `horizontalAlignment` of the table cell.
|
|
117
|
-
*
|
|
118
|
-
* @property {String} [verticalAlignment='middle'] The default `verticalAlignment` of the table cell.
|
|
119
|
-
*/
|
|
120
|
-
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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/commands/tablecellwidthcommand
|
|
7
|
+
*/
|
|
8
|
+
import type { Editor } from 'ckeditor5/src/core';
|
|
9
|
+
import TableCellPropertyCommand from '../../tablecellproperties/commands/tablecellpropertycommand';
|
|
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
|
+
}
|
|
47
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
48
|
+
interface CommandsMap {
|
|
49
|
+
tableCellWidth: TableCellWidthCommand;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -2,13 +2,8 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @module table/tablecellproperties/commands/tablecellwidthcommand
|
|
8
|
-
*/
|
|
9
5
|
import TableCellPropertyCommand from '../../tablecellproperties/commands/tablecellpropertycommand';
|
|
10
6
|
import { addDefaultUnitToNumericValue } from '../../utils/table-properties';
|
|
11
|
-
|
|
12
7
|
/**
|
|
13
8
|
* The table cell width command.
|
|
14
9
|
*
|
|
@@ -17,41 +12,40 @@ import { addDefaultUnitToNumericValue } from '../../utils/table-properties';
|
|
|
17
12
|
*
|
|
18
13
|
* To change the width of selected cells, execute the command:
|
|
19
14
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* editor.execute( 'tableCellWidth', {
|
|
17
|
+
* value: '50px'
|
|
18
|
+
* } );
|
|
19
|
+
* ```
|
|
23
20
|
*
|
|
24
21
|
* **Note**: This command adds a default `'px'` unit to numeric values. Executing:
|
|
25
22
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* editor.execute( 'tableCellWidth', {
|
|
25
|
+
* value: '50'
|
|
26
|
+
* } );
|
|
27
|
+
* ```
|
|
29
28
|
*
|
|
30
29
|
* will set the `width` attribute to `'50px'` in the model.
|
|
31
|
-
*
|
|
32
|
-
* @extends module:table/tablecellproperties/commands/tablecellpropertycommand~TableCellPropertyCommand
|
|
33
30
|
*/
|
|
34
31
|
export default class TableCellWidthCommand extends TableCellPropertyCommand {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return value;
|
|
56
|
-
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new `TableCellWidthCommand` instance.
|
|
34
|
+
*
|
|
35
|
+
* @param editor An editor in which this command will be used.
|
|
36
|
+
* @param defaultValue The default value of the attribute.
|
|
37
|
+
*/
|
|
38
|
+
constructor(editor, defaultValue) {
|
|
39
|
+
super(editor, 'tableCellWidth', defaultValue);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @inheritDoc
|
|
43
|
+
*/
|
|
44
|
+
_getValueToSet(value) {
|
|
45
|
+
value = addDefaultUnitToNumericValue(value, 'px');
|
|
46
|
+
if (value === this._defaultValue) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
57
51
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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, type PluginDependencies } from 'ckeditor5/src/core';
|
|
9
|
+
import '../tableconfig';
|
|
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(): PluginDependencies;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
init(): void;
|
|
29
|
+
}
|
|
30
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
31
|
+
interface PluginsMap {
|
|
32
|
+
[TableCellWidthEditing.pluginName]: TableCellWidthEditing;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -2,57 +2,45 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module table/tablecellwidth/tablecellwidthediting
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
|
-
|
|
12
9
|
import TableEditing from './../tableediting';
|
|
13
10
|
import TableCellWidthCommand from './commands/tablecellwidthcommand';
|
|
14
11
|
import { getNormalizedDefaultProperties } from '../utils/table-properties';
|
|
15
12
|
import { enableProperty } from '../utils/common';
|
|
16
|
-
|
|
13
|
+
import '../tableconfig';
|
|
17
14
|
/**
|
|
18
15
|
* The table cell width editing feature.
|
|
19
16
|
*
|
|
20
17
|
* Introduces `tableCellWidth` table cell model attribute alongside with its converters
|
|
21
18
|
* and a command.
|
|
22
|
-
*
|
|
23
|
-
* @extends module:core/plugin~Plugin
|
|
24
19
|
*/
|
|
25
20
|
export default class TableCellWidthEditing extends Plugin {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
modelAttribute: 'tableCellWidth',
|
|
52
|
-
styleName: 'width',
|
|
53
|
-
defaultValue: defaultTableCellProperties.width
|
|
54
|
-
} );
|
|
55
|
-
|
|
56
|
-
editor.commands.add( 'tableCellWidth', new TableCellWidthCommand( editor, defaultTableCellProperties.width ) );
|
|
57
|
-
}
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get pluginName() {
|
|
25
|
+
return 'TableCellWidthEditing';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static get requires() {
|
|
31
|
+
return [TableEditing];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
init() {
|
|
37
|
+
const editor = this.editor;
|
|
38
|
+
const defaultTableCellProperties = getNormalizedDefaultProperties(editor.config.get('table.tableCellProperties.defaultProperties'));
|
|
39
|
+
enableProperty(editor.model.schema, editor.conversion, {
|
|
40
|
+
modelAttribute: 'tableCellWidth',
|
|
41
|
+
styleName: 'width',
|
|
42
|
+
defaultValue: defaultTableCellProperties.width
|
|
43
|
+
});
|
|
44
|
+
editor.commands.add('tableCellWidth', new TableCellWidthCommand(editor, defaultTableCellProperties.width));
|
|
45
|
+
}
|
|
58
46
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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 { Plugin, type PluginDependencies } from 'ckeditor5/src/core';
|
|
6
|
+
import type { DocumentFragment, Element, Item, Model, Position, Writer } from 'ckeditor5/src/engine';
|
|
7
|
+
import { type TableSlot } from './tablewalker';
|
|
8
|
+
/**
|
|
9
|
+
* This plugin adds support for copying/cutting/pasting fragments of tables.
|
|
10
|
+
* It is loaded automatically by the {@link module:table/table~Table} plugin.
|
|
11
|
+
*/
|
|
12
|
+
export default class TableClipboard extends Plugin {
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
static get pluginName(): 'TableClipboard';
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get requires(): PluginDependencies;
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
init(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Copies table content to a clipboard on "copy" & "cut" events.
|
|
27
|
+
*
|
|
28
|
+
* @param evt An object containing information about the handled event.
|
|
29
|
+
* @param data Clipboard event data.
|
|
30
|
+
*/
|
|
31
|
+
private _onCopyCut;
|
|
32
|
+
/**
|
|
33
|
+
* Overrides default {@link module:engine/model/model~Model#insertContent `model.insertContent()`} method to handle pasting table inside
|
|
34
|
+
* selected table fragment.
|
|
35
|
+
*
|
|
36
|
+
* Depending on selected table fragment:
|
|
37
|
+
* - If a selected table fragment is smaller than paste table it will crop pasted table to match dimensions.
|
|
38
|
+
* - If dimensions are equal it will replace selected table fragment with a pasted table contents.
|
|
39
|
+
*
|
|
40
|
+
* @param content The content to insert.
|
|
41
|
+
* @param selectable The selection into which the content should be inserted.
|
|
42
|
+
* If not provided the current model document selection will be used.
|
|
43
|
+
*/
|
|
44
|
+
private _onInsertContent;
|
|
45
|
+
/**
|
|
46
|
+
* Replaces the part of selectedTable with pastedTable.
|
|
47
|
+
*/
|
|
48
|
+
private _replaceSelectedCellsWithPasted;
|
|
49
|
+
/**
|
|
50
|
+
* Replaces a single table slot.
|
|
51
|
+
*
|
|
52
|
+
* @returns Inserted table cell or null if slot should remain empty.
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
_replaceTableSlotCell(tableSlot: TableSlot, cellToInsert: Element | null, insertPosition: Position, writer: Writer): Element | null;
|
|
56
|
+
/**
|
|
57
|
+
* Extracts the table for pasting into a table.
|
|
58
|
+
*
|
|
59
|
+
* @param content The content to insert.
|
|
60
|
+
* @param model The editor model.
|
|
61
|
+
*/
|
|
62
|
+
getTableIfOnlyTableInContent(content: DocumentFragment | Item, model: Model): Element | null;
|
|
63
|
+
}
|
|
64
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
65
|
+
interface PluginsMap {
|
|
66
|
+
[TableClipboard.pluginName]: TableClipboard;
|
|
67
|
+
}
|
|
68
|
+
}
|