diff --git a/packages/ckeditor5-paste-from-office/src/filters/list.js b/packages/ckeditor5-paste-from-office/src/filters/list.js index b17575c697f..e282b8bf469 100644 --- a/packages/ckeditor5-paste-from-office/src/filters/list.js +++ b/packages/ckeditor5-paste-from-office/src/filters/list.js @@ -93,7 +93,7 @@ export function unwrapParagraphInListItem( documentFragment, writer ) { // Google Docs allows on single paragraph inside LI. const firstChild = element.getChild( 0 ); - if ( firstChild.is( 'element', 'p' ) ) { + if ( firstChild && firstChild.is( 'element', 'p' ) ) { writer.unwrapElement( firstChild ); } } diff --git a/packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/lists/empty-list-item/input.html b/packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/lists/empty-list-item/input.html new file mode 100644 index 00000000000..9bcac36d077 --- /dev/null +++ b/packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/lists/empty-list-item/input.html @@ -0,0 +1 @@ + diff --git a/packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/lists/empty-list-item/model.html b/packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/lists/empty-list-item/model.html new file mode 100644 index 00000000000..c1d222b3978 --- /dev/null +++ b/packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/lists/empty-list-item/model.html @@ -0,0 +1 @@ +Item 1 \ No newline at end of file diff --git a/packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/lists/index.js b/packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/lists/index.js index 1e9926b3729..eee01a36938 100644 --- a/packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/lists/index.js +++ b/packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/lists/index.js @@ -15,18 +15,23 @@ import repeatedlyNestedListModel from './repeatedly-nested-list/model.html'; import partiallySelected from './partially-selected/input.html'; import partiallySelectedModel from './partially-selected/model.html'; +import emptyListItem from './empty-list-item/input.html'; +import emptyListItemModel from './empty-list-item/model.html'; + export const fixtures = { input: { nestedOrderedList, mixedList, repeatedlyNestedList, - partiallySelected + partiallySelected, + emptyListItem }, model: { nestedOrderedList: nestedOrderedListModel, mixedList: mixedListModel, repeatedlyNestedList: repeatedlyNestedListModel, - partiallySelected: partiallySelectedModel + partiallySelected: partiallySelectedModel, + emptyListItem: emptyListItemModel } };