Jforrester has uploaded a new change for review.
https://gerrit.wikimedia.org/r/198266
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 of SurfaceWindowManager
based on the surface, and the directionality of the WindowManager
based on the body element direction.
Change-Id: Ibf29417a2eb64d966417cfa96a0d4417e3d80efd
(cherry picked from commit dafeb22c6a9115520438169f93b54f3b49c43aaa)
---
M src/ui/ve.ui.WindowManager.js
M src/ui/windowmanagers/ve.ui.SurfaceWindowManager.js
2 files changed, 23 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/66/198266/1
diff --git a/src/ui/ve.ui.WindowManager.js b/src/ui/ve.ui.WindowManager.js
index a44fa6d..8749da2 100644
--- a/src/ui/ve.ui.WindowManager.js
+++ b/src/ui/ve.ui.WindowManager.js
@@ -23,6 +23,9 @@
// Properties
this.overlay = config.overlay || null;
+
+ this.$element
+ .addClass( 've-ui-dir-block-' + this.getDir() );
};
/* Inheritance */
@@ -32,6 +35,14 @@
/* Methods */
/**
+ * Get directionality
+ * @return {string} UI directionality
+ */
+ve.ui.WindowManager.prototype.getDir = function () {
+ return $( 'body' ).css( 'direction' );
+};
+
+/**
* Get overlay for menus.
*
* @return {ve.ui.Overlay|null} Menu overlay, null if none was configured
diff --git a/src/ui/windowmanagers/ve.ui.SurfaceWindowManager.js
b/src/ui/windowmanagers/ve.ui.SurfaceWindowManager.js
index 4625da8..8c5b7c1 100644
--- a/src/ui/windowmanagers/ve.ui.SurfaceWindowManager.js
+++ b/src/ui/windowmanagers/ve.ui.SurfaceWindowManager.js
@@ -32,6 +32,18 @@
/* Methods */
/**
+ * Override the window manager's directionality method to get the
+ * directionality from the surface. The surface sometimes does not
+ * have a directionality set; fallback to direction from the document.
+ * @return {string} UI directionality
+ */
+ve.ui.SurfaceWindowManager.prototype.getDir = function () {
+ return this.surface.getDir() ||
+ // Fallback to parent method
+ ve.ui.SurfaceWindowManager.super.prototype.getDir.call( this );
+};
+
+/**
* Get surface.
*
* @return {ve.ui.Surface} Surface this belongs to
--
To view, visit https://gerrit.wikimedia.org/r/198266
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: wmf/1.25wmf21
Gerrit-Owner: Jforrester <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits