@@ -307,7 +307,9 @@ export function downcastRemoveRow() {
307307 } , { priority : 'higher' } ) ;
308308}
309309
310- // Renames a table cell in the view to a given element name.
310+ // Renames an existing table cell in the view to a given element name.
311+ //
312+ // **Note** This method will not do anything if a view table cell was not yet converted.
311313//
312314// @param {module:engine/model/element~Element } tableCell
313315// @param {String } desiredCellElementName
@@ -316,6 +318,11 @@ export function downcastRemoveRow() {
316318function renameViewTableCell ( tableCell , desiredCellElementName , conversionApi , asWidget ) {
317319 const viewCell = conversionApi . mapper . toViewElement ( tableCell ) ;
318320
321+ // View cell might be not yet converted - skip it as it will be properly created by cell converter later on.
322+ if ( ! viewCell ) {
323+ return ;
324+ }
325+
319326 let renamedCell ;
320327
321328 if ( asWidget ) {
@@ -486,6 +493,8 @@ function removeTableSectionIfEmpty( sectionName, tableElement, conversionApi ) {
486493
487494// Moves view table rows associated with passed model rows to the provided table section element.
488495//
496+ // **Note** This method will skip not converted table rows.
497+ //
489498// @param {Array.<module:engine/model/element~Element> } rowsToMove
490499// @param {module:engine/view/element~Element } viewTableSection
491500// @param {Object } conversionApi
@@ -494,7 +503,10 @@ function moveViewRowsToTableSection( rowsToMove, viewTableSection, conversionApi
494503 for ( const tableRow of rowsToMove ) {
495504 const viewTableRow = conversionApi . mapper . toViewElement ( tableRow ) ;
496505
497- conversionApi . writer . move ( ViewRange . createOn ( viewTableRow ) , ViewPosition . createAt ( viewTableSection , offset ) ) ;
506+ // View table row might be not yet converted - skip it as it will be properly created by cell converter later on.
507+ if ( viewTableRow ) {
508+ conversionApi . writer . move ( ViewRange . createOn ( viewTableRow ) , ViewPosition . createAt ( viewTableSection , offset ) ) ;
509+ }
498510 }
499511}
500512
0 commit comments