@ckeditor/ckeditor5-table 35.4.0 → 36.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/build/table.js +2 -2
- package/package.json +26 -26
- package/src/commands/insertcolumncommand.js +1 -1
- package/src/commands/insertrowcommand.js +1 -1
- package/src/commands/inserttablecommand.js +1 -1
- package/src/commands/mergecellcommand.js +1 -1
- package/src/commands/mergecellscommand.js +1 -1
- package/src/commands/removecolumncommand.js +1 -1
- package/src/commands/removerowcommand.js +1 -1
- package/src/commands/selectcolumncommand.js +1 -1
- package/src/commands/selectrowcommand.js +1 -1
- package/src/commands/setheadercolumncommand.js +1 -1
- package/src/commands/setheaderrowcommand.js +1 -1
- package/src/commands/splitcellcommand.js +1 -1
- package/src/converters/downcast.js +8 -5
- package/src/converters/table-caption-post-fixer.js +1 -1
- package/src/converters/table-cell-paragraph-post-fixer.js +1 -1
- package/src/converters/table-cell-refresh-handler.js +1 -1
- package/src/converters/table-headings-refresh-handler.js +1 -1
- package/src/converters/table-layout-post-fixer.js +1 -1
- package/src/converters/tableproperties.js +1 -1
- package/src/converters/upcasttable.js +20 -5
- package/src/index.js +1 -1
- package/src/plaintableoutput.js +1 -1
- package/src/table.js +1 -1
- package/src/tablecaption/tablecaptionediting.js +1 -1
- package/src/tablecaption/tablecaptionui.js +1 -1
- package/src/tablecaption/toggletablecaptioncommand.js +1 -1
- package/src/tablecaption/utils.js +1 -1
- package/src/tablecaption.js +1 -1
- 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/tablecellpropertycommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js +1 -1
- package/src/tablecellproperties/tablecellpropertiesediting.js +1 -1
- package/src/tablecellproperties/tablecellpropertiesui.js +53 -32
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +1 -1
- package/src/tablecellproperties.js +1 -1
- package/src/tablecellwidth/commands/tablecellwidthcommand.js +1 -1
- package/src/tablecellwidth/tablecellwidthediting.js +1 -1
- package/src/tableclipboard.js +1 -1
- package/src/tablecolumnresize/constants.js +1 -1
- package/src/tablecolumnresize/converters.js +5 -3
- package/src/tablecolumnresize/tablecolumnresizeediting.js +13 -15
- package/src/tablecolumnresize/tablecolumnwidthscommand.js +1 -1
- package/src/tablecolumnresize/tablewidthresizecommand.js +1 -1
- package/src/tablecolumnresize/utils.js +1 -25
- package/src/tablecolumnresize.js +1 -1
- package/src/tableediting.js +1 -40
- package/src/tablekeyboard.js +1 -1
- package/src/tablemouse/mouseeventsobserver.js +1 -1
- package/src/tablemouse.js +1 -1
- 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/tablepropertycommand.js +1 -1
- package/src/tableproperties/commands/tablewidthcommand.js +1 -1
- package/src/tableproperties/tablepropertiesediting.js +1 -1
- package/src/tableproperties/tablepropertiesui.js +32 -17
- package/src/tableproperties/ui/tablepropertiesview.js +1 -1
- package/src/tableproperties.js +1 -1
- package/src/tableselection.js +1 -1
- package/src/tabletoolbar.js +1 -1
- package/src/tableui.js +2 -2
- package/src/tableutils.js +1 -1
- package/src/tablewalker.js +1 -1
- package/src/ui/colorinputview.js +1 -1
- package/src/ui/formrowview.js +1 -1
- package/src/ui/inserttableview.js +1 -1
- package/src/utils/common.js +1 -1
- package/src/utils/structure.js +1 -1
- package/src/utils/table-properties.js +1 -1
- package/src/utils/ui/contextualballoon.js +1 -1
- package/src/utils/ui/table-properties.js +1 -1
- package/src/utils/ui/widget.js +1 -1
- package/theme/colorinput.css +1 -1
- package/theme/form.css +1 -1
- package/theme/formrow.css +1 -1
- package/theme/inserttable.css +1 -1
- package/theme/table.css +1 -1
- package/theme/tablecaption.css +1 -1
- package/theme/tablecellproperties.css +1 -1
- package/theme/tablecolumnresize.css +1 -1
- package/theme/tableediting.css +1 -1
- package/theme/tableform.css +1 -1
- package/theme/tableproperties.css +1 -1
- package/theme/tableselection.css +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "36.0.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": "^
|
|
15
|
+
"ckeditor5": "^36.0.0",
|
|
16
16
|
"lodash-es": "^4.17.15"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@ckeditor/ckeditor5-alignment": "^
|
|
20
|
-
"@ckeditor/ckeditor5-basic-styles": "^
|
|
21
|
-
"@ckeditor/ckeditor5-block-quote": "^
|
|
22
|
-
"@ckeditor/ckeditor5-clipboard": "^
|
|
23
|
-
"@ckeditor/ckeditor5-core": "^
|
|
24
|
-
"@ckeditor/ckeditor5-dev-utils": "^
|
|
25
|
-
"@ckeditor/ckeditor5-editor-classic": "^
|
|
26
|
-
"@ckeditor/ckeditor5-engine": "^
|
|
27
|
-
"@ckeditor/ckeditor5-highlight": "^
|
|
28
|
-
"@ckeditor/ckeditor5-horizontal-line": "^
|
|
29
|
-
"@ckeditor/ckeditor5-html-support": "^
|
|
30
|
-
"@ckeditor/ckeditor5-image": "^
|
|
31
|
-
"@ckeditor/ckeditor5-indent": "^
|
|
32
|
-
"@ckeditor/ckeditor5-link": "^
|
|
33
|
-
"@ckeditor/ckeditor5-list": "^
|
|
34
|
-
"@ckeditor/ckeditor5-media-embed": "^
|
|
35
|
-
"@ckeditor/ckeditor5-paragraph": "^
|
|
36
|
-
"@ckeditor/ckeditor5-theme-lark": "^
|
|
37
|
-
"@ckeditor/ckeditor5-typing": "^
|
|
38
|
-
"@ckeditor/ckeditor5-ui": "^
|
|
39
|
-
"@ckeditor/ckeditor5-undo": "^
|
|
40
|
-
"@ckeditor/ckeditor5-utils": "^
|
|
41
|
-
"@ckeditor/ckeditor5-widget": "^
|
|
42
|
-
"@ckeditor/ckeditor5-source-editing": "^
|
|
19
|
+
"@ckeditor/ckeditor5-alignment": "^36.0.0",
|
|
20
|
+
"@ckeditor/ckeditor5-basic-styles": "^36.0.0",
|
|
21
|
+
"@ckeditor/ckeditor5-block-quote": "^36.0.0",
|
|
22
|
+
"@ckeditor/ckeditor5-clipboard": "^36.0.0",
|
|
23
|
+
"@ckeditor/ckeditor5-core": "^36.0.0",
|
|
24
|
+
"@ckeditor/ckeditor5-dev-utils": "^32.0.0",
|
|
25
|
+
"@ckeditor/ckeditor5-editor-classic": "^36.0.0",
|
|
26
|
+
"@ckeditor/ckeditor5-engine": "^36.0.0",
|
|
27
|
+
"@ckeditor/ckeditor5-highlight": "^36.0.0",
|
|
28
|
+
"@ckeditor/ckeditor5-horizontal-line": "^36.0.0",
|
|
29
|
+
"@ckeditor/ckeditor5-html-support": "^36.0.0",
|
|
30
|
+
"@ckeditor/ckeditor5-image": "^36.0.0",
|
|
31
|
+
"@ckeditor/ckeditor5-indent": "^36.0.0",
|
|
32
|
+
"@ckeditor/ckeditor5-link": "^36.0.0",
|
|
33
|
+
"@ckeditor/ckeditor5-list": "^36.0.0",
|
|
34
|
+
"@ckeditor/ckeditor5-media-embed": "^36.0.0",
|
|
35
|
+
"@ckeditor/ckeditor5-paragraph": "^36.0.0",
|
|
36
|
+
"@ckeditor/ckeditor5-theme-lark": "^36.0.0",
|
|
37
|
+
"@ckeditor/ckeditor5-typing": "^36.0.0",
|
|
38
|
+
"@ckeditor/ckeditor5-ui": "^36.0.0",
|
|
39
|
+
"@ckeditor/ckeditor5-undo": "^36.0.0",
|
|
40
|
+
"@ckeditor/ckeditor5-utils": "^36.0.0",
|
|
41
|
+
"@ckeditor/ckeditor5-widget": "^36.0.0",
|
|
42
|
+
"@ckeditor/ckeditor5-source-editing": "^36.0.0",
|
|
43
43
|
"json-diff": "^0.5.4",
|
|
44
44
|
"webpack": "^5.58.1",
|
|
45
45
|
"webpack-cli": "^4.9.0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -114,7 +114,7 @@ export function downcastCell( options = {} ) {
|
|
|
114
114
|
* @returns {Function} Element creator.
|
|
115
115
|
*/
|
|
116
116
|
export function convertParagraphInTableCell( options = {} ) {
|
|
117
|
-
return ( modelElement, { writer
|
|
117
|
+
return ( modelElement, { writer } ) => {
|
|
118
118
|
if ( !modelElement.parent.is( 'element', 'tableCell' ) ) {
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
@@ -126,9 +126,12 @@ export function convertParagraphInTableCell( options = {} ) {
|
|
|
126
126
|
if ( options.asWidget ) {
|
|
127
127
|
return writer.createContainerElement( 'span', { class: 'ck-table-bogus-paragraph' } );
|
|
128
128
|
} else {
|
|
129
|
-
//
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
// Using `<p>` in case there are some markers on it and transparentRendering will render it anyway.
|
|
130
|
+
const viewElement = writer.createContainerElement( 'p' );
|
|
131
|
+
|
|
132
|
+
writer.setCustomProperty( 'dataPipeline:transparentRendering', true, viewElement );
|
|
133
|
+
|
|
134
|
+
return viewElement;
|
|
132
135
|
}
|
|
133
136
|
};
|
|
134
137
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -146,18 +146,33 @@ export function skipEmptyTableRow() {
|
|
|
146
146
|
*/
|
|
147
147
|
export function ensureParagraphInTableCell( elementName ) {
|
|
148
148
|
return dispatcher => {
|
|
149
|
-
dispatcher.on( `element:${ elementName }`, ( evt, data,
|
|
149
|
+
dispatcher.on( `element:${ elementName }`, ( evt, data, { writer } ) => {
|
|
150
150
|
// The default converter will create a model range on converted table cell.
|
|
151
151
|
if ( !data.modelRange ) {
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
const tableCell = data.modelRange.start.nodeAfter;
|
|
156
|
+
const modelCursor = writer.createPositionAt( tableCell, 0 );
|
|
157
|
+
|
|
155
158
|
// Ensure a paragraph in the model for empty table cells for converted table cells.
|
|
156
159
|
if ( data.viewItem.isEmpty ) {
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
writer.insertElement( 'paragraph', modelCursor );
|
|
161
|
+
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
159
164
|
|
|
160
|
-
|
|
165
|
+
const childNodes = Array.from( tableCell.getChildren() );
|
|
166
|
+
|
|
167
|
+
// In case there are only markers inside the table cell then move them to the paragraph.
|
|
168
|
+
if ( childNodes.every( node => node.is( 'element', '$marker' ) ) ) {
|
|
169
|
+
const paragraph = writer.createElement( 'paragraph' );
|
|
170
|
+
|
|
171
|
+
writer.insert( paragraph, writer.createPositionAt( tableCell, 0 ) );
|
|
172
|
+
|
|
173
|
+
for ( const node of childNodes ) {
|
|
174
|
+
writer.move( writer.createRangeOn( node ), writer.createPositionAt( paragraph, 'end' ) );
|
|
175
|
+
}
|
|
161
176
|
}
|
|
162
177
|
}, { priority: 'low' } );
|
|
163
178
|
};
|
package/src/index.js
CHANGED
package/src/plaintableoutput.js
CHANGED
package/src/table.js
CHANGED
package/src/tablecaption.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -113,7 +113,7 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
113
113
|
*
|
|
114
114
|
* @member {module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView}
|
|
115
115
|
*/
|
|
116
|
-
this.view =
|
|
116
|
+
this.view = null;
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* The batch used to undo all changes made by the form (which are live, as the user types)
|
|
@@ -124,6 +124,15 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
124
124
|
*/
|
|
125
125
|
this._undoStepBatch = null;
|
|
126
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Flag used to indicate whether view is ready to execute update commands
|
|
129
|
+
* (it finished loading initial data).
|
|
130
|
+
*
|
|
131
|
+
* @private
|
|
132
|
+
* @member {Boolean}
|
|
133
|
+
*/
|
|
134
|
+
this._isReady = false;
|
|
135
|
+
|
|
127
136
|
editor.ui.componentFactory.add( 'tableCellProperties', locale => {
|
|
128
137
|
const view = new ButtonView( locale );
|
|
129
138
|
|
|
@@ -154,7 +163,9 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
154
163
|
|
|
155
164
|
// Destroy created UI components as they are not automatically destroyed.
|
|
156
165
|
// See https://github.com/ckeditor/ckeditor5/issues/1341.
|
|
157
|
-
this.view
|
|
166
|
+
if ( this.view ) {
|
|
167
|
+
this.view.destroy();
|
|
168
|
+
}
|
|
158
169
|
}
|
|
159
170
|
|
|
160
171
|
/**
|
|
@@ -166,12 +177,12 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
166
177
|
*/
|
|
167
178
|
_createPropertiesView() {
|
|
168
179
|
const editor = this.editor;
|
|
169
|
-
const viewDocument = editor.editing.view.document;
|
|
170
180
|
const config = editor.config.get( 'table.tableCellProperties' );
|
|
171
181
|
const borderColorsConfig = normalizeColorOptions( config.borderColors );
|
|
172
182
|
const localizedBorderColors = getLocalizedColorOptions( editor.locale, borderColorsConfig );
|
|
173
183
|
const backgroundColorsConfig = normalizeColorOptions( config.backgroundColors );
|
|
174
184
|
const localizedBackgroundColors = getLocalizedColorOptions( editor.locale, backgroundColorsConfig );
|
|
185
|
+
|
|
175
186
|
const view = new TableCellPropertiesView( editor.locale, {
|
|
176
187
|
borderColors: localizedBorderColors,
|
|
177
188
|
backgroundColors: localizedBackgroundColors,
|
|
@@ -201,15 +212,6 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
201
212
|
cancel();
|
|
202
213
|
} );
|
|
203
214
|
|
|
204
|
-
// Reposition the balloon or hide the form if a table cell is no longer selected.
|
|
205
|
-
this.listenTo( editor.ui, 'update', () => {
|
|
206
|
-
if ( !getTableWidgetAncestor( viewDocument.selection ) ) {
|
|
207
|
-
this._hideView();
|
|
208
|
-
} else if ( this._isViewVisible ) {
|
|
209
|
-
repositionContextualBalloon( editor, 'cell' );
|
|
210
|
-
}
|
|
211
|
-
} );
|
|
212
|
-
|
|
213
215
|
// Close on click outside of balloon panel element.
|
|
214
216
|
clickOutsideHandler( {
|
|
215
217
|
emitter: view,
|
|
@@ -319,6 +321,8 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
319
321
|
|
|
320
322
|
this.view.set( property, value );
|
|
321
323
|
} );
|
|
324
|
+
|
|
325
|
+
this._isReady = true;
|
|
322
326
|
}
|
|
323
327
|
|
|
324
328
|
/**
|
|
@@ -333,6 +337,14 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
333
337
|
_showView() {
|
|
334
338
|
const editor = this.editor;
|
|
335
339
|
|
|
340
|
+
if ( !this.view ) {
|
|
341
|
+
this.view = this._createPropertiesView();
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
this.listenTo( editor.ui, 'update', () => {
|
|
345
|
+
this._updateView();
|
|
346
|
+
} );
|
|
347
|
+
|
|
336
348
|
// Update the view with the model values.
|
|
337
349
|
this._fillViewFormFromCommandValues();
|
|
338
350
|
|
|
@@ -354,14 +366,12 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
354
366
|
* @protected
|
|
355
367
|
*/
|
|
356
368
|
_hideView() {
|
|
357
|
-
if ( !this._isViewInBalloon ) {
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
369
|
const editor = this.editor;
|
|
362
370
|
|
|
363
371
|
this.stopListening( editor.ui, 'update' );
|
|
364
372
|
|
|
373
|
+
this._isReady = false;
|
|
374
|
+
|
|
365
375
|
// Blur any input element before removing it from DOM to prevent issues in some browsers.
|
|
366
376
|
// See https://github.com/ckeditor/ckeditor5/issues/1501.
|
|
367
377
|
this.view.saveButtonView.focus();
|
|
@@ -373,6 +383,22 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
373
383
|
this.editor.editing.view.focus();
|
|
374
384
|
}
|
|
375
385
|
|
|
386
|
+
/**
|
|
387
|
+
* Repositions the {@link #_balloon} or hides the {@link #view} if a table cell is no longer selected.
|
|
388
|
+
*
|
|
389
|
+
* @protected
|
|
390
|
+
*/
|
|
391
|
+
_updateView() {
|
|
392
|
+
const editor = this.editor;
|
|
393
|
+
const viewDocument = editor.editing.view.document;
|
|
394
|
+
|
|
395
|
+
if ( !getTableWidgetAncestor( viewDocument.selection ) ) {
|
|
396
|
+
this._hideView();
|
|
397
|
+
} else if ( this._isViewVisible ) {
|
|
398
|
+
repositionContextualBalloon( editor, 'cell' );
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
376
402
|
/**
|
|
377
403
|
* Returns `true` when the {@link #view} is visible in the {@link #_balloon}.
|
|
378
404
|
*
|
|
@@ -380,7 +406,7 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
380
406
|
* @type {Boolean}
|
|
381
407
|
*/
|
|
382
408
|
get _isViewVisible() {
|
|
383
|
-
return this._balloon.visibleView === this.view;
|
|
409
|
+
return !!this.view && this._balloon.visibleView === this.view;
|
|
384
410
|
}
|
|
385
411
|
|
|
386
412
|
/**
|
|
@@ -390,7 +416,7 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
390
416
|
* @type {Boolean}
|
|
391
417
|
*/
|
|
392
418
|
get _isViewInBalloon() {
|
|
393
|
-
return this._balloon.hasView( this.view );
|
|
419
|
+
return !!this.view && this._balloon.hasView( this.view );
|
|
394
420
|
}
|
|
395
421
|
|
|
396
422
|
/**
|
|
@@ -399,14 +425,12 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
399
425
|
*
|
|
400
426
|
* @private
|
|
401
427
|
* @param {String} commandName
|
|
402
|
-
* @param {String} defaultValue The default value of the command.
|
|
403
428
|
* @returns {Function}
|
|
404
429
|
*/
|
|
405
|
-
_getPropertyChangeCallback( commandName
|
|
406
|
-
return ( evt, propertyName, newValue
|
|
407
|
-
//
|
|
408
|
-
|
|
409
|
-
if ( !oldValue && defaultValue === newValue ) {
|
|
430
|
+
_getPropertyChangeCallback( commandName ) {
|
|
431
|
+
return ( evt, propertyName, newValue ) => {
|
|
432
|
+
// Do not execute the command on initial call (opening the table properties view).
|
|
433
|
+
if ( !this._isReady ) {
|
|
410
434
|
return;
|
|
411
435
|
}
|
|
412
436
|
|
|
@@ -428,21 +452,18 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
428
452
|
* @param {module:ui/view~View} options.viewField
|
|
429
453
|
* @param {Function} options.validator
|
|
430
454
|
* @param {String} options.errorText
|
|
431
|
-
* @param {String} options.defaultValue
|
|
432
455
|
* @returns {Function}
|
|
433
456
|
*/
|
|
434
457
|
_getValidatedPropertyChangeCallback( options ) {
|
|
435
|
-
const { commandName, viewField, validator, errorText
|
|
458
|
+
const { commandName, viewField, validator, errorText } = options;
|
|
436
459
|
const setErrorTextDebounced = debounce( () => {
|
|
437
460
|
viewField.errorText = errorText;
|
|
438
461
|
}, ERROR_TEXT_TIMEOUT );
|
|
439
462
|
|
|
440
|
-
return ( evt, propertyName, newValue
|
|
463
|
+
return ( evt, propertyName, newValue ) => {
|
|
441
464
|
setErrorTextDebounced.cancel();
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
// It is an initial call (when opening the table properties view).
|
|
445
|
-
if ( !oldValue && defaultValue === newValue ) {
|
|
465
|
+
// Do not execute the command on initial call (opening the table properties view).
|
|
466
|
+
if ( !this._isReady ) {
|
|
446
467
|
return;
|
|
447
468
|
}
|
|
448
469
|
|