Mooeypoo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/196661

Change subject: Add directionality classes to window manager
......................................................................

Add directionality classes to window manager

Many of the icon settings require the directionality class in
order to feature icons that can be flipped between ltr/rtl. Those
icons don't show inside dialogs and inspectors unless the wrapping
window manager holds those classes.

In this fix we set the directionality based on the given surface;
however, window manager can be created (and is created) without
being given a surface; in those cases, we have to have fallbacks
to the elements on the page.

Change-Id: Ibf29417a2eb64d966417cfa96a0d4417e3d80efd
---
M src/ui/ve.ui.WindowManager.js
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/61/196661/1

diff --git a/src/ui/ve.ui.WindowManager.js b/src/ui/ve.ui.WindowManager.js
index 73d7a31..2d647d7 100644
--- a/src/ui/ve.ui.WindowManager.js
+++ b/src/ui/ve.ui.WindowManager.js
@@ -16,6 +16,7 @@
  * @cfg {ve.ui.Overlay} [overlay] Overlay to use for menus
  */
 ve.ui.WindowManager = function VeUiWindowManager( surface, config ) {
+       var dir;
        // Configuration initialization
        config = config || {};
 
@@ -25,6 +26,20 @@
        // Properties
        this.surface = surface;
        this.overlay = config.overlay || null;
+
+       // We need to make sure the window manager reflects page directionality
+       // however, the window manager is occasionally instantiated without 
having
+       // a reference to the surface. In those cases we fall-back to the 
element
+       // if it is attached, or, if not attached, to the directionality of the
+       // body itself.
+       if ( this.surface ) {
+               dir = this.surface.getDir();
+       }
+       dir = dir || this.$element.css( 'direction' ) || $( 'body' ).css( 
'direction' );
+       this.$element
+               .removeClass( 've-ui-dir-block-rtl ve-ui-dir-block-ltr' )
+               .addClass( 've-ui-dir-block-' + dir );
+
 };
 
 /* Inheritance */

-- 
To view, visit https://gerrit.wikimedia.org/r/196661
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf29417a2eb64d966417cfa96a0d4417e3d80efd
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to