mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-18 01:00:45 +00:00
Merge "MWLinkNodeInspector: Remove 'Open' button"
This commit is contained in:
commit
a2060f57c1
|
@ -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.modelClasses = [ ve.dm.MWNumberedExternalLinkNode ];
|
||||||
|
|
||||||
ve.ui.MWLinkNodeInspector.static.actions = ve.ui.MWLinkNodeInspector.super.static.actions.concat( [
|
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',
|
action: 'convert',
|
||||||
label: OO.ui.deferMsg( 'visualeditor-linknodeinspector-add-label' ),
|
label: OO.ui.deferMsg( 'visualeditor-linknodeinspector-add-label' ),
|
||||||
|
@ -60,34 +55,10 @@ ve.ui.MWLinkNodeInspector.prototype.initialize = function () {
|
||||||
validate: ve.init.platform.getExternalLinkUrlProtocolsRegExp()
|
validate: ve.init.platform.getExternalLinkUrlProtocolsRegExp()
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Events
|
|
||||||
this.targetInput.connect( this, { change: 'onTargetInputChange' } );
|
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
this.form.$element.append( this.targetInput.$element );
|
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
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue