Procházet zdrojové kódy

Added docs to ImageAlternateTextCommand.

Szymon Kupś před 9 roky
rodič
revize
7547347843

+ 25 - 2
packages/ckeditor5-image/src/imagealternatetext/imagealternatetextcommand.js

@@ -8,11 +8,17 @@
  */
 
 import Command from 'ckeditor5-core/src/command/command';
-
-// TODO: isImage to image utils.
 import { isImage } from '../utils';
 
+/**
+ * The image alternate text command. It is used to change `alt` attribute on `image` elements.
+ *
+ * @extends module:core/command/command~Command
+ */
 export default class ImageAlternateTextCommand extends Command {
+	/**
+	 * @inheritDoc
+	 */
 	constructor( editor ) {
 		super( editor );
 
@@ -25,6 +31,11 @@ export default class ImageAlternateTextCommand extends Command {
 		} );
 	}
 
+	/**
+	 * Updates command's value.
+	 *
+	 * @private
+	 */
 	_updateValue() {
 		const doc = this.editor.document;
 		const element = doc.selection.getSelectedElement();
@@ -36,12 +47,24 @@ export default class ImageAlternateTextCommand extends Command {
 		}
 	}
 
+	/**
+	 * @inheritDoc
+	 */
 	_checkEnabled() {
 		const element = this.editor.document.selection.getSelectedElement();
 
 		return isImage( element );
 	}
 
+	/**
+	 * Executes command.
+	 *
+	 * @protected
+	 * @param {Object} options
+	 * @param {String} options.newValue New value of `alt` attribute to set.
+	 * @param {module:engine/model/batch~Batch} [options.batch] Batch to collect all the change steps. New batch will be
+	 * created if this option is not set.
+	 */
 	_doExecute( options ) {
 		const editor = this.editor;
 		const doc = editor.document;