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

Update selection.getTopMostBlocks() documentation.

Maciej Gołaszewski 7 лет назад
Родитель
Сommit
6b5f9b7306

+ 19 - 3
packages/ckeditor5-engine/src/model/documentselection.js

@@ -247,14 +247,30 @@ export default class DocumentSelection {
 	 *		<paragraph>b</paragraph>
 	 *		<paragraph>]c</paragraph> // this block will not be returned
 	 *
-	 * @returns {Iterator.<module:engine/model/element~Element>}
+	 * @returns {Iterable.<module:engine/model/element~Element>}
 	 */
 	getSelectedBlocks() {
 		return this._selection.getSelectedBlocks();
 	}
 
-	getTopMostBlocks( schema ) {
-		return this._selection.getTopMostBlocks( schema );
+	/**
+	 * Returns blocks that aren't nested in other selected blocks.
+	 *
+	 * In this case the method will return blocks A, B and E because C & D are children of block B:
+	 *
+	 *		[<blockA></blockA>
+	 *		<blockB>
+	 *			<blockC></blockC>
+	 *			<blockD></blockD>
+	 *		</blockB>
+	 *		<blockE></blockE>]
+	 *
+	 * **Note:** To get all selected blocks use {@link #getSelectedBlocks `getSelectedBlocks()`}.
+	 *
+	 * @returns {Iterable.<module:engine/model/element~Element>}
+	 */
+	getTopMostBlocks() {
+		return this._selection.getTopMostBlocks();
 	}
 
 	/**

+ 4 - 2
packages/ckeditor5-engine/src/model/selection.js

@@ -675,7 +675,7 @@ export default class Selection {
 	/**
 	 * Returns blocks that aren't nested in other selected blocks.
 	 *
-	 * In this case the method will return blocks A, B and C:
+	 * In this case the method will return blocks A, B and E because C & D are children of block B:
 	 *
 	 *		[<blockA></blockA>
 	 *		<blockB>
@@ -684,7 +684,9 @@ export default class Selection {
 	 *		</blockB>
 	 *		<blockE></blockE>]
 	 *
-	 * @returns {Iterator.<module:engine/model/element~Element>}
+	 * **Note:** To get all selected blocks use {@link #getSelectedBlocks `getSelectedBlocks()`}.
+	 *
+	 * @returns {Iterable.<module:engine/model/element~Element>}
 	 */
 	* getTopMostBlocks() {
 		for ( const block of this.getSelectedBlocks() ) {