Sfoglia il codice sorgente

Docs: Fixed invalid error docs. [skip ci]

Kamil Piechaczek 8 anni fa
parent
commit
2230723279

+ 2 - 2
packages/ckeditor5-engine/src/model/document.js

@@ -195,7 +195,7 @@ export default class Document {
 			/**
 			 * Root with specified name already exists.
 			 *
-			 * @error document-createRoot-name-exists
+			 * @error model-document-createRoot-name-exists
 			 * @param {module:engine/model/document~Document} doc
 			 * @param {String} name
 			 */
@@ -254,7 +254,7 @@ export default class Document {
 			/**
 			 * Root with specified name does not exist.
 			 *
-			 * @error document-getRoot-root-not-exist
+			 * @error model-document-getRoot-root-not-exist
 			 * @param {String} name
 			 */
 			throw new CKEditorError(

+ 6 - 15
packages/ckeditor5-engine/src/model/markercollection.js

@@ -268,11 +268,6 @@ class Marker {
 	 */
 	getStart() {
 		if ( !this._liveRange ) {
-			/**
-			 * Operating on destroyed marker instance.
-			 *
-			 * @error marker-destroyed
-			 */
 			throw new CKEditorError( 'marker-destroyed: Operating on destroyed marker instance.' );
 		}
 
@@ -286,11 +281,6 @@ class Marker {
 	 */
 	getEnd() {
 		if ( !this._liveRange ) {
-			/**
-			 * Operating on destroyed marker instance.
-			 *
-			 * @error marker-destroyed
-			 */
 			throw new CKEditorError( 'marker-destroyed: Operating on destroyed marker instance.' );
 		}
 
@@ -311,11 +301,6 @@ class Marker {
 	 */
 	getRange() {
 		if ( !this._liveRange ) {
-			/**
-			 * Operating on destroyed marker instance.
-			 *
-			 * @error marker-destroyed
-			 */
 			throw new CKEditorError( 'marker-destroyed: Operating on destroyed marker instance.' );
 		}
 
@@ -352,3 +337,9 @@ class Marker {
 }
 
 mix( Marker, EmitterMixin );
+
+/**
+ * Operating on destroyed marker instance.
+ *
+ * @error marker-destroyed
+ */

+ 6 - 10
packages/ckeditor5-engine/src/model/node.js

@@ -84,11 +84,6 @@ export default class Node {
 		}
 
 		if ( ( pos = this.parent.getChildIndex( this ) ) === null ) {
-			/**
-			 * The node's parent does not contain this node.
-			 *
-			 * @error node-not-found-in-parent
-			 */
 			throw new CKEditorError( 'model-node-not-found-in-parent: The node\'s parent does not contain this node.' );
 		}
 
@@ -113,11 +108,6 @@ export default class Node {
 		}
 
 		if ( ( pos = this.parent.getChildStartOffset( this ) ) === null ) {
-			/**
-			 * The node's parent does not contain this node.
-			 *
-			 * @error node-not-found-in-parent
-			 */
 			throw new CKEditorError( 'model-node-not-found-in-parent: The node\'s parent does not contain this node.' );
 		}
 
@@ -411,3 +401,9 @@ export default class Node {
 	 * @returns {Boolean}
 	 */
 }
+
+/**
+ * The node's parent does not contain this node.
+ *
+ * @error model-node-not-found-in-parent
+ */

+ 8 - 8
packages/ckeditor5-engine/src/model/position.js

@@ -47,7 +47,7 @@ export default class Position {
 			/**
 			 * Position root invalid.
 			 *
-			 * @error position-root-invalid.
+			 * @error model-position-root-invalid.
 			 */
 			throw new CKEditorError( 'model-position-root-invalid: Position root invalid.' );
 		}
@@ -56,7 +56,7 @@ export default class Position {
 			/**
 			 * Position path must be an Array with at least one item.
 			 *
-			 * @error position-path-incorrect
+			 * @error model-position-path-incorrect
 			 * @param path
 			 */
 			throw new CKEditorError( 'model-position-path-incorrect: Position path must be an Array with at least one item.', { path } );
@@ -688,10 +688,10 @@ export default class Position {
 			/**
 			 * You can not make position after root.
 			 *
-			 * @error position-after-root
+			 * @error model-position-after-root
 			 * @param {module:engine/model/item~Item} root
 			 */
-			throw new CKEditorError( 'model-position-after-root: You can not make position after root.', { root: item } );
+			throw new CKEditorError( 'model-position-after-root: You cannot make a position after root.', { root: item } );
 		}
 
 		return this.createFromParentAndOffset( item.parent, item.endOffset );
@@ -708,10 +708,10 @@ export default class Position {
 			/**
 			 * You can not make position before root.
 			 *
-			 * @error position-before-root
+			 * @error model-position-before-root
 			 * @param {module:engine/model/item~Item} root
 			 */
-			throw new CKEditorError( 'model-position-before-root: You can not make position before root.', { root: item } );
+			throw new CKEditorError( 'model-position-before-root: You cannot make a position before root.', { root: item } );
 		}
 
 		return this.createFromParentAndOffset( item.parent, item.startOffset );
@@ -729,7 +729,7 @@ export default class Position {
 			/**
 			 * Position parent have to be a model element or model document fragment.
 			 *
-			 * @error position-parent-incorrect
+			 * @error model-position-parent-incorrect
 			 */
 			throw new CKEditorError( 'model-position-parent-incorrect: Position parent have to be a element or document fragment.' );
 		}
@@ -766,7 +766,7 @@ export default class Position {
 			/**
 			 * Cannot create position for document. Root with specified name does not exist.
 			 *
-			 * @error position-fromjson-no-root
+			 * @error model-position-fromjson-no-root
 			 * @param {String} rootName
 			 */
 			throw new CKEditorError(

+ 1 - 1
packages/ckeditor5-engine/src/model/selection.js

@@ -717,7 +717,7 @@ export default class Selection {
 				/**
 				 * Trying to add a range that intersects with another range from selection.
 				 *
-				 * @error selection-range-intersects
+				 * @error model-selection-range-intersects
 				 * @param {module:engine/model/range~Range} addedRange Range that was added to the selection.
 				 * @param {module:engine/model/range~Range} intersectingRange Range from selection that intersects with `addedRange`.
 				 */

+ 1 - 1
packages/ckeditor5-engine/src/model/treewalker.js

@@ -40,7 +40,7 @@ export default class TreeWalker {
 			/**
 			 * Neither boundaries nor starting position have been defined.
 			 *
-			 * @error tree-walker-no-start-position
+			 * @error model-tree-walker-no-start-position
 			 */
 			throw new CKEditorError( 'model-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.' );
 		}

+ 2 - 2
packages/ckeditor5-engine/src/view/position.js

@@ -352,7 +352,7 @@ export default class Position {
 			/**
 			 * You can not make a position after a root.
 			 *
-			 * @error position-after-root
+			 * @error view-position-after-root
 			 * @param {module:engine/view/node~Node} root
 			 */
 			throw new CKEditorError( 'view-position-after-root: You can not make position after root.', { root: item } );
@@ -377,7 +377,7 @@ export default class Position {
 			/**
 			 * You cannot make a position before a root.
 			 *
-			 * @error position-before-root
+			 * @error view-position-before-root
 			 * @param {module:engine/view/node~Node} root
 			 */
 			throw new CKEditorError( 'view-position-before-root: You can not make position before root.', { root: item } );

+ 1 - 1
packages/ckeditor5-engine/src/view/selection.js

@@ -605,7 +605,7 @@ export default class Selection {
 				/**
 				 * Trying to add a range that intersects with another range from selection.
 				 *
-				 * @error selection-range-intersects
+				 * @error view-selection-range-intersects
 				 * @param {module:engine/view/range~Range} addedRange Range that was added to the selection.
 				 * @param {module:engine/view/range~Range} intersectingRange Range from selection that intersects with `addedRange`.
 				 */

+ 1 - 1
packages/ckeditor5-engine/src/view/treewalker.js

@@ -40,7 +40,7 @@ export default class TreeWalker {
 			/**
 			 * Neither boundaries nor starting position have been defined.
 			 *
-			 * @error tree-walker-no-start-position
+			 * @error view-tree-walker-no-start-position
 			 */
 			throw new CKEditorError( 'view-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.' );
 		}

+ 6 - 10
packages/ckeditor5-engine/src/view/writer.js

@@ -470,11 +470,6 @@ export function move( sourceRange, targetPosition ) {
  */
 export function wrap( range, attribute ) {
 	if ( !( attribute instanceof AttributeElement ) ) {
-		/**
-		 * Attribute element need to be instance of attribute element.
-		 *
-		 * @error view-writer-wrap-invalid-attribute
-		 */
 		throw new CKEditorError( 'view-writer-wrap-invalid-attribute' );
 	}
 
@@ -537,11 +532,6 @@ export function wrap( range, attribute ) {
  */
 export function wrapPosition( position, attribute ) {
 	if ( !( attribute instanceof AttributeElement ) ) {
-		/**
-		 * Attribute element need to be instance of attribute element.
-		 *
-		 * @error view-writer-wrap-invalid-attribute
-		 */
 		throw new CKEditorError( 'view-writer-wrap-invalid-attribute' );
 	}
 
@@ -665,6 +655,12 @@ export function rename( viewElement, newName ) {
 	return newElement;
 }
 
+/**
+ * Attribute element need to be instance of attribute element.
+ *
+ * @error view-writer-wrap-invalid-attribute
+ */
+
 // Returns first parent container of specified {@link module:engine/view/position~Position Position}.
 // Position's parent node is checked as first, then next parents are checked.
 // Note that {@link module:engine/view/documentfragment~DocumentFragment DocumentFragment} is treated like a container.