Răsfoiți Sursa

API docses.

Piotrek Koszuliński 9 ani în urmă
părinte
comite
d6c5927eeb
1 a modificat fișierele cu 27 adăugiri și 20 ștergeri
  1. 27 20
      packages/ckeditor5-engine/src/model/treewalker.js

+ 27 - 20
packages/ckeditor5-engine/src/model/treewalker.js

@@ -20,6 +20,7 @@ export default class TreeWalker {
 	/**
 	 * Creates a range iterator. All parameters are optional, but you have to specify either `boundaries` or `startPosition`.
 	 *
+	 * @constructor
 	 * @param {Object} options Object with configuration.
 	 * @param {engine.model.Position} [options.startPosition] Starting position.
 	 * @param {engine.model.Range} [options.boundaries=null] Range to define boundaries of the iterator.
@@ -34,7 +35,6 @@ export default class TreeWalker {
 	 * tags. If the option is true walker will not return a parent node of start position. If this option is `true`
 	 * each {@link engine.model.Element} will be returned once, while if the option is `false` they might be returned
 	 * twice: for `'ELEMENT_START'` and `'ELEMENT_END'`.
-	 * @constructor
 	 */
 	constructor(
 		{
@@ -70,30 +70,16 @@ export default class TreeWalker {
 		 *
 		 * If boundaries are not defined they are set before first and after last child of the root node.
 		 *
+		 * @readonly
 		 * @member {engine.model.Range} engine.model.TreeWalker#boundaries
 		 */
 		this.boundaries = boundaries;
 
-		/**
-		 * Start boundary cached for optimization purposes.
-		 *
-		 * @private
-		 * @member {engine.model.Element} engine.model.TreeWalker#_boundaryStartParent
-		 */
-		this._boundaryStartParent = this.boundaries ? this.boundaries.start.parent : null;
-
-		/**
-		 * End boundary cached for optimization purposes.
-		 *
-		 * @private
-		 * @member {engine.model.Element} engine.model.TreeWalker#_boundaryEndParent
-		 */
-		this._boundaryEndParent = this.boundaries ? this.boundaries.end.parent : null;
-
 		/**
 		 * Iterator position. This is always static position, even if the initial position was a
 		 * {@link engine.model.LivePosition live position}.
 		 *
+		 * @readonly
 		 * @member {engine.model.Position} engine.model.TreeWalker#position
 		 */
 		if ( startPosition ) {
@@ -105,8 +91,8 @@ export default class TreeWalker {
 		/**
 		 * Walking direction. Defaults `FORWARD`.
 		 *
-		 * @member engine.model.TreeWalker#direction
-		 * @type {'BACKWARD'|'FORWARD'} core.model.TreeWalkerDirection
+		 * @readonly
+		 * @member {'BACKWARD'|'FORWARD'} engine.model.TreeWalker#direction
 		 */
 		this.direction = direction;
 
@@ -114,6 +100,7 @@ export default class TreeWalker {
 		 * Flag indicating whether all consecutive characters with the same attributes should be
 		 * returned as one {@link engine.model.CharacterProxy} (`true`) or one by one (`false`).
 		 *
+		 * @readonly
 		 * @member {Boolean} engine.model.TreeWalker#singleCharacters
 		 */
 		this.singleCharacters = !!singleCharacters;
@@ -122,6 +109,7 @@ export default class TreeWalker {
 		 * Flag indicating whether iterator should enter elements or not. If the iterator is shallow child nodes of any
 		 * iterated node will not be returned along with `ELEMENT_END` tag.
 		 *
+		 * @readonly
 		 * @member {Boolean} engine.model.TreeWalker#shallow
 		 */
 		this.shallow = !!shallow;
@@ -132,10 +120,27 @@ export default class TreeWalker {
 		 * be returned once, while if the option is `false` they might be returned twice:
 		 * for `'ELEMENT_START'` and `'ELEMENT_END'`.
 		 *
+		 * @readonly
 		 * @member {Boolean} engine.model.TreeWalker#ignoreElementEnd
 		 */
 		this.ignoreElementEnd = !!ignoreElementEnd;
 
+		/**
+		 * Start boundary cached for optimization purposes.
+		 *
+		 * @private
+		 * @member {engine.model.Element} engine.model.TreeWalker#_boundaryStartParent
+		 */
+		this._boundaryStartParent = this.boundaries ? this.boundaries.start.parent : null;
+
+		/**
+		 * End boundary cached for optimization purposes.
+		 *
+		 * @private
+		 * @member {engine.model.Element} engine.model.TreeWalker#_boundaryEndParent
+		 */
+		this._boundaryEndParent = this.boundaries ? this.boundaries.end.parent : null;
+
 		/**
 		 * Parent of the most recently visited node. Cached for optimization purposes.
 		 *
@@ -157,7 +162,7 @@ export default class TreeWalker {
 	 * Detects walking direction and makes step forward or backward.
 	 *
 	 * @returns {Object} Object implementing iterator interface, returning information about taken step.
- 	 */
+	 */
 	next() {
 		if ( this.direction == 'FORWARD' ) {
 			return this._next();
@@ -175,6 +180,7 @@ export default class TreeWalker {
 	 * Makes a step forward in model. Moves the {@link #position} to the next position and returns the encountered value.
 	 *
 	 * @private
+	 * @returns {Object}
 	 * @returns {Boolean} return.done True if iterator is done.
 	 * @returns {engine.model.TreeWalkerValue} return.value Information about taken step.
 	 */
@@ -248,6 +254,7 @@ export default class TreeWalker {
 	 * Makes a step backward in model. Moves the {@link #position} to the previous position and returns the encountered value.
 	 *
 	 * @private
+	 * @returns {Object}
 	 * @returns {Boolean} return.done True if iterator is done.
 	 * @returns {core.model.TreeWalkerValue} return.value Information about taken step.
 	 */