@ckeditor/ckeditor5-table 46.0.3 → 46.1.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 +7 -2
- package/dist/index-editor.css +2 -2
- package/dist/index.css +22 -4
- package/dist/index.css.map +1 -1
- package/dist/index.js +15 -21
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/index.d.ts +1 -1
- package/src/tablecaption/tablecaptionediting.d.ts +1 -5
- package/src/tablecaption/tablecaptionediting.js +15 -14
- package/src/tableconfig.d.ts +54 -0
- package/src/tablewalker.d.ts +1 -1
- package/src/tablewalker.js +1 -0
- package/theme/table.css +17 -0
- package/theme/tablecaption.css +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-table",
|
|
3
|
-
"version": "46.0.
|
|
3
|
+
"version": "46.1.0-alpha.0",
|
|
4
4
|
"description": "Table feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"ckeditor5": "46.0.
|
|
17
|
-
"@ckeditor/ckeditor5-clipboard": "46.0.
|
|
18
|
-
"@ckeditor/ckeditor5-core": "46.0.
|
|
19
|
-
"@ckeditor/ckeditor5-engine": "46.0.
|
|
20
|
-
"@ckeditor/ckeditor5-icons": "46.0.
|
|
21
|
-
"@ckeditor/ckeditor5-ui": "46.0.
|
|
22
|
-
"@ckeditor/ckeditor5-utils": "46.0.
|
|
23
|
-
"@ckeditor/ckeditor5-widget": "46.0.
|
|
16
|
+
"ckeditor5": "46.1.0-alpha.0",
|
|
17
|
+
"@ckeditor/ckeditor5-clipboard": "46.1.0-alpha.0",
|
|
18
|
+
"@ckeditor/ckeditor5-core": "46.1.0-alpha.0",
|
|
19
|
+
"@ckeditor/ckeditor5-engine": "46.1.0-alpha.0",
|
|
20
|
+
"@ckeditor/ckeditor5-icons": "46.1.0-alpha.0",
|
|
21
|
+
"@ckeditor/ckeditor5-ui": "46.1.0-alpha.0",
|
|
22
|
+
"@ckeditor/ckeditor5-utils": "46.1.0-alpha.0",
|
|
23
|
+
"@ckeditor/ckeditor5-widget": "46.1.0-alpha.0",
|
|
24
24
|
"es-toolkit": "1.39.5"
|
|
25
25
|
},
|
|
26
26
|
"author": "CKSource (http://cksource.com/)",
|
package/src/index.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export { TableHeightCommand } from './tableproperties/commands/tableheightcomman
|
|
|
68
68
|
export { TableWidthCommand } from './tableproperties/commands/tablewidthcommand.js';
|
|
69
69
|
export { TablePropertyCommand, type TablePropertyCommandExecuteOptions } from './tableproperties/commands/tablepropertycommand.js';
|
|
70
70
|
export type { ViewDocumentTableMouseMoveEvent, ViewDocumentTableMouseLeaveEvent } from './tablemouse/mouseeventsobserver.js';
|
|
71
|
-
export type { TableConfig, TablePropertiesConfig, TablePropertiesOptions, TableCellPropertiesConfig, TableColorConfig, TableCellPropertiesOptions, TableLayoutConfig, TableType } from './tableconfig.js';
|
|
71
|
+
export type { TableConfig, TablePropertiesConfig, TablePropertiesOptions, TableCellPropertiesConfig, TableColorConfig, TableCellPropertiesOptions, TableLayoutConfig, TableCaptionConfig, TableType } from './tableconfig.js';
|
|
72
72
|
export { downcastTable as _downcastTable, downcastRow as _downcastTableRow, downcastCell as _downcastTableCell, convertParagraphInTableCell as _convertParagraphInTableCell, isSingleParagraphWithoutAttributes as _isSingleTableParagraphWithoutAttributes } from './converters/downcast.js';
|
|
73
73
|
export type { DowncastTableOptions as _DowncastTableOptions } from './converters/downcast.js';
|
|
74
74
|
export { injectTableCaptionPostFixer as _injectTableCaptionPostFixer } from './converters/table-caption-post-fixer.js';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tablecaption/tablecaptionediting
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { ModelElement } from 'ckeditor5/src/engine.js';
|
|
10
10
|
/**
|
|
11
11
|
* The table caption editing plugin.
|
|
@@ -26,10 +26,6 @@ export declare class TableCaptionEditing extends Plugin {
|
|
|
26
26
|
* @inheritDoc
|
|
27
27
|
*/
|
|
28
28
|
static get isOfficialPlugin(): true;
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
constructor(editor: Editor);
|
|
33
29
|
/**
|
|
34
30
|
* @inheritDoc
|
|
35
31
|
*/
|
|
@@ -21,7 +21,7 @@ export class TableCaptionEditing extends Plugin {
|
|
|
21
21
|
*
|
|
22
22
|
* To learn more about this system, see {@link #_saveCaption}.
|
|
23
23
|
*/
|
|
24
|
-
_savedCaptionsMap;
|
|
24
|
+
_savedCaptionsMap = new WeakMap();
|
|
25
25
|
/**
|
|
26
26
|
* @inheritDoc
|
|
27
27
|
*/
|
|
@@ -34,13 +34,6 @@ export class TableCaptionEditing extends Plugin {
|
|
|
34
34
|
static get isOfficialPlugin() {
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
38
|
-
* @inheritDoc
|
|
39
|
-
*/
|
|
40
|
-
constructor(editor) {
|
|
41
|
-
super(editor);
|
|
42
|
-
this._savedCaptionsMap = new WeakMap();
|
|
43
|
-
}
|
|
44
37
|
/**
|
|
45
38
|
* @inheritDoc
|
|
46
39
|
*/
|
|
@@ -49,6 +42,7 @@ export class TableCaptionEditing extends Plugin {
|
|
|
49
42
|
const schema = editor.model.schema;
|
|
50
43
|
const view = editor.editing.view;
|
|
51
44
|
const t = editor.t;
|
|
45
|
+
const useCaptionElement = editor.config.get('table.tableCaption.useCaptionElement');
|
|
52
46
|
if (!schema.isRegistered('caption')) {
|
|
53
47
|
schema.register('caption', {
|
|
54
48
|
allowIn: 'table',
|
|
@@ -62,6 +56,13 @@ export class TableCaptionEditing extends Plugin {
|
|
|
62
56
|
});
|
|
63
57
|
}
|
|
64
58
|
editor.commands.add('toggleTableCaption', new ToggleTableCaptionCommand(this.editor));
|
|
59
|
+
if (useCaptionElement) {
|
|
60
|
+
const tableEditing = editor.plugins.get('TableEditing');
|
|
61
|
+
tableEditing.registerAdditionalSlot({
|
|
62
|
+
filter: element => element.is('element', 'caption'),
|
|
63
|
+
positionOffset: 'end'
|
|
64
|
+
});
|
|
65
|
+
}
|
|
65
66
|
// View -> model converter for the data pipeline.
|
|
66
67
|
editor.conversion.for('upcast').elementToElement({
|
|
67
68
|
view: matchTableCaptionViewElement,
|
|
@@ -74,7 +75,7 @@ export class TableCaptionEditing extends Plugin {
|
|
|
74
75
|
if (!isTable(modelElement.parent)) {
|
|
75
76
|
return null;
|
|
76
77
|
}
|
|
77
|
-
return writer.createContainerElement('figcaption');
|
|
78
|
+
return writer.createContainerElement(useCaptionElement ? 'caption' : 'figcaption');
|
|
78
79
|
}
|
|
79
80
|
});
|
|
80
81
|
// Model -> view converter for the editing pipeline.
|
|
@@ -84,15 +85,15 @@ export class TableCaptionEditing extends Plugin {
|
|
|
84
85
|
if (!isTable(modelElement.parent)) {
|
|
85
86
|
return null;
|
|
86
87
|
}
|
|
87
|
-
const
|
|
88
|
-
writer.setCustomProperty('tableCaption', true,
|
|
89
|
-
|
|
88
|
+
const captionElement = writer.createEditableElement(useCaptionElement ? 'caption' : 'figcaption');
|
|
89
|
+
writer.setCustomProperty('tableCaption', true, captionElement);
|
|
90
|
+
captionElement.placeholder = t('Enter table caption');
|
|
90
91
|
enableViewPlaceholder({
|
|
91
92
|
view,
|
|
92
|
-
element:
|
|
93
|
+
element: captionElement,
|
|
93
94
|
keepOnFocus: true
|
|
94
95
|
});
|
|
95
|
-
return toWidgetEditable(
|
|
96
|
+
return toWidgetEditable(captionElement, writer);
|
|
96
97
|
}
|
|
97
98
|
});
|
|
98
99
|
injectTableCaptionPostFixer(editor.model);
|
package/src/tableconfig.d.ts
CHANGED
|
@@ -212,6 +212,16 @@ export interface TableConfig {
|
|
|
212
212
|
* ```
|
|
213
213
|
*/
|
|
214
214
|
tableLayout?: TableLayoutConfig;
|
|
215
|
+
/**
|
|
216
|
+
* Configuration of the table caption feature.
|
|
217
|
+
*
|
|
218
|
+
* ```ts
|
|
219
|
+
* const tableConfig = {
|
|
220
|
+
* tableCaption: ... // Table caption feature config.
|
|
221
|
+
* };
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
tableCaption?: TableCaptionConfig;
|
|
215
225
|
}
|
|
216
226
|
/**
|
|
217
227
|
* The configuration of the table properties user interface (balloon).
|
|
@@ -377,6 +387,50 @@ export interface TableLayoutConfig {
|
|
|
377
387
|
*/
|
|
378
388
|
preferredExternalTableType: TableType;
|
|
379
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* The configuration of the table caption feature.
|
|
392
|
+
*/
|
|
393
|
+
export interface TableCaptionConfig {
|
|
394
|
+
/**
|
|
395
|
+
* Sets the preferred HTML structure for table captions.
|
|
396
|
+
*
|
|
397
|
+
* When this option is `false` (the default) the structure is like this:
|
|
398
|
+
*
|
|
399
|
+
* ```html
|
|
400
|
+
* <figure class="table">
|
|
401
|
+
* <table>
|
|
402
|
+
* <tbody> ... </tbody>
|
|
403
|
+
* </table>
|
|
404
|
+
* <figcaption> ... </figcaption>
|
|
405
|
+
* </figure>
|
|
406
|
+
* ```
|
|
407
|
+
*
|
|
408
|
+
* When this option is `true` the structure is like this:
|
|
409
|
+
*
|
|
410
|
+
* ```html
|
|
411
|
+
* <figure class="table">
|
|
412
|
+
* <table>
|
|
413
|
+
* <tbody> ... </tbody>
|
|
414
|
+
* <caption> ... </caption>
|
|
415
|
+
* </table>
|
|
416
|
+
* </figure>
|
|
417
|
+
* ```
|
|
418
|
+
*
|
|
419
|
+
* ```ts
|
|
420
|
+
* ClassicEditor
|
|
421
|
+
* .create( {
|
|
422
|
+
* table: {
|
|
423
|
+
* tableCaption: {
|
|
424
|
+
* useCaptionElement: true
|
|
425
|
+
* }
|
|
426
|
+
* }
|
|
427
|
+
* } )
|
|
428
|
+
* .then( ... )
|
|
429
|
+
* .catch( ... );
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
useCaptionElement?: boolean;
|
|
433
|
+
}
|
|
380
434
|
/**
|
|
381
435
|
* The type of the table.
|
|
382
436
|
*/
|
package/src/tablewalker.d.ts
CHANGED
package/src/tablewalker.js
CHANGED
package/theme/table.css
CHANGED
|
@@ -90,6 +90,23 @@
|
|
|
90
90
|
|
|
91
91
|
@media print {
|
|
92
92
|
.ck-content figure.table {
|
|
93
|
+
/**
|
|
94
|
+
* Sometimes Chrome incorrectly calculates the height of the last table row and some
|
|
95
|
+
* of the content overlaps the paragraph that is placed directly after the table. It affects
|
|
96
|
+
* the column split mode pagination calculation which causes mismatch between the print mode and
|
|
97
|
+
* the preview mode.
|
|
98
|
+
*
|
|
99
|
+
* This issue happens only if:
|
|
100
|
+
*
|
|
101
|
+
* * The table is inside a figure element.
|
|
102
|
+
* * The table has `display: table` style set.
|
|
103
|
+
* * The block element is placed directly after the table.
|
|
104
|
+
*/
|
|
105
|
+
&:not(.layout-table):not(:has(> figcaption)) {
|
|
106
|
+
display: block;
|
|
107
|
+
width: fit-content;
|
|
108
|
+
}
|
|
109
|
+
|
|
93
110
|
/**
|
|
94
111
|
* Expanding the table to the full height of the parent container is necessary because tables
|
|
95
112
|
* are rendered inside <figure> elements, which is kinda buggy in table height calculation.
|
package/theme/tablecaption.css
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/* Content styles */
|
|
15
|
-
.ck-content .table > figcaption
|
|
15
|
+
.ck-content .table > figcaption,
|
|
16
|
+
.ck-content figure.table > table > caption {
|
|
16
17
|
display: table-caption;
|
|
17
18
|
caption-side: top;
|
|
18
19
|
word-break: normal;
|
|
@@ -32,7 +33,8 @@
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/* Editing styles */
|
|
35
|
-
.ck.ck-editor__editable .table > figcaption
|
|
36
|
+
.ck.ck-editor__editable .table > figcaption,
|
|
37
|
+
.ck.ck-editor__editable figure.table > table > caption {
|
|
36
38
|
@mixin ck-media-default-colors {
|
|
37
39
|
&.table__caption_highlighted {
|
|
38
40
|
animation: ck-table-caption-highlight .6s ease-out;
|