Dialog must listen for changes to the param names

Otherwise the second keystroke made while changing parameter names will cause
an error. I think this code previously assumed the change only happened once,
rather than on-keystroke.

Bug: T142889
Change-Id: I0e9c096a053667c51bbce74ee3ce1bd573ae7d49
This commit is contained in:
David Lynch 2016-08-12 17:31:04 -07:00
parent bee2e2fa6a
commit 1564abd48d

View file

@ -280,6 +280,21 @@ mw.TemplateData.Dialog.prototype.onModelChangeParamOrder = function () {
this.repopulateParamSelectWidget(); this.repopulateParamSelectWidget();
}; };
/**
* Respond to change of param property from the model
*
* @param {string} paramKey Parameter key
* @param {string} prop Property name
* @param {...Mixed} value Property value
* @param {string} [language] Value language
*/
mw.TemplateData.Dialog.prototype.onModelChangeProperty = function ( paramKey, prop, value ) {
// Refresh the parameter widget
if ( paramKey === this.selectedParamKey && prop === 'name' ) {
this.selectedParamKey = value;
}
};
/** /**
* Respond to a change in the model * Respond to a change in the model
*/ */
@ -804,6 +819,7 @@ mw.TemplateData.Dialog.prototype.getSetupProcess = function ( data ) {
this.model.connect( this, { this.model.connect( this, {
'change-description': 'onModelChangeDescription', 'change-description': 'onModelChangeDescription',
'change-paramOrder': 'onModelChangeParamOrder', 'change-paramOrder': 'onModelChangeParamOrder',
'change-property': 'onModelChangeProperty',
change: 'onModelChange' change: 'onModelChange'
} ); } );