mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Merge "Image insertion alignment fix"
This commit is contained in:
commit
890c14009e
|
@ -63,9 +63,6 @@ ve.ce.MWBlockImageNode = function VeCeMWBlockImageNode( model, config ) {
|
||||||
// Type "frame", "thumb" and the default
|
// Type "frame", "thumb" and the default
|
||||||
this.$image.addClass( 'thumbimage' );
|
this.$image.addClass( 'thumbimage' );
|
||||||
this.$thumb
|
this.$thumb
|
||||||
.addClass(
|
|
||||||
ve.ce.MWBlockImageNode.static.cssClasses[ 'default' ][ this.model.getAttribute( 'align' ) ]
|
|
||||||
)
|
|
||||||
.addClass( 'thumb' );
|
.addClass( 'thumb' );
|
||||||
this.$a.appendTo( this.$thumbInner );
|
this.$a.appendTo( this.$thumbInner );
|
||||||
this.$thumbInner.appendTo( this.$thumb );
|
this.$thumbInner.appendTo( this.$thumb );
|
||||||
|
@ -118,7 +115,8 @@ ve.ce.MWBlockImageNode.static.cssClasses = {
|
||||||
'right': 'tright',
|
'right': 'tright',
|
||||||
'center' : 'tnone',
|
'center' : 'tnone',
|
||||||
'none' : 'tnone',
|
'none' : 'tnone',
|
||||||
'default': 'tright'
|
// Default is different between RTL and LTR wikis:
|
||||||
|
'default': ['tright', 'tleft']
|
||||||
},
|
},
|
||||||
'none': {
|
'none': {
|
||||||
'left': 'floatleft',
|
'left': 'floatleft',
|
||||||
|
@ -130,6 +128,27 @@ ve.ce.MWBlockImageNode.static.cssClasses = {
|
||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override the default onSetup to add direction-dependent
|
||||||
|
* classes to the image thumbnail.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
*/
|
||||||
|
ve.ce.MWBlockImageNode.prototype.onSetup = function ( ) {
|
||||||
|
var type = this.model.getAttribute( 'type' ),
|
||||||
|
isRTL;
|
||||||
|
|
||||||
|
if ( type !== 'none' && type !=='frameless' ) {
|
||||||
|
// get the proper alignment for the image inside the editor
|
||||||
|
isRTL = ( this.$.css( 'direction' ) === 'rtl' ) ? 1 : 0;
|
||||||
|
this.$thumb
|
||||||
|
.addClass(
|
||||||
|
ve.ce.MWBlockImageNode.static.cssClasses[ 'default' ][ this.model.getAttribute( 'align' ) ][ isRTL ]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
ve.ce.MWBlockImageNode.prototype.onAttributeChange = function ( key, from, to ) {
|
ve.ce.MWBlockImageNode.prototype.onAttributeChange = function ( key, from, to ) {
|
||||||
var $element, type;
|
var $element, type;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ ve.ui.MWMediaInsertDialog.prototype.onClose = function ( action ) {
|
||||||
'type': 'mwBlockImage',
|
'type': 'mwBlockImage',
|
||||||
'attributes': {
|
'attributes': {
|
||||||
'type': 'thumb',
|
'type': 'thumb',
|
||||||
'align': 'right',
|
'align': 'default',
|
||||||
//'href': info.descriptionurl,
|
//'href': info.descriptionurl,
|
||||||
'href': './' + this.item.title,
|
'href': './' + this.item.title,
|
||||||
'src': info.thumburl,
|
'src': info.thumburl,
|
||||||
|
|
Loading…
Reference in a new issue