@ckeditor/ckeditor5-table 34.0.0 → 35.0.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +261 -0
  2. package/LICENSE.md +6 -2
  3. package/build/table.js +1 -1
  4. package/build/translations/ar.js +1 -1
  5. package/build/translations/bg.js +1 -1
  6. package/build/translations/bn.js +1 -0
  7. package/build/translations/ca.js +1 -0
  8. package/build/translations/da.js +1 -1
  9. package/build/translations/et.js +1 -1
  10. package/build/translations/fi.js +1 -1
  11. package/build/translations/fr.js +1 -1
  12. package/build/translations/he.js +1 -0
  13. package/build/translations/hi.js +1 -1
  14. package/build/translations/id.js +1 -1
  15. package/build/translations/ja.js +1 -1
  16. package/build/translations/ko.js +1 -1
  17. package/build/translations/lt.js +1 -1
  18. package/build/translations/lv.js +1 -1
  19. package/build/translations/ms.js +1 -0
  20. package/build/translations/nl.js +1 -1
  21. package/build/translations/no.js +1 -1
  22. package/build/translations/pt.js +1 -0
  23. package/build/translations/sv.js +1 -1
  24. package/build/translations/th.js +1 -1
  25. package/build/translations/tr.js +1 -1
  26. package/build/translations/uk.js +1 -1
  27. package/build/translations/ur.js +1 -0
  28. package/build/translations/vi.js +1 -1
  29. package/build/translations/zh-cn.js +1 -1
  30. package/ckeditor5-metadata.json +19 -0
  31. package/lang/translations/ar.po +11 -11
  32. package/lang/translations/bg.po +43 -43
  33. package/lang/translations/bn.po +263 -0
  34. package/lang/translations/ca.po +261 -0
  35. package/lang/translations/da.po +6 -6
  36. package/lang/translations/es.po +1 -1
  37. package/lang/translations/et.po +3 -3
  38. package/lang/translations/fi.po +41 -41
  39. package/lang/translations/fr.po +4 -4
  40. package/lang/translations/he.po +261 -0
  41. package/lang/translations/hi.po +3 -3
  42. package/lang/translations/id.po +21 -21
  43. package/lang/translations/it.po +1 -1
  44. package/lang/translations/ja.po +45 -45
  45. package/lang/translations/ko.po +60 -60
  46. package/lang/translations/lt.po +43 -43
  47. package/lang/translations/lv.po +42 -42
  48. package/lang/translations/ms.po +261 -0
  49. package/lang/translations/nl.po +25 -25
  50. package/lang/translations/no.po +3 -3
  51. package/lang/translations/pt-br.po +1 -1
  52. package/lang/translations/pt.po +261 -0
  53. package/lang/translations/sv.po +56 -56
  54. package/lang/translations/th.po +42 -42
  55. package/lang/translations/tr.po +3 -3
  56. package/lang/translations/uk.po +3 -3
  57. package/lang/translations/ur.po +261 -0
  58. package/lang/translations/vi.po +28 -28
  59. package/lang/translations/zh-cn.po +3 -3
  60. package/package.json +27 -23
  61. package/src/index.js +2 -0
  62. package/src/tablecellproperties/ui/tablecellpropertiesview.js +2 -2
  63. package/src/tablecolumnresize/constants.js +32 -0
  64. package/src/tablecolumnresize/converters.js +126 -0
  65. package/src/tablecolumnresize/tablecolumnresizeediting.js +758 -0
  66. package/src/tablecolumnresize/utils.js +367 -0
  67. package/src/tablecolumnresize.js +36 -0
  68. package/src/tableproperties/ui/tablepropertiesview.js +1 -1
  69. package/src/tableui.js +6 -2
  70. package/src/ui/colorinputview.js +2 -1
  71. package/src/utils/ui/contextualballoon.js +3 -3
  72. package/src/utils/ui/widget.js +7 -1
  73. package/theme/tablecolumnresize.css +59 -0
  74. package/build/table.js.map +0 -1
@@ -0,0 +1,367 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module table/tablecolumnresize/utils
8
+ */
9
+
10
+ /* istanbul ignore file */
11
+
12
+ import { global } from 'ckeditor5/src/utils';
13
+ import {
14
+ COLUMN_WIDTH_PRECISION,
15
+ COLUMN_MIN_WIDTH_AS_PERCENTAGE,
16
+ COLUMN_MIN_WIDTH_IN_PIXELS
17
+ } from './constants';
18
+
19
+ /**
20
+ * Collects all affected by the differ table model elements. The returned set may be empty.
21
+ *
22
+ * @param {Array.<module:engine/model/differ~DiffItem>} changes
23
+ * @param {module:engine/model/model~Model} model
24
+ * @returns {Set.<module:engine/model/element~Element>}
25
+ */
26
+ export function getAffectedTables( changes, model ) {
27
+ const tablesToProcess = new Set();
28
+
29
+ for ( const change of changes ) {
30
+ let referencePosition = null;
31
+
32
+ // Checks if the particular change from the differ is:
33
+ // - an insertion or removal of a table, a row or a cell,
34
+ // - an attribute change on a table, a row or a cell.
35
+ switch ( change.type ) {
36
+ case 'insert':
37
+ case 'remove':
38
+ referencePosition = [ 'table', 'tableRow', 'tableCell' ].includes( change.name ) ?
39
+ change.position :
40
+ null;
41
+
42
+ break;
43
+
44
+ case 'attribute':
45
+ if ( change.range.start.nodeAfter ) {
46
+ referencePosition = [ 'table', 'tableRow', 'tableCell' ].includes( change.range.start.nodeAfter.name ) ?
47
+ change.range.start :
48
+ null;
49
+ }
50
+
51
+ break;
52
+ }
53
+
54
+ const affectedTables = [];
55
+
56
+ if ( referencePosition ) {
57
+ const tableNode = ( referencePosition.nodeAfter && referencePosition.nodeAfter.name === 'table' ) ?
58
+ referencePosition.nodeAfter : referencePosition.findAncestor( 'table' );
59
+
60
+ if ( tableNode ) {
61
+ const range = model.createRangeOn( tableNode );
62
+
63
+ for ( const node of range.getItems() ) {
64
+ if ( node.is( 'element' ) && node.name === 'table' ) {
65
+ affectedTables.push( node );
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ const table = affectedTables;
72
+
73
+ if ( table ) {
74
+ for ( const tableItem of table ) {
75
+ tablesToProcess.add( tableItem );
76
+ }
77
+ }
78
+ }
79
+
80
+ return tablesToProcess;
81
+ }
82
+
83
+ /**
84
+ * Returns the computed width (in pixels) of the DOM element.
85
+ *
86
+ * @param {HTMLElement} domElement
87
+ * @returns {Number}
88
+ */
89
+ export function getElementWidthInPixels( domElement ) {
90
+ return parseFloat( global.window.getComputedStyle( domElement ).width );
91
+ }
92
+
93
+ /**
94
+ * Calculates the table width in pixels.
95
+ *
96
+ * @param {module:engine/model/element~Element} table
97
+ * @param {module:core/editor/editor~Editor} editor
98
+ * @returns {Number}
99
+ */
100
+ export function getTableWidthInPixels( table, editor ) {
101
+ const viewTbody = getTbodyViewElement( table, editor );
102
+ const domTbody = editor.editing.view.domConverter.mapViewToDom( viewTbody );
103
+
104
+ return getElementWidthInPixels( domTbody );
105
+ }
106
+
107
+ /**
108
+ * Calculates the column widths in pixels basing on the `columnWidths` table attribute:
109
+ * - If the value for a given column is provided in pixels then it is just converted to a number and returned.
110
+ * - Otherwise, it is assumed that unit is percentage and the column width is calculated proportionally to the whole table width.
111
+ *
112
+ * @param {module:engine/model/element~Element} table
113
+ * @param {module:core/editor/editor~Editor} editor
114
+ * @returns {Array.<Number>}
115
+ */
116
+ export function getColumnWidthsInPixels( table, editor ) {
117
+ const tableWidthInPixels = getTableWidthInPixels( table, editor );
118
+
119
+ return table.getAttribute( 'columnWidths' )
120
+ .split( ',' )
121
+ .map( columnWidth => columnWidth.trim() )
122
+ .map( columnWidth => {
123
+ return columnWidth.endsWith( 'px' ) ?
124
+ parseFloat( columnWidth ) :
125
+ parseFloat( columnWidth ) * tableWidthInPixels / 100;
126
+ } );
127
+ }
128
+
129
+ /**
130
+ * Calculates the percentage of the minimum column width given in pixels for a given table.
131
+ *
132
+ * @param {module:engine/model/element~Element} table
133
+ * @param {module:core/editor/editor~Editor} editor
134
+ * @returns {Number}
135
+ */
136
+ export function getColumnMinWidthAsPercentage( table, editor ) {
137
+ const tableWidthInPixels = getTableWidthInPixels( table, editor );
138
+
139
+ return COLUMN_MIN_WIDTH_IN_PIXELS * 100 / tableWidthInPixels;
140
+ }
141
+
142
+ /**
143
+ * Returns the column indexes on the left and right edges of a cell.
144
+ *
145
+ * @param {module:engine/model/element~Element} cell
146
+ * @returns {Object}
147
+ */
148
+ export function getColumnIndex( cell, columnIndexMap ) {
149
+ const cellColumnIndex = columnIndexMap.get( cell );
150
+ const cellWidth = cell.getAttribute( 'colspan' ) || 1;
151
+
152
+ return {
153
+ leftEdge: cellColumnIndex,
154
+ rightEdge: cellColumnIndex + cellWidth - 1
155
+ };
156
+ }
157
+
158
+ /**
159
+ * Returns the total number of columns in a table.
160
+ *
161
+ * @param {module:engine/model/element~Element} table
162
+ * @param {module:core/editor/editor~Editor} editor
163
+ * @returns {Number}
164
+ */
165
+ export function getNumberOfColumn( table, editor ) {
166
+ return editor.plugins.get( 'TableUtils' ).getColumns( table );
167
+ }
168
+
169
+ /**
170
+ * Checks if the table is already fully rendered, with the `<colgroup>` element that defines the widths for each column.
171
+ *
172
+ * @param {module:engine/model/element~Element} table
173
+ * @param {module:core/editor/editor~Editor} editor
174
+ * @returns {Number}
175
+ */
176
+ export function isTableRendered( table, editor ) {
177
+ return !!getColgroupViewElement( table, editor );
178
+ }
179
+
180
+ // Returns the `<colgroup>` view element, if it exists in a table. Returns `undefined` otherwise.
181
+ //
182
+ // @private
183
+ // @param {module:engine/model/element~Element} table
184
+ // @param {module:core/editor/editor~Editor} editor
185
+ // @returns {module:engine/view/element~Element|undefined}
186
+ function getColgroupViewElement( table, editor ) {
187
+ const viewFigure = editor.editing.mapper.toViewElement( table );
188
+ const viewTable = [ ...viewFigure.getChildren() ].find( viewChild => viewChild.is( 'element', 'table' ) );
189
+
190
+ return [ ...viewTable.getChildren() ].find( viewChild => viewChild.is( 'element', 'colgroup' ) );
191
+ }
192
+
193
+ // Returns the `<tbody>` view element, if it exists in a table. Returns `undefined` otherwise.
194
+ //
195
+ // @private
196
+ // @param {module:engine/model/element~Element} table
197
+ // @param {module:core/editor/editor~Editor} editor
198
+ // @returns {module:engine/view/element~Element|undefined}
199
+ function getTbodyViewElement( table, editor ) {
200
+ const viewFigure = editor.editing.mapper.toViewElement( table );
201
+ const viewTable = [ ...viewFigure.getChildren() ].find( viewChild => viewChild.is( 'element', 'table' ) );
202
+
203
+ return [ ...viewTable.getChildren() ].find( viewChild => viewChild.is( 'element', 'tbody' ) );
204
+ }
205
+
206
+ /**
207
+ * Rounds the provided value to a fixed-point number with defined number of digits after the decimal point.
208
+ *
209
+ * @param {Number|String} value
210
+ * @returns {Number}
211
+ */
212
+ export function toPrecision( value ) {
213
+ const multiplier = Math.pow( 10, COLUMN_WIDTH_PRECISION );
214
+ const number = parseFloat( value );
215
+
216
+ return Math.round( number * multiplier ) / multiplier;
217
+ }
218
+
219
+ /**
220
+ * Clamps the number within the inclusive lower (min) and upper (max) bounds. Returned number is rounded using the
221
+ * {@link ~toPrecision `toPrecision()`} function.
222
+ *
223
+ * @param {Number} number
224
+ * @param {Number} min
225
+ * @param {Number} max
226
+ * @returns {Number}
227
+ */
228
+ export function clamp( number, min, max ) {
229
+ if ( number <= min ) {
230
+ return toPrecision( min );
231
+ }
232
+
233
+ if ( number >= max ) {
234
+ return toPrecision( max );
235
+ }
236
+
237
+ return toPrecision( number );
238
+ }
239
+
240
+ /**
241
+ * Creates an array with defined length and fills all elements with defined value.
242
+ *
243
+ * @param {Number} length
244
+ * @param {*} value
245
+ * @returns {Array.<*>}
246
+ */
247
+ export function fillArray( length, value ) {
248
+ return Array( length ).fill( value );
249
+ }
250
+
251
+ /**
252
+ * Sums all array values that can be parsed to a float.
253
+ *
254
+ * @param {Array.<Number>} array
255
+ * @returns {Number}
256
+ */
257
+ export function sumArray( array ) {
258
+ return array
259
+ .map( value => parseFloat( value ) )
260
+ .filter( value => !Number.isNaN( value ) )
261
+ .reduce( ( result, item ) => result + item, 0 );
262
+ }
263
+
264
+ /**
265
+ * Makes sure that the sum of the widths from all columns is 100%. If the sum of all the widths is not equal 100%, all the widths are
266
+ * changed proportionally so that they all sum back to 100%.
267
+ *
268
+ * Currently, only widths provided as percentage values are supported.
269
+ *
270
+ * @param {String} columnWidthsAttribute
271
+ * @returns {Array.<Number>}
272
+ */
273
+ export function normalizeColumnWidthsAttribute( columnWidthsAttribute ) {
274
+ const columnWidths = prepareColumnWidths( columnWidthsAttribute );
275
+ const totalWidth = sumArray( columnWidths );
276
+
277
+ if ( totalWidth === 100 ) {
278
+ return columnWidths;
279
+ }
280
+
281
+ return columnWidths
282
+ // Adjust all the columns proportionally.
283
+ .map( columnWidth => toPrecision( columnWidth * 100 / totalWidth ) )
284
+ // Due to rounding of numbers it may happen that the sum of the widths of all columns will not be exactly 100%. Therefore, the width
285
+ // of the last column is explicitly adjusted (narrowed or expanded), since all the columns have been proportionally changed already.
286
+ .map( ( columnWidth, columnIndex, columnWidths ) => {
287
+ const isLastColumn = columnIndex === columnWidths.length - 1;
288
+
289
+ if ( !isLastColumn ) {
290
+ return columnWidth;
291
+ }
292
+
293
+ const totalWidth = sumArray( columnWidths );
294
+
295
+ return toPrecision( columnWidth + 100 - totalWidth );
296
+ } );
297
+ }
298
+
299
+ // Initializes the column widths by parsing the attribute value and calculating the uninitialized column widths. The special value 'auto'
300
+ // indicates that width for the column must be calculated. The width of such uninitialized column is calculated as follows:
301
+ // - If there is enough free space in the table for all uninitialized columns to have at least the minimum allowed width for all of them,
302
+ // then set this width equally for all uninitialized columns.
303
+ // - Otherwise, just set the minimum allowed width for all uninitialized columns. The sum of all column widths will be greater than 100%,
304
+ // but then it will be adjusted proportionally to 100% in {@link #normalizeColumnWidthsAttribute `normalizeColumnWidthsAttribute()`}.
305
+ //
306
+ // @private
307
+ // @param {String} columnWidthsAttribute
308
+ // @returns {Array.<Number>}
309
+ function prepareColumnWidths( columnWidthsAttribute ) {
310
+ const columnWidths = columnWidthsAttribute
311
+ .split( ',' )
312
+ .map( columnWidth => columnWidth.trim() );
313
+
314
+ const numberOfUninitializedColumns = columnWidths.filter( columnWidth => columnWidth === 'auto' ).length;
315
+
316
+ if ( numberOfUninitializedColumns === 0 ) {
317
+ return columnWidths.map( columnWidth => toPrecision( columnWidth ) );
318
+ }
319
+
320
+ const totalWidthOfInitializedColumns = sumArray( columnWidths );
321
+
322
+ const widthForUninitializedColumn = Math.max(
323
+ ( 100 - totalWidthOfInitializedColumns ) / numberOfUninitializedColumns,
324
+ COLUMN_MIN_WIDTH_AS_PERCENTAGE
325
+ );
326
+
327
+ return columnWidths
328
+ .map( columnWidth => columnWidth === 'auto' ? widthForUninitializedColumn : columnWidth )
329
+ .map( columnWidth => toPrecision( columnWidth ) );
330
+ }
331
+
332
+ // Inserts column resizer element into a view cell.
333
+ //
334
+ // @param {module:engine/view/downcastwriter~DowncastWriter} viewWriter View writer instance.
335
+ // @param {module:engine/view/element~Element} viewCell View cell.
336
+ export function insertColumnResizerElements( viewWriter, viewCell ) {
337
+ let viewTableColumnResizerElement = [ ...viewCell.getChildren() ]
338
+ .find( viewElement => viewElement.hasClass( 'table-column-resizer' ) );
339
+
340
+ if ( viewTableColumnResizerElement ) {
341
+ return;
342
+ }
343
+
344
+ viewTableColumnResizerElement = viewWriter.createUIElement( 'div', {
345
+ class: 'table-column-resizer'
346
+ } );
347
+
348
+ viewWriter.insert(
349
+ viewWriter.createPositionAt( viewCell, 'end' ),
350
+ viewTableColumnResizerElement
351
+ );
352
+ }
353
+
354
+ // Removes column resizer element from a view cell.
355
+ //
356
+ // @param {module:engine/view/downcastwriter~DowncastWriter} viewWriter View writer instance.
357
+ // @param {module:engine/view/element~Element} viewCell View cell.
358
+ export function removeColumnResizerElements( viewWriter, viewCell ) {
359
+ const viewTableColumnResizerElement = [ ...viewCell.getChildren() ]
360
+ .find( viewElement => viewElement.hasClass( 'table-column-resizer' ) );
361
+
362
+ if ( !viewTableColumnResizerElement ) {
363
+ return;
364
+ }
365
+
366
+ viewWriter.remove( viewTableColumnResizerElement );
367
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module table/tablecolumnresize
8
+ */
9
+
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+ import TableColumnResizeEditing from './tablecolumnresize/tablecolumnresizeediting';
12
+
13
+ import '../theme/tablecolumnresize.css';
14
+
15
+ /**
16
+ * The table column resizer feature.
17
+ *
18
+ * It provides the possibility to set the width of each column in a table using a resize handle.
19
+ *
20
+ * @extends module:core/plugin~Plugin
21
+ */
22
+ export default class TableColumnResize extends Plugin {
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get requires() {
27
+ return [ TableColumnResizeEditing ];
28
+ }
29
+
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ static get pluginName() {
34
+ return 'TableColumnResize';
35
+ }
36
+ }
@@ -216,7 +216,7 @@ export default class TablePropertiesView extends View {
216
216
  /**
217
217
  * A toolbar with buttons that allow changing the alignment of an entire table.
218
218
  * @readonly
219
- * @member {module:ui/toolbar/toolbar~ToolbarView}
219
+ * @member {module:ui/toolbar/toolbarview~ToolbarView}
220
220
  */
221
221
  this.alignmentToolbar = alignmentToolbar;
222
222
 
package/src/tableui.js CHANGED
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import { Plugin } from 'ckeditor5/src/core';
11
- import { addListToDropdown, createDropdown, Model, SplitButtonView } from 'ckeditor5/src/ui';
11
+ import { addListToDropdown, createDropdown, Model, SplitButtonView, SwitchButtonView } from 'ckeditor5/src/ui';
12
12
  import { Collection } from 'ckeditor5/src/utils';
13
13
 
14
14
  import InsertTableView from './ui/inserttableview';
@@ -256,7 +256,11 @@ export default class TableUI extends Plugin {
256
256
 
257
257
  this.listenTo( dropdownView, 'execute', evt => {
258
258
  editor.execute( evt.source.commandName );
259
- editor.editing.view.focus();
259
+
260
+ // Toggling a switch button view should not move the focus to the editable.
261
+ if ( !( evt.source instanceof SwitchButtonView ) ) {
262
+ editor.editing.view.focus();
263
+ }
260
264
  } );
261
265
 
262
266
  return dropdownView;
@@ -207,7 +207,8 @@ export default class ColorInputView extends View {
207
207
  } );
208
208
 
209
209
  dropdown.buttonView.children.add( colorPreview );
210
- dropdown.buttonView.tooltip = t( 'Color picker' );
210
+ dropdown.buttonView.label = t( 'Color picker' );
211
+ dropdown.buttonView.tooltip = true;
211
212
 
212
213
  dropdown.panelPosition = locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw';
213
214
  dropdown.panelView.children.add( removeColorButton );
@@ -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.viewToDom( viewTable ),
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.viewToDom( viewTableCell ),
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.viewToDom( viewTableCell ) );
121
+ return new Rect( domConverter.mapViewToDom( viewTableCell ) );
122
122
  } );
123
123
 
124
124
  return Rect.getBoundingRect( rects );
@@ -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
- let parent = selection.getFirstPosition().parent;
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 ) ) {
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ :root {
7
+ --ck-color-table-column-resizer-hover: var(--ck-color-base-active);
8
+ --ck-table-column-resizer-width: 7px;
9
+
10
+ /* The offset used for absolute positioning of the resizer element, so that it is placed exactly above the cell border.
11
+ The value is: minus half the width of the resizer decreased additionaly by the half the width of the border (0.5px). */
12
+ --ck-table-column-resizer-position-offset: calc(var(--ck-table-column-resizer-width) * -0.5 - 0.5px);
13
+ }
14
+
15
+ .ck-content .table table {
16
+ overflow: hidden;
17
+ table-layout: fixed;
18
+ }
19
+
20
+ .ck-content .table td,
21
+ .ck-content .table th {
22
+ position: relative;
23
+ }
24
+
25
+ .ck-content .table .table-column-resizer {
26
+ position: absolute;
27
+ /* 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
+ it is extended to an extremely high height. Even for screens with a very high pixel density, the resizer will fulfill its role as
29
+ it should, i.e. for a screen of 476 ppi the total height of the resizer will take over 350 sheets of A4 format, which is totally
30
+ unrealistic height for a single table. */
31
+ top: -999999px;
32
+ bottom: -999999px;
33
+ right: var(--ck-table-column-resizer-position-offset);
34
+ width: var(--ck-table-column-resizer-width);
35
+ cursor: col-resize;
36
+ user-select: none;
37
+ z-index: var(--ck-z-default);
38
+ }
39
+
40
+ /* The resizer elements, which are extended to an extremely high height, break the drag & drop feature in Chrome. To make it work again,
41
+ all resizers must be hidden while the table is dragged. */
42
+ .ck-content .table[draggable] .table-column-resizer {
43
+ display: none;
44
+ }
45
+
46
+ .ck-content .table .table-column-resizer:hover,
47
+ .ck-content .table .table-column-resizer__active {
48
+ background-color: var(--ck-color-table-column-resizer-hover);
49
+ opacity: 0.25;
50
+ }
51
+
52
+ .ck-content[dir=rtl] .table .table-column-resizer {
53
+ left: var(--ck-table-column-resizer-position-offset);
54
+ right: unset;
55
+ }
56
+
57
+ .ck-content.ck-read-only .table .table-column-resizer {
58
+ display: none;
59
+ }