Merge "Quickfix for Transclusion icon in RTL wikis"

This commit is contained in:
jenkins-bot 2013-07-24 03:45:01 +00:00 committed by Gerrit Code Review
commit 8b201c7dc4
3 changed files with 24 additions and 3 deletions

View file

@ -1566,3 +1566,11 @@ ve.ce.Surface.prototype.enableRendering = function () {
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' );
};

View file

@ -266,8 +266,8 @@ ve.ui.Context.prototype.updateDimensions = function ( transition ) {
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 @@ ve.ui.Context.prototype.updateDimensions = function ( transition ) {
$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,

View file

@ -250,3 +250,11 @@ ve.ui.Surface.prototype.addTriggers = function ( triggers, command ) {
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' );
};