8
0
Просмотр исходного кода

Minor refactor – simplified the condition.

Piotrek Koszuliński 7 лет назад
Родитель
Сommit
3f91f08d43
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      packages/ckeditor5-paste-from-office/src/filters/list.js

+ 5 - 1
packages/ckeditor5-paste-from-office/src/filters/list.js

@@ -223,6 +223,10 @@ function isNewListNeeded( previousItem, currentItem ) {
 
 	const previousSibling = currentItem.element.previousSibling;
 
+	if ( !previousSibling ) {
+		return true;
+	}
+
 	// Even with the same id the list does not have to by continuous one (#43).
-	return !( previousSibling && ( previousSibling.is( 'element', 'ul' ) || previousSibling.is( 'element', 'ol' ) ) );
+	return !previousSibling.is( 'element', 'ul' ) && !previousSibling.is( 'element', 'ol' );
 }