@ckeditor/ckeditor5-table 34.2.0 → 35.1.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/CHANGELOG.md +261 -0
- package/LICENSE.md +4 -0
- package/build/table.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/da.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -0
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -0
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/vi.js +1 -1
- package/lang/translations/ar.po +11 -11
- package/lang/translations/bg.po +43 -43
- package/lang/translations/bn.po +263 -0
- package/lang/translations/ca.po +261 -0
- package/lang/translations/da.po +6 -6
- package/lang/translations/et.po +3 -3
- package/lang/translations/fi.po +41 -41
- package/lang/translations/fr.po +3 -3
- package/lang/translations/he.po +261 -0
- package/lang/translations/hi.po +3 -3
- package/lang/translations/id.po +21 -21
- package/lang/translations/ja.po +45 -45
- package/lang/translations/ko.po +60 -60
- package/lang/translations/lt.po +43 -43
- package/lang/translations/lv.po +2 -2
- package/lang/translations/ms.po +261 -0
- package/lang/translations/nl.po +25 -25
- package/lang/translations/no.po +3 -3
- package/lang/translations/pt.po +59 -59
- package/lang/translations/sv.po +56 -56
- package/lang/translations/th.po +42 -42
- package/lang/translations/tr.po +3 -3
- package/lang/translations/tt.po +261 -0
- package/lang/translations/uk.po +3 -3
- package/lang/translations/ur.po +9 -9
- package/lang/translations/vi.po +28 -28
- package/package.json +27 -26
- package/src/tablecaption/tablecaptionui.js +2 -0
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +2 -2
- package/src/tablecolumnresize/constants.js +0 -2
- package/src/tablecolumnresize/converters.js +29 -28
- package/src/tablecolumnresize/tablecolumnresizeediting.js +399 -425
- package/src/tablecolumnresize/tablecolumnwidthscommand.js +55 -0
- package/src/tablecolumnresize/tablewidthresizecommand.js +60 -0
- package/src/tablecolumnresize/utils.js +131 -167
- package/src/tablecolumnresize.js +2 -2
- package/src/tableproperties/ui/tablepropertiesview.js +1 -1
- package/src/tableui.js +6 -8
- package/src/ui/colorinputview.js +2 -1
- package/src/ui/inserttableview.js +81 -14
- package/src/utils/ui/contextualballoon.js +3 -3
- package/src/utils/ui/widget.js +7 -1
- package/theme/tablecolumnresize.css +13 -10
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* @module table/ui/inserttableview
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { View } from 'ckeditor5/src/ui';
|
|
10
|
+
import { View, addKeyboardHandlingForGrid } from 'ckeditor5/src/ui';
|
|
11
|
+
|
|
12
|
+
import { KeystrokeHandler, FocusTracker, uid } from 'ckeditor5/src/utils';
|
|
11
13
|
|
|
12
14
|
import './../../theme/inserttable.css';
|
|
13
15
|
|
|
@@ -28,6 +30,16 @@ export default class InsertTableView extends View {
|
|
|
28
30
|
|
|
29
31
|
const bind = this.bindTemplate;
|
|
30
32
|
|
|
33
|
+
/**
|
|
34
|
+
* A unique id of a label element displaying the current geometry of the table.
|
|
35
|
+
* Used by every {@link #items item} of the view as a pointer to an accessible label.
|
|
36
|
+
*
|
|
37
|
+
* @private
|
|
38
|
+
* @readonly
|
|
39
|
+
* @member {String}
|
|
40
|
+
*/
|
|
41
|
+
this._geometryLabelId = `ck-editor__label_${ uid() }`;
|
|
42
|
+
|
|
31
43
|
/**
|
|
32
44
|
* A collection of table size box items.
|
|
33
45
|
*
|
|
@@ -36,6 +48,16 @@ export default class InsertTableView extends View {
|
|
|
36
48
|
*/
|
|
37
49
|
this.items = this._createGridCollection();
|
|
38
50
|
|
|
51
|
+
this.keystrokes = new KeystrokeHandler();
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Tracks information about the DOM focus in the grid.
|
|
55
|
+
*
|
|
56
|
+
* @readonly
|
|
57
|
+
* @member {module:utils/focustracker~FocusTracker}
|
|
58
|
+
*/
|
|
59
|
+
this.focusTracker = new FocusTracker();
|
|
60
|
+
|
|
39
61
|
/**
|
|
40
62
|
* The currently selected number of rows of the new table.
|
|
41
63
|
*
|
|
@@ -81,7 +103,11 @@ export default class InsertTableView extends View {
|
|
|
81
103
|
{
|
|
82
104
|
tag: 'div',
|
|
83
105
|
attributes: {
|
|
84
|
-
|
|
106
|
+
id: this._geometryLabelId,
|
|
107
|
+
class: [
|
|
108
|
+
'ck',
|
|
109
|
+
'ck-insert-table-dropdown__label'
|
|
110
|
+
]
|
|
85
111
|
},
|
|
86
112
|
children: [
|
|
87
113
|
{
|
|
@@ -98,13 +124,34 @@ export default class InsertTableView extends View {
|
|
|
98
124
|
|
|
99
125
|
click: bind.to( () => {
|
|
100
126
|
this.fire( 'execute' );
|
|
127
|
+
} ),
|
|
128
|
+
|
|
129
|
+
keydown: bind.to( evt => {
|
|
130
|
+
if ( evt.key === 'Enter' ) {
|
|
131
|
+
this.fire( 'execute' );
|
|
132
|
+
evt.preventDefault();
|
|
133
|
+
}
|
|
101
134
|
} )
|
|
102
135
|
}
|
|
103
136
|
} );
|
|
104
137
|
|
|
138
|
+
// #rows and #columns are set via changes to #focusTracker on mouse over.
|
|
105
139
|
this.on( 'boxover', ( evt, domEvt ) => {
|
|
106
140
|
const { row, column } = domEvt.target.dataset;
|
|
107
141
|
|
|
142
|
+
this.items.get( ( row - 1 ) * 10 + ( column - 1 ) ).focus();
|
|
143
|
+
} );
|
|
144
|
+
|
|
145
|
+
// This allows the #rows and #columns to be updated when:
|
|
146
|
+
// * the user navigates the grid using the keyboard,
|
|
147
|
+
// * the user moves the mouse over grid items.
|
|
148
|
+
this.focusTracker.on( 'change:focusedElement', ( evt, name, focusedElement ) => {
|
|
149
|
+
if ( !focusedElement ) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const { row, column } = focusedElement.dataset;
|
|
154
|
+
|
|
108
155
|
// As row & column indexes are zero-based transform it to number of selected rows & columns.
|
|
109
156
|
this.set( {
|
|
110
157
|
rows: parseInt( row ),
|
|
@@ -112,29 +159,39 @@ export default class InsertTableView extends View {
|
|
|
112
159
|
} );
|
|
113
160
|
} );
|
|
114
161
|
|
|
115
|
-
this.on( 'change:columns', () =>
|
|
116
|
-
|
|
117
|
-
|
|
162
|
+
this.on( 'change:columns', () => this._highlightGridBoxes() );
|
|
163
|
+
this.on( 'change:rows', () => this._highlightGridBoxes() );
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
render() {
|
|
167
|
+
super.render();
|
|
118
168
|
|
|
119
|
-
|
|
120
|
-
this.
|
|
169
|
+
addKeyboardHandlingForGrid( {
|
|
170
|
+
keystrokeHandler: this.keystrokes,
|
|
171
|
+
focusTracker: this.focusTracker,
|
|
172
|
+
gridItems: this.items,
|
|
173
|
+
numberOfColumns: 10
|
|
121
174
|
} );
|
|
175
|
+
|
|
176
|
+
for ( const item of this.items ) {
|
|
177
|
+
this.focusTracker.add( item.element );
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
this.keystrokes.listenTo( this.element );
|
|
122
181
|
}
|
|
123
182
|
|
|
124
183
|
/**
|
|
125
184
|
* @inheritDoc
|
|
126
185
|
*/
|
|
127
186
|
focus() {
|
|
128
|
-
|
|
129
|
-
// The method should be implemented while working on keyboard support for this view. See #22.
|
|
187
|
+
this.items.get( 0 ).focus();
|
|
130
188
|
}
|
|
131
189
|
|
|
132
190
|
/**
|
|
133
191
|
* @inheritDoc
|
|
134
192
|
*/
|
|
135
193
|
focusLast() {
|
|
136
|
-
|
|
137
|
-
// The method should be implemented while working on keyboard support for this view. See #22.
|
|
194
|
+
this.items.get( 0 ).focus();
|
|
138
195
|
}
|
|
139
196
|
|
|
140
197
|
/**
|
|
@@ -170,7 +227,7 @@ export default class InsertTableView extends View {
|
|
|
170
227
|
const row = Math.floor( index / 10 );
|
|
171
228
|
const column = index % 10;
|
|
172
229
|
|
|
173
|
-
boxes.push( new TableSizeGridBoxView( this.locale, row + 1, column + 1 ) );
|
|
230
|
+
boxes.push( new TableSizeGridBoxView( this.locale, row + 1, column + 1, this._geometryLabelId ) );
|
|
174
231
|
}
|
|
175
232
|
|
|
176
233
|
return this.createCollection( boxes );
|
|
@@ -194,7 +251,7 @@ class TableSizeGridBoxView extends View {
|
|
|
194
251
|
/**
|
|
195
252
|
* @inheritDoc
|
|
196
253
|
*/
|
|
197
|
-
constructor( locale, row, column ) {
|
|
254
|
+
constructor( locale, row, column, ariaLabelledById ) {
|
|
198
255
|
super( locale );
|
|
199
256
|
|
|
200
257
|
const bind = this.bindTemplate;
|
|
@@ -211,12 +268,22 @@ class TableSizeGridBoxView extends View {
|
|
|
211
268
|
tag: 'div',
|
|
212
269
|
attributes: {
|
|
213
270
|
class: [
|
|
271
|
+
'ck',
|
|
214
272
|
'ck-insert-table-dropdown-grid-box',
|
|
215
273
|
bind.if( 'isOn', 'ck-on' )
|
|
216
274
|
],
|
|
217
275
|
'data-row': row,
|
|
218
|
-
'data-column': column
|
|
276
|
+
'data-column': column,
|
|
277
|
+
'tabindex': -1,
|
|
278
|
+
'aria-labelledby': ariaLabelledById
|
|
219
279
|
}
|
|
220
280
|
} );
|
|
221
281
|
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @inheritDoc
|
|
285
|
+
*/
|
|
286
|
+
focus() {
|
|
287
|
+
this.element.focus();
|
|
288
|
+
}
|
|
222
289
|
}
|
|
@@ -63,7 +63,7 @@ export function getBalloonTablePositionData( editor ) {
|
|
|
63
63
|
const viewTable = editor.editing.mapper.toViewElement( modelTable );
|
|
64
64
|
|
|
65
65
|
return {
|
|
66
|
-
target: editor.editing.view.domConverter.
|
|
66
|
+
target: editor.editing.view.domConverter.mapViewToDom( viewTable ),
|
|
67
67
|
positions: BALLOON_POSITIONS
|
|
68
68
|
};
|
|
69
69
|
}
|
|
@@ -92,7 +92,7 @@ export function getBalloonCellPositionData( editor ) {
|
|
|
92
92
|
const viewTableCell = mapper.toViewElement( modelTableCell );
|
|
93
93
|
|
|
94
94
|
return {
|
|
95
|
-
target: domConverter.
|
|
95
|
+
target: domConverter.mapViewToDom( viewTableCell ),
|
|
96
96
|
positions: BALLOON_POSITIONS
|
|
97
97
|
};
|
|
98
98
|
}
|
|
@@ -118,7 +118,7 @@ function createBoundingRect( ranges, editor ) {
|
|
|
118
118
|
const rects = Array.from( ranges ).map( range => {
|
|
119
119
|
const modelTableCell = getTableCellAtPosition( range.start );
|
|
120
120
|
const viewTableCell = mapper.toViewElement( modelTableCell );
|
|
121
|
-
return new Rect( domConverter.
|
|
121
|
+
return new Rect( domConverter.mapViewToDom( viewTableCell ) );
|
|
122
122
|
} );
|
|
123
123
|
|
|
124
124
|
return Rect.getBoundingRect( rects );
|
package/src/utils/ui/widget.js
CHANGED
|
@@ -32,7 +32,13 @@ export function getSelectedTableWidget( selection ) {
|
|
|
32
32
|
* @returns {module:engine/view/element~Element|null}
|
|
33
33
|
*/
|
|
34
34
|
export function getTableWidgetAncestor( selection ) {
|
|
35
|
-
|
|
35
|
+
const selectionPosition = selection.getFirstPosition();
|
|
36
|
+
|
|
37
|
+
if ( !selectionPosition ) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let parent = selectionPosition.parent;
|
|
36
42
|
|
|
37
43
|
while ( parent ) {
|
|
38
44
|
if ( parent.is( 'element' ) && isTableWidget( parent ) ) {
|
|
@@ -12,9 +12,12 @@
|
|
|
12
12
|
--ck-table-column-resizer-position-offset: calc(var(--ck-table-column-resizer-width) * -0.5 - 0.5px);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
.ck-content .table .ck-table-resized {
|
|
16
|
+
table-layout: fixed;
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
.ck-content .table table {
|
|
16
20
|
overflow: hidden;
|
|
17
|
-
table-layout: fixed;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
.ck-content .table td,
|
|
@@ -22,7 +25,7 @@
|
|
|
22
25
|
position: relative;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
.ck-
|
|
28
|
+
.ck.ck-editor__editable .table .ck-table-column-resizer {
|
|
26
29
|
position: absolute;
|
|
27
30
|
/* The resizer element resides in each cell so to occupy the entire height of the table, which is unknown from a CSS point of view,
|
|
28
31
|
it is extended to an extremely high height. Even for screens with a very high pixel density, the resizer will fulfill its role as
|
|
@@ -37,23 +40,23 @@
|
|
|
37
40
|
z-index: var(--ck-z-default);
|
|
38
41
|
}
|
|
39
42
|
|
|
43
|
+
.ck.ck-editor__editable.ck-column-resize_disabled .table .ck-table-column-resizer {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
/* The resizer elements, which are extended to an extremely high height, break the drag & drop feature in Chrome. To make it work again,
|
|
41
48
|
all resizers must be hidden while the table is dragged. */
|
|
42
|
-
.ck-
|
|
49
|
+
.ck.ck-editor__editable .table[draggable] .ck-table-column-resizer {
|
|
43
50
|
display: none;
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
.ck-
|
|
47
|
-
.ck-
|
|
53
|
+
.ck.ck-editor__editable .table .ck-table-column-resizer:hover,
|
|
54
|
+
.ck.ck-editor__editable .table .ck-table-column-resizer__active {
|
|
48
55
|
background-color: var(--ck-color-table-column-resizer-hover);
|
|
49
56
|
opacity: 0.25;
|
|
50
57
|
}
|
|
51
58
|
|
|
52
|
-
.ck-
|
|
59
|
+
.ck.ck-editor__editable[dir=rtl] .table .ck-table-column-resizer {
|
|
53
60
|
left: var(--ck-table-column-resizer-position-offset);
|
|
54
61
|
right: unset;
|
|
55
62
|
}
|
|
56
|
-
|
|
57
|
-
.ck-content.ck-read-only .table .table-column-resizer {
|
|
58
|
-
display: none;
|
|
59
|
-
}
|