瀏覽代碼

Code refactoring in HeadingCommand: 'format'->'option'.

Aleksander Nowodzinski 8 年之前
父節點
當前提交
ea23266bdb
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      packages/ckeditor5-heading/src/headingcommand.js

+ 5 - 5
packages/ckeditor5-heading/src/headingcommand.js

@@ -53,7 +53,7 @@ export default class HeadingCommand extends Command {
 	 */
 	get defaultOption() {
 		// See https://github.com/ckeditor/ckeditor5/issues/98.
-		return this._getFormatById( this.editor.config.get( 'heading.defaultOptionId' ) );
+		return this._getOptionById( this.editor.config.get( 'heading.defaultOptionId' ) );
 	}
 
 	/**
@@ -132,7 +132,7 @@ export default class HeadingCommand extends Command {
 	 * @param {String} id
 	 * @returns {module:heading/headingcommand~HeadingOption}
 	 */
-	_getFormatById( id ) {
+	_getOptionById( id ) {
 		return this.options.find( item => item.id === id ) || this.defaultOption;
 	}
 
@@ -146,7 +146,7 @@ export default class HeadingCommand extends Command {
 		const block = findTopmostBlock( position );
 
 		if ( block ) {
-			this.value = this._getFormatById( block.name );
+			this.value = this._getOptionById( block.name );
 		}
 	}
 }
@@ -180,7 +180,7 @@ function findTopmostBlock( position, nodeAfter = true ) {
  * Heading option descriptor.
  *
  * @typedef {Object} module:heading/headingcommand~HeadingOption
- * @property {String} id Format identifier. It will be used as the element's name in the model.
- * @property {String} viewElement The name of the view element that will be used to represent the model element in the view.
+ * @property {String} id Option identifier. It will be used as the element's name in the model.
+ * @property {String} element The name of the view element that will be used to represent the model element in the view.
  * @property {String} label The display name of the option.
  */