浏览代码

Minor refactoring.

Piotrek Koszuliński 9 年之前
父节点
当前提交
9c8f13bd61
共有 1 个文件被更改,包括 5 次插入8 次删除
  1. 5 8
      packages/ckeditor5-list/src/listcommand.js

+ 5 - 8
packages/ckeditor5-list/src/listcommand.js

@@ -38,17 +38,14 @@ export default class ListCommand extends Command {
 		 */
 		this.set( 'value', false );
 
-		// Listen on selection change and sets current command's value.
-		this.listenTo( editor.document.selection, 'change:range', () => {
+		const changeCallback = () => {
 			this.refreshValue();
 			this.refreshState();
-		} );
+		};
 
-		// Listen on changesDone model document and sets current command's value.
-		this.listenTo( editor.document, 'changesDone', () => {
-			this.refreshValue();
-			this.refreshState();
-		} );
+		// Listen on selection and document changes and set the current command's value.
+		this.listenTo( editor.document.selection, 'change:range', changeCallback );
+		this.listenTo( editor.document, 'changesDone', changeCallback );
 	}
 
 	/**