@ckeditor/ckeditor5-table 46.1.1 → 47.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/table.js +1 -1
- package/dist/index-content.css +0 -34
- package/dist/index.css +25 -29
- package/dist/index.css.map +1 -1
- package/dist/index.js +52 -39
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/tablecellproperties/tablecellpropertiesediting.d.ts +9 -0
- package/src/tablecellproperties/tablecellpropertiesediting.js +13 -0
- package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +9 -0
- package/src/tablecolumnresize/tablecolumnresizeediting.js +13 -0
- package/src/tablekeyboard.js +4 -41
- package/src/tablelayout/tablelayoutediting.d.ts +9 -0
- package/src/tablelayout/tablelayoutediting.js +13 -0
- package/src/tableproperties/tablepropertiesediting.d.ts +9 -0
- package/src/tableproperties/tablepropertiesediting.js +13 -0
- package/src/utils/ui/widget.d.ts +7 -1
- package/src/utils/ui/widget.js +4 -2
- package/theme/table.css +20 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "47.0.0-alpha.1",
|
|
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": "
|
|
17
|
-
"@ckeditor/ckeditor5-clipboard": "
|
|
18
|
-
"@ckeditor/ckeditor5-core": "
|
|
19
|
-
"@ckeditor/ckeditor5-engine": "
|
|
20
|
-
"@ckeditor/ckeditor5-icons": "
|
|
21
|
-
"@ckeditor/ckeditor5-ui": "
|
|
22
|
-
"@ckeditor/ckeditor5-utils": "
|
|
23
|
-
"@ckeditor/ckeditor5-widget": "
|
|
16
|
+
"ckeditor5": "47.0.0-alpha.1",
|
|
17
|
+
"@ckeditor/ckeditor5-clipboard": "47.0.0-alpha.1",
|
|
18
|
+
"@ckeditor/ckeditor5-core": "47.0.0-alpha.1",
|
|
19
|
+
"@ckeditor/ckeditor5-engine": "47.0.0-alpha.1",
|
|
20
|
+
"@ckeditor/ckeditor5-icons": "47.0.0-alpha.1",
|
|
21
|
+
"@ckeditor/ckeditor5-ui": "47.0.0-alpha.1",
|
|
22
|
+
"@ckeditor/ckeditor5-utils": "47.0.0-alpha.1",
|
|
23
|
+
"@ckeditor/ckeditor5-widget": "47.0.0-alpha.1",
|
|
24
24
|
"es-toolkit": "1.39.5"
|
|
25
25
|
},
|
|
26
26
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -32,10 +32,19 @@ export declare class TableCellPropertiesEditing extends Plugin {
|
|
|
32
32
|
* @inheritDoc
|
|
33
33
|
*/
|
|
34
34
|
static get pluginName(): "TableCellPropertiesEditing";
|
|
35
|
+
/**
|
|
36
|
+
* @inheritDoc
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
static get licenseFeatureCode(): string;
|
|
35
40
|
/**
|
|
36
41
|
* @inheritDoc
|
|
37
42
|
*/
|
|
38
43
|
static get isOfficialPlugin(): true;
|
|
44
|
+
/**
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
static get isPremiumPlugin(): true;
|
|
39
48
|
/**
|
|
40
49
|
* @inheritDoc
|
|
41
50
|
*/
|
|
@@ -48,12 +48,25 @@ export class TableCellPropertiesEditing extends Plugin {
|
|
|
48
48
|
static get pluginName() {
|
|
49
49
|
return 'TableCellPropertiesEditing';
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* @inheritDoc
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
static get licenseFeatureCode() {
|
|
56
|
+
return 'TCP';
|
|
57
|
+
}
|
|
51
58
|
/**
|
|
52
59
|
* @inheritDoc
|
|
53
60
|
*/
|
|
54
61
|
static get isOfficialPlugin() {
|
|
55
62
|
return true;
|
|
56
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* @inheritDoc
|
|
66
|
+
*/
|
|
67
|
+
static get isPremiumPlugin() {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
57
70
|
/**
|
|
58
71
|
* @inheritDoc
|
|
59
72
|
*/
|
|
@@ -47,10 +47,19 @@ export declare class TableColumnResizeEditing extends Plugin {
|
|
|
47
47
|
* @inheritDoc
|
|
48
48
|
*/
|
|
49
49
|
static get pluginName(): "TableColumnResizeEditing";
|
|
50
|
+
/**
|
|
51
|
+
* @inheritDoc
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
static get licenseFeatureCode(): string;
|
|
50
55
|
/**
|
|
51
56
|
* @inheritDoc
|
|
52
57
|
*/
|
|
53
58
|
static get isOfficialPlugin(): true;
|
|
59
|
+
/**
|
|
60
|
+
* @inheritDoc
|
|
61
|
+
*/
|
|
62
|
+
static get isPremiumPlugin(): true;
|
|
54
63
|
/**
|
|
55
64
|
* @inheritDoc
|
|
56
65
|
*/
|
|
@@ -54,12 +54,25 @@ export class TableColumnResizeEditing extends Plugin {
|
|
|
54
54
|
static get pluginName() {
|
|
55
55
|
return 'TableColumnResizeEditing';
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* @inheritDoc
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
static get licenseFeatureCode() {
|
|
62
|
+
return 'TCR';
|
|
63
|
+
}
|
|
57
64
|
/**
|
|
58
65
|
* @inheritDoc
|
|
59
66
|
*/
|
|
60
67
|
static get isOfficialPlugin() {
|
|
61
68
|
return true;
|
|
62
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* @inheritDoc
|
|
72
|
+
*/
|
|
73
|
+
static get isPremiumPlugin() {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
63
76
|
/**
|
|
64
77
|
* @inheritDoc
|
|
65
78
|
*/
|
package/src/tablekeyboard.js
CHANGED
|
@@ -79,12 +79,9 @@ export class TableKeyboard extends Plugin {
|
|
|
79
79
|
if (!selectedElement || !selectedElement.is('element', 'table')) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
// For backward compatibility stop propagation of this DOM event.
|
|
83
|
+
// The default tab handling from widgets handles navigation.
|
|
83
84
|
domEventData.stopPropagation();
|
|
84
|
-
bubblingEventInfo.stop();
|
|
85
|
-
editor.model.change(writer => {
|
|
86
|
-
writer.setSelection(writer.createRangeIn(selectedElement.getChild(0).getChild(0)));
|
|
87
|
-
});
|
|
88
85
|
}
|
|
89
86
|
/**
|
|
90
87
|
* Handles {@link module:engine/view/document~ViewDocument#event:tab tab} events for the <kbd>Tab</kbd> key executed
|
|
@@ -103,52 +100,18 @@ export class TableKeyboard extends Plugin {
|
|
|
103
100
|
if (!tableCell) {
|
|
104
101
|
return;
|
|
105
102
|
}
|
|
106
|
-
|
|
103
|
+
// For backward compatibility stop propagation of this DOM event.
|
|
104
|
+
// The default tab handling from widgets handles navigation.
|
|
107
105
|
domEventData.stopPropagation();
|
|
108
|
-
bubblingEventInfo.stop();
|
|
109
106
|
const tableRow = tableCell.parent;
|
|
110
107
|
const table = tableRow.parent;
|
|
111
108
|
const currentRowIndex = table.getChildIndex(tableRow);
|
|
112
109
|
const currentCellIndex = tableRow.getChildIndex(tableCell);
|
|
113
|
-
const isFirstCellInRow = currentCellIndex === 0;
|
|
114
|
-
if (!isForward && isFirstCellInRow && currentRowIndex === 0) {
|
|
115
|
-
// Set the selection over the whole table if the selection was in the first table cell.
|
|
116
|
-
editor.model.change(writer => {
|
|
117
|
-
writer.setSelection(writer.createRangeOn(table));
|
|
118
|
-
});
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
110
|
const isLastCellInRow = currentCellIndex === tableRow.childCount - 1;
|
|
122
111
|
const isLastRow = currentRowIndex === tableUtils.getRows(table) - 1;
|
|
123
112
|
if (isForward && isLastRow && isLastCellInRow) {
|
|
124
113
|
editor.execute('insertTableRowBelow');
|
|
125
|
-
// Check if the command actually added a row. If `insertTableRowBelow` execution didn't add a row (because it was disabled
|
|
126
|
-
// or it got overwritten) set the selection over the whole table to mirror the first cell case.
|
|
127
|
-
if (currentRowIndex === tableUtils.getRows(table) - 1) {
|
|
128
|
-
editor.model.change(writer => {
|
|
129
|
-
writer.setSelection(writer.createRangeOn(table));
|
|
130
|
-
});
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
114
|
}
|
|
134
|
-
let cellToFocus;
|
|
135
|
-
// Move to the first cell in the next row.
|
|
136
|
-
if (isForward && isLastCellInRow) {
|
|
137
|
-
const nextRow = table.getChild(currentRowIndex + 1);
|
|
138
|
-
cellToFocus = nextRow.getChild(0);
|
|
139
|
-
}
|
|
140
|
-
// Move to the last cell in the previous row.
|
|
141
|
-
else if (!isForward && isFirstCellInRow) {
|
|
142
|
-
const previousRow = table.getChild(currentRowIndex - 1);
|
|
143
|
-
cellToFocus = previousRow.getChild(previousRow.childCount - 1);
|
|
144
|
-
}
|
|
145
|
-
// Move to the next/previous cell.
|
|
146
|
-
else {
|
|
147
|
-
cellToFocus = tableRow.getChild(currentCellIndex + (isForward ? 1 : -1));
|
|
148
|
-
}
|
|
149
|
-
editor.model.change(writer => {
|
|
150
|
-
writer.setSelection(writer.createRangeIn(cellToFocus));
|
|
151
|
-
});
|
|
152
115
|
}
|
|
153
116
|
/**
|
|
154
117
|
* Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events.
|
|
@@ -16,6 +16,11 @@ export declare class TableLayoutEditing extends Plugin {
|
|
|
16
16
|
* @inheritDoc
|
|
17
17
|
*/
|
|
18
18
|
static get pluginName(): "TableLayoutEditing";
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
static get licenseFeatureCode(): string;
|
|
19
24
|
/**
|
|
20
25
|
* @inheritDoc
|
|
21
26
|
*/
|
|
@@ -24,6 +29,10 @@ export declare class TableLayoutEditing extends Plugin {
|
|
|
24
29
|
* @inheritDoc
|
|
25
30
|
*/
|
|
26
31
|
static get isOfficialPlugin(): true;
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
static get isPremiumPlugin(): true;
|
|
27
36
|
/**
|
|
28
37
|
* @inheritDoc
|
|
29
38
|
*/
|
|
@@ -22,6 +22,13 @@ export class TableLayoutEditing extends Plugin {
|
|
|
22
22
|
static get pluginName() {
|
|
23
23
|
return 'TableLayoutEditing';
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
static get licenseFeatureCode() {
|
|
30
|
+
return 'TL';
|
|
31
|
+
}
|
|
25
32
|
/**
|
|
26
33
|
* @inheritDoc
|
|
27
34
|
*/
|
|
@@ -34,6 +41,12 @@ export class TableLayoutEditing extends Plugin {
|
|
|
34
41
|
static get isOfficialPlugin() {
|
|
35
42
|
return true;
|
|
36
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
static get isPremiumPlugin() {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
37
50
|
/**
|
|
38
51
|
* @inheritDoc
|
|
39
52
|
*/
|
|
@@ -29,10 +29,19 @@ export declare class TablePropertiesEditing extends Plugin {
|
|
|
29
29
|
* @inheritDoc
|
|
30
30
|
*/
|
|
31
31
|
static get pluginName(): "TablePropertiesEditing";
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
static get licenseFeatureCode(): string;
|
|
32
37
|
/**
|
|
33
38
|
* @inheritDoc
|
|
34
39
|
*/
|
|
35
40
|
static get isOfficialPlugin(): true;
|
|
41
|
+
/**
|
|
42
|
+
* @inheritDoc
|
|
43
|
+
*/
|
|
44
|
+
static get isPremiumPlugin(): true;
|
|
36
45
|
/**
|
|
37
46
|
* @inheritDoc
|
|
38
47
|
*/
|
|
@@ -43,12 +43,25 @@ export class TablePropertiesEditing extends Plugin {
|
|
|
43
43
|
static get pluginName() {
|
|
44
44
|
return 'TablePropertiesEditing';
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* @inheritDoc
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
static get licenseFeatureCode() {
|
|
51
|
+
return 'TCP';
|
|
52
|
+
}
|
|
46
53
|
/**
|
|
47
54
|
* @inheritDoc
|
|
48
55
|
*/
|
|
49
56
|
static get isOfficialPlugin() {
|
|
50
57
|
return true;
|
|
51
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* @inheritDoc
|
|
61
|
+
*/
|
|
62
|
+
static get isPremiumPlugin() {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
52
65
|
/**
|
|
53
66
|
* @inheritDoc
|
|
54
67
|
*/
|
package/src/utils/ui/widget.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/utils/ui/widget
|
|
7
7
|
*/
|
|
8
|
-
import type { ViewDocumentSelection, ViewElement } from 'ckeditor5/src/engine.js';
|
|
8
|
+
import type { ViewDocumentSelection, ViewElement, ViewNode } from 'ckeditor5/src/engine.js';
|
|
9
9
|
/**
|
|
10
10
|
* Depending on the position of the selection either return the selected table or the table higher in the hierarchy.
|
|
11
11
|
*
|
|
@@ -24,3 +24,9 @@ export declare function getSelectedTableWidget(selection: ViewDocumentSelection)
|
|
|
24
24
|
* @internal
|
|
25
25
|
*/
|
|
26
26
|
export declare function getTableWidgetAncestor(selection: ViewDocumentSelection): ViewElement | null;
|
|
27
|
+
/**
|
|
28
|
+
* Checks if a given view element is a table widget.
|
|
29
|
+
*
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare function isTableWidget(viewNode: ViewNode): boolean;
|
package/src/utils/ui/widget.js
CHANGED
|
@@ -48,7 +48,9 @@ export function getTableWidgetAncestor(selection) {
|
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Checks if a given view element is a table widget.
|
|
51
|
+
*
|
|
52
|
+
* @internal
|
|
51
53
|
*/
|
|
52
|
-
function isTableWidget(
|
|
53
|
-
return !!
|
|
54
|
+
export function isTableWidget(viewNode) {
|
|
55
|
+
return viewNode.is('element') && !!viewNode.getCustomProperty('table') && isWidget(viewNode);
|
|
54
56
|
}
|
package/theme/table.css
CHANGED
|
@@ -14,24 +14,8 @@
|
|
|
14
14
|
text-align: left;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
&
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
& > table {
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 100%;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
& .table:not(.layout-table) {
|
|
27
|
-
/* Give the table widget some air and center it horizontally */
|
|
28
|
-
/* The first value should be equal to --ck-spacing-large variable if used in the editor context
|
|
29
|
-
to avoid the content jumping (See https://github.com/ckeditor/ckeditor5/issues/9825). */
|
|
30
|
-
margin: 0.9em auto;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
& table.table:not(.layout-table),
|
|
34
|
-
& figure.table:not(.layout-table) > table {
|
|
17
|
+
& :where(table).table:where(:not(.layout-table)),
|
|
18
|
+
& :where(figure).table:where(:not(.layout-table)) > table {
|
|
35
19
|
/* The table cells should have slight borders */
|
|
36
20
|
border-collapse: collapse;
|
|
37
21
|
border-spacing: 0;
|
|
@@ -40,13 +24,12 @@
|
|
|
40
24
|
Also see https://github.com/ckeditor/ckeditor5-table/issues/50. */
|
|
41
25
|
border: 1px double hsl(0, 0%, 70%);
|
|
42
26
|
|
|
43
|
-
& > thead,
|
|
44
|
-
& > tbody {
|
|
27
|
+
& > :where(thead, tbody) {
|
|
45
28
|
/* The linter is disabled here because linter is confused when resolving the `table.table:not(.layout-table)`
|
|
46
29
|
and `figure.table:not(.layout-table) > table` selectors combined with below selectors.
|
|
47
30
|
There is no need to split it into two large structures with same code just to make linter happy. */
|
|
48
31
|
/* stylelint-disable no-descending-specificity */
|
|
49
|
-
& > tr {
|
|
32
|
+
& > :where(tr) {
|
|
50
33
|
& > th {
|
|
51
34
|
font-weight: bold;
|
|
52
35
|
background: hsla(0, 0%, 0%, 5%);
|
|
@@ -86,6 +69,22 @@
|
|
|
86
69
|
}
|
|
87
70
|
}
|
|
88
71
|
}
|
|
72
|
+
|
|
73
|
+
& figure.table:not(.layout-table) {
|
|
74
|
+
display: table;
|
|
75
|
+
|
|
76
|
+
& > table {
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: 100%;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
& .table:not(.layout-table) {
|
|
83
|
+
/* Give the table widget some air and center it horizontally */
|
|
84
|
+
/* The first value should be equal to --ck-spacing-large variable if used in the editor context
|
|
85
|
+
to avoid the content jumping (See https://github.com/ckeditor/ckeditor5/issues/9825). */
|
|
86
|
+
margin: 0.9em auto;
|
|
87
|
+
}
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
@media print {
|