@ckeditor/ckeditor5-table 45.2.1 → 46.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/dist/index-content.css +6 -5
- package/dist/index-editor.css +46 -46
- package/dist/index.css +63 -62
- package/dist/index.css.map +1 -1
- package/dist/index.js +305 -49
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/src/commands/insertcolumncommand.d.ts +1 -1
- package/src/commands/insertcolumncommand.js +1 -1
- package/src/commands/insertrowcommand.d.ts +1 -1
- package/src/commands/insertrowcommand.js +1 -1
- package/src/commands/inserttablecommand.d.ts +1 -1
- package/src/commands/inserttablecommand.js +1 -1
- package/src/commands/inserttablelayoutcommand.d.ts +1 -1
- package/src/commands/inserttablelayoutcommand.js +1 -1
- package/src/commands/mergecellcommand.d.ts +3 -3
- package/src/commands/mergecellcommand.js +2 -2
- package/src/commands/mergecellscommand.d.ts +1 -1
- package/src/commands/mergecellscommand.js +2 -2
- package/src/commands/removecolumncommand.d.ts +1 -1
- package/src/commands/removecolumncommand.js +2 -2
- package/src/commands/removerowcommand.d.ts +1 -1
- package/src/commands/removerowcommand.js +1 -1
- package/src/commands/selectcolumncommand.d.ts +1 -1
- package/src/commands/selectcolumncommand.js +2 -2
- package/src/commands/selectrowcommand.d.ts +1 -1
- package/src/commands/selectrowcommand.js +1 -1
- package/src/commands/setheadercolumncommand.d.ts +2 -2
- package/src/commands/setheadercolumncommand.js +1 -1
- package/src/commands/setheaderrowcommand.d.ts +2 -2
- package/src/commands/setheaderrowcommand.js +1 -1
- package/src/commands/splitcellcommand.d.ts +1 -1
- package/src/commands/splitcellcommand.js +1 -1
- package/src/converters/downcast.d.ts +21 -9
- package/src/converters/downcast.js +11 -3
- package/src/converters/table-caption-post-fixer.d.ts +3 -1
- package/src/converters/table-caption-post-fixer.js +3 -1
- package/src/converters/table-cell-paragraph-post-fixer.d.ts +3 -1
- package/src/converters/table-cell-paragraph-post-fixer.js +3 -1
- package/src/converters/table-cell-refresh-handler.d.ts +3 -1
- package/src/converters/table-cell-refresh-handler.js +3 -1
- package/src/converters/table-headings-refresh-handler.d.ts +3 -1
- package/src/converters/table-headings-refresh-handler.js +4 -2
- package/src/converters/table-layout-post-fixer.d.ts +3 -1
- package/src/converters/table-layout-post-fixer.js +4 -2
- package/src/converters/tableproperties.d.ts +17 -1
- package/src/converters/tableproperties.js +49 -2
- package/src/converters/upcasttable.d.ts +6 -1
- package/src/converters/upcasttable.js +6 -1
- package/src/index.d.ts +89 -56
- package/src/index.js +84 -24
- package/src/plaintableoutput.d.ts +2 -2
- package/src/plaintableoutput.js +2 -2
- package/src/table.d.ts +7 -7
- package/src/table.js +7 -7
- package/src/tablecaption/tablecaptionediting.d.ts +6 -6
- package/src/tablecaption/tablecaptionediting.js +8 -8
- package/src/tablecaption/tablecaptionui.d.ts +1 -1
- package/src/tablecaption/tablecaptionui.js +1 -1
- package/src/tablecaption/toggletablecaptioncommand.d.ts +1 -1
- package/src/tablecaption/toggletablecaptioncommand.js +1 -1
- package/src/tablecaption/utils.d.ts +8 -4
- package/src/tablecaption/utils.js +4 -0
- package/src/tablecaption.d.ts +3 -3
- package/src/tablecaption.js +3 -3
- package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +2 -2
- package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +4 -4
- package/src/tablecellproperties/commands/tablecellbordercolorcommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellborderstylecommand.d.ts +4 -4
- package/src/tablecellproperties/commands/tablecellborderstylecommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +4 -4
- package/src/tablecellproperties/commands/tablecellborderwidthcommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellheightcommand.d.ts +2 -2
- package/src/tablecellproperties/commands/tablecellheightcommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +2 -2
- package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellpaddingcommand.d.ts +4 -4
- package/src/tablecellproperties/commands/tablecellpaddingcommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellpropertycommand.d.ts +3 -3
- package/src/tablecellproperties/commands/tablecellpropertycommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +2 -2
- package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js +2 -2
- package/src/tablecellproperties/tablecellpropertiesediting.d.ts +3 -3
- package/src/tablecellproperties/tablecellpropertiesediting.js +44 -19
- package/src/tablecellproperties/tablecellpropertiesui.d.ts +2 -2
- package/src/tablecellproperties/tablecellpropertiesui.js +2 -2
- package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +2 -2
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +1 -1
- package/src/tablecellproperties.d.ts +3 -3
- package/src/tablecellproperties.js +3 -3
- package/src/tablecellwidth/commands/tablecellwidthcommand.d.ts +2 -2
- package/src/tablecellwidth/commands/tablecellwidthcommand.js +2 -2
- package/src/tablecellwidth/tablecellwidthediting.d.ts +2 -2
- package/src/tablecellwidth/tablecellwidthediting.js +5 -3
- package/src/tableclipboard.d.ts +6 -6
- package/src/tableclipboard.js +4 -4
- package/src/tablecolumnresize/constants.d.ts +9 -0
- package/src/tablecolumnresize/constants.js +9 -0
- package/src/tablecolumnresize/converters.d.ts +11 -1
- package/src/tablecolumnresize/converters.js +16 -0
- package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +7 -7
- package/src/tablecolumnresize/tablecolumnresizeediting.js +13 -11
- package/src/tablecolumnresize/tablewidthscommand.d.ts +3 -3
- package/src/tablecolumnresize/tablewidthscommand.js +1 -1
- package/src/tablecolumnresize/utils.d.ts +23 -11
- package/src/tablecolumnresize/utils.js +14 -2
- package/src/tablecolumnresize.d.ts +3 -3
- package/src/tablecolumnresize.js +3 -3
- package/src/tableconfig.d.ts +3 -1
- package/src/tableediting.d.ts +7 -7
- package/src/tableediting.js +19 -19
- package/src/tablekeyboard.d.ts +8 -8
- package/src/tablekeyboard.js +7 -7
- package/src/tablelayout/commands/tabletypecommand.d.ts +1 -1
- package/src/tablelayout/commands/tabletypecommand.js +1 -1
- package/src/tablelayout/tablelayoutediting.d.ts +2 -2
- package/src/tablelayout/tablelayoutediting.js +4 -4
- package/src/tablelayout/tablelayoutui.d.ts +1 -1
- package/src/tablelayout/tablelayoutui.js +4 -4
- package/src/tablelayout.d.ts +5 -5
- package/src/tablelayout.js +5 -5
- package/src/tablemouse/mouseeventsobserver.d.ts +13 -11
- package/src/tablemouse/mouseeventsobserver.js +4 -2
- package/src/tablemouse.d.ts +3 -3
- package/src/tablemouse.js +4 -4
- package/src/tableproperties/commands/tablealignmentcommand.d.ts +2 -2
- package/src/tableproperties/commands/tablealignmentcommand.js +2 -2
- package/src/tableproperties/commands/tablebackgroundcolorcommand.d.ts +2 -2
- package/src/tableproperties/commands/tablebackgroundcolorcommand.js +2 -2
- package/src/tableproperties/commands/tablebordercolorcommand.d.ts +4 -4
- package/src/tableproperties/commands/tablebordercolorcommand.js +2 -2
- package/src/tableproperties/commands/tableborderstylecommand.d.ts +4 -4
- package/src/tableproperties/commands/tableborderstylecommand.js +2 -2
- package/src/tableproperties/commands/tableborderwidthcommand.d.ts +4 -4
- package/src/tableproperties/commands/tableborderwidthcommand.js +2 -2
- package/src/tableproperties/commands/tableheightcommand.d.ts +2 -2
- package/src/tableproperties/commands/tableheightcommand.js +2 -2
- package/src/tableproperties/commands/tablepropertycommand.d.ts +4 -4
- package/src/tableproperties/commands/tablepropertycommand.js +1 -1
- package/src/tableproperties/commands/tablewidthcommand.d.ts +2 -2
- package/src/tableproperties/commands/tablewidthcommand.js +2 -2
- package/src/tableproperties/tablepropertiesediting.d.ts +2 -2
- package/src/tableproperties/tablepropertiesediting.js +49 -21
- package/src/tableproperties/tablepropertiesui.d.ts +2 -2
- package/src/tableproperties/tablepropertiesui.js +2 -2
- package/src/tableproperties/ui/tablepropertiesview.d.ts +2 -2
- package/src/tableproperties/ui/tablepropertiesview.js +1 -1
- package/src/tableproperties.d.ts +3 -3
- package/src/tableproperties.js +3 -3
- package/src/tableselection.d.ts +9 -9
- package/src/tableselection.js +4 -4
- package/src/tabletoolbar.d.ts +1 -1
- package/src/tabletoolbar.js +1 -1
- package/src/tableui.d.ts +1 -1
- package/src/tableui.js +4 -4
- package/src/tableutils.d.ts +25 -26
- package/src/tableutils.js +4 -4
- package/src/tablewalker.d.ts +8 -8
- package/src/tablewalker.js +2 -2
- package/src/ui/colorinputview.d.ts +6 -1
- package/src/ui/colorinputview.js +1 -1
- package/src/ui/inserttableview.d.ts +3 -1
- package/src/ui/inserttableview.js +3 -1
- package/src/utils/common.d.ts +16 -7
- package/src/utils/common.js +9 -1
- package/src/utils/structure.d.ts +24 -14
- package/src/utils/structure.js +11 -1
- package/src/utils/table-properties.d.ts +15 -2
- package/src/utils/table-properties.js +6 -0
- package/src/utils/ui/contextualballoon.d.ts +4 -3
- package/src/utils/ui/contextualballoon.js +1 -0
- package/src/utils/ui/table-properties.d.ts +20 -7
- package/src/utils/ui/table-properties.js +24 -11
- package/src/utils/ui/widget.d.ts +6 -0
- package/src/utils/ui/widget.js +6 -0
- package/theme/tablecaption.css +9 -8
- package/theme/tablecolumnresize.css +2 -2
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
* @module table/tablecellproperties/tablecellpropertiesediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import {
|
|
9
|
+
import { addBorderStylesRules, addPaddingStylesRules, addBackgroundStylesRules } from 'ckeditor5/src/engine.js';
|
|
10
10
|
import { downcastAttributeToStyle, getDefaultValueAdjusted, upcastBorderStyles } from '../converters/tableproperties.js';
|
|
11
|
-
import TableEditing from './../tableediting.js';
|
|
12
|
-
import TableCellWidthEditing from '../tablecellwidth/tablecellwidthediting.js';
|
|
13
|
-
import TableCellPaddingCommand from './commands/tablecellpaddingcommand.js';
|
|
14
|
-
import TableCellHeightCommand from './commands/tablecellheightcommand.js';
|
|
15
|
-
import TableCellBackgroundColorCommand from './commands/tablecellbackgroundcolorcommand.js';
|
|
16
|
-
import TableCellVerticalAlignmentCommand from './commands/tablecellverticalalignmentcommand.js';
|
|
17
|
-
import TableCellHorizontalAlignmentCommand from './commands/tablecellhorizontalalignmentcommand.js';
|
|
18
|
-
import TableCellBorderStyleCommand from './commands/tablecellborderstylecommand.js';
|
|
19
|
-
import TableCellBorderColorCommand from './commands/tablecellbordercolorcommand.js';
|
|
20
|
-
import TableCellBorderWidthCommand from './commands/tablecellborderwidthcommand.js';
|
|
11
|
+
import { TableEditing } from './../tableediting.js';
|
|
12
|
+
import { TableCellWidthEditing } from '../tablecellwidth/tablecellwidthediting.js';
|
|
13
|
+
import { TableCellPaddingCommand } from './commands/tablecellpaddingcommand.js';
|
|
14
|
+
import { TableCellHeightCommand } from './commands/tablecellheightcommand.js';
|
|
15
|
+
import { TableCellBackgroundColorCommand } from './commands/tablecellbackgroundcolorcommand.js';
|
|
16
|
+
import { TableCellVerticalAlignmentCommand } from './commands/tablecellverticalalignmentcommand.js';
|
|
17
|
+
import { TableCellHorizontalAlignmentCommand } from './commands/tablecellhorizontalalignmentcommand.js';
|
|
18
|
+
import { TableCellBorderStyleCommand } from './commands/tablecellborderstylecommand.js';
|
|
19
|
+
import { TableCellBorderColorCommand } from './commands/tablecellbordercolorcommand.js';
|
|
20
|
+
import { TableCellBorderWidthCommand } from './commands/tablecellborderwidthcommand.js';
|
|
21
21
|
import { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';
|
|
22
22
|
import { enableProperty } from '../utils/common.js';
|
|
23
23
|
const VALIGN_VALUES_REG_EXP = /^(top|middle|bottom)$/;
|
|
@@ -41,7 +41,7 @@ const ALIGN_VALUES_REG_EXP = /^(left|center|right|justify)$/;
|
|
|
41
41
|
* - horizontal and vertical alignment: the `'tableCellHorizontalAlignment'` and `'tableCellVerticalAlignment'` commands
|
|
42
42
|
* - width and height: the `'tableCellWidth'` and `'tableCellHeight'` commands
|
|
43
43
|
*/
|
|
44
|
-
export
|
|
44
|
+
export class TableCellPropertiesEditing extends Plugin {
|
|
45
45
|
/**
|
|
46
46
|
* @inheritDoc
|
|
47
47
|
*/
|
|
@@ -74,7 +74,7 @@ export default class TableCellPropertiesEditing extends Plugin {
|
|
|
74
74
|
includePaddingProperty: true,
|
|
75
75
|
isRightToLeftContent: editor.locale.contentLanguageDirection === 'rtl'
|
|
76
76
|
});
|
|
77
|
-
editor.data.addStyleProcessorRules(
|
|
77
|
+
editor.data.addStyleProcessorRules(addBorderStylesRules);
|
|
78
78
|
enableBorderProperties(schema, conversion, {
|
|
79
79
|
color: defaultTableCellProperties.borderColor,
|
|
80
80
|
style: defaultTableCellProperties.borderStyle,
|
|
@@ -86,10 +86,12 @@ export default class TableCellPropertiesEditing extends Plugin {
|
|
|
86
86
|
enableProperty(schema, conversion, {
|
|
87
87
|
modelAttribute: 'tableCellHeight',
|
|
88
88
|
styleName: 'height',
|
|
89
|
+
attributeName: 'height',
|
|
90
|
+
attributeType: 'length',
|
|
89
91
|
defaultValue: defaultTableCellProperties.height
|
|
90
92
|
});
|
|
91
93
|
editor.commands.add('tableCellHeight', new TableCellHeightCommand(editor, defaultTableCellProperties.height));
|
|
92
|
-
editor.data.addStyleProcessorRules(
|
|
94
|
+
editor.data.addStyleProcessorRules(addPaddingStylesRules);
|
|
93
95
|
enableProperty(schema, conversion, {
|
|
94
96
|
modelAttribute: 'tableCellPadding',
|
|
95
97
|
styleName: 'padding',
|
|
@@ -97,10 +99,12 @@ export default class TableCellPropertiesEditing extends Plugin {
|
|
|
97
99
|
defaultValue: defaultTableCellProperties.padding
|
|
98
100
|
});
|
|
99
101
|
editor.commands.add('tableCellPadding', new TableCellPaddingCommand(editor, defaultTableCellProperties.padding));
|
|
100
|
-
editor.data.addStyleProcessorRules(
|
|
102
|
+
editor.data.addStyleProcessorRules(addBackgroundStylesRules);
|
|
101
103
|
enableProperty(schema, conversion, {
|
|
102
104
|
modelAttribute: 'tableCellBackgroundColor',
|
|
103
105
|
styleName: 'background-color',
|
|
106
|
+
attributeName: 'bgcolor',
|
|
107
|
+
attributeType: 'color',
|
|
104
108
|
defaultValue: defaultTableCellProperties.backgroundColor
|
|
105
109
|
});
|
|
106
110
|
editor.commands.add('tableCellBackgroundColor', new TableCellBackgroundColorCommand(editor, defaultTableCellProperties.backgroundColor));
|
|
@@ -127,6 +131,9 @@ function enableBorderProperties(schema, conversion, defaultBorder) {
|
|
|
127
131
|
schema.extend('tableCell', {
|
|
128
132
|
allowAttributes: Object.values(modelAttributes)
|
|
129
133
|
});
|
|
134
|
+
for (const modelAttribute of Object.values(modelAttributes)) {
|
|
135
|
+
schema.setAttributeProperties(modelAttribute, { isFormatting: true });
|
|
136
|
+
}
|
|
130
137
|
upcastBorderStyles(conversion, 'td', modelAttributes, defaultBorder);
|
|
131
138
|
upcastBorderStyles(conversion, 'th', modelAttributes, defaultBorder);
|
|
132
139
|
downcastAttributeToStyle(conversion, { modelElement: 'tableCell', modelAttribute: modelAttributes.style, styleName: 'border-style' });
|
|
@@ -142,6 +149,7 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
142
149
|
schema.extend('tableCell', {
|
|
143
150
|
allowAttributes: ['tableCellHorizontalAlignment']
|
|
144
151
|
});
|
|
152
|
+
schema.setAttributeProperties('tableCellHorizontalAlignment', { isFormatting: true });
|
|
145
153
|
conversion.for('downcast')
|
|
146
154
|
.attributeToAttribute({
|
|
147
155
|
model: {
|
|
@@ -169,7 +177,11 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
169
177
|
value: (viewElement, conversionApi, data) => {
|
|
170
178
|
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);
|
|
171
179
|
const align = viewElement.getStyle('text-align');
|
|
172
|
-
|
|
180
|
+
if (align !== localDefaultValue) {
|
|
181
|
+
return align;
|
|
182
|
+
}
|
|
183
|
+
// Consume the style even if not applied to the element so it won't be processed by other converters.
|
|
184
|
+
conversionApi.consumable.consume(viewElement, { styles: 'text-align' });
|
|
173
185
|
}
|
|
174
186
|
}
|
|
175
187
|
})
|
|
@@ -186,7 +198,11 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
186
198
|
value: (viewElement, conversionApi, data) => {
|
|
187
199
|
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);
|
|
188
200
|
const align = viewElement.getAttribute('align');
|
|
189
|
-
|
|
201
|
+
if (align !== localDefaultValue) {
|
|
202
|
+
return align;
|
|
203
|
+
}
|
|
204
|
+
// Consume the style even if not applied to the element so it won't be processed by other converters.
|
|
205
|
+
conversionApi.consumable.consume(viewElement, { attributes: 'align' });
|
|
190
206
|
}
|
|
191
207
|
}
|
|
192
208
|
});
|
|
@@ -200,6 +216,7 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
200
216
|
schema.extend('tableCell', {
|
|
201
217
|
allowAttributes: ['tableCellVerticalAlignment']
|
|
202
218
|
});
|
|
219
|
+
schema.setAttributeProperties('tableCellVerticalAlignment', { isFormatting: true });
|
|
203
220
|
conversion.for('downcast')
|
|
204
221
|
.attributeToAttribute({
|
|
205
222
|
model: {
|
|
@@ -227,7 +244,11 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
227
244
|
value: (viewElement, conversionApi, data) => {
|
|
228
245
|
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);
|
|
229
246
|
const align = viewElement.getStyle('vertical-align');
|
|
230
|
-
|
|
247
|
+
if (align !== localDefaultValue) {
|
|
248
|
+
return align;
|
|
249
|
+
}
|
|
250
|
+
// Consume the style even if not applied to the element so it won't be processed by other converters.
|
|
251
|
+
conversionApi.consumable.consume(viewElement, { styles: 'vertical-align' });
|
|
231
252
|
}
|
|
232
253
|
}
|
|
233
254
|
})
|
|
@@ -244,7 +265,11 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
244
265
|
value: (viewElement, conversionApi, data) => {
|
|
245
266
|
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);
|
|
246
267
|
const valign = viewElement.getAttribute('valign');
|
|
247
|
-
|
|
268
|
+
if (valign !== localDefaultValue) {
|
|
269
|
+
return valign;
|
|
270
|
+
}
|
|
271
|
+
// Consume the attribute even if not applied to the element so it won't be processed by other converters.
|
|
272
|
+
conversionApi.consumable.consume(viewElement, { attributes: 'valign' });
|
|
248
273
|
}
|
|
249
274
|
}
|
|
250
275
|
});
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { ContextualBalloon } from 'ckeditor5/src/ui.js';
|
|
10
|
-
import TableCellPropertiesView from './ui/tablecellpropertiesview.js';
|
|
10
|
+
import { TableCellPropertiesView } from './ui/tablecellpropertiesview.js';
|
|
11
11
|
/**
|
|
12
12
|
* The table cell properties UI plugin. It introduces the `'tableCellProperties'` button
|
|
13
13
|
* that opens a form allowing to specify the visual styling of a table cell.
|
|
14
14
|
*
|
|
15
15
|
* It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare class TableCellPropertiesUI extends Plugin {
|
|
18
18
|
/**
|
|
19
19
|
* The default table cell properties.
|
|
20
20
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { IconTableCellProperties } from 'ckeditor5/src/icons.js';
|
|
10
10
|
import { ButtonView, clickOutsideHandler, ContextualBalloon, getLocalizedColorOptions, normalizeColorOptions } from 'ckeditor5/src/ui.js';
|
|
11
|
-
import TableCellPropertiesView from './ui/tablecellpropertiesview.js';
|
|
11
|
+
import { TableCellPropertiesView } from './ui/tablecellpropertiesview.js';
|
|
12
12
|
import { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, defaultColors, lengthFieldValidator, lineWidthFieldValidator } from '../utils/ui/table-properties.js';
|
|
13
13
|
import { debounce } from 'es-toolkit/compat';
|
|
14
14
|
import { getSelectionAffectedTableWidget, getTableWidgetAncestor } from '../utils/ui/widget.js';
|
|
@@ -33,7 +33,7 @@ const propertyToCommandMap = {
|
|
|
33
33
|
*
|
|
34
34
|
* It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
|
|
35
35
|
*/
|
|
36
|
-
export
|
|
36
|
+
export class TableCellPropertiesUI extends Plugin {
|
|
37
37
|
/**
|
|
38
38
|
* The default table cell properties.
|
|
39
39
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ButtonView, FocusCycler, LabeledFieldView, ToolbarView, View, ViewCollection, type FocusableView, type NormalizedColorOption, type ColorPickerConfig } from 'ckeditor5/src/ui.js';
|
|
9
9
|
import { KeystrokeHandler, FocusTracker, type Locale } from 'ckeditor5/src/utils.js';
|
|
10
|
-
import type ColorInputView from '../../ui/colorinputview.js';
|
|
10
|
+
import { type ColorInputView } from '../../ui/colorinputview.js';
|
|
11
11
|
import type { TableCellPropertiesOptions } from '../../tableconfig.js';
|
|
12
12
|
import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
|
|
13
13
|
import '../../../theme/formrow.css';
|
|
@@ -23,7 +23,7 @@ export interface TableCellPropertiesViewOptions {
|
|
|
23
23
|
* The class representing a table cell properties form, allowing users to customize
|
|
24
24
|
* certain style aspects of a table cell, for instance, border, padding, text alignment, etc..
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
26
|
+
export declare class TableCellPropertiesView extends View {
|
|
27
27
|
/**
|
|
28
28
|
* The value of the cell border style.
|
|
29
29
|
*
|
|
@@ -18,7 +18,7 @@ import '../../../theme/tablecellproperties.css';
|
|
|
18
18
|
* The class representing a table cell properties form, allowing users to customize
|
|
19
19
|
* certain style aspects of a table cell, for instance, border, padding, text alignment, etc..
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export class TableCellPropertiesView extends View {
|
|
22
22
|
/**
|
|
23
23
|
* Options passed to the view. See {@link #constructor} to learn more.
|
|
24
24
|
*/
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module table/tablecellproperties
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import TableCellPropertiesUI from './tablecellproperties/tablecellpropertiesui.js';
|
|
10
|
-
import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertiesediting.js';
|
|
9
|
+
import { TableCellPropertiesUI } from './tablecellproperties/tablecellpropertiesui.js';
|
|
10
|
+
import { TableCellPropertiesEditing } from './tablecellproperties/tablecellpropertiesediting.js';
|
|
11
11
|
/**
|
|
12
12
|
* The table cell properties feature. Enables support for setting properties of table cells (size, border, background, etc.).
|
|
13
13
|
*
|
|
@@ -18,7 +18,7 @@ import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertie
|
|
|
18
18
|
* {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing table cell properties editing feature} and
|
|
19
19
|
* the {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI table cell properties UI feature}.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export declare class TableCellProperties extends Plugin {
|
|
22
22
|
/**
|
|
23
23
|
* @inheritDoc
|
|
24
24
|
*/
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module table/tablecellproperties
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import TableCellPropertiesUI from './tablecellproperties/tablecellpropertiesui.js';
|
|
10
|
-
import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertiesediting.js';
|
|
9
|
+
import { TableCellPropertiesUI } from './tablecellproperties/tablecellpropertiesui.js';
|
|
10
|
+
import { TableCellPropertiesEditing } from './tablecellproperties/tablecellpropertiesediting.js';
|
|
11
11
|
/**
|
|
12
12
|
* The table cell properties feature. Enables support for setting properties of table cells (size, border, background, etc.).
|
|
13
13
|
*
|
|
@@ -18,7 +18,7 @@ import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertie
|
|
|
18
18
|
* {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing table cell properties editing feature} and
|
|
19
19
|
* the {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI table cell properties UI feature}.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export class TableCellProperties extends Plugin {
|
|
22
22
|
/**
|
|
23
23
|
* @inheritDoc
|
|
24
24
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module table/tablecellwidth/commands/tablecellwidthcommand
|
|
7
7
|
*/
|
|
8
8
|
import type { Editor } from 'ckeditor5/src/core.js';
|
|
9
|
-
import TableCellPropertyCommand from '../../tablecellproperties/commands/tablecellpropertycommand.js';
|
|
9
|
+
import { TableCellPropertyCommand } from '../../tablecellproperties/commands/tablecellpropertycommand.js';
|
|
10
10
|
/**
|
|
11
11
|
* The table cell width command.
|
|
12
12
|
*
|
|
@@ -31,7 +31,7 @@ import TableCellPropertyCommand from '../../tablecellproperties/commands/tablece
|
|
|
31
31
|
*
|
|
32
32
|
* will set the `width` attribute to `'50px'` in the model.
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export declare class TableCellWidthCommand extends TableCellPropertyCommand {
|
|
35
35
|
/**
|
|
36
36
|
* Creates a new `TableCellWidthCommand` instance.
|
|
37
37
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import TableCellPropertyCommand from '../../tablecellproperties/commands/tablecellpropertycommand.js';
|
|
5
|
+
import { TableCellPropertyCommand } from '../../tablecellproperties/commands/tablecellpropertycommand.js';
|
|
6
6
|
import { addDefaultUnitToNumericValue } from '../../utils/table-properties.js';
|
|
7
7
|
/**
|
|
8
8
|
* The table cell width command.
|
|
@@ -28,7 +28,7 @@ import { addDefaultUnitToNumericValue } from '../../utils/table-properties.js';
|
|
|
28
28
|
*
|
|
29
29
|
* will set the `width` attribute to `'50px'` in the model.
|
|
30
30
|
*/
|
|
31
|
-
export
|
|
31
|
+
export class TableCellWidthCommand extends TableCellPropertyCommand {
|
|
32
32
|
/**
|
|
33
33
|
* Creates a new `TableCellWidthCommand` instance.
|
|
34
34
|
*
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* @module table/tablecellwidth/tablecellwidthediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import TableEditing from './../tableediting.js';
|
|
9
|
+
import { TableEditing } from './../tableediting.js';
|
|
10
10
|
/**
|
|
11
11
|
* The table cell width editing feature.
|
|
12
12
|
*
|
|
13
13
|
* Introduces `tableCellWidth` table cell model attribute alongside with its converters
|
|
14
14
|
* and a command.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export declare class TableCellWidthEditing extends Plugin {
|
|
17
17
|
/**
|
|
18
18
|
* @inheritDoc
|
|
19
19
|
*/
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module table/tablecellwidth/tablecellwidthediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import TableEditing from './../tableediting.js';
|
|
10
|
-
import TableCellWidthCommand from './commands/tablecellwidthcommand.js';
|
|
9
|
+
import { TableEditing } from './../tableediting.js';
|
|
10
|
+
import { TableCellWidthCommand } from './commands/tablecellwidthcommand.js';
|
|
11
11
|
import { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';
|
|
12
12
|
import { enableProperty } from '../utils/common.js';
|
|
13
13
|
/**
|
|
@@ -16,7 +16,7 @@ import { enableProperty } from '../utils/common.js';
|
|
|
16
16
|
* Introduces `tableCellWidth` table cell model attribute alongside with its converters
|
|
17
17
|
* and a command.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export class TableCellWidthEditing extends Plugin {
|
|
20
20
|
/**
|
|
21
21
|
* @inheritDoc
|
|
22
22
|
*/
|
|
@@ -44,6 +44,8 @@ export default class TableCellWidthEditing extends Plugin {
|
|
|
44
44
|
enableProperty(editor.model.schema, editor.conversion, {
|
|
45
45
|
modelAttribute: 'tableCellWidth',
|
|
46
46
|
styleName: 'width',
|
|
47
|
+
attributeName: 'width',
|
|
48
|
+
attributeType: 'length',
|
|
47
49
|
defaultValue: defaultTableCellProperties.width
|
|
48
50
|
});
|
|
49
51
|
editor.commands.add('tableCellWidth', new TableCellWidthCommand(editor, defaultTableCellProperties.width));
|
package/src/tableclipboard.d.ts
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ClipboardPipeline, ClipboardMarkersUtils } from 'ckeditor5/src/clipboard.js';
|
|
6
6
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
7
|
-
import type {
|
|
8
|
-
import TableSelection from './tableselection.js';
|
|
7
|
+
import type { ModelDocumentFragment, ModelElement, ModelItem, Model, ModelPosition, ModelWriter } from 'ckeditor5/src/engine.js';
|
|
8
|
+
import { TableSelection } from './tableselection.js';
|
|
9
9
|
import { type TableSlot } from './tablewalker.js';
|
|
10
|
-
import TableUtils from './tableutils.js';
|
|
10
|
+
import { TableUtils } from './tableutils.js';
|
|
11
11
|
/**
|
|
12
12
|
* This plugin adds support for copying/cutting/pasting fragments of tables.
|
|
13
13
|
* It is loaded automatically by the {@link module:table/table~Table} plugin.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare class TableClipboard extends Plugin {
|
|
16
16
|
/**
|
|
17
17
|
* @inheritDoc
|
|
18
18
|
*/
|
|
@@ -72,12 +72,12 @@ export default class TableClipboard extends Plugin {
|
|
|
72
72
|
* @returns Inserted table cell or null if slot should remain empty.
|
|
73
73
|
* @private
|
|
74
74
|
*/
|
|
75
|
-
_replaceTableSlotCell(tableSlot: TableSlot, cellToInsert:
|
|
75
|
+
_replaceTableSlotCell(tableSlot: TableSlot, cellToInsert: ModelElement | null, insertPosition: ModelPosition, writer: ModelWriter): ModelElement | null;
|
|
76
76
|
/**
|
|
77
77
|
* Extracts the table for pasting into a table.
|
|
78
78
|
*
|
|
79
79
|
* @param content The content to insert.
|
|
80
80
|
* @param model The editor model.
|
|
81
81
|
*/
|
|
82
|
-
getTableIfOnlyTableInContent(content:
|
|
82
|
+
getTableIfOnlyTableInContent(content: ModelDocumentFragment | ModelItem, model: Model): ModelElement | null;
|
|
83
83
|
}
|
package/src/tableclipboard.js
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ClipboardPipeline, ClipboardMarkersUtils } from 'ckeditor5/src/clipboard.js';
|
|
6
6
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
7
|
-
import TableSelection from './tableselection.js';
|
|
8
|
-
import TableWalker from './tablewalker.js';
|
|
9
|
-
import TableUtils from './tableutils.js';
|
|
7
|
+
import { TableSelection } from './tableselection.js';
|
|
8
|
+
import { TableWalker } from './tablewalker.js';
|
|
9
|
+
import { TableUtils } from './tableutils.js';
|
|
10
10
|
import { cropTableToDimensions, getHorizontallyOverlappingCells, getVerticallyOverlappingCells, removeEmptyRowsColumns, splitHorizontally, splitVertically, trimTableCellIfNeeded, adjustLastRowIndex, adjustLastColumnIndex } from './utils/structure.js';
|
|
11
11
|
/**
|
|
12
12
|
* This plugin adds support for copying/cutting/pasting fragments of tables.
|
|
13
13
|
* It is loaded automatically by the {@link module:table/table~Table} plugin.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export class TableClipboard extends Plugin {
|
|
16
16
|
/**
|
|
17
17
|
* @inheritDoc
|
|
18
18
|
*/
|
|
@@ -8,17 +8,26 @@
|
|
|
8
8
|
/**
|
|
9
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
10
|
* calculate how many percentage of the table width would be {@link ~COLUMN_MIN_WIDTH_IN_PIXELS minimum column width in pixels}.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
11
13
|
*/
|
|
12
14
|
export declare const COLUMN_MIN_WIDTH_AS_PERCENTAGE = 5;
|
|
13
15
|
/**
|
|
14
16
|
* The minimum column width in pixels when the maximum table width is known.
|
|
17
|
+
* This value is an equivalent of `10%` of the default editor width (600px).
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
15
20
|
*/
|
|
16
21
|
export declare const COLUMN_MIN_WIDTH_IN_PIXELS = 40;
|
|
17
22
|
/**
|
|
18
23
|
* Determines how many digits after the decimal point are used to store the column width as a percentage value.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
19
26
|
*/
|
|
20
27
|
export declare const COLUMN_WIDTH_PRECISION = 2;
|
|
21
28
|
/**
|
|
22
29
|
* The distance in pixels that the mouse has to move to start resizing the column.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
23
32
|
*/
|
|
24
33
|
export declare const COLUMN_RESIZE_DISTANCE_THRESHOLD = 3;
|
|
@@ -8,17 +8,26 @@
|
|
|
8
8
|
/**
|
|
9
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
10
|
* calculate how many percentage of the table width would be {@link ~COLUMN_MIN_WIDTH_IN_PIXELS minimum column width in pixels}.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
11
13
|
*/
|
|
12
14
|
export const COLUMN_MIN_WIDTH_AS_PERCENTAGE = 5;
|
|
13
15
|
/**
|
|
14
16
|
* The minimum column width in pixels when the maximum table width is known.
|
|
17
|
+
* This value is an equivalent of `10%` of the default editor width (600px).
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
15
20
|
*/
|
|
16
21
|
export const COLUMN_MIN_WIDTH_IN_PIXELS = 40;
|
|
17
22
|
/**
|
|
18
23
|
* Determines how many digits after the decimal point are used to store the column width as a percentage value.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
19
26
|
*/
|
|
20
27
|
export const COLUMN_WIDTH_PRECISION = 2;
|
|
21
28
|
/**
|
|
22
29
|
* The distance in pixels that the mouse has to move to start resizing the column.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
23
32
|
*/
|
|
24
33
|
export const COLUMN_RESIZE_DISTANCE_THRESHOLD = 3;
|
|
@@ -6,13 +6,23 @@
|
|
|
6
6
|
* @module table/tablecolumnresize/converters
|
|
7
7
|
*/
|
|
8
8
|
import type { DowncastDispatcher, UpcastDispatcher } from 'ckeditor5/src/engine.js';
|
|
9
|
-
import type TableUtils from '../tableutils.js';
|
|
9
|
+
import { type TableUtils } from '../tableutils.js';
|
|
10
10
|
/**
|
|
11
11
|
* Returns a upcast helper that ensures the number of `<tableColumn>` elements corresponds to the actual number of columns in the table,
|
|
12
12
|
* because the input data might have too few or too many <col> elements.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
13
15
|
*/
|
|
14
16
|
export declare function upcastColgroupElement(tableUtilsPlugin: TableUtils): (dispatcher: UpcastDispatcher) => void;
|
|
15
17
|
/**
|
|
16
18
|
* Returns downcast helper for adding `ck-table-resized` class if there is a `<tableColumnGroup>` element inside the table.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
17
21
|
*/
|
|
18
22
|
export declare function downcastTableResizedClass(): (dispatcher: DowncastDispatcher) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Returns a upcast helper that removes the `ck-table-resized` class from the table element.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare function upcastTableResizedClass(): (dispatcher: UpcastDispatcher) => void;
|
|
@@ -6,6 +6,8 @@ import { normalizeColumnWidths, updateColumnElements, getColumnGroupElement, get
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns a upcast helper that ensures the number of `<tableColumn>` elements corresponds to the actual number of columns in the table,
|
|
8
8
|
* because the input data might have too few or too many <col> elements.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
9
11
|
*/
|
|
10
12
|
export function upcastColgroupElement(tableUtilsPlugin) {
|
|
11
13
|
return dispatcher => dispatcher.on('element:colgroup', (evt, data, conversionApi) => {
|
|
@@ -26,6 +28,8 @@ export function upcastColgroupElement(tableUtilsPlugin) {
|
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Returns downcast helper for adding `ck-table-resized` class if there is a `<tableColumnGroup>` element inside the table.
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
29
33
|
*/
|
|
30
34
|
export function downcastTableResizedClass() {
|
|
31
35
|
return dispatcher => dispatcher.on('insert:table', (evt, data, conversionApi) => {
|
|
@@ -44,3 +48,15 @@ export function downcastTableResizedClass() {
|
|
|
44
48
|
}
|
|
45
49
|
}, { priority: 'low' });
|
|
46
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns a upcast helper that removes the `ck-table-resized` class from the table element.
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export function upcastTableResizedClass() {
|
|
57
|
+
return (dispatcher) => {
|
|
58
|
+
dispatcher.on('element:table', (evt, data, conversionApi) => {
|
|
59
|
+
conversionApi.consumable.consume(data.viewItem, { classes: 'ck-table-resized' });
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
6
|
-
import type {
|
|
7
|
-
import TableEditing from '../tableediting.js';
|
|
8
|
-
import TableUtils from '../tableutils.js';
|
|
6
|
+
import type { ModelElement } from 'ckeditor5/src/engine.js';
|
|
7
|
+
import { TableEditing } from '../tableediting.js';
|
|
8
|
+
import { TableUtils } from '../tableutils.js';
|
|
9
9
|
/**
|
|
10
10
|
* The table column resize editing plugin.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export declare class TableColumnResizeEditing extends Plugin {
|
|
13
13
|
/**
|
|
14
14
|
* A flag indicating if the column resizing is in progress.
|
|
15
15
|
*/
|
|
@@ -69,21 +69,21 @@ export default class TableColumnResizeEditing extends Plugin {
|
|
|
69
69
|
* @param element A 'table' or 'tableColumnGroup' element.
|
|
70
70
|
* @returns A 'tableColumnGroup' element.
|
|
71
71
|
*/
|
|
72
|
-
getColumnGroupElement(element:
|
|
72
|
+
getColumnGroupElement(element: ModelElement): ModelElement | undefined;
|
|
73
73
|
/**
|
|
74
74
|
* Returns an array of 'tableColumn' elements.
|
|
75
75
|
*
|
|
76
76
|
* @param element A 'table' or 'tableColumnGroup' element.
|
|
77
77
|
* @returns An array of 'tableColumn' elements.
|
|
78
78
|
*/
|
|
79
|
-
getTableColumnElements(element:
|
|
79
|
+
getTableColumnElements(element: ModelElement): Array<ModelElement>;
|
|
80
80
|
/**
|
|
81
81
|
* Returns an array of table column widths.
|
|
82
82
|
*
|
|
83
83
|
* @param element A 'table' or 'tableColumnGroup' element.
|
|
84
84
|
* @returns An array of table column widths.
|
|
85
85
|
*/
|
|
86
|
-
getTableColumnsWidths(element:
|
|
86
|
+
getTableColumnsWidths(element: ModelElement): Array<string>;
|
|
87
87
|
/**
|
|
88
88
|
* Registers new attributes for a table model element.
|
|
89
89
|
*/
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
import { throttle, isEqual } from 'es-toolkit/compat';
|
|
9
9
|
import { global, DomEmitterMixin, Rect, toUnit } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
11
|
-
import MouseEventsObserver from '../../src/tablemouse/mouseeventsobserver.js';
|
|
12
|
-
import TableEditing from '../tableediting.js';
|
|
13
|
-
import TableUtils from '../tableutils.js';
|
|
14
|
-
import TableWalker from '../tablewalker.js';
|
|
15
|
-
import TableWidthsCommand from './tablewidthscommand.js';
|
|
16
|
-
import { downcastTableResizedClass, upcastColgroupElement } from './converters.js';
|
|
11
|
+
import { MouseEventsObserver } from '../../src/tablemouse/mouseeventsobserver.js';
|
|
12
|
+
import { TableEditing } from '../tableediting.js';
|
|
13
|
+
import { TableUtils } from '../tableutils.js';
|
|
14
|
+
import { TableWalker } from '../tablewalker.js';
|
|
15
|
+
import { TableWidthsCommand } from './tablewidthscommand.js';
|
|
16
|
+
import { downcastTableResizedClass, upcastColgroupElement, upcastTableResizedClass } from './converters.js';
|
|
17
17
|
import { clamp, createFilledArray, sumArray, getColumnEdgesIndexes, getChangedResizedTables, getColumnMinWidthAsPercentage, getElementWidthInPixels, getTableWidthInPixels, normalizeColumnWidths, toPrecision, getDomCellOuterWidth, updateColumnElements, getColumnGroupElement, getTableColumnElements, getTableColumnsWidths } from './utils.js';
|
|
18
18
|
import { COLUMN_MIN_WIDTH_IN_PIXELS, COLUMN_RESIZE_DISTANCE_THRESHOLD } from './constants.js';
|
|
19
19
|
const toPx = /* #__PURE__ */ toUnit('px');
|
|
20
20
|
/**
|
|
21
21
|
* The table column resize editing plugin.
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export class TableColumnResizeEditing extends Plugin {
|
|
24
24
|
/**
|
|
25
25
|
* A flag indicating if the column resizing is in progress.
|
|
26
26
|
*/
|
|
@@ -144,18 +144,20 @@ export default class TableColumnResizeEditing extends Plugin {
|
|
|
144
144
|
* Registers new attributes for a table model element.
|
|
145
145
|
*/
|
|
146
146
|
_extendSchema() {
|
|
147
|
-
this.editor.model.schema
|
|
147
|
+
const schema = this.editor.model.schema;
|
|
148
|
+
schema.extend('table', {
|
|
148
149
|
allowAttributes: ['tableWidth']
|
|
149
150
|
});
|
|
150
|
-
|
|
151
|
+
schema.register('tableColumnGroup', {
|
|
151
152
|
allowIn: 'table',
|
|
152
153
|
isLimit: true
|
|
153
154
|
});
|
|
154
|
-
|
|
155
|
+
schema.register('tableColumn', {
|
|
155
156
|
allowIn: 'tableColumnGroup',
|
|
156
157
|
allowAttributes: ['columnWidth', 'colSpan'],
|
|
157
158
|
isLimit: true
|
|
158
159
|
});
|
|
160
|
+
schema.setAttributeProperties('columnWidth', { isFormatting: true });
|
|
159
161
|
}
|
|
160
162
|
/**
|
|
161
163
|
* Registers table column resize post-fixer.
|
|
@@ -261,7 +263,6 @@ export default class TableColumnResizeEditing extends Plugin {
|
|
|
261
263
|
}
|
|
262
264
|
},
|
|
263
265
|
model: {
|
|
264
|
-
name: 'table',
|
|
265
266
|
key: 'tableWidth',
|
|
266
267
|
value: (viewElement) => {
|
|
267
268
|
const parent = viewElement.parent;
|
|
@@ -288,6 +289,7 @@ export default class TableColumnResizeEditing extends Plugin {
|
|
|
288
289
|
conversion.elementToElement({ model: 'tableColumnGroup', view: 'colgroup' });
|
|
289
290
|
conversion.elementToElement({ model: 'tableColumn', view: 'col' });
|
|
290
291
|
conversion.for('downcast').add(downcastTableResizedClass());
|
|
292
|
+
conversion.for('upcast').add(upcastTableResizedClass());
|
|
291
293
|
conversion.for('upcast').add(upcastColgroupElement(this._tableUtilsPlugin));
|
|
292
294
|
conversion.for('upcast').attributeToAttribute({
|
|
293
295
|
view: {
|