A fix for arrow movements in RTL wikis.

This will make sure the marker moves correctly (backwards/forward)
in RTL languages as well as LTR languages, judging from the wiki pageLanguage.
This can be a quickfix until the movement can be decided per the direction
of the specific element (span/paragraph/div) the marker is in.

Bug: 38546
Change-Id: Ic01e110a5e6094cd275327a2e8cea90c900f1bd1
This commit is contained in:
Moriel Schottlender 2013-05-27 18:14:59 -04:00
parent cba55b9330
commit 5e9c9b9367

View file

@ -916,7 +916,12 @@ ve.ce.Surface.prototype.handleLeftOrRightArrowKey = function ( e ) {
// Stop with final poll cycle so we have correct information in model
this.surfaceObserver.stop( true );
selection = this.model.getSelection();
offsetDelta = e.keyCode === ve.Keys.LEFT ? -1 : 1;
if ( this.$$( e.target ).css( 'direction' ) === 'rtl' ) {
// If the language direction is RTL, switch left/right directions:
offsetDelta = e.keyCode === ve.Keys.LEFT ? 1 : -1;
} else {
offsetDelta = e.keyCode === ve.Keys.LEFT ? -1 : 1;
}
// Check for selecting/deselecting inline images and aliens
if ( selection.isCollapsed() ) {