jenkins-bot has submitted this change and it was merged.
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
---
M src/ui/ve.ui.WindowManager.js
M src/ui/windowmanagers/ve.ui.SurfaceWindowManager.js
2 files changed, 23 insertions(+), 0 deletions(-)
Approvals:
Jforrester: Looks good to me, but someone else must approve
Trevor Parscal: Looks good to me, approved
jenkins-bot: Verified
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/196661
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibf29417a2eb64d966417cfa96a0d4417e3d80efd
Gerrit-PatchSet: 11
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits