@ckeditor/ckeditor5-table 28.0.0 → 30.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.
- package/LICENSE.md +1 -1
- package/README.md +3 -3
- package/build/table.js +1 -1
- package/build/translations/ar.js +1 -0
- package/build/translations/az.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de-ch.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/en-gb.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/fa.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/gl.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/ku.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/nb.js +1 -0
- package/build/translations/ne.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sq.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/tk.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/ug.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +174 -0
- package/lang/translations/de.po +3 -3
- package/lang/translations/gl.po +3 -3
- package/lang/translations/hu.po +14 -14
- package/lang/translations/id.po +11 -11
- package/lang/translations/it.po +3 -3
- package/lang/translations/nl.po +2 -2
- package/lang/translations/ro.po +42 -42
- package/lang/translations/ru.po +3 -3
- package/lang/translations/sr-latn.po +3 -3
- package/lang/translations/sr.po +3 -3
- package/package.json +25 -23
- package/src/commands/inserttablecommand.js +22 -7
- package/src/converters/downcast.js +3 -22
- package/src/converters/table-heading-rows-refresh-post-fixer.js +23 -6
- package/src/converters/upcasttable.js +2 -0
- package/src/table.js +17 -0
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +0 -1
- package/src/tableediting.js +71 -2
- package/src/tablekeyboard.js +19 -4
- package/src/tableproperties/ui/tablepropertiesview.js +0 -1
- package/src/tableutils.js +2 -2
- package/src/ui/colorinputview.js +2 -2
- package/src/utils/ui/contextualballoon.js +3 -8
- package/theme/table.css +17 -1
- package/CHANGELOG.md +0 -261
- package/build/table.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "30.0.0",
|
|
4
4
|
"description": "Table feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
7
7
|
"ckeditor5",
|
|
8
8
|
"ckeditor 5",
|
|
9
9
|
"ckeditor5-feature",
|
|
10
|
-
"ckeditor5-plugin"
|
|
10
|
+
"ckeditor5-plugin",
|
|
11
|
+
"ckeditor5-dll"
|
|
11
12
|
],
|
|
12
13
|
"main": "src/index.js",
|
|
13
14
|
"dependencies": {
|
|
14
|
-
"ckeditor5": "^
|
|
15
|
+
"ckeditor5": "^30.0.0",
|
|
15
16
|
"lodash-es": "^4.17.15"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
|
-
"@ckeditor/ckeditor5-alignment": "^
|
|
19
|
-
"@ckeditor/ckeditor5-block-quote": "^
|
|
20
|
-
"@ckeditor/ckeditor5-clipboard": "^
|
|
21
|
-
"@ckeditor/ckeditor5-core": "^
|
|
22
|
-
"@ckeditor/ckeditor5-dev-utils": "^25.
|
|
23
|
-
"@ckeditor/ckeditor5-editor-classic": "^
|
|
24
|
-
"@ckeditor/ckeditor5-engine": "^
|
|
25
|
-
"@ckeditor/ckeditor5-horizontal-line": "^
|
|
26
|
-
"@ckeditor/ckeditor5-image": "^
|
|
27
|
-
"@ckeditor/ckeditor5-indent": "^
|
|
28
|
-
"@ckeditor/ckeditor5-list": "^
|
|
29
|
-
"@ckeditor/ckeditor5-media-embed": "^
|
|
30
|
-
"@ckeditor/ckeditor5-paragraph": "^
|
|
31
|
-
"@ckeditor/ckeditor5-theme-lark": "^
|
|
32
|
-
"@ckeditor/ckeditor5-typing": "^
|
|
33
|
-
"@ckeditor/ckeditor5-ui": "^
|
|
34
|
-
"@ckeditor/ckeditor5-undo": "^
|
|
35
|
-
"@ckeditor/ckeditor5-utils": "^
|
|
36
|
-
"@ckeditor/ckeditor5-widget": "^
|
|
19
|
+
"@ckeditor/ckeditor5-alignment": "^30.0.0",
|
|
20
|
+
"@ckeditor/ckeditor5-block-quote": "^30.0.0",
|
|
21
|
+
"@ckeditor/ckeditor5-clipboard": "^30.0.0",
|
|
22
|
+
"@ckeditor/ckeditor5-core": "^30.0.0",
|
|
23
|
+
"@ckeditor/ckeditor5-dev-utils": "^25.4.0",
|
|
24
|
+
"@ckeditor/ckeditor5-editor-classic": "^30.0.0",
|
|
25
|
+
"@ckeditor/ckeditor5-engine": "^30.0.0",
|
|
26
|
+
"@ckeditor/ckeditor5-horizontal-line": "^30.0.0",
|
|
27
|
+
"@ckeditor/ckeditor5-image": "^30.0.0",
|
|
28
|
+
"@ckeditor/ckeditor5-indent": "^30.0.0",
|
|
29
|
+
"@ckeditor/ckeditor5-list": "^30.0.0",
|
|
30
|
+
"@ckeditor/ckeditor5-media-embed": "^30.0.0",
|
|
31
|
+
"@ckeditor/ckeditor5-paragraph": "^30.0.0",
|
|
32
|
+
"@ckeditor/ckeditor5-theme-lark": "^30.0.0",
|
|
33
|
+
"@ckeditor/ckeditor5-typing": "^30.0.0",
|
|
34
|
+
"@ckeditor/ckeditor5-ui": "^30.0.0",
|
|
35
|
+
"@ckeditor/ckeditor5-undo": "^30.0.0",
|
|
36
|
+
"@ckeditor/ckeditor5-utils": "^30.0.0",
|
|
37
|
+
"@ckeditor/ckeditor5-widget": "^30.0.0",
|
|
37
38
|
"json-diff": "^0.5.4",
|
|
38
39
|
"webpack": "^4.43.0",
|
|
39
40
|
"webpack-cli": "^3.3.11"
|
|
@@ -55,7 +56,8 @@
|
|
|
55
56
|
"lang",
|
|
56
57
|
"src",
|
|
57
58
|
"theme",
|
|
58
|
-
"build"
|
|
59
|
+
"build",
|
|
60
|
+
"ckeditor5-metadata.json"
|
|
59
61
|
],
|
|
60
62
|
"scripts": {
|
|
61
63
|
"dll:build": "webpack"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Command } from 'ckeditor5/src/core';
|
|
11
|
-
import {
|
|
11
|
+
import { findOptimalInsertionRange } from 'ckeditor5/src/widget';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The insert table command.
|
|
@@ -30,8 +30,7 @@ export default class InsertTableCommand extends Command {
|
|
|
30
30
|
const selection = model.document.selection;
|
|
31
31
|
const schema = model.schema;
|
|
32
32
|
|
|
33
|
-
this.isEnabled = isAllowedInParent( selection, schema )
|
|
34
|
-
!checkSelectionOnObject( selection, schema );
|
|
33
|
+
this.isEnabled = isAllowedInParent( selection, schema );
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
/**
|
|
@@ -42,21 +41,37 @@ export default class InsertTableCommand extends Command {
|
|
|
42
41
|
* @param {Object} options
|
|
43
42
|
* @param {Number} [options.rows=2] The number of rows to create in the inserted table.
|
|
44
43
|
* @param {Number} [options.columns=2] The number of columns to create in the inserted table.
|
|
45
|
-
* @param {Number} [options.headingRows
|
|
46
|
-
*
|
|
44
|
+
* @param {Number} [options.headingRows] The number of heading rows.
|
|
45
|
+
* If not provided it will default to {@link module:table/table~TableConfig#defaultHeadings `config.table.defaultHeadings.rows`}
|
|
46
|
+
* table config.
|
|
47
|
+
* @param {Number} [options.headingColumns] The number of heading columns.
|
|
48
|
+
* If not provided it will default to {@link module:table/table~TableConfig#defaultHeadings `config.table.defaultHeadings.columns`}
|
|
49
|
+
* table config.
|
|
47
50
|
* @fires execute
|
|
48
51
|
*/
|
|
49
52
|
execute( options = {} ) {
|
|
50
53
|
const model = this.editor.model;
|
|
51
54
|
const selection = model.document.selection;
|
|
52
55
|
const tableUtils = this.editor.plugins.get( 'TableUtils' );
|
|
56
|
+
const config = this.editor.config.get( 'table' );
|
|
53
57
|
|
|
54
|
-
const
|
|
58
|
+
const insertionRange = findOptimalInsertionRange( selection, model );
|
|
59
|
+
|
|
60
|
+
const defaultRows = config.defaultHeadings.rows;
|
|
61
|
+
const defaultColumns = config.defaultHeadings.columns;
|
|
62
|
+
|
|
63
|
+
if ( options.headingRows === undefined && defaultRows ) {
|
|
64
|
+
options.headingRows = defaultRows;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if ( options.headingColumns === undefined && defaultColumns ) {
|
|
68
|
+
options.headingColumns = defaultColumns;
|
|
69
|
+
}
|
|
55
70
|
|
|
56
71
|
model.change( writer => {
|
|
57
72
|
const table = tableUtils.createTable( writer, options );
|
|
58
73
|
|
|
59
|
-
model.insertContent( table,
|
|
74
|
+
model.insertContent( table, insertionRange );
|
|
60
75
|
|
|
61
76
|
writer.setSelection( writer.createPositionAt( table.getNodeByPath( [ 0, 0, 0 ] ), 0 ) );
|
|
62
77
|
} );
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import TableWalker from './../tablewalker';
|
|
11
|
-
import {
|
|
12
|
-
import { toArray } from 'ckeditor5/src/utils';
|
|
11
|
+
import { toWidget, toWidgetEditable } from 'ckeditor5/src/widget';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Model table element to view table element conversion helper.
|
|
@@ -258,9 +257,7 @@ export function convertParagraphInTableCell( modelElement, conversionApi ) {
|
|
|
258
257
|
}
|
|
259
258
|
|
|
260
259
|
if ( isSingleParagraphWithoutAttributes( modelElement ) ) {
|
|
261
|
-
|
|
262
|
-
// See #6062.
|
|
263
|
-
return writer.createContainerElement( 'span', { style: 'display:inline-block' } );
|
|
260
|
+
return writer.createContainerElement( 'span', { class: 'ck-table-bogus-paragraph' } );
|
|
264
261
|
} else {
|
|
265
262
|
return writer.createContainerElement( 'p' );
|
|
266
263
|
}
|
|
@@ -271,7 +268,7 @@ export function convertParagraphInTableCell( modelElement, conversionApi ) {
|
|
|
271
268
|
*
|
|
272
269
|
* The paragraph should be converted in the editing view to:
|
|
273
270
|
*
|
|
274
|
-
* * If returned `true` - to a `<span
|
|
271
|
+
* * If returned `true` - to a `<span class="ck-table-bogus-paragraph">`
|
|
275
272
|
* * If returned `false` - to a `<p>`
|
|
276
273
|
*
|
|
277
274
|
* @param {module:engine/model/element~Element} modelElement
|
|
@@ -313,13 +310,6 @@ function renameViewTableCell( tableCell, desiredCellElementName, conversionApi )
|
|
|
313
310
|
const editable = viewWriter.createEditableElement( desiredCellElementName, viewCell.getAttributes() );
|
|
314
311
|
const renamedCell = toWidgetEditable( editable, viewWriter );
|
|
315
312
|
|
|
316
|
-
setHighlightHandling(
|
|
317
|
-
renamedCell,
|
|
318
|
-
viewWriter,
|
|
319
|
-
( element, descriptor, writer ) => writer.addClass( toArray( descriptor.classes ), element ),
|
|
320
|
-
( element, descriptor, writer ) => writer.removeClass( toArray( descriptor.classes ), element )
|
|
321
|
-
);
|
|
322
|
-
|
|
323
313
|
viewWriter.insert( viewWriter.createPositionAfter( viewCell ), renamedCell );
|
|
324
314
|
viewWriter.move( viewWriter.createRangeIn( viewCell ), viewWriter.createPositionAt( renamedCell, 0 ) );
|
|
325
315
|
viewWriter.remove( viewWriter.createRangeOn( viewCell ) );
|
|
@@ -361,15 +351,6 @@ function createViewTableCellElement( tableSlot, tableAttributes, insertPosition,
|
|
|
361
351
|
toWidgetEditable( conversionApi.writer.createEditableElement( cellElementName ), conversionApi.writer ) :
|
|
362
352
|
conversionApi.writer.createContainerElement( cellElementName );
|
|
363
353
|
|
|
364
|
-
if ( asWidget ) {
|
|
365
|
-
setHighlightHandling(
|
|
366
|
-
cellElement,
|
|
367
|
-
conversionApi.writer,
|
|
368
|
-
( element, descriptor, writer ) => writer.addClass( toArray( descriptor.classes ), element ),
|
|
369
|
-
( element, descriptor, writer ) => writer.removeClass( toArray( descriptor.classes ), element )
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
354
|
const tableCell = tableSlot.cell;
|
|
374
355
|
|
|
375
356
|
const firstChild = tableCell.getChild( 0 );
|
|
@@ -29,14 +29,31 @@ function tableHeadingRowsRefreshPostFixer( model ) {
|
|
|
29
29
|
const tablesToRefresh = new Set();
|
|
30
30
|
|
|
31
31
|
for ( const change of differ.getChanges() ) {
|
|
32
|
-
if ( change.type
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if ( change.type === 'attribute' ) {
|
|
33
|
+
const element = change.range.start.nodeAfter;
|
|
34
|
+
|
|
35
|
+
if ( element && element.is( 'element', 'table' ) && change.attributeKey === 'headingRows' ) {
|
|
36
|
+
tablesToRefresh.add( element );
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
/* istanbul ignore else */
|
|
40
|
+
if ( change.type === 'insert' || change.type === 'remove' ) {
|
|
41
|
+
if ( change.name === 'tableRow' ) {
|
|
42
|
+
const table = change.position.findAncestor( 'table' );
|
|
43
|
+
const headingRows = table.getAttribute( 'headingRows' ) || 0;
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
if ( change.position.offset < headingRows ) {
|
|
46
|
+
tablesToRefresh.add( table );
|
|
47
|
+
}
|
|
48
|
+
} else if ( change.name === 'tableCell' ) {
|
|
49
|
+
const table = change.position.findAncestor( 'table' );
|
|
50
|
+
const headingColumns = table.getAttribute( 'headingColumns' ) || 0;
|
|
37
51
|
|
|
38
|
-
|
|
39
|
-
|
|
52
|
+
if ( change.position.offset < headingColumns ) {
|
|
53
|
+
tablesToRefresh.add( table );
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
40
57
|
}
|
|
41
58
|
}
|
|
42
59
|
|
|
@@ -48,6 +48,8 @@ export function upcastTableFigure() {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
conversionApi.consumable.consume( data.viewItem, { name: true, classes: 'table' } );
|
|
52
|
+
|
|
51
53
|
conversionApi.convertChildren( data.viewItem, conversionApi.writer.createPositionAt( modelTable, 'end' ) );
|
|
52
54
|
conversionApi.updateConversionResult( modelTable, data );
|
|
53
55
|
} );
|
package/src/table.js
CHANGED
|
@@ -74,6 +74,23 @@ export default class Table extends Plugin {
|
|
|
74
74
|
* @member {module:table/table~TableConfig} module:core/editor/editorconfig~EditorConfig#table
|
|
75
75
|
*/
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Number of rows and columns to render by default as table heading when inserting new tables.
|
|
79
|
+
*
|
|
80
|
+
* You can configure it like this:
|
|
81
|
+
*
|
|
82
|
+
* const tableConfig = {
|
|
83
|
+
* defaultHeadings: {
|
|
84
|
+
* rows: 1,
|
|
85
|
+
* columns: 1
|
|
86
|
+
* }
|
|
87
|
+
* };
|
|
88
|
+
*
|
|
89
|
+
* Both rows and columns properties are optional defaulting to 0 (no heading).
|
|
90
|
+
*
|
|
91
|
+
* @member {Object} module:table/table~TableConfig#defaultHeadings
|
|
92
|
+
*/
|
|
93
|
+
|
|
77
94
|
/**
|
|
78
95
|
* An array of color definitions (either strings or objects).
|
|
79
96
|
*
|
package/src/tableediting.js
CHANGED
|
@@ -114,12 +114,30 @@ export default class TableEditing extends Plugin {
|
|
|
114
114
|
} );
|
|
115
115
|
|
|
116
116
|
// Table attributes conversion.
|
|
117
|
-
conversion.attributeToAttribute( { model: 'colspan', view: 'colspan' } );
|
|
118
|
-
conversion.
|
|
117
|
+
conversion.for( 'downcast' ).attributeToAttribute( { model: 'colspan', view: 'colspan' } );
|
|
118
|
+
conversion.for( 'upcast' ).attributeToAttribute( {
|
|
119
|
+
model: { key: 'colspan', value: upcastCellSpan( 'colspan' ) },
|
|
120
|
+
view: 'colspan'
|
|
121
|
+
} );
|
|
122
|
+
|
|
123
|
+
conversion.for( 'downcast' ).attributeToAttribute( { model: 'rowspan', view: 'rowspan' } );
|
|
124
|
+
conversion.for( 'upcast' ).attributeToAttribute( {
|
|
125
|
+
model: { key: 'rowspan', value: upcastCellSpan( 'rowspan' ) },
|
|
126
|
+
view: 'rowspan'
|
|
127
|
+
} );
|
|
119
128
|
|
|
120
129
|
// Table heading columns conversion (a change of heading rows requires a reconversion of the whole table).
|
|
121
130
|
conversion.for( 'editingDowncast' ).add( downcastTableHeadingColumnsChange() );
|
|
122
131
|
|
|
132
|
+
// Manually adjust model position mappings in a special case, when a table cell contains a paragraph, which is bound
|
|
133
|
+
// to its parent (to the table cell). This custom model-to-view position mapping is necessary in data pipeline only,
|
|
134
|
+
// because only during this conversion a paragraph can be bound to its parent.
|
|
135
|
+
editor.data.mapper.on( 'modelToViewPosition', mapTableCellModelPositionToView() );
|
|
136
|
+
|
|
137
|
+
// Define the config.
|
|
138
|
+
editor.config.define( 'table.defaultHeadings.rows', 0 );
|
|
139
|
+
editor.config.define( 'table.defaultHeadings.columns', 0 );
|
|
140
|
+
|
|
123
141
|
// Define all the commands.
|
|
124
142
|
editor.commands.add( 'insertTable', new InsertTableCommand( editor ) );
|
|
125
143
|
editor.commands.add( 'insertTableRowAbove', new InsertRowCommand( editor, { order: 'above' } ) );
|
|
@@ -159,3 +177,54 @@ export default class TableEditing extends Plugin {
|
|
|
159
177
|
return [ TableUtils ];
|
|
160
178
|
}
|
|
161
179
|
}
|
|
180
|
+
|
|
181
|
+
// Creates a mapper callback to adjust model position mappings in a table cell containing a paragraph, which is bound to its parent
|
|
182
|
+
// (to the table cell). Only positions after this paragraph have to be adjusted, because after binding this paragraph to the table cell,
|
|
183
|
+
// elements located after this paragraph would point either to a non-existent offset inside `tableCell` (if paragraph is empty), or after
|
|
184
|
+
// the first character of the paragraph's text. See https://github.com/ckeditor/ckeditor5/issues/10116.
|
|
185
|
+
//
|
|
186
|
+
// <tableCell><paragraph></paragraph>^</tableCell> -> <td>^ </td>
|
|
187
|
+
//
|
|
188
|
+
// <tableCell><paragraph>foobar</paragraph>^</tableCell> -> <td>foobar^</td>
|
|
189
|
+
//
|
|
190
|
+
// @returns {Function}
|
|
191
|
+
function mapTableCellModelPositionToView() {
|
|
192
|
+
return ( evt, data ) => {
|
|
193
|
+
const modelParent = data.modelPosition.parent;
|
|
194
|
+
const modelNodeBefore = data.modelPosition.nodeBefore;
|
|
195
|
+
|
|
196
|
+
if ( !modelParent.is( 'element', 'tableCell' ) ) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if ( !modelNodeBefore || !modelNodeBefore.is( 'element', 'paragraph' ) ) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const viewNodeBefore = data.mapper.toViewElement( modelNodeBefore );
|
|
205
|
+
const viewParent = data.mapper.toViewElement( modelParent );
|
|
206
|
+
|
|
207
|
+
if ( viewNodeBefore === viewParent ) {
|
|
208
|
+
// Since the paragraph has already been bound to its parent, update the current position in the model with paragraph's
|
|
209
|
+
// max offset, so it points to the place which should normally (in all other cases) be the end position of this paragraph.
|
|
210
|
+
data.viewPosition = data.mapper.findPositionIn( viewParent, modelNodeBefore.maxOffset );
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Returns fixed colspan and rowspan attrbutes values.
|
|
216
|
+
//
|
|
217
|
+
// @private
|
|
218
|
+
// @param {String} type colspan or rowspan.
|
|
219
|
+
// @returns {Function} conversion value function.
|
|
220
|
+
function upcastCellSpan( type ) {
|
|
221
|
+
return cell => {
|
|
222
|
+
const span = parseInt( cell.getAttribute( type ) );
|
|
223
|
+
|
|
224
|
+
if ( Number.isNaN( span ) || span <= 0 ) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return span;
|
|
229
|
+
};
|
|
230
|
+
}
|
package/src/tablekeyboard.js
CHANGED
|
@@ -218,10 +218,25 @@ export default class TableKeyboard extends Plugin {
|
|
|
218
218
|
return false;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
//
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
// When the selection is not collapsed.
|
|
222
|
+
if ( !selection.isCollapsed ) {
|
|
223
|
+
if ( expandSelection ) {
|
|
224
|
+
// Navigation is in the opposite direction than the selection direction so this is shrinking of the selection.
|
|
225
|
+
// Selection for sure will not approach cell edge.
|
|
226
|
+
//
|
|
227
|
+
// With a special case when all cell content is selected - then selection should expand to the other cell.
|
|
228
|
+
// Note: When the entire cell gets selected using CTRL+A, the selection is always forward.
|
|
229
|
+
if ( selection.isBackward == isForward && !selection.containsEntireContent( tableCell ) ) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
const selectedElement = selection.getSelectedElement();
|
|
234
|
+
|
|
235
|
+
// It will collapse for non-object selected so it's not going to move to other cell.
|
|
236
|
+
if ( !selectedElement || !model.schema.isObject( selectedElement ) ) {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
225
240
|
}
|
|
226
241
|
|
|
227
242
|
// Let's check if the selection is at the beginning/end of the cell.
|
package/src/tableutils.js
CHANGED
|
@@ -106,11 +106,11 @@ export default class TableUtils extends Plugin {
|
|
|
106
106
|
createEmptyRows( writer, table, 0, rows, columns );
|
|
107
107
|
|
|
108
108
|
if ( options.headingRows ) {
|
|
109
|
-
updateNumericAttribute( 'headingRows', options.headingRows, table, writer, 0 );
|
|
109
|
+
updateNumericAttribute( 'headingRows', Math.min( options.headingRows, rows ), table, writer, 0 );
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
if ( options.headingColumns ) {
|
|
113
|
-
updateNumericAttribute( 'headingColumns', options.headingColumns, table, writer, 0 );
|
|
113
|
+
updateNumericAttribute( 'headingColumns', Math.min( options.headingColumns, columns ), table, writer, 0 );
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
return table;
|
package/src/ui/colorinputview.js
CHANGED
|
@@ -25,7 +25,7 @@ export default class ColorInputView extends View {
|
|
|
25
25
|
*
|
|
26
26
|
* @param {module:utils/locale~Locale} locale The locale instance.
|
|
27
27
|
* @param {Object} options The input options.
|
|
28
|
-
* @param {module:ui/colorgrid/colorgrid~ColorDefinition} options.colorDefinitions The colors to be displayed
|
|
28
|
+
* @param {Array.<module:ui/colorgrid/colorgrid~ColorDefinition>} options.colorDefinitions The colors to be displayed
|
|
29
29
|
* in the palette inside the input's dropdown.
|
|
30
30
|
* @param {Number} options.columns The number of columns in which the colors will be displayed.
|
|
31
31
|
* @param {String} [options.defaultColorValue] If specified, the color input view will replace the "Remove color" button with
|
|
@@ -98,7 +98,7 @@ export default class ColorInputView extends View {
|
|
|
98
98
|
* some error, it helps screen readers read the error text.
|
|
99
99
|
*
|
|
100
100
|
* @observable
|
|
101
|
-
* @member {
|
|
101
|
+
* @member {String} #ariaDescribedById
|
|
102
102
|
*/
|
|
103
103
|
this.set( 'ariaDescribedById' );
|
|
104
104
|
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* @module table/utils/ui/contextualballoon
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { centeredBalloonPositionForLongWidgets } from 'ckeditor5/src/widget';
|
|
11
10
|
import { Rect } from 'ckeditor5/src/utils';
|
|
12
11
|
import { BalloonPanelView } from 'ckeditor5/src/ui';
|
|
13
12
|
|
|
@@ -21,12 +20,8 @@ const BALLOON_POSITIONS = [
|
|
|
21
20
|
DEFAULT_BALLOON_POSITIONS.northArrowSouthEast,
|
|
22
21
|
DEFAULT_BALLOON_POSITIONS.southArrowNorth,
|
|
23
22
|
DEFAULT_BALLOON_POSITIONS.southArrowNorthWest,
|
|
24
|
-
DEFAULT_BALLOON_POSITIONS.southArrowNorthEast
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const TABLE_PROPERTIES_BALLOON_POSITIONS = [
|
|
28
|
-
...BALLOON_POSITIONS,
|
|
29
|
-
centeredBalloonPositionForLongWidgets
|
|
23
|
+
DEFAULT_BALLOON_POSITIONS.southArrowNorthEast,
|
|
24
|
+
DEFAULT_BALLOON_POSITIONS.viewportStickyNorth
|
|
30
25
|
];
|
|
31
26
|
|
|
32
27
|
/**
|
|
@@ -69,7 +64,7 @@ export function getBalloonTablePositionData( editor ) {
|
|
|
69
64
|
|
|
70
65
|
return {
|
|
71
66
|
target: editor.editing.view.domConverter.viewToDom( viewTable ),
|
|
72
|
-
positions:
|
|
67
|
+
positions: BALLOON_POSITIONS
|
|
73
68
|
};
|
|
74
69
|
}
|
|
75
70
|
|
package/theme/table.css
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
.ck-content .table {
|
|
7
7
|
/* Give the table widget some air and center it horizontally */
|
|
8
|
-
|
|
8
|
+
/* The first value should be equal to --ck-spacing-large variable if used in the editor context
|
|
9
|
+
to avoid the content jumping (See https://github.com/ckeditor/ckeditor5/issues/9825). */
|
|
10
|
+
margin: 0.9em auto;
|
|
9
11
|
display: table;
|
|
10
12
|
|
|
11
13
|
& table {
|
|
@@ -49,3 +51,17 @@ when content is available outside the ediitor. See https://github.com/ckeditor/c
|
|
|
49
51
|
.ck-content[dir="ltr"] .table th {
|
|
50
52
|
text-align: left;
|
|
51
53
|
}
|
|
54
|
+
|
|
55
|
+
.ck-editor__editable .ck-table-bogus-paragraph {
|
|
56
|
+
/*
|
|
57
|
+
* Use display:inline-block to force Chrome/Safari to limit text mutations to this element.
|
|
58
|
+
* See https://github.com/ckeditor/ckeditor5/issues/6062.
|
|
59
|
+
*/
|
|
60
|
+
display: inline-block;
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* Inline HTML elements nested in the span should always be dimensioned in relation to the whole cell width.
|
|
64
|
+
* See https://github.com/ckeditor/ckeditor5/issues/9117.
|
|
65
|
+
*/
|
|
66
|
+
width: 100%;
|
|
67
|
+
}
|