Преглед на файлове

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

Kamil Piechaczek преди 5 години
родител
ревизия
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;