@ckeditor/ckeditor5-table 35.3.1 → 35.4.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/package.json +25 -25
- package/src/converters/tableproperties.js +6 -1
- package/src/converters/upcasttable.js +1 -1
- package/src/tablecolumnresize/tablewidthresizecommand.js +8 -3
- package/src/tableproperties/tablepropertiesediting.js +7 -1
- package/src/tablewalker.js +1 -1
- package/src/ui/inserttableview.js +2 -1
- package/build/table.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-table",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.4.0",
|
|
4
4
|
"description": "Table feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -12,34 +12,34 @@
|
|
|
12
12
|
],
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"ckeditor5": "^35.
|
|
15
|
+
"ckeditor5": "^35.4.0",
|
|
16
16
|
"lodash-es": "^4.17.15"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@ckeditor/ckeditor5-alignment": "^35.
|
|
20
|
-
"@ckeditor/ckeditor5-basic-styles": "^35.
|
|
21
|
-
"@ckeditor/ckeditor5-block-quote": "^35.
|
|
22
|
-
"@ckeditor/ckeditor5-clipboard": "^35.
|
|
23
|
-
"@ckeditor/ckeditor5-core": "^35.
|
|
19
|
+
"@ckeditor/ckeditor5-alignment": "^35.4.0",
|
|
20
|
+
"@ckeditor/ckeditor5-basic-styles": "^35.4.0",
|
|
21
|
+
"@ckeditor/ckeditor5-block-quote": "^35.4.0",
|
|
22
|
+
"@ckeditor/ckeditor5-clipboard": "^35.4.0",
|
|
23
|
+
"@ckeditor/ckeditor5-core": "^35.4.0",
|
|
24
24
|
"@ckeditor/ckeditor5-dev-utils": "^31.0.0",
|
|
25
|
-
"@ckeditor/ckeditor5-editor-classic": "^35.
|
|
26
|
-
"@ckeditor/ckeditor5-engine": "^35.
|
|
27
|
-
"@ckeditor/ckeditor5-highlight": "^35.
|
|
28
|
-
"@ckeditor/ckeditor5-horizontal-line": "^35.
|
|
29
|
-
"@ckeditor/ckeditor5-html-support": "^35.
|
|
30
|
-
"@ckeditor/ckeditor5-image": "^35.
|
|
31
|
-
"@ckeditor/ckeditor5-indent": "^35.
|
|
32
|
-
"@ckeditor/ckeditor5-link": "^35.
|
|
33
|
-
"@ckeditor/ckeditor5-list": "^35.
|
|
34
|
-
"@ckeditor/ckeditor5-media-embed": "^35.
|
|
35
|
-
"@ckeditor/ckeditor5-paragraph": "^35.
|
|
36
|
-
"@ckeditor/ckeditor5-theme-lark": "^35.
|
|
37
|
-
"@ckeditor/ckeditor5-typing": "^35.
|
|
38
|
-
"@ckeditor/ckeditor5-ui": "^35.
|
|
39
|
-
"@ckeditor/ckeditor5-undo": "^35.
|
|
40
|
-
"@ckeditor/ckeditor5-utils": "^35.
|
|
41
|
-
"@ckeditor/ckeditor5-widget": "^35.
|
|
42
|
-
"@ckeditor/ckeditor5-source-editing": "^35.
|
|
25
|
+
"@ckeditor/ckeditor5-editor-classic": "^35.4.0",
|
|
26
|
+
"@ckeditor/ckeditor5-engine": "^35.4.0",
|
|
27
|
+
"@ckeditor/ckeditor5-highlight": "^35.4.0",
|
|
28
|
+
"@ckeditor/ckeditor5-horizontal-line": "^35.4.0",
|
|
29
|
+
"@ckeditor/ckeditor5-html-support": "^35.4.0",
|
|
30
|
+
"@ckeditor/ckeditor5-image": "^35.4.0",
|
|
31
|
+
"@ckeditor/ckeditor5-indent": "^35.4.0",
|
|
32
|
+
"@ckeditor/ckeditor5-link": "^35.4.0",
|
|
33
|
+
"@ckeditor/ckeditor5-list": "^35.4.0",
|
|
34
|
+
"@ckeditor/ckeditor5-media-embed": "^35.4.0",
|
|
35
|
+
"@ckeditor/ckeditor5-paragraph": "^35.4.0",
|
|
36
|
+
"@ckeditor/ckeditor5-theme-lark": "^35.4.0",
|
|
37
|
+
"@ckeditor/ckeditor5-typing": "^35.4.0",
|
|
38
|
+
"@ckeditor/ckeditor5-ui": "^35.4.0",
|
|
39
|
+
"@ckeditor/ckeditor5-undo": "^35.4.0",
|
|
40
|
+
"@ckeditor/ckeditor5-utils": "^35.4.0",
|
|
41
|
+
"@ckeditor/ckeditor5-widget": "^35.4.0",
|
|
42
|
+
"@ckeditor/ckeditor5-source-editing": "^35.4.0",
|
|
43
43
|
"json-diff": "^0.5.4",
|
|
44
44
|
"webpack": "^5.58.1",
|
|
45
45
|
"webpack-cli": "^4.9.0"
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
* @param {String} options.viewElement The view element name that should be converted.
|
|
18
18
|
* @param {String} options.defaultValue The default value for the specified `modelAttribute`.
|
|
19
19
|
* @param {Boolean} [options.reduceBoxSides=false]
|
|
20
|
+
* @param {Function} [options.shouldUpcast] The function which returns `true` if style should be upcasted from this element.
|
|
20
21
|
*/
|
|
21
22
|
export function upcastStyleToAttribute( conversion, options ) {
|
|
22
|
-
const { viewElement, defaultValue, modelAttribute, styleName, reduceBoxSides = false } = options;
|
|
23
|
+
const { viewElement, defaultValue, modelAttribute, styleName, reduceBoxSides = false, shouldUpcast = () => true } = options;
|
|
23
24
|
|
|
24
25
|
conversion.for( 'upcast' ).attributeToAttribute( {
|
|
25
26
|
view: {
|
|
@@ -31,6 +32,10 @@ export function upcastStyleToAttribute( conversion, options ) {
|
|
|
31
32
|
model: {
|
|
32
33
|
key: modelAttribute,
|
|
33
34
|
value: viewElement => {
|
|
35
|
+
if ( !shouldUpcast( viewElement ) ) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
const normalized = viewElement.getNormalizedStyle( styleName );
|
|
35
40
|
const value = reduceBoxSides ? reduceBoxSidesValue( normalized ) : normalized;
|
|
36
41
|
|
|
@@ -29,7 +29,7 @@ export function upcastTableFigure() {
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
// Find
|
|
32
|
+
// Find a table element inside the figure element.
|
|
33
33
|
const viewTable = getViewTableFromFigure( data.viewItem );
|
|
34
34
|
|
|
35
35
|
// Do not convert if table element is absent or was already converted.
|
|
@@ -39,8 +39,8 @@ export default class TableWidthResizeCommand extends TablePropertyCommand {
|
|
|
39
39
|
* Changes the `tableWidth` and `columnWidths` attribute values for the given or currently selected table.
|
|
40
40
|
*
|
|
41
41
|
* @param {Object} options
|
|
42
|
-
* @param {String} [options.tableWidth] The new table width.
|
|
43
|
-
* @param {String} [options.columnWidths] The new table column widths.
|
|
42
|
+
* @param {String} [options.tableWidth] The new table width. If skipped, the model attribute will be removed.
|
|
43
|
+
* @param {String} [options.columnWidths] The new table column widths. If skipped, the model attribute will be removed.
|
|
44
44
|
* @param {module:engine/model/element~Element} [options.table] The table that is affected by the resize.
|
|
45
45
|
*/
|
|
46
46
|
execute( options = {} ) {
|
|
@@ -51,10 +51,15 @@ export default class TableWidthResizeCommand extends TablePropertyCommand {
|
|
|
51
51
|
model.change( writer => {
|
|
52
52
|
if ( tableWidth ) {
|
|
53
53
|
writer.setAttribute( this.attributeName, tableWidth, table );
|
|
54
|
-
writer.setAttribute( 'columnWidths', columnWidths, table );
|
|
55
54
|
} else {
|
|
56
55
|
writer.removeAttribute( this.attributeName, table );
|
|
57
56
|
}
|
|
57
|
+
|
|
58
|
+
if ( columnWidths ) {
|
|
59
|
+
writer.setAttribute( 'columnWidths', columnWidths, table );
|
|
60
|
+
} else {
|
|
61
|
+
writer.removeAttribute( 'columnWidths', table );
|
|
62
|
+
}
|
|
58
63
|
} );
|
|
59
64
|
}
|
|
60
65
|
}
|
|
@@ -242,6 +242,12 @@ function enableTableToFigureProperty( schema, conversion, options ) {
|
|
|
242
242
|
schema.extend( 'table', {
|
|
243
243
|
allowAttributes: [ modelAttribute ]
|
|
244
244
|
} );
|
|
245
|
-
|
|
245
|
+
|
|
246
|
+
upcastStyleToAttribute( conversion, {
|
|
247
|
+
viewElement: /^(table|figure)$/,
|
|
248
|
+
shouldUpcast: element => !( element.name == 'table' && element.parent.name == 'figure' ),
|
|
249
|
+
...options
|
|
250
|
+
} );
|
|
251
|
+
|
|
246
252
|
downcastAttributeToStyle( conversion, { modelElement: 'table', ...options } );
|
|
247
253
|
}
|
package/src/tablewalker.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module table/tablewalker
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
// @if CK_DEBUG //
|
|
10
|
+
// @if CK_DEBUG // const { CKEditorError } = require( 'ckeditor5/src/utils' );
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The table iterator class. It allows to iterate over table cells. For each cell the iterator yields
|
|
@@ -158,7 +158,8 @@ export default class InsertTableView extends View {
|
|
|
158
158
|
keystrokeHandler: this.keystrokes,
|
|
159
159
|
focusTracker: this.focusTracker,
|
|
160
160
|
gridItems: this.items,
|
|
161
|
-
numberOfColumns: 10
|
|
161
|
+
numberOfColumns: 10,
|
|
162
|
+
uiLanguageDirection: this.locale && this.locale.uiLanguageDirection
|
|
162
163
|
} );
|
|
163
164
|
|
|
164
165
|
for ( const item of this.items ) {
|