Jelajahi Sumber

Improved the docs.

Kamil Piechaczek 7 tahun lalu
induk
melakukan
63a73c7040

+ 3 - 0
packages/ckeditor5-engine/src/model/element.js

@@ -236,6 +236,7 @@ export default class Element extends Node {
 	/**
 	/**
 	 * {@link module:engine/model/element~Element#_insertChildren Inserts} one or more nodes at the end of this element.
 	 * {@link module:engine/model/element~Element#_insertChildren Inserts} one or more nodes at the end of this element.
 	 *
 	 *
+	 * @see module:engine/model/writer~Writer#append
 	 * @protected
 	 * @protected
 	 * @param {module:engine/model/item~Item|Iterable.<module:engine/model/item~Item>} nodes Nodes to be inserted.
 	 * @param {module:engine/model/item~Item|Iterable.<module:engine/model/item~Item>} nodes Nodes to be inserted.
 	 */
 	 */
@@ -247,6 +248,7 @@ export default class Element extends Node {
 	 * Inserts one or more nodes at the given index and sets {@link module:engine/model/node~Node#parent parent} of these nodes
 	 * Inserts one or more nodes at the given index and sets {@link module:engine/model/node~Node#parent parent} of these nodes
 	 * to this element.
 	 * to this element.
 	 *
 	 *
+	 * @see module:engine/model/writer~Writer#insert
 	 * @protected
 	 * @protected
 	 * @param {Number} index Index at which nodes should be inserted.
 	 * @param {Number} index Index at which nodes should be inserted.
 	 * @param {module:engine/model/item~Item|Iterable.<module:engine/model/item~Item>} items Items to be inserted.
 	 * @param {module:engine/model/item~Item|Iterable.<module:engine/model/item~Item>} items Items to be inserted.
@@ -270,6 +272,7 @@ export default class Element extends Node {
 	 * Removes one or more nodes starting at the given index and sets
 	 * Removes one or more nodes starting at the given index and sets
 	 * {@link module:engine/model/node~Node#parent parent} of these nodes to `null`.
 	 * {@link module:engine/model/node~Node#parent parent} of these nodes to `null`.
 	 *
 	 *
+	 * @see module:engine/model/writer~Writer#remove
 	 * @protected
 	 * @protected
 	 * @param {Number} index Index of the first node to remove.
 	 * @param {Number} index Index of the first node to remove.
 	 * @param {Number} [howMany=1] Number of nodes to remove.
 	 * @param {Number} [howMany=1] Number of nodes to remove.

+ 5 - 0
packages/ckeditor5-engine/src/model/node.js

@@ -342,6 +342,7 @@ export default class Node {
 	/**
 	/**
 	 * Removes this node from it's parent.
 	 * Removes this node from it's parent.
 	 *
 	 *
+	 * @see module:engine/model/writer~Writer#remove
 	 * @protected
 	 * @protected
 	 */
 	 */
 	_remove() {
 	_remove() {
@@ -351,6 +352,7 @@ export default class Node {
 	/**
 	/**
 	 * Sets attribute on the node. If attribute with the same key already is set, it's value is overwritten.
 	 * Sets attribute on the node. If attribute with the same key already is set, it's value is overwritten.
 	 *
 	 *
+	 * @see module:engine/model/writer~Writer#setAttribute
 	 * @protected
 	 * @protected
 	 * @param {String} key Key of attribute to set.
 	 * @param {String} key Key of attribute to set.
 	 * @param {*} value Attribute value.
 	 * @param {*} value Attribute value.
@@ -362,6 +364,7 @@ export default class Node {
 	/**
 	/**
 	 * Removes all attributes from the node and sets given attributes.
 	 * Removes all attributes from the node and sets given attributes.
 	 *
 	 *
+	 * @see module:engine/model/writer~Writer#setAttributes
 	 * @protected
 	 * @protected
 	 * @param {Object} [attrs] Attributes to set. See {@link module:utils/tomap~toMap} for a list of accepted values.
 	 * @param {Object} [attrs] Attributes to set. See {@link module:utils/tomap~toMap} for a list of accepted values.
 	 */
 	 */
@@ -372,6 +375,7 @@ export default class Node {
 	/**
 	/**
 	 * Removes an attribute with given key from the node.
 	 * Removes an attribute with given key from the node.
 	 *
 	 *
+	 * @see module:engine/model/writer~Writer#removeAttribute
 	 * @protected
 	 * @protected
 	 * @param {String} key Key of attribute to remove.
 	 * @param {String} key Key of attribute to remove.
 	 * @returns {Boolean} `true` if the attribute was set on the element, `false` otherwise.
 	 * @returns {Boolean} `true` if the attribute was set on the element, `false` otherwise.
@@ -383,6 +387,7 @@ export default class Node {
 	/**
 	/**
 	 * Removes all attributes from the node.
 	 * Removes all attributes from the node.
 	 *
 	 *
+	 * @see module:engine/model/writer~Writer#clearAttributes
 	 * @protected
 	 * @protected
 	 */
 	 */
 	_clearAttributes() {
 	_clearAttributes() {

+ 1 - 0
packages/ckeditor5-engine/src/view/attributeelement.js

@@ -26,6 +26,7 @@ export default class AttributeElement extends Element {
 	/**
 	/**
 	 * Creates a attribute element.
 	 * Creates a attribute element.
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#createAttributeElement
 	 * @protected
 	 * @protected
 	 * @see module:engine/view/element~Element
 	 * @see module:engine/view/element~Element
 	 */
 	 */

+ 2 - 1
packages/ckeditor5-engine/src/view/containerelement.js

@@ -48,8 +48,9 @@ export default class ContainerElement extends Element {
 	/**
 	/**
 	 * Creates a container element.
 	 * Creates a container element.
 	 *
 	 *
-	 * @protected
 	 * @see module:engine/view/element~Element
 	 * @see module:engine/view/element~Element
+	 * @see module:engine/view/writer~Writer#createContainerElement
+	 * @protected
 	 */
 	 */
 	constructor( name, attrs, children ) {
 	constructor( name, attrs, children ) {
 		super( name, attrs, children );
 		super( name, attrs, children );

+ 3 - 0
packages/ckeditor5-engine/src/view/editableelement.js

@@ -26,6 +26,9 @@ const documentSymbol = Symbol( 'document' );
 export default class EditableElement extends ContainerElement {
 export default class EditableElement extends ContainerElement {
 	/**
 	/**
 	 * Creates an editable element.
 	 * Creates an editable element.
+	 *
+	 * @see module:engine/view/writer~Writer#createEditableElement
+	 * @protected
 	 */
 	 */
 	constructor( name, attrs, children ) {
 	constructor( name, attrs, children ) {
 		super( name, attrs, children );
 		super( name, attrs, children );

+ 14 - 2
packages/ckeditor5-engine/src/view/element.js

@@ -516,8 +516,10 @@ export default class Element extends Node {
 	 * {@link module:engine/view/element~Element#_insertChildren Insert} a child node or a list of child nodes at the end of this node
 	 * {@link module:engine/view/element~Element#_insertChildren Insert} a child node or a list of child nodes at the end of this node
 	 * and sets the parent of these nodes to this element.
 	 * and sets the parent of these nodes to this element.
 	 *
 	 *
-	 * @fires module:engine/view/node~Node#change
+	 * @see module:engine/view/writer~Writer#insert
+	 * @protected
 	 * @param {module:engine/view/item~Item|Iterable.<module:engine/view/item~Item>} items Items to be inserted.
 	 * @param {module:engine/view/item~Item|Iterable.<module:engine/view/item~Item>} items Items to be inserted.
+	 * @fires module:engine/view/node~Node#change
 	 * @returns {Number} Number of appended nodes.
 	 * @returns {Number} Number of appended nodes.
 	 */
 	 */
 	_appendChildren( items ) {
 	_appendChildren( items ) {
@@ -528,6 +530,7 @@ export default class Element extends Node {
 	 * Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to
 	 * Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to
 	 * this element.
 	 * this element.
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#insert
 	 * @protected
 	 * @protected
 	 * @param {Number} index Position where nodes should be inserted.
 	 * @param {Number} index Position where nodes should be inserted.
 	 * @param {module:engine/view/item~Item|Iterable.<module:engine/view/item~Item>} items Items to be inserted.
 	 * @param {module:engine/view/item~Item|Iterable.<module:engine/view/item~Item>} items Items to be inserted.
@@ -559,10 +562,11 @@ export default class Element extends Node {
 	/**
 	/**
 	 * Removes number of child nodes starting at the given index and set the parent of these nodes to `null`.
 	 * Removes number of child nodes starting at the given index and set the parent of these nodes to `null`.
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#remove
 	 * @param {Number} index Number of the first node to remove.
 	 * @param {Number} index Number of the first node to remove.
 	 * @param {Number} [howMany=1] Number of nodes to remove.
 	 * @param {Number} [howMany=1] Number of nodes to remove.
-	 * @returns {Array.<module:engine/view/node~Node>} The array of removed nodes.
 	 * @fires module:engine/view/node~Node#change
 	 * @fires module:engine/view/node~Node#change
+	 * @returns {Array.<module:engine/view/node~Node>} The array of removed nodes.
 	 */
 	 */
 	_removeChildren( index, howMany = 1 ) {
 	_removeChildren( index, howMany = 1 ) {
 		this._fireChange( 'children', this );
 		this._fireChange( 'children', this );
@@ -577,6 +581,7 @@ export default class Element extends Node {
 	/**
 	/**
 	 * Adds or overwrite attribute with a specified key and value.
 	 * Adds or overwrite attribute with a specified key and value.
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#setAttribute
 	 * @protected
 	 * @protected
 	 * @param {String} key Attribute key.
 	 * @param {String} key Attribute key.
 	 * @param {String} value Attribute value.
 	 * @param {String} value Attribute value.
@@ -599,6 +604,7 @@ export default class Element extends Node {
 	/**
 	/**
 	 * Removes attribute from the element.
 	 * Removes attribute from the element.
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#removeAttribute
 	 * @protected
 	 * @protected
 	 * @param {String} key Attribute key.
 	 * @param {String} key Attribute key.
 	 * @returns {Boolean} Returns true if an attribute existed and has been removed.
 	 * @returns {Boolean} Returns true if an attribute existed and has been removed.
@@ -639,6 +645,7 @@ export default class Element extends Node {
 	 *		element._addClass( 'foo' ); // Adds 'foo' class.
 	 *		element._addClass( 'foo' ); // Adds 'foo' class.
 	 *		element._addClass( [ 'foo', 'bar' ] ); // Adds 'foo' and 'bar' classes.
 	 *		element._addClass( [ 'foo', 'bar' ] ); // Adds 'foo' and 'bar' classes.
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#addClass
 	 * @protected
 	 * @protected
 	 * @param {Array.<String>|String} className
 	 * @param {Array.<String>|String} className
 	 * @fires module:engine/view/node~Node#change
 	 * @fires module:engine/view/node~Node#change
@@ -656,6 +663,7 @@ export default class Element extends Node {
 	 *		element._removeClass( 'foo' );  // Removes 'foo' class.
 	 *		element._removeClass( 'foo' );  // Removes 'foo' class.
 	 *		element._removeClass( [ 'foo', 'bar' ] ); // Removes both 'foo' and 'bar' classes.
 	 *		element._removeClass( [ 'foo', 'bar' ] ); // Removes both 'foo' and 'bar' classes.
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#removeClass
 	 * @param {Array.<String>|String} className
 	 * @param {Array.<String>|String} className
 	 * @fires module:engine/view/node~Node#change
 	 * @fires module:engine/view/node~Node#change
 	 */
 	 */
@@ -675,6 +683,7 @@ export default class Element extends Node {
 	 *			position: 'fixed'
 	 *			position: 'fixed'
 	 *		} );
 	 *		} );
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#setStyle
 	 * @protected
 	 * @protected
 	 * @param {String|Object} property Property name or object with key - value pairs.
 	 * @param {String|Object} property Property name or object with key - value pairs.
 	 * @param {String} [value] Value to set. This parameter is ignored if object is provided as the first parameter.
 	 * @param {String} [value] Value to set. This parameter is ignored if object is provided as the first parameter.
@@ -700,6 +709,7 @@ export default class Element extends Node {
 	 *		element._removeStyle( 'color' );  // Removes 'color' style.
 	 *		element._removeStyle( 'color' );  // Removes 'color' style.
 	 *		element._removeStyle( [ 'color', 'border-top' ] ); // Removes both 'color' and 'border-top' styles.
 	 *		element._removeStyle( [ 'color', 'border-top' ] ); // Removes both 'color' and 'border-top' styles.
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#removeStyle
 	 * @protected
 	 * @protected
 	 * @param {Array.<String>|String} property
 	 * @param {Array.<String>|String} property
 	 * @fires module:engine/view/node~Node#change
 	 * @fires module:engine/view/node~Node#change
@@ -715,6 +725,7 @@ export default class Element extends Node {
 	 * Sets a custom property. Unlike attributes, custom properties are not rendered to the DOM,
 	 * Sets a custom property. Unlike attributes, custom properties are not rendered to the DOM,
 	 * so they can be used to add special data to elements.
 	 * so they can be used to add special data to elements.
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#setCustomProperty
 	 * @protected
 	 * @protected
 	 * @param {String|Symbol} key
 	 * @param {String|Symbol} key
 	 * @param {*} value
 	 * @param {*} value
@@ -726,6 +737,7 @@ export default class Element extends Node {
 	/**
 	/**
 	 * Removes the custom property stored under the given key.
 	 * Removes the custom property stored under the given key.
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#removeCustomProperty
 	 * @protected
 	 * @protected
 	 * @param {String|Symbol} key
 	 * @param {String|Symbol} key
 	 * @returns {Boolean} Returns true if property was removed.
 	 * @returns {Boolean} Returns true if property was removed.

+ 1 - 0
packages/ckeditor5-engine/src/view/emptyelement.js

@@ -21,6 +21,7 @@ export default class EmptyElement extends Element {
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` when third parameter is passed,
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` when third parameter is passed,
 	 * to inform that usage of EmptyElement is incorrect (adding child nodes to EmptyElement is forbidden).
 	 * to inform that usage of EmptyElement is incorrect (adding child nodes to EmptyElement is forbidden).
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#createEmptyElement
 	 * @protected
 	 * @protected
 	 * @param {String} name Node name.
 	 * @param {String} name Node name.
 	 * @param {Object|Iterable} [attributes] Collection of attributes.
 	 * @param {Object|Iterable} [attributes] Collection of attributes.

+ 2 - 0
packages/ckeditor5-engine/src/view/uielement.js

@@ -23,6 +23,8 @@ export default class UIElement extends Element {
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` when third parameter is passed,
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` when third parameter is passed,
 	 * to inform that usage of UIElement is incorrect (adding child nodes to UIElement is forbidden).
 	 * to inform that usage of UIElement is incorrect (adding child nodes to UIElement is forbidden).
 	 *
 	 *
+	 * @see module:engine/view/writer~Writer#createUIElement
+	 * @protected
 	 * @param {String} name Node name.
 	 * @param {String} name Node name.
 	 * @param {Object|Iterable} [attributes] Collection of attributes.
 	 * @param {Object|Iterable} [attributes] Collection of attributes.
 	 */
 	 */