8
0
Просмотр исходного кода

Docs: Update Font commands documentation.

Maciej Gołaszewski 8 лет назад
Родитель
Сommit
b298048c41

+ 23 - 16
packages/ckeditor5-font/src/fontcommand.js

@@ -4,28 +4,40 @@
  */
 
 /**
- * @module font/fontfamilycommand
+ * @module font/fontcommand
  */
 
 import Command from '@ckeditor/ckeditor5-core/src/command';
 
 /**
- * The font family command. It is used by the {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing}
- * to apply font family.
- *
- * TODO: those commands are duplicated here and there - maybe make them one?
+ * The base font command.
  *
  * @extends module:core/command~Command
  */
 export default class FontCommand extends Command {
 	/**
-	 * TODO: docs me
-	 * @param editor
-	 * @param attribute
+	 * Creates a new `FontCommand` instance.
+	 *
+	 * @param {module:core/editor/editor~Editor} editor Editor on which this command will be used.
+	 * @param {String} attribute Name of an model attribute on which this command operates.
 	 */
 	constructor( editor, attribute ) {
 		super( editor );
 
+		/**
+		 * If is set it means that selection has `attribute` set.
+		 *
+		 * @observable
+		 * @readonly
+		 * @member {Boolean} module:font/fontcommand~FontCommand#value
+		 */
+
+		/**
+		 * A model attribute on which this command operates.
+		 *
+		 * @readonly
+		 * @member {Boolean} module:font/fontcommand~FontCommand#attribute
+		 */
 		this.attribute = attribute;
 	}
 
@@ -36,23 +48,18 @@ export default class FontCommand extends Command {
 		const model = this.editor.model;
 		const doc = model.document;
 
-		/**
-		 * A flag indicating whether the command is active, which means that the selection has fontFamily attribute set.
-		 *
-		 * @observable
-		 * @readonly
-		 * @member {Boolean} module:font/fontfamilycommand~FontFamilyCommand#value
-		 */
 		this.value = doc.selection.getAttribute( this.attribute );
 		this.isEnabled = model.schema.checkAttributeInSelection( doc.selection, this.attribute );
 	}
 
 	/**
-	 * Executes the command.
+	 * Executes the command. Applies the the attribute `value` to a selection. If no value is passed it removes attribute from selection.
 	 *
 	 * @protected
 	 * @param {Object} [options] Options for the executed command.
 	 * @param {String} [options.value] a value to apply.
+	 *
+	 * @fires execute
 	 */
 	execute( options = {} ) {
 		const model = this.editor.model;

+ 4 - 3
packages/ckeditor5-font/src/fontfamily/fontfamilycommand.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module font/fontfamilycommand
+ * @module font/fontfamily/fontfamilycommand
  */
 
 import FontCommand from '../fontcommand';
@@ -17,8 +17,9 @@ import FontCommand from '../fontcommand';
  */
 export default class FontFamilyCommand extends FontCommand {
 	/**
-	 * TODO: docs me
-	 * @param editor
+	 * Creates a new `FontFamilyCommand` instance.
+	 *
+	 * @param {module:core/editor/editor~Editor} editor Editor on which this command will be used.
 	 */
 	constructor( editor ) {
 		super( editor, 'fontFamily' );

+ 1 - 1
packages/ckeditor5-font/src/fontfamily/fontfamilyui.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module heading/heading
+ * @module font/fontfamily/fontfamilyui
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';

+ 4 - 3
packages/ckeditor5-font/src/fontsize/fontsizecommand.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module font/fontsizecommand
+ * @module font/fontsize/fontsizecommand
  */
 
 import FontCommand from '../fontcommand';
@@ -17,8 +17,9 @@ import FontCommand from '../fontcommand';
  */
 export default class FontSizeCommand extends FontCommand {
 	/**
-	 * TODO: docs me
-	 * @param editor
+	 * Creates a new `FontSizeCommand` instance.
+	 *
+	 * @param {module:core/editor/editor~Editor} editor Editor on which this command will be used.
 	 */
 	constructor( editor ) {
 		super( editor, 'fontSize' );

+ 1 - 1
packages/ckeditor5-font/src/fontsize/fontsizeui.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module heading/heading
+ * @module font/fontsize/fontsizeui
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';