瀏覽代碼

Minor simplification. [skip ci]

Piotrek Koszuliński 8 年之前
父節點
當前提交
9d2a24cd6d
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      packages/ckeditor5-list/src/listcommand.js

+ 3 - 2
packages/ckeditor5-list/src/listcommand.js

@@ -38,7 +38,7 @@ export default class ListCommand extends Command {
 		 * Flag indicating whether the command is active, which means that selection starts in a list of the same type.
 		 *
 		 * @observable
-		 * @member {Boolean}
+		 * @member {Boolean} #value
 		 */
 		this.set( 'value', false );
 
@@ -58,6 +58,7 @@ export default class ListCommand extends Command {
 	refreshValue() {
 		// Check whether closest `listItem` ancestor of the position has a correct type.
 		const listItem = first( this.editor.document.selection.getSelectedBlocks() );
+
 		this.value = listItem !== null && listItem.getAttribute( 'type' ) == this.type;
 	}
 
@@ -239,7 +240,7 @@ export default class ListCommand extends Command {
 		const selection = this.editor.document.selection;
 		const schema = this.editor.document.schema;
 
-		const firstBlock = selection.getSelectedBlocks().next().value;
+		const firstBlock = first( selection.getSelectedBlocks() );
 
 		if ( !firstBlock ) {
 			return false;