Skip to content

Commit

Permalink
Merge pull request #7959 from tomi-bigpi/i/7958
Browse files Browse the repository at this point in the history
Fix (paste-from-office): Fix list paste from Google Docs with an empty item. Closes #7958.
  • Loading branch information
jodator authored Aug 28, 2020
2 parents ef3a8ad + 0ac2ed9 commit ebf6bb7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/ckeditor5-paste-from-office/src/filters/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta charset='utf-8'><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-7f8963f3-7fff-683a-b3de-156ff66d4860"><ul style="margin-top:0;margin-bottom:0;"><li dir="ltr" style="list-style-type:disc;font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Item 1</span></p></li><li dir="ltr" style="list-style-type:disc;font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;"><br /></li></ul></b>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<listItem listIndent="0" listType="bulleted">Item 1</listItem><listItem listIndent="0" listType="bulleted"></listItem>
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
};

Expand Down

0 comments on commit ebf6bb7

Please sign in to comment.