mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 00:00:49 +00:00
Use less repetitive code when calling .showHandles()
This is just shorter and avoids duplication, but does the same as before. Change-Id: Ib33603bcba15c08e93406c71677b4733bf16a149
This commit is contained in:
parent
760d8a3a86
commit
fccb9bb4bb
|
@ -136,20 +136,12 @@ ve.ce.MWBlockImageNode.prototype.updateClasses = function ( oldAlign ) {
|
|||
// Border
|
||||
this.$element.toggleClass( 'mw-image-border', !!this.model.getAttribute( 'borderImage' ) );
|
||||
|
||||
switch ( alignClass ) {
|
||||
case 'mw-halign-right':
|
||||
this.showHandles( [ 'sw' ] );
|
||||
break;
|
||||
case 'mw-halign-left':
|
||||
this.showHandles( [ 'se' ] );
|
||||
break;
|
||||
case 'mw-halign-center':
|
||||
this.showHandles( [ 'sw', 'se' ] );
|
||||
break;
|
||||
default:
|
||||
this.showHandles();
|
||||
break;
|
||||
}
|
||||
this.showHandles( {
|
||||
'mw-halign-right': [ 'sw' ],
|
||||
'mw-halign-left': [ 'se' ],
|
||||
'mw-halign-center': [ 'sw', 'se' ]
|
||||
// Defaults to undefined
|
||||
}[ alignClass ] );
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,11 +46,7 @@ ve.ce.MWInlineImageNode = function VeCeMWInlineImageNode( model, config ) {
|
|||
.attr( 'width', this.model.getAttribute( 'width' ) )
|
||||
.attr( 'height', this.model.getAttribute( 'height' ) );
|
||||
|
||||
if ( this.$element.css( 'direction' ) === 'rtl' ) {
|
||||
this.showHandles( [ 'sw' ] );
|
||||
} else {
|
||||
this.showHandles( [ 'se' ] );
|
||||
}
|
||||
this.showHandles( [ this.$element.css( 'direction' ) === 'rtl' ? 'sw' : 'se' ] );
|
||||
|
||||
this.updateClasses();
|
||||
|
||||
|
|
Loading…
Reference in a new issue