Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/ckeditor5-paste-from-office/src/filters/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,11 @@ function isListContinuation( currentItem: ListLikeElement ) {
const previousSibling = currentItem.element.previousSibling;

if ( !previousSibling ) {
const parent = currentItem.element.parent as ViewElement;

// If it's a li inside ul or ol like in here: https://github.com/ckeditor/ckeditor5/issues/15964.
return isList( currentItem.element.parent as ViewElement );
// If the parent has previous sibling, which is not a list, then it is not a continuation.
return isList( parent ) && ( !parent.previousSibling || isList( parent.previousSibling ) );
}

// Even with the same id the list does not have to be continuous (#43).
Expand Down
12 changes: 9 additions & 3 deletions packages/ckeditor5-paste-from-office/tests/_data/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import styledAnchor from './styled-anchor/input.word2016.html';
import multiBlock from './multi-block/input.word.html';
import mixedElements from './mixed-elements/input.word.html';
import multiBlockBlockAfter from './multi-block-block-after/input.word.html';
import listContinuation from './list-continuation/input.word2016.html';

import simpleNormalized from './simple/normalized.word2016.html';
import styledNormalized from './styled/normalized.word2016.html';
Expand All @@ -39,6 +40,7 @@ import styledAnchorNormalized from './styled-anchor/normalized.word2016.html';
import multiBlockNormalized from './multi-block/normalized.word.html';
import mixedElementsNormalized from './mixed-elements/normalized.word.html';
import multiBlockBlockAfterNormalized from './multi-block-block-after/normalized.word.html';
import listContinuationNormalized from './list-continuation/normalized.word2016.html';

import simpleModel from './simple/model.word2016.html';
import styledModel from './styled/model.word2016.html';
Expand All @@ -57,6 +59,7 @@ import styledAnchorModel from './styled-anchor/model.word2016.html';
import multiBlockModel from './multi-block/model.word.html';
import mixedElementsModel from './mixed-elements/model.word.html';
import multiBlockBlockAfterModel from './multi-block-block-after/model.word.html';
import listContinuationModel from './list-continuation/model.word2016.html';

export const fixtures = {
input: {
Expand All @@ -76,7 +79,8 @@ export const fixtures = {
styledAnchor,
multiBlock,
mixedElements,
multiBlockBlockAfter
multiBlockBlockAfter,
listContinuation
},
normalized: {
simple: simpleNormalized,
Expand All @@ -95,7 +99,8 @@ export const fixtures = {
styledAnchor: styledAnchorNormalized,
multiBlock: multiBlockNormalized,
mixedElements: mixedElementsNormalized,
multiBlockBlockAfter: multiBlockBlockAfterNormalized
multiBlockBlockAfter: multiBlockBlockAfterNormalized,
listContinuation: listContinuationNormalized
},
model: {
simple: simpleModel,
Expand All @@ -114,7 +119,8 @@ export const fixtures = {
styledAnchor: styledAnchorModel,
multiBlock: multiBlockModel,
mixedElements: mixedElementsModel,
multiBlockBlockAfter: multiBlockBlockAfterModel
multiBlockBlockAfter: multiBlockBlockAfterModel,
listContinuation: listContinuationModel
}
};

Expand Down
Loading