diff --git a/packages/ckeditor5-paste-from-office/src/filters/list.ts b/packages/ckeditor5-paste-from-office/src/filters/list.ts index 69f37163770..508cd92ca6f 100644 --- a/packages/ckeditor5-paste-from-office/src/filters/list.ts +++ b/packages/ckeditor5-paste-from-office/src/filters/list.ts @@ -261,7 +261,11 @@ function findListMarkerNode( element: ViewElement ): ViewText | null { continue; } - const textNodeOrElement = childNode.getChild( 0 )!; + const textNodeOrElement = childNode.getChild( 0 ); + + if ( !textNodeOrElement ) { + continue; + } // If already found the marker element, use it. if ( textNodeOrElement.is( '$text' ) ) { diff --git a/packages/ckeditor5-paste-from-office/tests/filters/list.js b/packages/ckeditor5-paste-from-office/tests/filters/list.js index aa26890e371..78df3087e38 100644 --- a/packages/ckeditor5-paste-from-office/tests/filters/list.js +++ b/packages/ckeditor5-paste-from-office/tests/filters/list.js @@ -82,6 +82,28 @@ describe( 'PasteFromOffice - filters', () => { expect( stringify( view ) ).to.equal( '' ); } ); + it( 'handles RTL lists with bold item - #13711', () => { + const html = '

' + + '' + + 'Foo' + + '

'; + + const view = htmlDataProcessor.toView( html ); + + transformListItemLikeElementsIntoLists( view, '@list l0:level1 { mso-level-number-format: bullet; }' ); + + expect( view.childCount ).to.equal( 1 ); + expect( view.getChild( 0 ).name ).to.equal( 'ul' ); + expect( stringify( view ) ).to.equal( + '' + ); + } ); + describe( 'nesting', () => { const level1 = 'style="mso-list:l0 level1 lfo0"'; const level2 = 'style="mso-list:l0 level2 lfo0"';