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

getSiblingListItem() handles the direction where to looking for a list item.

Kamil Piechaczek 5 лет назад
Родитель
Сommit
bf9935158e
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      packages/ckeditor5-list/src/utils.js

+ 6 - 1
packages/ckeditor5-list/src/utils.js

@@ -207,6 +207,7 @@ export function positionAfterUiElements( viewPosition ) {
  * @param {Boolean} [options.sameIndent=false] Whether the sought sibling should have the same indentation.
  * @param {Boolean} [options.smallerIndent=false] Whether the sought sibling should have a smaller indentation.
  * @param {Number} [options.listIndent] The reference indentation.
+ * @param {'forward'|'backward'} [options.direction='backward'] Walking direction.
  * @returns {module:engine/model/item~Item|null}
  */
 export function getSiblingListItem( modelItem, options ) {
@@ -223,7 +224,11 @@ export function getSiblingListItem( modelItem, options ) {
 			return item;
 		}
 
-		item = item.previousSibling;
+		if ( options.direction === 'forward' ) {
+			item = item.nextSibling;
+		} else {
+			item = item.previousSibling;
+		}
 	}
 
 	return null;