Browse Source

Minor refactoring.

Piotrek Koszuliński 9 years ago
parent
commit
9c8f13bd61
1 changed files with 5 additions and 8 deletions
  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 );
 	}
 
 	/**