浏览代码

API docs changes for typing.

Anna Tomanek 9 年之前
父节点
当前提交
dc5a878abf

+ 1 - 1
packages/ckeditor5-typing/CONTRIBUTING.md

@@ -1,4 +1,4 @@
 Contributing
 ========================================
 
-Information about contributing can be found at the following page: <https://github.com/ckeditor/ckeditor5/blob/master/CONTRIBUTING.md>.
+Information about contributing can be found on the following page: <https://github.com/ckeditor/ckeditor5/blob/master/CONTRIBUTING.md>.

+ 1 - 1
packages/ckeditor5-typing/README.md

@@ -3,7 +3,7 @@ CKEditor 5 Typing Feature
 
 [![devDependency Status](https://david-dm.org/ckeditor/ckeditor5-typing/dev-status.svg)](https://david-dm.org/ckeditor/ckeditor5-typing#info=devDependencies)
 
-Typing feature for CKEditor 5. More information about the project can be found at the following url: <https://github.com/ckeditor/ckeditor5-typing>.
+The typing feature for CKEditor 5. More information about the project can be found at the following URL: <https://github.com/ckeditor/ckeditor5-typing>.
 
 ## License
 

+ 17 - 17
packages/ckeditor5-typing/src/changebuffer.js

@@ -14,7 +14,7 @@ import count from '../utils/count.js';
  * The buffer has a configurable limit of atomic changes that it can accomodate. After the limit was
  * exceeded (see {@link typing.ChangeBuffer#input}), a new batch is created in {@link typing.ChangeBuffer#batch}.
  *
- * To use the change buffer you need to let it know about number of changes that has been added to the batch:
+ * To use the change buffer you need to let it know about the number of changes that were added to the batch:
  *
  *		const buffer = new ChangeBuffer( document, LIMIT );
  *
@@ -26,14 +26,14 @@ import count from '../utils/count.js';
  */
 export default class ChangeBuffer {
 	/**
-	 * Creates a new instance of the ChangeBuffer.
+	 * Creates a new instance of the change buffer.
 	 *
 	 * @param {engine.treeModel.Document} document
-	 * @param {Number} [limit=20] Maximum number of atomic changes which can be contained in one batch.
+	 * @param {Number} [limit=20] The maximum number of atomic changes which can be contained in one batch.
 	 */
 	constructor( doc, limit = 20 ) {
 		/**
-		 * Instance of the document.
+		 * The document instance.
 		 *
 		 * @readonly
 		 * @property {engine.treeModel.Document} typing.ChangeBuffer#document
@@ -41,8 +41,8 @@ export default class ChangeBuffer {
 		this.document = doc;
 
 		/**
-		 * Number of atomic changes in the buffer. Once it exceeds the {@link typing.ChangeBuffer#limit},
-		 * {@link typing.ChangeBuffer#batch batch} is set to a new batch.
+		 * The number of atomic changes in the buffer. Once it exceeds the {@link typing.ChangeBuffer#limit},
+		 * the {@link typing.ChangeBuffer#batch batch} is set to a new one.
 		 *
 		 * @readonly
 		 * @property {Number} typing.ChangeBuffer#size
@@ -50,7 +50,7 @@ export default class ChangeBuffer {
 		this.size = 0;
 
 		/**
-		 * Maximum number of atomic changes which can be contained in one batch.
+		 * The maximum number of atomic changes which can be contained in one batch.
 		 *
 		 * @readonly
 		 * @property {Number} typing.ChangeBuffer#limit
@@ -71,7 +71,7 @@ export default class ChangeBuffer {
 		 */
 
 		/**
-		 * The callback to document change event which later needs to be removed.
+		 * The callback to document the change event which later needs to be removed.
 		 *
 		 * @private
 		 * @property typing.ChangeBuffer#_changeCallback
@@ -79,8 +79,8 @@ export default class ChangeBuffer {
 	}
 
 	/**
-	 * Current batch to which a feature should add its deltas. Once the {@link typing.ChangeBuffer#size}
-	 * reach or exceeds the {@link typing.ChangeBuffer#limit}, then the batch is set to a new instance and size is reset.
+	 * The current batch to which a feature should add its deltas. Once the {@link typing.ChangeBuffer#size}
+	 * is reached or exceeds the {@link typing.ChangeBuffer#limit}, the batch is set to a new instance and the size is reset.
 	 *
 	 * @type {engine.treeModel.batch.Batch}
 	 */
@@ -93,10 +93,10 @@ export default class ChangeBuffer {
 	}
 
 	/**
-	 * Input number of changes into the buffer. Once the {@link typing.ChangeBuffer#size}
-	 * reach or exceeds the {@link typing.ChangeBuffer#limit}, then the batch is set to a new instance and size is reset.
+	 * The input number of changes into the buffer. Once the {@link typing.ChangeBuffer#size} is
+	 * reached or exceeds the {@link typing.ChangeBuffer#limit}, the batch is set to a new instance and the size is reset.
 	 *
-	 * @param {Number} changeCount Number of atomic changes to input.
+	 * @param {Number} changeCount The number of atomic changes to input.
 	 */
 	input( changeCount ) {
 		this.size += changeCount;
@@ -114,11 +114,11 @@ export default class ChangeBuffer {
 	}
 
 	/**
-	 * To be called in order to notify the buffer about batches which appeared in the document.
+	 * The method to be called in order to notify the buffer about batches which appeared in the document.
 	 * The method will check whether it is a new batch and in that case the buffer will be flushed.
 	 *
-	 * The reason why the buffer needs to be flushed whenever a new batch appears is that changes added afterwards
-	 * should be added to a new batch. For instance, when a user types, then inserts an image and then types again,
+	 * The reason why the buffer needs to be flushed whenever a new batch appears is that the changes added afterwards
+	 * should be added to a new batch. For instance, when the  user types, then inserts an image, and then types again,
 	 * the characters typed after inserting the image should be added to a different batch than the characters typed before.
 	 *
 	 * @private
@@ -132,7 +132,7 @@ export default class ChangeBuffer {
 	}
 
 	/**
-	 * Resets change buffer.
+	 * Resets the change buffer.
 	 *
 	 * @private
 	 */

+ 1 - 1
packages/ckeditor5-typing/src/delete.js

@@ -8,7 +8,7 @@ import DeleteCommand from './deletecommand.js';
 import DeleteObserver from './deleteobserver.js';
 
 /**
- * The delete and backspace feature. Handles <kbd>Delete</kbd> and <kbd>Backspace</kbd> keys in the editor.
+ * The delete and backspace feature. Handles the <kbd>Delete</kbd> and <kbd>Backspace</kbd> keys in the editor.
  *
  * @memberOf typing
  * @extends ckeditor5.Feature

+ 8 - 8
packages/ckeditor5-typing/src/deletecommand.js

@@ -9,7 +9,7 @@ import ChangeBuffer from './changebuffer.js';
 import count from '../utils/count.js';
 
 /**
- * Delete command. Used by the {@link typing.Delete delete feature} to handle <kbd>Delete</kbd> and
+ * The delete command. Used by the {@link typing.Delete delete feature} to handle the <kbd>Delete</kbd> and
  * <kbd>Backspace</kbd> keys.
  *
  * @member typing
@@ -17,18 +17,18 @@ import count from '../utils/count.js';
  */
 export default class DeleteCommand extends Command {
 	/**
-	 * Creates instance of the command;
+	 * Creates an instance of the command.
 	 *
 	 * @param {ckeditor5.Editor} editor
-	 * @param {'forward'|'backward'} direction The directionality of the delete (in what direction it should
-	 * consume the content when selection is collapsed).
+	 * @param {'forward'|'backward'} direction The directionality of the delete describing in what direction it
+	 * should consume the content when the selection is collapsed.
 	 */
 	constructor( editor, direction ) {
 		super( editor );
 
 		/**
-		 * The directionality of the delete (in what direction it should
-		 * consume the content when selection is collapsed).
+		 * The directionality of the delete describing in what direction it should
+		 * consume the content when the selection is collapsed.
 		 *
 		 * @readonly
 		 * @member {'forward'|'backward'} typing.DeleteCommand#direction
@@ -46,8 +46,8 @@ export default class DeleteCommand extends Command {
 	}
 
 	/**
-	 * Executes the command: depending on whether the selection is collapsed or not, deletes its contents
-	 * or piece of content in the {@link typing.DeleteCommand#direction defined direction}.
+	 * Executes the delete command. Depending on whether the selection is collapsed or not, deletes its content
+	 * or a piece of content in the {@link typing.DeleteCommand#direction defined direction}.
 	 *
 	 * @param {Object} [options] The command options.
 	 * @param {'character'} [options.unit='character'] See {@link engine.model.composer.modifySelection}'s options.

+ 1 - 1
packages/ckeditor5-typing/src/deleteobserver.js

@@ -41,7 +41,7 @@ export default class DeleteObserver extends Observer {
 }
 
 /**
- * Event fired when the user tries to delete contents (e.g. presses <kbd>Delete</kbd> or <kbd>Backspace</kbd>).
+ * Event fired when the user tries to delete content (e.g. presses <kbd>Delete</kbd> or <kbd>Backspace</kbd>).
  *
  * Note: This event is fired by the {@link typing.DeleteObserver observer}
  * (usually registered by the {@link typing.Delete delete feature}).

+ 16 - 16
packages/ckeditor5-typing/src/input.js

@@ -14,7 +14,7 @@ import diffToChanges from '../utils/difftochanges.js';
 import { getCode } from '../utils/keyboard.js';
 
 /**
- * Handles text input, coming from keyboard or other input methods.
+ * Handles text input coming from the keyboard or other input methods.
  *
  * @memberOf typing
  * @extends ckeditor5.Feature
@@ -35,7 +35,7 @@ export default class Input extends Feature {
 		 */
 		this._buffer = new ChangeBuffer( editor.document, editor.config.get( 'typing.undoStep' ) || 20 );
 
-		// TODO The above default config value should be defines using editor.config.define() once it's fixed.
+		// TODO The above default configuration value should be defined using editor.config.define() once it's fixed.
 
 		this.listenTo( editingView, 'keydown', ( evt, data ) => {
 			this._handleKeydown( data );
@@ -57,15 +57,15 @@ export default class Input extends Feature {
 	}
 
 	/**
-	 * Handles keydown event. We need to guess whether such a keystroke is going to result
-	 * in typing. If so, then before character insertion happens, we need to delete
-	 * any selected content. Otherwise, a default browser deletion mechanism would be
+	 * Handles the keydown event. We need to guess whether such keystroke is going to result
+	 * in typing. If so, then before character insertion happens, any selected content needs
+	 * to be deleted. Otherwise the default browser deletion mechanism would be
 	 * triggered, resulting in:
 	 *
-	 * * hundreds of mutations which couldn't be handled,
-	 * * but most importantly, loss of a control over how content is being deleted.
+	 * * Hundreds of mutations which could not be handled.
+	 * * But most importantly, loss of control over how the content is being deleted.
 	 *
-	 * The method is used in a low-prior listener, hence allowing other listeners (e.g. delete or enter features)
+	 * The method is used in a low-priority listener, hence allowing other listeners (e.g. delete or enter features)
 	 * to handle the event.
 	 *
 	 * @private
@@ -104,7 +104,7 @@ export default class Input extends Feature {
  */
 class MutationHandler {
 	/**
-	 * Creates instance of the mutation handler.
+	 * Creates an instance of the mutation handler.
 	 *
 	 * @param {engine.EditingController} editing
 	 * @param {typing.ChangeBuffer} buffer
@@ -125,7 +125,7 @@ class MutationHandler {
 		this.buffer = buffer;
 
 		/**
-		 * Number of inserted characters which need to be feed to the {@link #buffer change buffer}
+		 * The number of inserted characters which need to be fed to the {@link #buffer change buffer}
 		 * on {@link #commit}.
 		 *
 		 * @member {Number} typing.Input.MutationHandler#insertedCharacterCount
@@ -133,11 +133,11 @@ class MutationHandler {
 		this.insertedCharacterCount = 0;
 
 		/**
-		 * Position to which the selection should be moved on {@link #commit}.
+		 * The position to which the selection should be moved on {@link #commit}.
 		 *
-		 * Note: Currently, the mutation handler will move selection to the position set by the
+		 * Note: Currently, the mutation handler will move the selection to the position set by the
 		 * last consumer. Placing the selection right after the last change will work for many cases, but not
-		 * for ones like autocorrection or spellchecking. The caret should be placed after the whole piece
+		 * for ones like autocorrect or spell checking. The caret should be placed after the whole piece
 		 * which was corrected (e.g. a word), not after the letter that was replaced.
 		 *
 		 * @member {engine.model.Position} typing.Input.MutationHandler#selectionPosition
@@ -145,7 +145,7 @@ class MutationHandler {
 	}
 
 	/**
-	 * Handle given mutations.
+	 * Handles given mutations.
 	 *
 	 * @param {Array.<engine.view.Document~MutatatedText|engine.view.Document~MutatatedChildren>} mutations
 	 */
@@ -265,9 +265,9 @@ for ( let code = 112; code <= 135; code++ ) {
 	safeKeycodes.push( code );
 }
 
-// Returns true if a keystroke should not cause any content change caused by "typing".
+// Returns `true` if a keystroke should not cause any content change caused by "typing".
 //
-// Note: this implementation is very simple and will need to be refined with time.
+// Note: This implementation is very simple and will need to be refined with time.
 //
 // @param {engine.view.observer.keyObserver.KeyEventData} keyData
 // @returns {Boolean}

+ 1 - 1
packages/ckeditor5-typing/src/typing.js

@@ -8,7 +8,7 @@ import Input from './input';
 import Delete from './delete';
 
 /**
- * The typing feature. Handles... typing.
+ * The typing feature. Handles typing.
  *
  * @memberOf typing
  * @extends ckeditor5.Feature