Skip to content

Commit

Permalink
Fix (table): Improve compability of PlainTableOutput and TableColumnR…
Browse files Browse the repository at this point in the history
…esize plugins
  • Loading branch information
filipsobol committed Jan 12, 2023
1 parent 672f45d commit c8e07c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/ckeditor5-table/src/tablecolumnresize/converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ export function downcastTableColumnWidthsAttribute() {
return dispatcher => dispatcher.on( 'attribute:columnWidths:table', ( evt, data, conversionApi ) => {
const viewWriter = conversionApi.writer;
const modelTable = data.item;
const viewElement = conversionApi.mapper.toViewElement( modelTable );

const viewTable = [ ...conversionApi.mapper.toViewElement( modelTable ).getChildren() ]
.find( viewChild => viewChild.is( 'element', 'table' ) );
const viewTable = viewElement.is( 'element', 'table' ) ?
viewElement :
Array.from( viewElement.getChildren() ).find( viewChild => viewChild.is( 'element', 'table' ) );

if ( data.attributeNewValue ) {
// If new value is the same as the old, the operation is not applied (see the `writer.setAttributeOnItem()`).
Expand Down

0 comments on commit c8e07c3

Please sign in to comment.