8
0
Szymon Kupś 9 лет назад
Родитель
Сommit
ba44b3fa11

+ 19 - 16
packages/ckeditor5-typing/src/changebuffer.js

@@ -3,16 +3,20 @@
  * For licensing, see LICENSE.md.
  */
 
+/**
+ * @module typing/changebuffer
+ */
+
 import count from '../utils/count.js';
 
 /**
  * Change buffer allows to group atomic changes (like characters that have been typed) into
- * {@link engine.treeModel.batch.Batch batches}.
+ * {@link module:engine/model/batch~Batch batches}.
  *
  * Batches represent single undo steps, hence changes added to one single batch are undone together.
  *
  * The buffer has a configurable limit of atomic changes that it can accommodate. After the limit was
- * exceeded (see {@link typing.ChangeBuffer#input}), a new batch is created in {@link typing.ChangeBuffer#batch}.
+ * exceeded (see {@link ~ChangeBuffer#input}), a new batch is created in {@link ~ChangeBuffer#batch}.
  *
  * To use the change buffer you need to let it know about the number of changes that were added to the batch:
  *
@@ -22,13 +26,12 @@ import count from '../utils/count.js';
  *		buffer.batch.insert( pos, insertedCharacters );
  *		buffer.input( insertedCharacters.length );
  *
- * @memberOf typing
  */
 export default class ChangeBuffer {
 	/**
 	 * Creates a new instance of the change buffer.
 	 *
-	 * @param {engine.treeModel.Document} document
+	 * @param {module:engine/model/document~Document} document
 	 * @param {Number} [limit=20] The maximum number of atomic changes which can be contained in one batch.
 	 */
 	constructor( doc, limit = 20 ) {
@@ -36,16 +39,16 @@ export default class ChangeBuffer {
 		 * The document instance.
 		 *
 		 * @readonly
-		 * @property {engine.treeModel.Document} typing.ChangeBuffer#document
+		 * @member {module:engine/model/document~Document} #document
 		 */
 		this.document = doc;
 
 		/**
-		 * 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.
+		 * The number of atomic changes in the buffer. Once it exceeds the {@link #limit},
+		 * the {@link #batch batch} is set to a new one.
 		 *
 		 * @readonly
-		 * @property {Number} typing.ChangeBuffer#size
+		 * @member {Number} #size
 		 */
 		this.size = 0;
 
@@ -53,7 +56,7 @@ export default class ChangeBuffer {
 		 * The maximum number of atomic changes which can be contained in one batch.
 		 *
 		 * @readonly
-		 * @property {Number} typing.ChangeBuffer#limit
+		 * @member {Number} #limit
 		 */
 		this.limit = limit;
 
@@ -67,20 +70,20 @@ export default class ChangeBuffer {
 		 * The current batch instance.
 		 *
 		 * @private
-		 * @property typing.ChangeBuffer#_batch
+		 * @member #_batch
 		 */
 
 		/**
 		 * The callback to document the change event which later needs to be removed.
 		 *
 		 * @private
-		 * @property typing.ChangeBuffer#_changeCallback
+		 * @member #_changeCallback
 		 */
 	}
 
 	/**
-	 * 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.
+	 * The current batch to which a feature should add its deltas. Once the {@link #size}
+	 * is reached or exceeds the {@link #limit}, the batch is set to a new instance and the size is reset.
 	 *
 	 * @type {engine.treeModel.batch.Batch}
 	 */
@@ -93,8 +96,8 @@ export default class ChangeBuffer {
 	}
 
 	/**
-	 * 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.
+	 * The input number of changes into the buffer. Once the {@link #size} is
+	 * reached or exceeds the {@link #limit}, the batch is set to a new instance and the size is reset.
 	 *
 	 * @param {Number} changeCount The number of atomic changes to input.
 	 */
@@ -122,7 +125,7 @@ export default class ChangeBuffer {
 	 * the characters typed after inserting the image should be added to a different batch than the characters typed before.
 	 *
 	 * @private
-	 * @param {engine.treeModel.batch.Batch} batch The batch which appears in the document.
+	 * @param {module:engine/model/batch~Batch} batch The batch which appears in the document.
 	 */
 	_onBatch( batch ) {
 		// One operation means a newly created batch.

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

@@ -3,6 +3,10 @@
  * For licensing, see LICENSE.md.
  */
 
+/**
+ * @module typing/delete
+ */
+
 import Plugin from '../core/plugin.js';
 import DeleteCommand from './deletecommand.js';
 import DeleteObserver from './deleteobserver.js';
@@ -10,7 +14,6 @@ import DeleteObserver from './deleteobserver.js';
 /**
  * The delete and backspace feature. Handles the <kbd>Delete</kbd> and <kbd>Backspace</kbd> keys in the editor.
  *
- * @memberOf typing
  * @extends core.Plugin
  */
 export default class Delete extends Plugin {

+ 11 - 7
packages/ckeditor5-typing/src/deletecommand.js

@@ -3,23 +3,26 @@
  * For licensing, see LICENSE.md.
  */
 
+/**
+ * @module typing/deletecommand
+ */
+
 import Command from '../core/command/command.js';
 import Selection from '../engine/model/selection.js';
 import ChangeBuffer from './changebuffer.js';
 import count from '../utils/count.js';
 
 /**
- * The delete command. Used by the {@link typing.Delete delete feature} to handle the <kbd>Delete</kbd> and
+ * The delete command. Used by the {@link module:typing/delete~Delete delete feature} to handle the <kbd>Delete</kbd> and
  * <kbd>Backspace</kbd> keys.
  *
- * @member typing
  * @extends core.command.Command
  */
 export default class DeleteCommand extends Command {
 	/**
 	 * Creates an instance of the command.
 	 *
-	 * @param {core.editor.Editor} editor
+	 * @param {module:core/editor/editor~Editor} editor
 	 * @param {'forward'|'backward'} direction The directionality of the delete describing in what direction it
 	 * should consume the content when the selection is collapsed.
 	 */
@@ -31,7 +34,7 @@ export default class DeleteCommand extends Command {
 		 * consume the content when the selection is collapsed.
 		 *
 		 * @readonly
-		 * @member {'forward'|'backward'} typing.DeleteCommand#direction
+		 * @member {'forward'|'backward'} #direction
 		 */
 		this.direction = direction;
 
@@ -40,17 +43,18 @@ export default class DeleteCommand extends Command {
 		 *
 		 * @readonly
 		 * @private
-		 * @member {typing.ChangeBuffer} typing.DeleteCommand#buffer
+		 * @member {typing.ChangeBuffer} #buffer
 		 */
 		this._buffer = new ChangeBuffer( editor.document, editor.config.get( 'undo.step' ) );
 	}
 
 	/**
 	 * 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}.
+	 * or a piece of content in the {@link #direction defined direction}.
 	 *
 	 * @param {Object} [options] The command options.
-	 * @param {'character'} [options.unit='character'] See {@link engine.controller.modifySelection}'s options.
+	 * @param {'character'} [options.unit='character'] See {@link module:engine/controller/modifyselection~modifySelection}'s
+	 * options.
 	 */
 	_doExecute( options = {} ) {
 		const doc = this.editor.document;

+ 9 - 6
packages/ckeditor5-typing/src/deleteobserver.js

@@ -3,14 +3,17 @@
  * For licensing, see LICENSE.md.
  */
 
+/**
+ * @module typing/deleteobserver
+ */
+
 import Observer from '../engine/view/observer/observer.js';
 import DomEventData from '../engine/view/observer/domeventdata.js';
 import { keyCodes } from '../utils/keyboard.js';
 
 /**
- * Delete observer introduces the {@link engine.view.Document#delete} event.
+ * Delete observer introduces the {@link module:engine/view/document~Document#event:delete} event.
  *
- * @memberOf typing
  * @extends engine.view.observer.Observer
  */
 export default class DeleteObserver extends Observer {
@@ -45,11 +48,11 @@ export default class DeleteObserver extends Observer {
 /**
  * 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}).
+ * Note: This event is fired by the {@link module:typing/deleteobserver~DeleteObserver observer}
+ * (usually registered by the {@link module:typing/delete~Delete delete feature}).
  *
- * @event engine.view.Document#delete
- * @param {engine.view.observer.DomEventData} data
+ * @event module:engine/view/document~Document#event:delete
+ * @param {module:engine/view/observer/domeventdata~DomEventData} data
  * @param {'forward'|'delete'} data.direction The direction in which the deletion should happen.
  * @param {'character'|'word'} data.unit The "amount" of content that should be deleted.
  */

+ 12 - 11
packages/ckeditor5-typing/src/input.js

@@ -3,6 +3,10 @@
  * For licensing, see LICENSE.md.
  */
 
+/**
+ * @module typing/input
+ */
+
 import Plugin from '../core/plugin.js';
 import ChangeBuffer from './changebuffer.js';
 import ModelRange from '../engine/model/range.js';
@@ -15,7 +19,6 @@ import { getCode } from '../utils/keyboard.js';
 /**
  * Handles text input coming from the keyboard or other input methods.
  *
- * @memberOf typing
  * @extends core.Plugin
  */
 export default class Input extends Plugin {
@@ -30,7 +33,7 @@ export default class Input extends Plugin {
 		 * Typing's change buffer used to group subsequent changes into batches.
 		 *
 		 * @protected
-		 * @member {typing.ChangeBuffer} typing.Input#_buffer
+		 * @member {typing.ChangeBuffer} #_buffer
 		 */
 		this._buffer = new ChangeBuffer( editor.document, editor.config.get( 'typing.undoStep' ) || 20 );
 
@@ -68,7 +71,7 @@ export default class Input extends Plugin {
 	 * to handle the event.
 	 *
 	 * @private
-	 * @param {engine.view.observer.keyObserver.KeyEventData} evtData
+	 * @param {module:engine/view/observer/keyobserver~KeyEventData} evtData
 	 */
 	_handleKeydown( evtData ) {
 		const doc = this.editor.document;
@@ -99,35 +102,33 @@ export default class Input extends Plugin {
  * Helper class for translating DOM mutations into model changes.
  *
  * @private
- * @member typing.Input
  */
 class MutationHandler {
 	/**
 	 * Creates an instance of the mutation handler.
 	 *
-	 * @param {engine.controller.EditingController} editing
-	 * @param {typing.ChangeBuffer} buffer
+	 * @param {module:engine/controller/editingcontroller~EditingController} editing
+	 * @param {module:typing/changebuffer~ChangeBuffer} buffer
 	 */
 	constructor( editing, buffer ) {
 		/**
 		 * The editing controller.
 		 *
-		 * @member {engine.controller.EditingController} typing.Input.MutationHandler#editing
+		 * @member {engine.controller.EditingController} #editing
 		 */
 		this.editing = editing;
 
 		/**
 		 * The change buffer.
 		 *
-		 * @member {engine.controller.EditingController} typing.Input.MutationHandler#buffer
+		 * @member {engine.controller.EditingController} #buffer
 		 */
 		this.buffer = buffer;
 
 		/**
-		 * The number of inserted characters which need to be fed to the {@link #buffer change buffer}
-		 * on {@link #commit}.
+		 * The number of inserted characters which need to be fed to the {@link #buffer change buffer}.
 		 *
-		 * @member {Number} typing.Input.MutationHandler#insertedCharacterCount
+		 * @member {Number} #insertedCharacterCount
 		 */
 		this.insertedCharacterCount = 0;
 	}

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

@@ -3,6 +3,10 @@
  * For licensing, see LICENSE.md.
  */
 
+/**
+ * @module typing/typing
+ */
+
 import Plugin from '../core/plugin.js';
 import Input from './input.js';
 import Delete from './delete.js';
@@ -10,7 +14,6 @@ import Delete from './delete.js';
 /**
  * The typing feature. Handles typing.
  *
- * @memberOf typing
  * @extends core.Plugin
  */
 export default class Typing extends Plugin {