Преглед изворни кода

Docs: added docs to methods registered in deltas.

Piotr Jasiun пре 10 година
родитељ
комит
f78b9d6a19

+ 10 - 0
packages/ckeditor5-engine/src/document/delta/insertdelta.js

@@ -18,6 +18,16 @@ CKEDITOR.define( [
 	 */
 	class InsertDelta extends Delta {}
 
+	/**
+	 * Insert node or nodes at the given position.
+	 *
+	 * @chainable
+	 * @memberOf document.Transaction
+	 * @method insert
+	 * @param {document.Position} position Position of insertion.
+	 * @param {document.Node|document.Text|document.NodeList|String|Iterable} nodes The list of nodes to be inserted.
+	 * List of nodes can be any type accepted by the {@link document.NodeList} constructor.
+	 */
 	register( 'insert', ( doc, transaction, position, nodes ) => {
 		const delta = new InsertDelta();
 

+ 11 - 0
packages/ckeditor5-engine/src/document/delta/mergedelta.js

@@ -22,6 +22,17 @@ CKEDITOR.define( [
 	 */
 	class MergeDelta extends Delta {}
 
+	/**
+	 * Merge two siblings at the given position.
+	 *
+	 * Node before and after the position have to be an element. Otherwise `transaction-merge-no-element-before` or
+	 * `transaction-merge-no-element-after` error will be thrown.
+	 *
+	 * @chainable
+	 * @memberOf document.Transaction
+	 * @method merge
+	 * @param {document.Position} position Position of merge.
+	 */
 	register( 'merge', ( doc, transaction, position ) => {
 		const delta = new MergeDelta();
 		const nodeBefore = position.nodeBefore;

+ 9 - 0
packages/ckeditor5-engine/src/document/delta/removedelta.js

@@ -18,6 +18,15 @@ CKEDITOR.define( [
 	 */
 	class RemoveDelta extends Delta {}
 
+	/**
+	 * Remove nodes starting at the given position.
+	 *
+	 * @chainable
+	 * @memberOf document.Transaction
+	 * @method remove
+	 * @param {document.Position} position Position before the first node to remove.
+	 * @param {Number} howMany How many nodes to remove.
+	 */
 	register( 'remove', ( doc, transaction, position, howMany ) => {
 		if ( typeof howMany !== 'number' ) {
 			howMany = 1;

+ 11 - 0
packages/ckeditor5-engine/src/document/delta/splitdelta.js

@@ -22,6 +22,17 @@ CKEDITOR.define( [
 	 */
 	class SplitDelta extends Delta {}
 
+	/**
+	 * Split a node at the given position.
+	 *
+	 * This can not be a position inside a root element, method will throw `transaction-split-root` if you try to split
+	 * root element.
+	 *
+	 * @chainable
+	 * @memberOf document.Transaction
+	 * @method split
+	 * @param {document.Position} position Position of split.
+	 */
 	register( 'split', ( doc, transaction, position ) => {
 		const delta = new SplitDelta();
 		const splitElement = position.parent;