MediaContext: Link filename to file page

Change-Id: Ice3fdd40cd1f7b8ba2841ac326babc7f24a2635e
This commit is contained in:
Ed Sanders 2018-03-20 12:49:13 +00:00
parent c245dd9ca0
commit 10792e179f

View file

@ -65,6 +65,21 @@ ve.ui.MWMediaContextItem.prototype.getDescription = function () {
return ve.ce.nodeFactory.getDescription( this.model ); return ve.ce.nodeFactory.getDescription( this.model );
}; };
/**
* @inheritdoc
*/
ve.ui.MWMediaContextItem.prototype.renderBody = function () {
this.$body.append(
$( '<a>' )
.text( this.getDescription() )
.attr( {
href: mw.util.getUrl( this.model.getAttribute( 'resource' ) ),
target: '_blank',
rel: 'noopener'
} )
);
};
/* Registration */ /* Registration */
ve.ui.contextItemFactory.register( ve.ui.MWMediaContextItem ); ve.ui.contextItemFactory.register( ve.ui.MWMediaContextItem );