jenkins-bot has submitted this change and it was merged.
Change subject: Quickfix for Transclusion icon in RTL wikis
..
Quickfix for Transclusion icon in RTL wikis
Added GUI-level and Page-level getDir() methods to get the direction
of the GUI and Page respectively in the ve.ui.Surface and ve.ce.Surface
respectively.
The correction to the direction-test condition in ve.ui.Context reflects
the new method of getting these directions, and fixes the problem with
the transclusion icon. The icon position depends on the wiki/page-level
directionality, regardless of the GUI-level direction.
Bug: 51819
Change-Id: I36cef115017542c461e6d757f1c8bfda92074607
---
M modules/ve/ce/ve.ce.Surface.js
M modules/ve/ui/ve.ui.Context.js
M modules/ve/ui/ve.ui.Surface.js
3 files changed, 24 insertions(+), 3 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js
index 68519f3..fb46695 100644
--- a/modules/ve/ce/ve.ce.Surface.js
+++ b/modules/ve/ce/ve.ce.Surface.js
@@ -1566,3 +1566,11 @@
ve.ce.Surface.prototype.disableRendering = function () {
this.renderingEnabled = false;
};
+
+/**
+ * Surface 'dir' property (Content-Level Direction)
+ * @returns {string} 'ltr' or 'rtl'
+ */
+ve.ce.Surface.prototype.getDir = function () {
+ return this.$.css( 'direction' );
+};
diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js
index 7df3676..694af14 100644
--- a/modules/ve/ui/ve.ui.Context.js
+++ b/modules/ve/ui/ve.ui.Context.js
@@ -266,8 +266,8 @@
focusableWidth = focusedNode.$focusable.outerWidth();
$container = this.$menu;
position = { 'y': focusableOffset.top };
- // HACK: Proper RTL detection plz!
- if ( $( 'body' ).is( '.rtl,.ve-rtl' ) ) {
+ // RTL check for Page-level (CE)
+ if ( this.surface.view.getDir() === 'rtl' ) {
position.x = focusableOffset.left;
this.popup.align = 'left';
} else {
@@ -278,7 +278,12 @@
$container = inspector ? this.inspectors.$ : this.$menu;
this.popup.align = 'center';
}
- this.$.css( { 'left': position.x, 'top': position.y } );
+ // Flip left with right if CE is RTL
+ if ( this.surface.view.getDir() === 'rtl' ) {
+ this.$.css( { 'right': position.x, 'top': position.y }
);
+ } else {
+ this.$.css( { 'left': position.x, 'top': position.y } );
+ }
this.popup.display(
position.x,
position.y,
diff --git a/modules/ve/ui/ve.ui.Surface.js b/modules/ve/ui/ve.ui.Surface.js
index dcbade4..200dd5e 100644
--- a/modules/ve/ui/ve.ui.Surface.js
+++ b/modules/ve/ui/ve.ui.Surface.js
@@ -250,3 +250,11 @@
this.commands[trigger] = command.action;
}
};
+
+/**
+ * Surface 'dir' property (GUI/User-Level Direction)
+ * @returns {string} 'ltr' or 'rtl'
+ */
+ve.ui.Surface.prototype.getDir = function () {
+ return this.$.css( 'direction' );
+};
--
To view, visit https://gerrit.wikimedia.org/r/75246
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I36cef115017542c461e6d757f1c8bfda92074607
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com
Gerrit-Reviewer: Amire80 amir.ahar...@mail.huji.ac.il
Gerrit-Reviewer: Catrope roan.katt...@gmail.com
Gerrit-Reviewer: Inez i...@wikia-inc.com
Gerrit-Reviewer: jenkins-bot
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits