@ckeditor/ckeditor5-table 45.2.1-alpha.9 → 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,16 +6,16 @@
|
|
|
6
6
|
* @module table/tableproperties/tablepropertiesediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import {
|
|
10
|
-
import TableEditing from '../tableediting.js';
|
|
9
|
+
import { addBackgroundStylesRules, addBorderStylesRules } from 'ckeditor5/src/engine.js';
|
|
10
|
+
import { TableEditing } from '../tableediting.js';
|
|
11
11
|
import { downcastAttributeToStyle, downcastTableAttribute, getDefaultValueAdjusted, upcastBorderStyles, upcastStyleToAttribute } from '../converters/tableproperties.js';
|
|
12
|
-
import TableBackgroundColorCommand from './commands/tablebackgroundcolorcommand.js';
|
|
13
|
-
import TableBorderColorCommand from './commands/tablebordercolorcommand.js';
|
|
14
|
-
import TableBorderStyleCommand from './commands/tableborderstylecommand.js';
|
|
15
|
-
import TableBorderWidthCommand from './commands/tableborderwidthcommand.js';
|
|
16
|
-
import TableWidthCommand from './commands/tablewidthcommand.js';
|
|
17
|
-
import TableHeightCommand from './commands/tableheightcommand.js';
|
|
18
|
-
import TableAlignmentCommand from './commands/tablealignmentcommand.js';
|
|
12
|
+
import { TableBackgroundColorCommand } from './commands/tablebackgroundcolorcommand.js';
|
|
13
|
+
import { TableBorderColorCommand } from './commands/tablebordercolorcommand.js';
|
|
14
|
+
import { TableBorderStyleCommand } from './commands/tableborderstylecommand.js';
|
|
15
|
+
import { TableBorderWidthCommand } from './commands/tableborderwidthcommand.js';
|
|
16
|
+
import { TableWidthCommand } from './commands/tablewidthcommand.js';
|
|
17
|
+
import { TableHeightCommand } from './commands/tableheightcommand.js';
|
|
18
|
+
import { TableAlignmentCommand } from './commands/tablealignmentcommand.js';
|
|
19
19
|
import { getNormalizedDefaultTableProperties } from '../utils/table-properties.js';
|
|
20
20
|
const ALIGN_VALUES_REG_EXP = /^(left|center|right)$/;
|
|
21
21
|
const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
|
|
@@ -36,7 +36,7 @@ const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
|
|
|
36
36
|
* - horizontal alignment: `'tableAlignment'`
|
|
37
37
|
* - width & height: `'tableWidth'` & `'tableHeight'`
|
|
38
38
|
*/
|
|
39
|
-
export
|
|
39
|
+
export class TablePropertiesEditing extends Plugin {
|
|
40
40
|
/**
|
|
41
41
|
* @inheritDoc
|
|
42
42
|
*/
|
|
@@ -66,7 +66,7 @@ export default class TablePropertiesEditing extends Plugin {
|
|
|
66
66
|
const defaultTableProperties = getNormalizedDefaultTableProperties(editor.config.get('table.tableProperties.defaultProperties'), {
|
|
67
67
|
includeAlignmentProperty: true
|
|
68
68
|
});
|
|
69
|
-
editor.data.addStyleProcessorRules(
|
|
69
|
+
editor.data.addStyleProcessorRules(addBorderStylesRules);
|
|
70
70
|
enableBorderProperties(schema, conversion, {
|
|
71
71
|
color: defaultTableProperties.borderColor,
|
|
72
72
|
style: defaultTableProperties.borderStyle,
|
|
@@ -80,19 +80,25 @@ export default class TablePropertiesEditing extends Plugin {
|
|
|
80
80
|
enableTableToFigureProperty(schema, conversion, {
|
|
81
81
|
modelAttribute: 'tableWidth',
|
|
82
82
|
styleName: 'width',
|
|
83
|
+
attributeName: 'width',
|
|
84
|
+
attributeType: 'length',
|
|
83
85
|
defaultValue: defaultTableProperties.width
|
|
84
86
|
});
|
|
85
87
|
editor.commands.add('tableWidth', new TableWidthCommand(editor, defaultTableProperties.width));
|
|
86
88
|
enableTableToFigureProperty(schema, conversion, {
|
|
87
89
|
modelAttribute: 'tableHeight',
|
|
88
90
|
styleName: 'height',
|
|
91
|
+
attributeName: 'height',
|
|
92
|
+
attributeType: 'length',
|
|
89
93
|
defaultValue: defaultTableProperties.height
|
|
90
94
|
});
|
|
91
95
|
editor.commands.add('tableHeight', new TableHeightCommand(editor, defaultTableProperties.height));
|
|
92
|
-
editor.data.addStyleProcessorRules(
|
|
96
|
+
editor.data.addStyleProcessorRules(addBackgroundStylesRules);
|
|
93
97
|
enableProperty(schema, conversion, {
|
|
94
98
|
modelAttribute: 'tableBackgroundColor',
|
|
95
99
|
styleName: 'background-color',
|
|
100
|
+
attributeName: 'bgcolor',
|
|
101
|
+
attributeType: 'color',
|
|
96
102
|
defaultValue: defaultTableProperties.backgroundColor
|
|
97
103
|
});
|
|
98
104
|
editor.commands.add('tableBackgroundColor', new TableBackgroundColorCommand(editor, defaultTableProperties.backgroundColor));
|
|
@@ -115,6 +121,9 @@ function enableBorderProperties(schema, conversion, defaultBorder) {
|
|
|
115
121
|
schema.extend('table', {
|
|
116
122
|
allowAttributes: Object.values(modelAttributes)
|
|
117
123
|
});
|
|
124
|
+
for (const modelAttribute of Object.values(modelAttributes)) {
|
|
125
|
+
schema.setAttributeProperties(modelAttribute, { isFormatting: true });
|
|
126
|
+
}
|
|
118
127
|
upcastBorderStyles(conversion, 'table', modelAttributes, defaultBorder);
|
|
119
128
|
downcastTableAttribute(conversion, { modelAttribute: modelAttributes.color, styleName: 'border-color' });
|
|
120
129
|
downcastTableAttribute(conversion, { modelAttribute: modelAttributes.style, styleName: 'border-style' });
|
|
@@ -129,6 +138,7 @@ function enableAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
129
138
|
schema.extend('table', {
|
|
130
139
|
allowAttributes: ['tableAlignment']
|
|
131
140
|
});
|
|
141
|
+
schema.setAttributeProperties('tableAlignment', { isFormatting: true });
|
|
132
142
|
conversion.for('downcast')
|
|
133
143
|
.attributeToAttribute({
|
|
134
144
|
model: {
|
|
@@ -177,13 +187,21 @@ function enableAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
177
187
|
model: {
|
|
178
188
|
key: 'tableAlignment',
|
|
179
189
|
value: (viewElement, conversionApi, data) => {
|
|
190
|
+
// Ignore other figure elements.
|
|
191
|
+
if (viewElement.name == 'figure' && !viewElement.hasClass('table')) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
180
194
|
const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
|
|
181
195
|
let align = viewElement.getStyle('float');
|
|
182
196
|
// CSS: `float:none` => Model: `alignment:center`.
|
|
183
197
|
if (align === 'none') {
|
|
184
198
|
align = 'center';
|
|
185
199
|
}
|
|
186
|
-
|
|
200
|
+
if (align !== localDefaultValue) {
|
|
201
|
+
return align;
|
|
202
|
+
}
|
|
203
|
+
// Consume the style even if not applied to the element so it won't be processed by other converters.
|
|
204
|
+
conversionApi.consumable.consume(viewElement, { styles: 'float' });
|
|
187
205
|
}
|
|
188
206
|
}
|
|
189
207
|
})
|
|
@@ -199,26 +217,38 @@ function enableAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
199
217
|
model: {
|
|
200
218
|
key: 'tableAlignment',
|
|
201
219
|
value: (viewElement, conversionApi, data) => {
|
|
220
|
+
// Ignore other figure elements.
|
|
221
|
+
if (viewElement.name == 'figure' && !viewElement.hasClass('table')) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
202
224
|
const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
|
|
203
225
|
const align = 'center';
|
|
204
|
-
|
|
226
|
+
if (align !== localDefaultValue) {
|
|
227
|
+
return align;
|
|
228
|
+
}
|
|
229
|
+
// Consume the styles even if not applied to the element so it won't be processed by other converters.
|
|
230
|
+
conversionApi.consumable.consume(viewElement, { styles: ['margin-left', 'margin-right'] });
|
|
205
231
|
}
|
|
206
232
|
}
|
|
207
233
|
})
|
|
208
234
|
// Support for the `align` attribute as the backward compatibility while pasting from other sources.
|
|
209
235
|
.attributeToAttribute({
|
|
210
236
|
view: {
|
|
237
|
+
name: 'table',
|
|
211
238
|
attributes: {
|
|
212
239
|
align: ALIGN_VALUES_REG_EXP
|
|
213
240
|
}
|
|
214
241
|
},
|
|
215
242
|
model: {
|
|
216
|
-
name: 'table',
|
|
217
243
|
key: 'tableAlignment',
|
|
218
244
|
value: (viewElement, conversionApi, data) => {
|
|
219
245
|
const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
|
|
220
246
|
const align = viewElement.getAttribute('align');
|
|
221
|
-
|
|
247
|
+
if (align !== localDefaultValue) {
|
|
248
|
+
return align;
|
|
249
|
+
}
|
|
250
|
+
// Consume the attribute even if not applied to the element so it won't be processed by other converters.
|
|
251
|
+
conversionApi.consumable.consume(viewElement, { attributes: 'align' });
|
|
222
252
|
}
|
|
223
253
|
}
|
|
224
254
|
});
|
|
@@ -233,6 +263,7 @@ function enableProperty(schema, conversion, options) {
|
|
|
233
263
|
schema.extend('table', {
|
|
234
264
|
allowAttributes: [modelAttribute]
|
|
235
265
|
});
|
|
266
|
+
schema.setAttributeProperties(modelAttribute, { isFormatting: true });
|
|
236
267
|
upcastStyleToAttribute(conversion, { viewElement: 'table', ...options });
|
|
237
268
|
downcastTableAttribute(conversion, options);
|
|
238
269
|
}
|
|
@@ -244,10 +275,7 @@ function enableTableToFigureProperty(schema, conversion, options) {
|
|
|
244
275
|
schema.extend('table', {
|
|
245
276
|
allowAttributes: [modelAttribute]
|
|
246
277
|
});
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
shouldUpcast: (element) => !(element.name == 'table' && element.parent.name == 'figure'),
|
|
250
|
-
...options
|
|
251
|
-
});
|
|
278
|
+
schema.setAttributeProperties(modelAttribute, { isFormatting: true });
|
|
279
|
+
upcastStyleToAttribute(conversion, { viewElement: /^(table|figure)$/, ...options });
|
|
252
280
|
downcastAttributeToStyle(conversion, { modelElement: 'table', ...options });
|
|
253
281
|
}
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { ButtonView, ContextualBalloon } from 'ckeditor5/src/ui.js';
|
|
10
|
-
import TablePropertiesView from './ui/tablepropertiesview.js';
|
|
10
|
+
import { TablePropertiesView } from './ui/tablepropertiesview.js';
|
|
11
11
|
/**
|
|
12
12
|
* The table properties UI plugin. It introduces the `'tableProperties'` button
|
|
13
13
|
* that opens a form allowing to specify visual styling of an entire table.
|
|
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 TablePropertiesUI extends Plugin {
|
|
18
18
|
/**
|
|
19
19
|
* The default table properties.
|
|
20
20
|
*/
|
|
@@ -9,7 +9,7 @@ import { Plugin } from 'ckeditor5/src/core.js';
|
|
|
9
9
|
import { IconTableProperties } from 'ckeditor5/src/icons.js';
|
|
10
10
|
import { ButtonView, ContextualBalloon, clickOutsideHandler, getLocalizedColorOptions, normalizeColorOptions } from 'ckeditor5/src/ui.js';
|
|
11
11
|
import { debounce } from 'es-toolkit/compat';
|
|
12
|
-
import TablePropertiesView from './ui/tablepropertiesview.js';
|
|
12
|
+
import { TablePropertiesView } from './ui/tablepropertiesview.js';
|
|
13
13
|
import { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, lengthFieldValidator, lineWidthFieldValidator, defaultColors } from '../utils/ui/table-properties.js';
|
|
14
14
|
import { getSelectionAffectedTableWidget } from '../utils/ui/widget.js';
|
|
15
15
|
import { getBalloonTablePositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon.js';
|
|
@@ -31,7 +31,7 @@ const propertyToCommandMap = {
|
|
|
31
31
|
*
|
|
32
32
|
* It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export class TablePropertiesUI extends Plugin {
|
|
35
35
|
/**
|
|
36
36
|
* The default table properties.
|
|
37
37
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ButtonView, FocusCycler, LabeledFieldView, ToolbarView, View, ViewCollection, type DropdownView, type InputTextView, type NormalizedColorOption, type ColorPickerConfig, type FocusableView } from 'ckeditor5/src/ui.js';
|
|
9
9
|
import { FocusTracker, KeystrokeHandler, 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 { TablePropertiesOptions } from '../../tableconfig.js';
|
|
12
12
|
import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
|
|
13
13
|
import '../../../theme/formrow.css';
|
|
@@ -40,7 +40,7 @@ export interface TablePropertiesViewOptions {
|
|
|
40
40
|
* The class representing a table properties form, allowing users to customize
|
|
41
41
|
* certain style aspects of a table, for instance, border, background color, alignment, etc..
|
|
42
42
|
*/
|
|
43
|
-
export
|
|
43
|
+
export declare class TablePropertiesView extends View {
|
|
44
44
|
/**
|
|
45
45
|
* The value of the border style.
|
|
46
46
|
*
|
|
@@ -18,7 +18,7 @@ import '../../../theme/tableproperties.css';
|
|
|
18
18
|
* The class representing a table properties form, allowing users to customize
|
|
19
19
|
* certain style aspects of a table, for instance, border, background color, alignment, etc..
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export class TablePropertiesView extends View {
|
|
22
22
|
/**
|
|
23
23
|
* Options passed to the view. See {@link #constructor} to learn more.
|
|
24
24
|
*/
|
package/src/tableproperties.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module table/tableproperties
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import TablePropertiesEditing from './tableproperties/tablepropertiesediting.js';
|
|
10
|
-
import TablePropertiesUI from './tableproperties/tablepropertiesui.js';
|
|
9
|
+
import { TablePropertiesEditing } from './tableproperties/tablepropertiesediting.js';
|
|
10
|
+
import { TablePropertiesUI } from './tableproperties/tablepropertiesui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The table properties feature. Enables support for setting properties of tables (size, border, background, etc.).
|
|
13
13
|
*
|
|
@@ -18,7 +18,7 @@ import TablePropertiesUI from './tableproperties/tablepropertiesui.js';
|
|
|
18
18
|
* {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing table properties editing feature} and
|
|
19
19
|
* the {@link module:table/tableproperties/tablepropertiesui~TablePropertiesUI table properties UI feature}.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export declare class TableProperties extends Plugin {
|
|
22
22
|
/**
|
|
23
23
|
* @inheritDoc
|
|
24
24
|
*/
|
package/src/tableproperties.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module table/tableproperties
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import TablePropertiesEditing from './tableproperties/tablepropertiesediting.js';
|
|
10
|
-
import TablePropertiesUI from './tableproperties/tablepropertiesui.js';
|
|
9
|
+
import { TablePropertiesEditing } from './tableproperties/tablepropertiesediting.js';
|
|
10
|
+
import { TablePropertiesUI } from './tableproperties/tablepropertiesui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The table properties feature. Enables support for setting properties of tables (size, border, background, etc.).
|
|
13
13
|
*
|
|
@@ -18,7 +18,7 @@ import TablePropertiesUI from './tableproperties/tablepropertiesui.js';
|
|
|
18
18
|
* {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing table properties editing feature} and
|
|
19
19
|
* the {@link module:table/tableproperties/tablepropertiesui~TablePropertiesUI table properties UI feature}.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export class TableProperties extends Plugin {
|
|
22
22
|
/**
|
|
23
23
|
* @inheritDoc
|
|
24
24
|
*/
|
package/src/tableselection.d.ts
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* @module table/tableselection
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import type {
|
|
10
|
-
import TableUtils from './tableutils.js';
|
|
9
|
+
import type { ModelElement, ModelDocumentFragment } from 'ckeditor5/src/engine.js';
|
|
10
|
+
import { TableUtils } from './tableutils.js';
|
|
11
11
|
import '../theme/tableselection.css';
|
|
12
12
|
/**
|
|
13
13
|
* This plugin enables the advanced table cells, rows and columns selection.
|
|
14
14
|
* It is loaded automatically by the {@link module:table/table~Table} plugin.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export declare class TableSelection extends Plugin {
|
|
17
17
|
/**
|
|
18
18
|
* @inheritDoc
|
|
19
19
|
*/
|
|
@@ -33,11 +33,11 @@ export default class TableSelection extends Plugin {
|
|
|
33
33
|
/**
|
|
34
34
|
* Returns the currently selected table cells or `null` if it is not a table cells selection.
|
|
35
35
|
*/
|
|
36
|
-
getSelectedTableCells(): Array<
|
|
36
|
+
getSelectedTableCells(): Array<ModelElement> | null;
|
|
37
37
|
/**
|
|
38
38
|
* Returns the selected table fragment as a document fragment.
|
|
39
39
|
*/
|
|
40
|
-
getSelectionAsFragment():
|
|
40
|
+
getSelectionAsFragment(): ModelDocumentFragment | null;
|
|
41
41
|
/**
|
|
42
42
|
* Sets the model selection based on given anchor and target cells (can be the same cell).
|
|
43
43
|
* Takes care of setting the backward flag.
|
|
@@ -51,15 +51,15 @@ export default class TableSelection extends Plugin {
|
|
|
51
51
|
* tableSelection.setCellSelection( firstCell, lastCell );
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
setCellSelection(anchorCell:
|
|
54
|
+
setCellSelection(anchorCell: ModelElement, targetCell: ModelElement): void;
|
|
55
55
|
/**
|
|
56
56
|
* Returns the focus cell from the current selection.
|
|
57
57
|
*/
|
|
58
|
-
getFocusCell():
|
|
58
|
+
getFocusCell(): ModelElement | null;
|
|
59
59
|
/**
|
|
60
60
|
* Returns the anchor cell from the current selection.
|
|
61
61
|
*/
|
|
62
|
-
getAnchorCell():
|
|
62
|
+
getAnchorCell(): ModelElement | null;
|
|
63
63
|
/**
|
|
64
64
|
* Defines a selection converter which marks the selected cells with a specific class.
|
|
65
65
|
*
|
|
@@ -91,7 +91,7 @@ export default class TableSelection extends Plugin {
|
|
|
91
91
|
* yes, it's a hack).
|
|
92
92
|
*
|
|
93
93
|
* When multiple cells are selected in the model and the user starts to type, the
|
|
94
|
-
* {@link module:engine/view/document~
|
|
94
|
+
* {@link module:engine/view/document~ViewDocument#event:insertText} event carries information provided by the
|
|
95
95
|
* beforeinput DOM event, that in turn only knows about this collapsed DOM selection in the last cell.
|
|
96
96
|
*
|
|
97
97
|
* As a result, the selected cells have no chance to be cleaned up. To fix this, this listener intercepts
|
package/src/tableselection.js
CHANGED
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { first } from 'ckeditor5/src/utils.js';
|
|
10
|
-
import TableWalker from './tablewalker.js';
|
|
11
|
-
import TableUtils from './tableutils.js';
|
|
10
|
+
import { TableWalker } from './tablewalker.js';
|
|
11
|
+
import { TableUtils } from './tableutils.js';
|
|
12
12
|
import { cropTableToDimensions, adjustLastRowIndex, adjustLastColumnIndex } from './utils/structure.js';
|
|
13
13
|
import '../theme/tableselection.css';
|
|
14
14
|
/**
|
|
15
15
|
* This plugin enables the advanced table cells, rows and columns selection.
|
|
16
16
|
* It is loaded automatically by the {@link module:table/table~Table} plugin.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export class TableSelection extends Plugin {
|
|
19
19
|
/**
|
|
20
20
|
* @inheritDoc
|
|
21
21
|
*/
|
|
@@ -242,7 +242,7 @@ export default class TableSelection extends Plugin {
|
|
|
242
242
|
* yes, it's a hack).
|
|
243
243
|
*
|
|
244
244
|
* When multiple cells are selected in the model and the user starts to type, the
|
|
245
|
-
* {@link module:engine/view/document~
|
|
245
|
+
* {@link module:engine/view/document~ViewDocument#event:insertText} event carries information provided by the
|
|
246
246
|
* beforeinput DOM event, that in turn only knows about this collapsed DOM selection in the last cell.
|
|
247
247
|
*
|
|
248
248
|
* As a result, the selected cells have no chance to be cleaned up. To fix this, this listener intercepts
|
package/src/tabletoolbar.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { WidgetToolbarRepository } from 'ckeditor5/src/widget.js';
|
|
|
16
16
|
* Table content toolbar shows up when the selection is inside the content of a table. It creates its component based on the
|
|
17
17
|
* {@link module:table/tableconfig~TableConfig#contentToolbar `table.contentToolbar` configuration option}.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export declare class TableToolbar extends Plugin {
|
|
20
20
|
/**
|
|
21
21
|
* @inheritDoc
|
|
22
22
|
*/
|
package/src/tabletoolbar.js
CHANGED
|
@@ -17,7 +17,7 @@ import { getSelectedTableWidget, getTableWidgetAncestor } from './utils/ui/widge
|
|
|
17
17
|
* Table content toolbar shows up when the selection is inside the content of a table. It creates its component based on the
|
|
18
18
|
* {@link module:table/tableconfig~TableConfig#contentToolbar `table.contentToolbar` configuration option}.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export class TableToolbar extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
package/src/tableui.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { Plugin } from 'ckeditor5/src/core.js';
|
|
|
17
17
|
*
|
|
18
18
|
* The `'tableColumn'`, `'tableRow'` and `'mergeTableCells'` dropdowns work best with {@link module:table/tabletoolbar~TableToolbar}.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export declare class TableUI extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
package/src/tableui.js
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { IconTable, IconTableColumn, IconTableRow, IconTableMergeCell } from 'ckeditor5/src/icons.js';
|
|
10
|
-
import { addListToDropdown, createDropdown,
|
|
10
|
+
import { addListToDropdown, createDropdown, UIModel, SplitButtonView, SwitchButtonView, MenuBarMenuView } from 'ckeditor5/src/ui.js';
|
|
11
11
|
import { Collection } from 'ckeditor5/src/utils.js';
|
|
12
|
-
import InsertTableView from './ui/inserttableview.js';
|
|
12
|
+
import { InsertTableView } from './ui/inserttableview.js';
|
|
13
13
|
/**
|
|
14
14
|
* The table UI plugin. It introduces:
|
|
15
15
|
*
|
|
@@ -21,7 +21,7 @@ import InsertTableView from './ui/inserttableview.js';
|
|
|
21
21
|
*
|
|
22
22
|
* The `'tableColumn'`, `'tableRow'` and `'mergeTableCells'` dropdowns work best with {@link module:table/tabletoolbar~TableToolbar}.
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export class TableUI extends Plugin {
|
|
25
25
|
/**
|
|
26
26
|
* @inheritDoc
|
|
27
27
|
*/
|
|
@@ -318,7 +318,7 @@ export default class TableUI extends Plugin {
|
|
|
318
318
|
*/
|
|
319
319
|
function addListOption(option, editor, commands, itemDefinitions) {
|
|
320
320
|
if (option.type === 'button' || option.type === 'switchbutton') {
|
|
321
|
-
const model = option.model = new
|
|
321
|
+
const model = option.model = new UIModel(option.model);
|
|
322
322
|
const { commandName, bindIsOn } = option.model;
|
|
323
323
|
const command = editor.commands.get(commandName);
|
|
324
324
|
commands.push(command);
|
package/src/tableutils.d.ts
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
6
|
-
import type {
|
|
7
|
-
import TableWalker,
|
|
8
|
-
type
|
|
6
|
+
import type { ModelDocumentSelection, ModelElement, ModelRange, ModelSelection, ModelWriter } from 'ckeditor5/src/engine.js';
|
|
7
|
+
import { TableWalker, type TableWalkerOptions } from './tablewalker.js';
|
|
8
|
+
export type TableIndexesObject = {
|
|
9
9
|
first: number;
|
|
10
10
|
last: number;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* The table utilities plugin.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare class TableUtils extends Plugin {
|
|
16
16
|
/**
|
|
17
17
|
* @inheritDoc
|
|
18
18
|
*/
|
|
@@ -53,7 +53,7 @@ export default class TableUtils extends Plugin {
|
|
|
53
53
|
*
|
|
54
54
|
* @returns Returns a `{row, column}` object.
|
|
55
55
|
*/
|
|
56
|
-
getCellLocation(tableCell:
|
|
56
|
+
getCellLocation(tableCell: ModelElement): {
|
|
57
57
|
row: number;
|
|
58
58
|
column: number;
|
|
59
59
|
};
|
|
@@ -78,12 +78,12 @@ export default class TableUtils extends Plugin {
|
|
|
78
78
|
* @param options.headingColumns The number of heading columns. Default value is 0.
|
|
79
79
|
* @returns The created table element.
|
|
80
80
|
*/
|
|
81
|
-
createTable(writer:
|
|
81
|
+
createTable(writer: ModelWriter, options: {
|
|
82
82
|
rows?: number;
|
|
83
83
|
columns?: number;
|
|
84
84
|
headingRows?: number;
|
|
85
85
|
headingColumns?: number;
|
|
86
|
-
}):
|
|
86
|
+
}): ModelElement;
|
|
87
87
|
/**
|
|
88
88
|
* Inserts rows into a table.
|
|
89
89
|
*
|
|
@@ -112,7 +112,7 @@ export default class TableUtils extends Plugin {
|
|
|
112
112
|
* @param options.copyStructureFromAbove The flag for copying row structure. Note that
|
|
113
113
|
* the row structure will not be copied if this option is not provided.
|
|
114
114
|
*/
|
|
115
|
-
insertRows(table:
|
|
115
|
+
insertRows(table: ModelElement, options?: {
|
|
116
116
|
at?: number;
|
|
117
117
|
rows?: number;
|
|
118
118
|
copyStructureFromAbove?: boolean;
|
|
@@ -144,7 +144,7 @@ export default class TableUtils extends Plugin {
|
|
|
144
144
|
* @param options.at The column index at which the columns will be inserted. Default value is 0.
|
|
145
145
|
* @param options.columns The number of columns to insert. Default value is 1.
|
|
146
146
|
*/
|
|
147
|
-
insertColumns(table:
|
|
147
|
+
insertColumns(table: ModelElement, options?: {
|
|
148
148
|
at?: number;
|
|
149
149
|
columns?: number;
|
|
150
150
|
}): void;
|
|
@@ -176,7 +176,7 @@ export default class TableUtils extends Plugin {
|
|
|
176
176
|
* @param options.at The row index at which the removing rows will start.
|
|
177
177
|
* @param options.rows The number of rows to remove. Default value is 1.
|
|
178
178
|
*/
|
|
179
|
-
removeRows(table:
|
|
179
|
+
removeRows(table: ModelElement, options: {
|
|
180
180
|
at: number;
|
|
181
181
|
rows?: number;
|
|
182
182
|
}): void;
|
|
@@ -209,7 +209,7 @@ export default class TableUtils extends Plugin {
|
|
|
209
209
|
* @param options.at The row index at which the removing columns will start.
|
|
210
210
|
* @param options.columns The number of columns to remove.
|
|
211
211
|
*/
|
|
212
|
-
removeColumns(table:
|
|
212
|
+
removeColumns(table: ModelElement, options: {
|
|
213
213
|
at: number;
|
|
214
214
|
columns?: number;
|
|
215
215
|
}): void;
|
|
@@ -254,7 +254,7 @@ export default class TableUtils extends Plugin {
|
|
|
254
254
|
* | b | c | d |
|
|
255
255
|
* +---+---+---+
|
|
256
256
|
*/
|
|
257
|
-
splitCellVertically(tableCell:
|
|
257
|
+
splitCellVertically(tableCell: ModelElement, numberOfCells?: number): void;
|
|
258
258
|
/**
|
|
259
259
|
* Divides a table cell horizontally into several ones.
|
|
260
260
|
*
|
|
@@ -308,7 +308,7 @@ export default class TableUtils extends Plugin {
|
|
|
308
308
|
* | | h | i |
|
|
309
309
|
* +---+---+---+
|
|
310
310
|
*/
|
|
311
|
-
splitCellHorizontally(tableCell:
|
|
311
|
+
splitCellHorizontally(tableCell: ModelElement, numberOfCells?: number): void;
|
|
312
312
|
/**
|
|
313
313
|
* Returns the number of columns for a given table.
|
|
314
314
|
*
|
|
@@ -318,7 +318,7 @@ export default class TableUtils extends Plugin {
|
|
|
318
318
|
*
|
|
319
319
|
* @param table The table to analyze.
|
|
320
320
|
*/
|
|
321
|
-
getColumns(table:
|
|
321
|
+
getColumns(table: ModelElement): number;
|
|
322
322
|
/**
|
|
323
323
|
* Returns the number of rows for a given table. Any other element present in the table model is omitted.
|
|
324
324
|
*
|
|
@@ -328,7 +328,7 @@ export default class TableUtils extends Plugin {
|
|
|
328
328
|
*
|
|
329
329
|
* @param table The table to analyze.
|
|
330
330
|
*/
|
|
331
|
-
getRows(table:
|
|
331
|
+
getRows(table: ModelElement): number;
|
|
332
332
|
/**
|
|
333
333
|
* Creates an instance of the table walker.
|
|
334
334
|
*
|
|
@@ -341,7 +341,7 @@ export default class TableUtils extends Plugin {
|
|
|
341
341
|
* @param table A table over which the walker iterates.
|
|
342
342
|
* @param options An object with configuration.
|
|
343
343
|
*/
|
|
344
|
-
createTableWalker(table:
|
|
344
|
+
createTableWalker(table: ModelElement, options?: TableWalkerOptions): TableWalker;
|
|
345
345
|
/**
|
|
346
346
|
* Returns all model table cells that are fully selected (from the outside)
|
|
347
347
|
* within the provided model selection's ranges.
|
|
@@ -349,24 +349,24 @@ export default class TableUtils extends Plugin {
|
|
|
349
349
|
* To obtain the cells selected from the inside, use
|
|
350
350
|
* {@link #getTableCellsContainingSelection}.
|
|
351
351
|
*/
|
|
352
|
-
getSelectedTableCells(selection:
|
|
352
|
+
getSelectedTableCells(selection: ModelSelection | ModelDocumentSelection): Array<ModelElement>;
|
|
353
353
|
/**
|
|
354
354
|
* Returns all model table cells that the provided model selection's ranges
|
|
355
|
-
* {@link module:engine/model/range~
|
|
355
|
+
* {@link module:engine/model/range~ModelRange#start} inside.
|
|
356
356
|
*
|
|
357
357
|
* To obtain the cells selected from the outside, use
|
|
358
358
|
* {@link #getSelectedTableCells}.
|
|
359
359
|
*/
|
|
360
|
-
getTableCellsContainingSelection(selection:
|
|
360
|
+
getTableCellsContainingSelection(selection: ModelSelection | ModelDocumentSelection): Array<ModelElement>;
|
|
361
361
|
/**
|
|
362
362
|
* Returns all model table cells that are either completely selected
|
|
363
363
|
* by selection ranges or host selection range
|
|
364
|
-
* {@link module:engine/model/range~
|
|
364
|
+
* {@link module:engine/model/range~ModelRange#start start positions} inside them.
|
|
365
365
|
*
|
|
366
366
|
* Combines {@link #getTableCellsContainingSelection} and
|
|
367
367
|
* {@link #getSelectedTableCells}.
|
|
368
368
|
*/
|
|
369
|
-
getSelectionAffectedTableCells(selection:
|
|
369
|
+
getSelectionAffectedTableCells(selection: ModelSelection | ModelDocumentSelection): Array<ModelElement>;
|
|
370
370
|
/**
|
|
371
371
|
* Returns an object with the `first` and `last` row index contained in the given `tableCells`.
|
|
372
372
|
*
|
|
@@ -380,7 +380,7 @@ export default class TableUtils extends Plugin {
|
|
|
380
380
|
*
|
|
381
381
|
* @returns Returns an object with the `first` and `last` table row indexes.
|
|
382
382
|
*/
|
|
383
|
-
getRowIndexes(tableCells: Array<
|
|
383
|
+
getRowIndexes(tableCells: Array<ModelElement>): TableIndexesObject;
|
|
384
384
|
/**
|
|
385
385
|
* Returns an object with the `first` and `last` column index contained in the given `tableCells`.
|
|
386
386
|
*
|
|
@@ -394,7 +394,7 @@ export default class TableUtils extends Plugin {
|
|
|
394
394
|
*
|
|
395
395
|
* @returns Returns an object with the `first` and `last` table column indexes.
|
|
396
396
|
*/
|
|
397
|
-
getColumnIndexes(tableCells: Array<
|
|
397
|
+
getColumnIndexes(tableCells: Array<ModelElement>): TableIndexesObject;
|
|
398
398
|
/**
|
|
399
399
|
* Checks if the selection contains cells that do not exceed rectangular selection.
|
|
400
400
|
*
|
|
@@ -418,11 +418,11 @@ export default class TableUtils extends Plugin {
|
|
|
418
418
|
* - a, c (the unselected cell "b" creates a gap)
|
|
419
419
|
* - f, g, h (cell "d" spans over a cell from the row of "f" cell - thus creates a gap)
|
|
420
420
|
*/
|
|
421
|
-
isSelectionRectangular(selectedTableCells: Array<
|
|
421
|
+
isSelectionRectangular(selectedTableCells: Array<ModelElement>): boolean;
|
|
422
422
|
/**
|
|
423
423
|
* Returns array of sorted ranges.
|
|
424
424
|
*/
|
|
425
|
-
sortRanges(ranges: Iterable<
|
|
425
|
+
sortRanges(ranges: Iterable<ModelRange>): Array<ModelRange>;
|
|
426
426
|
/**
|
|
427
427
|
* Helper method to get an object with `first` and `last` indexes from an unsorted array of indexes.
|
|
428
428
|
*/
|
|
@@ -449,4 +449,3 @@ export default class TableUtils extends Plugin {
|
|
|
449
449
|
*/
|
|
450
450
|
private _areIndexesInSameSection;
|
|
451
451
|
}
|
|
452
|
-
export {};
|
package/src/tableutils.js
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { CKEditorError } from 'ckeditor5/src/utils.js';
|
|
9
9
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
10
|
-
import TableWalker from './tablewalker.js';
|
|
10
|
+
import { TableWalker } from './tablewalker.js';
|
|
11
11
|
import { createEmptyTableCell, updateNumericAttribute } from './utils/common.js';
|
|
12
12
|
import { removeEmptyColumns, removeEmptyRows } from './utils/structure.js';
|
|
13
13
|
import { getTableColumnElements } from './tablecolumnresize/utils.js';
|
|
14
14
|
/**
|
|
15
15
|
* The table utilities plugin.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export class TableUtils extends Plugin {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
|
@@ -730,7 +730,7 @@ export default class TableUtils extends Plugin {
|
|
|
730
730
|
}
|
|
731
731
|
/**
|
|
732
732
|
* Returns all model table cells that the provided model selection's ranges
|
|
733
|
-
* {@link module:engine/model/range~
|
|
733
|
+
* {@link module:engine/model/range~ModelRange#start} inside.
|
|
734
734
|
*
|
|
735
735
|
* To obtain the cells selected from the outside, use
|
|
736
736
|
* {@link #getSelectedTableCells}.
|
|
@@ -748,7 +748,7 @@ export default class TableUtils extends Plugin {
|
|
|
748
748
|
/**
|
|
749
749
|
* Returns all model table cells that are either completely selected
|
|
750
750
|
* by selection ranges or host selection range
|
|
751
|
-
* {@link module:engine/model/range~
|
|
751
|
+
* {@link module:engine/model/range~ModelRange#start start positions} inside them.
|
|
752
752
|
*
|
|
753
753
|
* Combines {@link #getTableCellsContainingSelection} and
|
|
754
754
|
* {@link #getSelectedTableCells}.
|