mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-04 18:58:37 +00:00
Merge "Streamline and harden template paramter search widget behavior"
This commit is contained in:
commit
d3e8fe001c
|
@ -105,16 +105,16 @@ ve.ui.MWParameterPlaceholderPage.prototype.setOutlineItem = function () {
|
|||
};
|
||||
|
||||
ve.ui.MWParameterPlaceholderPage.prototype.onParameterChoose = function ( name ) {
|
||||
if ( !name ) {
|
||||
this.addParameterSearch.query.setValue( '' );
|
||||
|
||||
if ( !name || this.template.hasParameter( name ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Note that every parameter is known after it is added
|
||||
var knownBefore = this.template.getSpec().isKnownParameterOrAlias( name ),
|
||||
param = new ve.dm.MWParameterModel( this.template, name );
|
||||
var knownBefore = this.template.getSpec().isKnownParameterOrAlias( name );
|
||||
|
||||
this.addParameterSearch.query.setValue( '' );
|
||||
this.template.addParameter( param );
|
||||
this.template.addParameter( new ve.dm.MWParameterModel( this.template, name ) );
|
||||
|
||||
ve.track( 'activity.transclusion', {
|
||||
action: knownBefore ? 'add-known-parameter' : 'add-unknown-parameter'
|
||||
|
|
Loading…
Reference in a new issue