@ckeditor/ckeditor5-table 31.0.0 → 31.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/build/table.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/uz.js +1 -0
- package/build/translations/zh.js +1 -1
- package/lang/translations/es.po +11 -11
- package/lang/translations/id.po +10 -10
- package/lang/translations/pt-br.po +3 -3
- package/lang/translations/uz.po +261 -0
- package/lang/translations/zh.po +3 -3
- package/package.json +21 -21
- package/src/converters/tableproperties.js +5 -4
- package/src/converters/upcasttable.js +6 -2
- package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellbordercolorcommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellborderstylecommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellborderwidthcommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellheightcommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellpaddingcommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellwidthcommand.js +1 -1
- package/src/tablecellproperties/tablecellpropertiesediting.js +41 -34
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +10 -0
- package/src/tableproperties/commands/tablealignmentcommand.js +1 -1
- package/src/tableproperties/commands/tablebackgroundcolorcommand.js +1 -1
- package/src/tableproperties/commands/tablebordercolorcommand.js +1 -1
- package/src/tableproperties/commands/tableborderstylecommand.js +1 -1
- package/src/tableproperties/commands/tableborderwidthcommand.js +1 -1
- package/src/tableproperties/commands/tableheightcommand.js +1 -1
- package/src/tableproperties/commands/tablewidthcommand.js +1 -1
- package/src/tableproperties/tablepropertiesediting.js +28 -20
- package/src/tableproperties/ui/tablepropertiesview.js +10 -0
|
@@ -32,7 +32,7 @@ export default class TableCellBorderColorCommand extends TableCellPropertyComman
|
|
|
32
32
|
* @param {String} defaultValue The default value of the attribute.
|
|
33
33
|
*/
|
|
34
34
|
constructor( editor, defaultValue ) {
|
|
35
|
-
super( editor, '
|
|
35
|
+
super( editor, 'tableCellBorderColor', defaultValue );
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -32,7 +32,7 @@ export default class TableCellBorderStyleCommand extends TableCellPropertyComman
|
|
|
32
32
|
* @param {String} defaultValue The default value of the attribute.
|
|
33
33
|
*/
|
|
34
34
|
constructor( editor, defaultValue ) {
|
|
35
|
-
super( editor, '
|
|
35
|
+
super( editor, 'tableCellBorderStyle', defaultValue );
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -40,7 +40,7 @@ export default class TableCellBorderWidthCommand extends TableCellPropertyComman
|
|
|
40
40
|
* @param {String} defaultValue The default value of the attribute.
|
|
41
41
|
*/
|
|
42
42
|
constructor( editor, defaultValue ) {
|
|
43
|
-
super( editor, '
|
|
43
|
+
super( editor, 'tableCellBorderWidth', defaultValue );
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -40,7 +40,7 @@ export default class TableCellHeightCommand extends TableCellPropertyCommand {
|
|
|
40
40
|
* @param {String} defaultValue The default value of the attribute.
|
|
41
41
|
*/
|
|
42
42
|
constructor( editor, defaultValue ) {
|
|
43
|
-
super( editor, '
|
|
43
|
+
super( editor, 'tableCellHeight', defaultValue );
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -31,6 +31,6 @@ export default class TableCellHorizontalAlignmentCommand extends TableCellProper
|
|
|
31
31
|
* @param {String} defaultValue The default value for the "alignment" attribute.
|
|
32
32
|
*/
|
|
33
33
|
constructor( editor, defaultValue ) {
|
|
34
|
-
super( editor, '
|
|
34
|
+
super( editor, 'tableCellHorizontalAlignment', defaultValue );
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -40,7 +40,7 @@ export default class TableCellPaddingCommand extends TableCellPropertyCommand {
|
|
|
40
40
|
* @param {String} defaultValue The default value of the attribute.
|
|
41
41
|
*/
|
|
42
42
|
constructor( editor, defaultValue ) {
|
|
43
|
-
super( editor, '
|
|
43
|
+
super( editor, 'tableCellPadding', defaultValue );
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -39,6 +39,6 @@ export default class TableCellVerticalAlignmentCommand extends TableCellProperty
|
|
|
39
39
|
* @param {String} defaultValue The default value for the "alignment" attribute.
|
|
40
40
|
*/
|
|
41
41
|
constructor( editor, defaultValue ) {
|
|
42
|
-
super( editor, '
|
|
42
|
+
super( editor, 'tableCellVerticalAlignment', defaultValue );
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -40,7 +40,7 @@ export default class TableCellWidthCommand extends TableCellPropertyCommand {
|
|
|
40
40
|
* @param {String} defaultValue The default value of the attribute.
|
|
41
41
|
*/
|
|
42
42
|
constructor( editor, defaultValue ) {
|
|
43
|
-
super( editor, '
|
|
43
|
+
super( editor, 'tableCellWidth', defaultValue );
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -31,11 +31,11 @@ const ALIGN_VALUES_REG_EXP = /^(left|center|right|justify)$/;
|
|
|
31
31
|
*
|
|
32
32
|
* Introduces table cell model attributes and their conversion:
|
|
33
33
|
*
|
|
34
|
-
* - border: `
|
|
35
|
-
* - background color: `
|
|
36
|
-
* - cell padding: `
|
|
37
|
-
* - horizontal and vertical alignment: `
|
|
38
|
-
* - cell width and height: `
|
|
34
|
+
* - border: `tableCellBorderStyle`, `tableCellBorderColor` and `tableCellBorderWidth`
|
|
35
|
+
* - background color: `tableCellBackgroundColor`
|
|
36
|
+
* - cell padding: `tableCellPadding`
|
|
37
|
+
* - horizontal and vertical alignment: `tableCellHorizontalAlignment`, `tableCellVerticalAlignment`
|
|
38
|
+
* - cell width and height: `tableCellWidth`, `tableCellHeight`
|
|
39
39
|
*
|
|
40
40
|
* It also registers commands used to manipulate the above attributes:
|
|
41
41
|
*
|
|
@@ -92,21 +92,15 @@ export default class TableCellPropertiesEditing extends Plugin {
|
|
|
92
92
|
editor.commands.add( 'tableCellBorderColor', new TableCellBorderColorCommand( editor, defaultTableCellProperties.borderColor ) );
|
|
93
93
|
editor.commands.add( 'tableCellBorderWidth', new TableCellBorderWidthCommand( editor, defaultTableCellProperties.borderWidth ) );
|
|
94
94
|
|
|
95
|
-
enableHorizontalAlignmentProperty( schema, conversion, defaultTableCellProperties.horizontalAlignment );
|
|
96
|
-
editor.commands.add(
|
|
97
|
-
'tableCellHorizontalAlignment',
|
|
98
|
-
new TableCellHorizontalAlignmentCommand( editor, defaultTableCellProperties.horizontalAlignment )
|
|
99
|
-
);
|
|
100
|
-
|
|
101
95
|
enableProperty( schema, conversion, {
|
|
102
|
-
modelAttribute: '
|
|
96
|
+
modelAttribute: 'tableCellWidth',
|
|
103
97
|
styleName: 'width',
|
|
104
98
|
defaultValue: defaultTableCellProperties.width
|
|
105
99
|
} );
|
|
106
100
|
editor.commands.add( 'tableCellWidth', new TableCellWidthCommand( editor, defaultTableCellProperties.width ) );
|
|
107
101
|
|
|
108
102
|
enableProperty( schema, conversion, {
|
|
109
|
-
modelAttribute: '
|
|
103
|
+
modelAttribute: 'tableCellHeight',
|
|
110
104
|
styleName: 'height',
|
|
111
105
|
defaultValue: defaultTableCellProperties.height
|
|
112
106
|
} );
|
|
@@ -114,7 +108,7 @@ export default class TableCellPropertiesEditing extends Plugin {
|
|
|
114
108
|
|
|
115
109
|
editor.data.addStyleProcessorRules( addPaddingRules );
|
|
116
110
|
enableProperty( schema, conversion, {
|
|
117
|
-
modelAttribute: '
|
|
111
|
+
modelAttribute: 'tableCellPadding',
|
|
118
112
|
styleName: 'padding',
|
|
119
113
|
reduceBoxSides: true,
|
|
120
114
|
defaultValue: defaultTableCellProperties.padding
|
|
@@ -123,7 +117,7 @@ export default class TableCellPropertiesEditing extends Plugin {
|
|
|
123
117
|
|
|
124
118
|
editor.data.addStyleProcessorRules( addBackgroundRules );
|
|
125
119
|
enableProperty( schema, conversion, {
|
|
126
|
-
modelAttribute: '
|
|
120
|
+
modelAttribute: 'tableCellBackgroundColor',
|
|
127
121
|
styleName: 'background-color',
|
|
128
122
|
defaultValue: defaultTableCellProperties.backgroundColor
|
|
129
123
|
} );
|
|
@@ -132,6 +126,12 @@ export default class TableCellPropertiesEditing extends Plugin {
|
|
|
132
126
|
new TableCellBackgroundColorCommand( editor, defaultTableCellProperties.backgroundColor )
|
|
133
127
|
);
|
|
134
128
|
|
|
129
|
+
enableHorizontalAlignmentProperty( schema, conversion, defaultTableCellProperties.horizontalAlignment );
|
|
130
|
+
editor.commands.add(
|
|
131
|
+
'tableCellHorizontalAlignment',
|
|
132
|
+
new TableCellHorizontalAlignmentCommand( editor, defaultTableCellProperties.horizontalAlignment )
|
|
133
|
+
);
|
|
134
|
+
|
|
135
135
|
enableVerticalAlignmentProperty( schema, conversion, defaultTableCellProperties.verticalAlignment );
|
|
136
136
|
editor.commands.add(
|
|
137
137
|
'tableCellVerticalAlignment',
|
|
@@ -140,26 +140,33 @@ export default class TableCellPropertiesEditing extends Plugin {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
// Enables the `'
|
|
143
|
+
// Enables the `'tableCellBorderStyle'`, `'tableCellBorderColor'` and `'tableCellBorderWidth'` attributes for table cells.
|
|
144
144
|
//
|
|
145
145
|
// @param {module:engine/model/schema~Schema} schema
|
|
146
146
|
// @param {module:engine/conversion/conversion~Conversion} conversion
|
|
147
147
|
// @param {Object} defaultBorder The default border values.
|
|
148
|
-
// @param {String} defaultBorder.color The default `
|
|
149
|
-
// @param {String} defaultBorder.style The default `
|
|
150
|
-
// @param {String} defaultBorder.width The default `
|
|
148
|
+
// @param {String} defaultBorder.color The default `tableCellBorderColor` value.
|
|
149
|
+
// @param {String} defaultBorder.style The default `tableCellBorderStyle` value.
|
|
150
|
+
// @param {String} defaultBorder.width The default `tableCellBorderWidth` value.
|
|
151
151
|
function enableBorderProperties( schema, conversion, defaultBorder ) {
|
|
152
|
+
const modelAttributes = {
|
|
153
|
+
width: 'tableCellBorderWidth',
|
|
154
|
+
color: 'tableCellBorderColor',
|
|
155
|
+
style: 'tableCellBorderStyle'
|
|
156
|
+
};
|
|
157
|
+
|
|
152
158
|
schema.extend( 'tableCell', {
|
|
153
|
-
allowAttributes:
|
|
159
|
+
allowAttributes: Object.values( modelAttributes )
|
|
154
160
|
} );
|
|
155
|
-
|
|
156
|
-
upcastBorderStyles( conversion, '
|
|
157
|
-
|
|
158
|
-
downcastAttributeToStyle( conversion, { modelElement: 'tableCell', modelAttribute:
|
|
159
|
-
downcastAttributeToStyle( conversion, { modelElement: 'tableCell', modelAttribute:
|
|
161
|
+
|
|
162
|
+
upcastBorderStyles( conversion, 'td', modelAttributes, defaultBorder );
|
|
163
|
+
upcastBorderStyles( conversion, 'th', modelAttributes, defaultBorder );
|
|
164
|
+
downcastAttributeToStyle( conversion, { modelElement: 'tableCell', modelAttribute: modelAttributes.style, styleName: 'border-style' } );
|
|
165
|
+
downcastAttributeToStyle( conversion, { modelElement: 'tableCell', modelAttribute: modelAttributes.color, styleName: 'border-color' } );
|
|
166
|
+
downcastAttributeToStyle( conversion, { modelElement: 'tableCell', modelAttribute: modelAttributes.width, styleName: 'border-width' } );
|
|
160
167
|
}
|
|
161
168
|
|
|
162
|
-
// Enables the `'
|
|
169
|
+
// Enables the `'tableCellHorizontalAlignment'` attribute for table cells.
|
|
163
170
|
//
|
|
164
171
|
// @param {module:engine/model/schema~Schema} schema
|
|
165
172
|
// @param {module:engine/conversion/conversion~Conversion} conversion
|
|
@@ -167,14 +174,14 @@ function enableBorderProperties( schema, conversion, defaultBorder ) {
|
|
|
167
174
|
// @param {String} defaultValue The default horizontal alignment value.
|
|
168
175
|
function enableHorizontalAlignmentProperty( schema, conversion, defaultValue ) {
|
|
169
176
|
schema.extend( 'tableCell', {
|
|
170
|
-
allowAttributes: [ '
|
|
177
|
+
allowAttributes: [ 'tableCellHorizontalAlignment' ]
|
|
171
178
|
} );
|
|
172
179
|
|
|
173
180
|
conversion.for( 'downcast' )
|
|
174
181
|
.attributeToAttribute( {
|
|
175
182
|
model: {
|
|
176
183
|
name: 'tableCell',
|
|
177
|
-
key: '
|
|
184
|
+
key: 'tableCellHorizontalAlignment'
|
|
178
185
|
},
|
|
179
186
|
view: alignment => ( {
|
|
180
187
|
key: 'style',
|
|
@@ -194,7 +201,7 @@ function enableHorizontalAlignmentProperty( schema, conversion, defaultValue ) {
|
|
|
194
201
|
}
|
|
195
202
|
},
|
|
196
203
|
model: {
|
|
197
|
-
key: '
|
|
204
|
+
key: 'tableCellHorizontalAlignment',
|
|
198
205
|
value: viewElement => {
|
|
199
206
|
const align = viewElement.getStyle( 'text-align' );
|
|
200
207
|
|
|
@@ -211,7 +218,7 @@ function enableHorizontalAlignmentProperty( schema, conversion, defaultValue ) {
|
|
|
211
218
|
}
|
|
212
219
|
},
|
|
213
220
|
model: {
|
|
214
|
-
key: '
|
|
221
|
+
key: 'tableCellHorizontalAlignment',
|
|
215
222
|
value: viewElement => {
|
|
216
223
|
const align = viewElement.getAttribute( 'align' );
|
|
217
224
|
|
|
@@ -228,14 +235,14 @@ function enableHorizontalAlignmentProperty( schema, conversion, defaultValue ) {
|
|
|
228
235
|
// @param {String} defaultValue The default vertical alignment value.
|
|
229
236
|
function enableVerticalAlignmentProperty( schema, conversion, defaultValue ) {
|
|
230
237
|
schema.extend( 'tableCell', {
|
|
231
|
-
allowAttributes: [ '
|
|
238
|
+
allowAttributes: [ 'tableCellVerticalAlignment' ]
|
|
232
239
|
} );
|
|
233
240
|
|
|
234
241
|
conversion.for( 'downcast' )
|
|
235
242
|
.attributeToAttribute( {
|
|
236
243
|
model: {
|
|
237
244
|
name: 'tableCell',
|
|
238
|
-
key: '
|
|
245
|
+
key: 'tableCellVerticalAlignment'
|
|
239
246
|
},
|
|
240
247
|
view: alignment => ( {
|
|
241
248
|
key: 'style',
|
|
@@ -255,7 +262,7 @@ function enableVerticalAlignmentProperty( schema, conversion, defaultValue ) {
|
|
|
255
262
|
}
|
|
256
263
|
},
|
|
257
264
|
model: {
|
|
258
|
-
key: '
|
|
265
|
+
key: 'tableCellVerticalAlignment',
|
|
259
266
|
value: viewElement => {
|
|
260
267
|
const align = viewElement.getStyle( 'vertical-align' );
|
|
261
268
|
|
|
@@ -272,7 +279,7 @@ function enableVerticalAlignmentProperty( schema, conversion, defaultValue ) {
|
|
|
272
279
|
}
|
|
273
280
|
},
|
|
274
281
|
model: {
|
|
275
|
-
key: '
|
|
282
|
+
key: 'tableCellVerticalAlignment',
|
|
276
283
|
value: viewElement => {
|
|
277
284
|
const valign = viewElement.getAttribute( 'valign' );
|
|
278
285
|
|
|
@@ -430,6 +430,16 @@ export default class TableCellPropertiesView extends View {
|
|
|
430
430
|
this.keystrokes.listenTo( this.element );
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
+
/**
|
|
434
|
+
* @inheritDoc
|
|
435
|
+
*/
|
|
436
|
+
destroy() {
|
|
437
|
+
super.destroy();
|
|
438
|
+
|
|
439
|
+
this.focusTracker.destroy();
|
|
440
|
+
this.keystrokes.destroy();
|
|
441
|
+
}
|
|
442
|
+
|
|
433
443
|
/**
|
|
434
444
|
* Focuses the fist focusable field in the form.
|
|
435
445
|
*/
|
|
@@ -31,6 +31,6 @@ export default class TableAlignmentCommand extends TablePropertyCommand {
|
|
|
31
31
|
* @param {String} defaultValue The default value for the "alignment" attribute.
|
|
32
32
|
*/
|
|
33
33
|
constructor( editor, defaultValue ) {
|
|
34
|
-
super( editor, '
|
|
34
|
+
super( editor, 'tableAlignment', defaultValue );
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -31,6 +31,6 @@ export default class TableBackgroundColorCommand extends TablePropertyCommand {
|
|
|
31
31
|
* @param {String} defaultValue The default value of the attribute.
|
|
32
32
|
*/
|
|
33
33
|
constructor( editor, defaultValue ) {
|
|
34
|
-
super( editor, '
|
|
34
|
+
super( editor, 'tableBackgroundColor', defaultValue );
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -32,7 +32,7 @@ export default class TableBorderColorCommand extends TablePropertyCommand {
|
|
|
32
32
|
* @param {String} defaultValue The default value of the attribute.
|
|
33
33
|
*/
|
|
34
34
|
constructor( editor, defaultValue ) {
|
|
35
|
-
super( editor, '
|
|
35
|
+
super( editor, 'tableBorderColor', defaultValue );
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -32,7 +32,7 @@ export default class TableBorderStyleCommand extends TablePropertyCommand {
|
|
|
32
32
|
* @param {String} defaultValue The default value of the attribute.
|
|
33
33
|
*/
|
|
34
34
|
constructor( editor, defaultValue ) {
|
|
35
|
-
super( editor, '
|
|
35
|
+
super( editor, 'tableBorderStyle', defaultValue );
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -40,7 +40,7 @@ export default class TableBorderWidthCommand extends TablePropertyCommand {
|
|
|
40
40
|
* @param {String} defaultValue The default value of the attribute.
|
|
41
41
|
*/
|
|
42
42
|
constructor( editor, defaultValue ) {
|
|
43
|
-
super( editor, '
|
|
43
|
+
super( editor, 'tableBorderWidth', defaultValue );
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -40,7 +40,7 @@ export default class TableHeightCommand extends TablePropertyCommand {
|
|
|
40
40
|
* @param {String} defaultValue The default value of the attribute.
|
|
41
41
|
*/
|
|
42
42
|
constructor( editor, defaultValue ) {
|
|
43
|
-
super( editor, '
|
|
43
|
+
super( editor, 'tableHeight', defaultValue );
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -40,7 +40,7 @@ export default class TableWidthCommand extends TablePropertyCommand {
|
|
|
40
40
|
* @param {String} defaultValue The default value of the attribute.
|
|
41
41
|
*/
|
|
42
42
|
constructor( editor, defaultValue ) {
|
|
43
|
-
super( editor, '
|
|
43
|
+
super( editor, 'tableWidth', defaultValue );
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -34,10 +34,10 @@ const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
|
|
|
34
34
|
*
|
|
35
35
|
* Introduces table's model attributes and their conversion:
|
|
36
36
|
*
|
|
37
|
-
* - border: `
|
|
38
|
-
* - background color: `
|
|
39
|
-
* - horizontal alignment: `
|
|
40
|
-
* - width & height: `
|
|
37
|
+
* - border: `tableBorderStyle`, `tableBorderColor` and `tableBorderWidth`
|
|
38
|
+
* - background color: `tableBackgroundColor`
|
|
39
|
+
* - horizontal alignment: `tableAlignment`
|
|
40
|
+
* - width & height: `tableWidth` & `tableHeight`
|
|
41
41
|
*
|
|
42
42
|
* It also registers commands used to manipulate the above attributes:
|
|
43
43
|
*
|
|
@@ -91,14 +91,14 @@ export default class TablePropertiesEditing extends Plugin {
|
|
|
91
91
|
editor.commands.add( 'tableAlignment', new TableAlignmentCommand( editor, defaultTableProperties.alignment ) );
|
|
92
92
|
|
|
93
93
|
enableTableToFigureProperty( schema, conversion, {
|
|
94
|
-
modelAttribute: '
|
|
94
|
+
modelAttribute: 'tableWidth',
|
|
95
95
|
styleName: 'width',
|
|
96
96
|
defaultValue: defaultTableProperties.width
|
|
97
97
|
} );
|
|
98
98
|
editor.commands.add( 'tableWidth', new TableWidthCommand( editor, defaultTableProperties.width ) );
|
|
99
99
|
|
|
100
100
|
enableTableToFigureProperty( schema, conversion, {
|
|
101
|
-
modelAttribute: '
|
|
101
|
+
modelAttribute: 'tableHeight',
|
|
102
102
|
styleName: 'height',
|
|
103
103
|
defaultValue: defaultTableProperties.height
|
|
104
104
|
} );
|
|
@@ -106,7 +106,7 @@ export default class TablePropertiesEditing extends Plugin {
|
|
|
106
106
|
|
|
107
107
|
editor.data.addStyleProcessorRules( addBackgroundRules );
|
|
108
108
|
enableProperty( schema, conversion, {
|
|
109
|
-
modelAttribute: '
|
|
109
|
+
modelAttribute: 'tableBackgroundColor',
|
|
110
110
|
styleName: 'background-color',
|
|
111
111
|
defaultValue: defaultTableProperties.backgroundColor
|
|
112
112
|
} );
|
|
@@ -117,22 +117,30 @@ export default class TablePropertiesEditing extends Plugin {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
// Enables `'
|
|
120
|
+
// Enables `tableBorderStyle'`, `tableBorderColor'` and `tableBorderWidth'` attributes for table.
|
|
121
121
|
//
|
|
122
122
|
// @param {module:engine/model/schema~Schema} schema
|
|
123
123
|
// @param {module:engine/conversion/conversion~Conversion} conversion
|
|
124
124
|
// @param {Object} defaultBorder The default border values.
|
|
125
|
-
// @param {String} defaultBorder.color The default `
|
|
126
|
-
// @param {String} defaultBorder.style The default `
|
|
127
|
-
// @param {String} defaultBorder.width The default `
|
|
125
|
+
// @param {String} defaultBorder.color The default `tableBorderColor` value.
|
|
126
|
+
// @param {String} defaultBorder.style The default `tableBorderStyle` value.
|
|
127
|
+
// @param {String} defaultBorder.width The default `tableBorderWidth` value.
|
|
128
128
|
function enableBorderProperties( schema, conversion, defaultBorder ) {
|
|
129
|
+
const modelAttributes = {
|
|
130
|
+
width: 'tableBorderWidth',
|
|
131
|
+
color: 'tableBorderColor',
|
|
132
|
+
style: 'tableBorderStyle'
|
|
133
|
+
};
|
|
134
|
+
|
|
129
135
|
schema.extend( 'table', {
|
|
130
|
-
allowAttributes:
|
|
136
|
+
allowAttributes: Object.values( modelAttributes )
|
|
131
137
|
} );
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
downcastTableAttribute( conversion, { modelAttribute:
|
|
138
|
+
|
|
139
|
+
upcastBorderStyles( conversion, 'table', modelAttributes, defaultBorder );
|
|
140
|
+
|
|
141
|
+
downcastTableAttribute( conversion, { modelAttribute: modelAttributes.color, styleName: 'border-color' } );
|
|
142
|
+
downcastTableAttribute( conversion, { modelAttribute: modelAttributes.style, styleName: 'border-style' } );
|
|
143
|
+
downcastTableAttribute( conversion, { modelAttribute: modelAttributes.width, styleName: 'border-width' } );
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
// Enables the `'alignment'` attribute for table.
|
|
@@ -142,14 +150,14 @@ function enableBorderProperties( schema, conversion, defaultBorder ) {
|
|
|
142
150
|
// @param {String} defaultValue The default alignment value.
|
|
143
151
|
function enableAlignmentProperty( schema, conversion, defaultValue ) {
|
|
144
152
|
schema.extend( 'table', {
|
|
145
|
-
allowAttributes: [ '
|
|
153
|
+
allowAttributes: [ 'tableAlignment' ]
|
|
146
154
|
} );
|
|
147
155
|
|
|
148
156
|
conversion.for( 'downcast' )
|
|
149
157
|
.attributeToAttribute( {
|
|
150
158
|
model: {
|
|
151
159
|
name: 'table',
|
|
152
|
-
key: '
|
|
160
|
+
key: 'tableAlignment'
|
|
153
161
|
},
|
|
154
162
|
view: alignment => ( {
|
|
155
163
|
key: 'style',
|
|
@@ -171,7 +179,7 @@ function enableAlignmentProperty( schema, conversion, defaultValue ) {
|
|
|
171
179
|
}
|
|
172
180
|
},
|
|
173
181
|
model: {
|
|
174
|
-
key: '
|
|
182
|
+
key: 'tableAlignment',
|
|
175
183
|
value: viewElement => {
|
|
176
184
|
let align = viewElement.getStyle( 'float' );
|
|
177
185
|
|
|
@@ -193,7 +201,7 @@ function enableAlignmentProperty( schema, conversion, defaultValue ) {
|
|
|
193
201
|
},
|
|
194
202
|
model: {
|
|
195
203
|
name: 'table',
|
|
196
|
-
key: '
|
|
204
|
+
key: 'tableAlignment',
|
|
197
205
|
value: viewElement => {
|
|
198
206
|
const align = viewElement.getAttribute( 'align' );
|
|
199
207
|
|
|
@@ -379,6 +379,16 @@ export default class TablePropertiesView extends View {
|
|
|
379
379
|
this.keystrokes.listenTo( this.element );
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
+
/**
|
|
383
|
+
* @inheritDoc
|
|
384
|
+
*/
|
|
385
|
+
destroy() {
|
|
386
|
+
super.destroy();
|
|
387
|
+
|
|
388
|
+
this.focusTracker.destroy();
|
|
389
|
+
this.keystrokes.destroy();
|
|
390
|
+
}
|
|
391
|
+
|
|
382
392
|
/**
|
|
383
393
|
* Focuses the fist focusable field in the form.
|
|
384
394
|
*/
|