Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge bdc2d0d into 35e70a8
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Apr 8, 2020
2 parents 35e70a8 + bdc2d0d commit efac187
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,30 +649,34 @@ export function modelChangePostFixer( model, writer ) {
return applied;

function _addListToFix( position ) {
const prev = position.nodeBefore;
const previousNode = position.nodeBefore;

if ( !prev || !prev.is( 'listItem' ) ) {
if ( !previousNode || !previousNode.is( 'listItem' ) ) {
const item = position.nodeAfter;

if ( item && item.is( 'listItem' ) ) {
itemToListHead.set( item, item );
}
} else {
let listHead = prev;
let listHead = previousNode;

if ( itemToListHead.has( listHead ) ) {
return;
}

while ( listHead.previousSibling && listHead.previousSibling.is( 'listItem' ) ) {
listHead = listHead.previousSibling;
for (
let previousSibling = listHead.previousSibling;
previousSibling && previousSibling.is( 'listItem' );
previousSibling = listHead.previousSibling
) {
listHead = previousSibling;

if ( itemToListHead.has( listHead ) ) {
return;
}
}

itemToListHead.set( position.nodeBefore, listHead );
itemToListHead.set( previousNode, listHead );
}
}

Expand Down

0 comments on commit efac187

Please sign in to comment.