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

Simplified the keystroke listener callback.

Aleksander Nowodzinski 8 лет назад
Родитель
Сommit
70c112ea33
1 измененных файлов с 4 добавлено и 13 удалено
  1. 4 13
      packages/ckeditor5-ui/src/list/listitemview.js

+ 4 - 13
packages/ckeditor5-ui/src/list/listitemview.js

@@ -105,7 +105,10 @@ export default class ListItemView extends View {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	init() {
 	init() {
-		const onKeystrokePress = getKeystrokePressCallback( this );
+		const onKeystrokePress = ( data, cancel ) => {
+			this.fire( 'execute' );
+			cancel();
+		};
 
 
 		this.keystrokes.listenTo( this.element );
 		this.keystrokes.listenTo( this.element );
 
 
@@ -121,15 +124,3 @@ export default class ListItemView extends View {
 		this.element.focus();
 		this.element.focus();
 	}
 	}
 }
 }
-
-// Returns the Enter and Space keystroke handler for given ListItemView.
-//
-// @private
-// @param {module:ui/list/listitemview~ListItemView} view
-// @returns {Function} A listener for {@link module:utils/keystrokehandler~KeystrokeHandler}.
-function getKeystrokePressCallback( view ) {
-	return ( data, cancel ) => {
-		view.fire( 'execute' );
-		cancel();
-	};
-}