mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
Only show non-anchored resize handles for MWBlock/InlineImages
For block images, show the bottom left/right anchor if the image is right/left aligned, and both if it is centred. For inline images, show the bottom right anchor unless the page is RTL. Change-Id: Icb5b74b954493257c517a5fbac5f0a0a457c544c
This commit is contained in:
parent
e31b28527e
commit
6f37b4608c
|
@ -149,7 +149,8 @@ ve.ce.MWBlockImageNode.prototype.updateCaption = function () {
|
|||
* @param {string} [oldAlign] The old alignment, for removing classes
|
||||
*/
|
||||
ve.ce.MWBlockImageNode.prototype.updateClasses = function ( oldAlign ) {
|
||||
var align = this.model.getAttribute( 'align' ),
|
||||
var alignClass,
|
||||
align = this.model.getAttribute( 'align' ),
|
||||
type = this.model.getAttribute( 'type' );
|
||||
|
||||
if ( oldAlign && oldAlign !== align ) {
|
||||
|
@ -160,15 +161,29 @@ ve.ce.MWBlockImageNode.prototype.updateClasses = function ( oldAlign ) {
|
|||
}
|
||||
|
||||
if ( type !== 'none' && type !== 'frameless' ) {
|
||||
alignClass = this.getCssClass( 'default', align );
|
||||
this.$image.addClass( 've-ce-mwBlockImageNode-thumbimage' );
|
||||
this.$figure
|
||||
.addClass( this.getCssClass( 'default', align ) )
|
||||
.addClass( 've-ce-mwBlockImageNode-borderwrap' );
|
||||
this.$figure.addClass( 've-ce-mwBlockImageNode-borderwrap' );
|
||||
} else {
|
||||
alignClass = this.getCssClass( 'none', align );
|
||||
this.$image.removeClass( 've-ce-mwBlockImageNode-thumbimage' );
|
||||
this.$figure
|
||||
.addClass( this.getCssClass( 'none', align ) )
|
||||
.removeClass( 've-ce-mwBlockImageNode-borderwrap' );
|
||||
this.$figure.removeClass( 've-ce-mwBlockImageNode-borderwrap' );
|
||||
}
|
||||
this.$figure.addClass( alignClass );
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -50,6 +50,12 @@ ve.ce.MWInlineImageNode = function VeCeMWInlineImageNode( model, config ) {
|
|||
this.$image.css( 'vertical-align', valign );
|
||||
}
|
||||
|
||||
if ( this.$element.css( 'direction' ) === 'rtl' ) {
|
||||
this.showHandles( ['sw'] );
|
||||
} else {
|
||||
this.showHandles( ['se'] );
|
||||
}
|
||||
|
||||
// DOM changes
|
||||
this.$element.addClass( 've-ce-mwInlineImageNode' );
|
||||
|
||||
|
|
Loading…
Reference in a new issue