Explorar o código

Apply suggestions from code review

Co-Authored-By: Maciej <jodator@jodator.net>
Kuba Niegowski %!s(int64=5) %!d(string=hai) anos
pai
achega
b53956ddd2
Modificáronse 1 ficheiros con 5 adicións e 7 borrados
  1. 5 7
      packages/ckeditor5-table/src/tablenavigation.js

+ 5 - 7
packages/ckeditor5-table/src/tablenavigation.js

@@ -18,7 +18,7 @@ import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
 import priorities from '@ckeditor/ckeditor5-utils/src/priorities';
 
 /**
- * This plugin enables a keyboard navigation for tables.
+ * This plugin enables keyboard navigation for tables.
  * It is loaded automatically by the {@link module:table/table~Table} plugin.
  *
  * @extends module:core/plugin~Plugin
@@ -156,16 +156,14 @@ export default class TableNavigation extends Plugin {
 	 * @param {module:engine/view/observer/domeventdata~DomEventData} domEventData
 	 */
 	_onKeydown( eventInfo, domEventData ) {
-		const isLtrContent = this.editor.locale.contentLanguageDirection === 'ltr';
 		const keyCode = domEventData.keyCode;
-		let wasHandled = false;
 
-		// Checks if the keys were handled and then prevents the default event behaviour and stops
-		// the propagation.
-		if ( isArrowKeyCode( keyCode ) ) {
-			wasHandled = this._handleArrowKeys( getDirectionFromKeyCode( keyCode, isLtrContent ) );
+		if ( !isArrowKeyCode( keyCode ) ) {
+			return;
 		}
 
+		const wasHandled = this._handleArrowKeys( getDirectionFromKeyCode( keyCode, this.editor.locale.contentLanguageDirection ) );
+
 		if ( wasHandled ) {
 			domEventData.preventDefault();
 			domEventData.stopPropagation();