mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 17:36:35 +00:00
MWLinkNodeInspector: Remove 'Open' button
You can now do this from the context menu. No need to have extra buttons, and this makes it consistent with the MWInternal/MWExternal link inspector. Bug: T109646 Change-Id: Ifd4b3645c66ba2f32ccee7e2848967cf5e7ec82e
This commit is contained in:
parent
bf520fee03
commit
55f78fcbf6
|
@ -34,11 +34,6 @@ ve.ui.MWLinkNodeInspector.static.title = OO.ui.deferMsg( 'visualeditor-linknodei
|
|||
ve.ui.MWLinkNodeInspector.static.modelClasses = [ ve.dm.MWNumberedExternalLinkNode ];
|
||||
|
||||
ve.ui.MWLinkNodeInspector.static.actions = ve.ui.MWLinkNodeInspector.super.static.actions.concat( [
|
||||
{
|
||||
action: 'open',
|
||||
label: OO.ui.deferMsg( 'visualeditor-linkinspector-open' ),
|
||||
modes: [ 'edit', 'insert' ]
|
||||
},
|
||||
{
|
||||
action: 'convert',
|
||||
label: OO.ui.deferMsg( 'visualeditor-linknodeinspector-add-label' ),
|
||||
|
@ -60,34 +55,10 @@ ve.ui.MWLinkNodeInspector.prototype.initialize = function () {
|
|||
validate: ve.init.platform.getExternalLinkUrlProtocolsRegExp()
|
||||
} );
|
||||
|
||||
// Events
|
||||
this.targetInput.connect( this, { change: 'onTargetInputChange' } );
|
||||
|
||||
// Initialization
|
||||
this.form.$element.append( this.targetInput.$element );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle target input change events.
|
||||
*
|
||||
* Updates the open button's hyperlink location.
|
||||
*
|
||||
* @param {string} value New target input value
|
||||
*/
|
||||
ve.ui.MWLinkNodeInspector.prototype.onTargetInputChange = function () {
|
||||
var href = this.targetInput.getValue(),
|
||||
inspector = this;
|
||||
this.targetInput.isValid().done( function ( valid ) {
|
||||
inspector.actions.forEach( { actions: 'open' }, function ( action ) {
|
||||
action.setHref( href ).setTarget( '_blank' ).setDisabled( !valid );
|
||||
// HACK: Chrome renders a dark outline around the action when it's a link, but causing it to
|
||||
// re-render makes it magically go away; this is incredibly evil and needs further
|
||||
// investigation
|
||||
action.$element.hide().fadeIn( 0 );
|
||||
} );
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue