Piotrek Koszuliński 10 tahun lalu
induk
melakukan
844054fdaf

+ 1 - 1
packages/ckeditor5-engine/src/document/operation/transform.js

@@ -38,7 +38,7 @@
  * @function document.operation.transform
  * @param {document.operation.Operation} a Operation that will be transformed.
  * @param {document.operation.Operation} b Operation to transform by.
- * @param {Boolean} isStrong Flag indicating whether the operation which will be transformed (`a`) should be treated
+ * @param {Boolean} isAMoreImportantThanB Flag indicating whether the operation which will be transformed (`a`) should be treated
  * as more important when resolving conflicts.
  * @returns {Array.<document.operation.Operation>} Result of the transformation.
  */

+ 15 - 7
packages/ckeditor5-engine/src/document/position.js

@@ -130,8 +130,9 @@ CKEDITOR.define( [ 'document/rootelement', 'utils', 'ckeditorerror' ], ( RootEle
 
 		/**
 		 * Checks whether this position is before given position.
-		 * Attention: watch out when using negation of the value returned by this method, because the negation will also
-		 * be true if positions are in different roots and you might not expect this. You should probably use
+		 *
+		 * **Note:** watch out when using negation of the value returned by this method, because the negation will also
+		 * be `true` if positions are in different roots and you might not expect this. You should probably use
 		 * `a.isAfter( b ) || a.isEqual( b )` or `!a.isBefore( p ) && a.root == b.root` in most scenarios. If your
 		 * condition uses multiple `isAfter` and `isBefore` checks, build them so they do not use negated values, i.e.:
 		 *
@@ -164,7 +165,8 @@ CKEDITOR.define( [ 'document/rootelement', 'utils', 'ckeditorerror' ], ( RootEle
 
 		/**
 		 * Checks whether this position is after given position.
-		 * Attention: see {document.Position#isBefore}.
+		 *
+		 * **Note:** see {document.Position#isBefore}.
 		 *
 		 * @param {document.Position} otherPosition Position to compare with.
 		 * @returns {Boolean} True if this position is after given position.
@@ -186,7 +188,7 @@ CKEDITOR.define( [ 'document/rootelement', 'utils', 'ckeditorerror' ], ( RootEle
 
 		/**
 		 * Creates and returns a new instance of {@link document.Position}
-		 * that is equal to this {@link document.Position position}.
+		 * which is equal to this {@link document.Position position}.
 		 *
 		 * @returns {document.Position} Cloned {@link document.Position position}.
 		 */
@@ -291,7 +293,7 @@ CKEDITOR.define( [ 'document/rootelement', 'utils', 'ckeditorerror' ], ( RootEle
 		 * @param {Number} howMany How many consecutive nodes to move, starting from `sourcePosition`.
 		 * @param {Boolean} insertBefore Flag indicating whether moved nodes are pasted before or after `insertPosition`.
 		 * This is important only when `targetPosition` and this position are same. If that is the case and the flag is
-		 * set to true, this position will get transformed by range insertion. If the flag is set to false, it won't.
+		 * set to `true`, this position will get transformed by range insertion. If the flag is set to `false`, it won't.
 		 * @returns {document.Position} Transformed position.
 		 */
 		getTransformedByMove( sourcePosition, targetPosition, howMany, insertBefore ) {
@@ -320,6 +322,7 @@ CKEDITOR.define( [ 'document/rootelement', 'utils', 'ckeditorerror' ], ( RootEle
 		 * injects `target` path in it's place, while doing necessary fixes in order to get a correct path.
 		 *
 		 * Example:
+		 *
 		 * 	let original = new Position( [ 2, 3, 1 ], root );
 		 * 	let source = new Position( [ 2, 2 ], root );
 		 * 	let target = new Position( [ 1, 1, 3 ], otherRoot );
@@ -327,6 +330,7 @@ CKEDITOR.define( [ 'document/rootelement', 'utils', 'ckeditorerror' ], ( RootEle
 		 * 	// combined.path is [ 1, 1, 4, 1 ], combined.root is otherRoot
 		 *
 		 * Explanation:
+		 *
 		 * We have a position `[ 2, 3, 1 ]` and move some nodes from `[ 2, 2 ]` to `[ 1, 1, 3 ]`. The original position
 		 * was inside moved nodes and now should point to the new place. The moved nodes will be after
 		 * positions `[ 1, 1, 3 ]`, `[ 1, 1, 4 ]`, `[ 1, 1, 5 ]`. Since our position was in the second moved node,
@@ -364,7 +368,7 @@ CKEDITOR.define( [ 'document/rootelement', 'utils', 'ckeditorerror' ], ( RootEle
 		 * @param {Number} howMany How many nodes are inserted.
 		 * @param {Boolean} insertBefore Flag indicating whether nodes are inserted before or after `insertPosition`.
 		 * This is important only when `insertPosition` and this position are same. If that is the case and the flag is
-		 * set to true, this position will get transformed. If the flag is set to false, it won't.
+		 * set to `true`, this position will get transformed. If the flag is set to `false`, it won't.
 		 * @returns {document.Position} Transformed position.
 		 */
 		getTransformedByInsertion( insertPosition, howMany, insertBefore ) {
@@ -402,7 +406,7 @@ CKEDITOR.define( [ 'document/rootelement', 'utils', 'ckeditorerror' ], ( RootEle
 		 *
 		 * @param {document.Position} deletePosition Position before the first removed node.
 		 * @param {Number} howMany How many nodes are removed.
-		 * @returns {document.Position|null} Transformed position or null.
+		 * @returns {document.Position|null} Transformed position or `null`.
 		 */
 		getTransformedByDeletion( deletePosition, howMany ) {
 			let transformed = this.clone();
@@ -446,24 +450,28 @@ CKEDITOR.define( [ 'document/rootelement', 'utils', 'ckeditorerror' ], ( RootEle
 
 	/**
 	 * Flag for "are same" relation between Positions.
+	 *
 	 * @type {Number}
 	 */
 	Position.SAME = SAME;
 
 	/**
 	 * Flag for "is before" relation between Positions.
+	 *
 	 * @type {Number}
 	 */
 	Position.BEFORE = BEFORE;
 
 	/**
 	 * Flag for "is after" relation between Positions.
+	 *
 	 * @type {Number}
 	 */
 	Position.AFTER = AFTER;
 
 	/**
 	 * Flag for "are in different roots" relation between Positions.
+	 *
 	 * @type {Number}
 	 */
 	Position.DIFFERENT = DIFFERENT;

+ 14 - 11
packages/ckeditor5-engine/src/document/range.js

@@ -73,7 +73,7 @@ CKEDITOR.define( [ 'document/position', 'document/positioniterator', 'utils' ],
 
 		/**
 		 * Creates and returns a new instance of {@link document.Range}
-		 * that is equal to this {@link document.Range range}.
+		 * which is equal to this {@link document.Range range}.
 		 *
 		 * @returns {document.Position} Cloned {@link document.Range range}.
 		 */
@@ -82,21 +82,22 @@ CKEDITOR.define( [ 'document/position', 'document/positioniterator', 'utils' ],
 		}
 
 		/**
-		 * Checks whether this {document.Range range} contains given (document.Position position}.
+		 * Checks whether this {document.Range range} contains given {@link document.Position position}.
 		 *
-		 * @param {document.Position} position Position to check.
-		 * @returns {boolean} True if given {document.Position position} is contained.
+		 * @param {@link document.Position} position Position to check.
+		 * @returns {Boolean} True if given {@link document.Position position} is contained.
 		 */
 		containsPosition( position ) {
 			return position.isAfter( this.start ) && position.isBefore( this.end );
 		}
 
 		/**
-		 * Returns an array containing one or two {document.Range ranges} that are results of transforming this
-		 * {document.Range range} by inserting `howMany` nodes at `insertPosition`. Two {document.Range ranges} are
-		 * returned if the insertion was inside this {document.Range range}.
+		 * Returns an array containing one or two {document.Range ranges} that are a result of transforming this
+		 * {@link document.Range range} by inserting `howMany` nodes at `insertPosition`. Two {@link document.Range ranges} are
+		 * returned if the insertion was inside this {@link document.Range range}.
 		 *
 		 * Examples:
+		 *
 		 * 	let range = new Range( new Position( [ 2, 7 ], root ), new Position( [ 4, 0, 1 ], root ) );
 		 * 	let transformed = range.getTransformedByInsertion( new Position( [ 1 ], root ), 2 );
 		 * 	// transformed array has one range from [ 4, 7 ] to [ 6, 0, 1 ]
@@ -147,10 +148,11 @@ CKEDITOR.define( [ 'document/position', 'document/positioniterator', 'utils' ],
 		}
 
 		/**
-		 * Gets a part of this {document.Range range} that is not a part of given {document.Range range}. Returned
-		 * array contains zero, one or two {document.Range ranges}.
+		 * Gets a part of this {@link document.Range range} which is not a part of given {@link document.Range range}. Returned
+		 * array contains zero, one or two {@link document.Range ranges}.
 		 *
 		 * Examples:
+		 *
 		 * 	let range = new Range( new Position( [ 2, 7 ], root ), new Position( [ 4, 0, 1 ], root ) );
 		 * 	let otherRange = new Range( new Position( [ 1 ], root ), new Position( [ 5 ], root ) );
 		 * 	let transformed = range.getDifference( otherRange );
@@ -203,10 +205,11 @@ CKEDITOR.define( [ 'document/position', 'document/positioniterator', 'utils' ],
 		}
 
 		/**
-		 * Returns an intersection of this {document.Range range} and given {document.Range range}. Intersection
-		 * is a common part of both of those ranges. If ranges has no common part, returns null.
+		 * Returns an intersection of this {@link document.Range range} and given {@link document.Range range}. Intersection
+		 * is a common part of both of those ranges. If ranges has no common part, returns `null`.
 		 *
 		 * Examples:
+		 *
 		 * 	let range = new Range( new Position( [ 2, 7 ], root ), new Position( [ 4, 0, 1 ], root ) );
 		 * 	let otherRange = new Range( new Position( [ 1 ], root ), new Position( [ 2 ], root ) );
 		 * 	let transformed = range.getIntersection( otherRange ); // null - ranges have no common part