mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Ensure node field change handlers are invoked after editprepare
This commit is contained in:
parent
acdef87be7
commit
9a73568c7a
@ -301,8 +301,10 @@ RED.editor = (function() {
|
||||
* @param prefix - the prefix to use in the input element ids (node-input|node-config-input)
|
||||
*/
|
||||
function attachPropertyChangeHandler(node,definition,property,prefix) {
|
||||
$("#"+prefix+"-"+property).change(function() {
|
||||
validateNodeEditor(node,prefix);
|
||||
$("#"+prefix+"-"+property).change(function(event,skipValidation) {
|
||||
if (!skipValidation) {
|
||||
validateNodeEditor(node,prefix);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -399,6 +401,20 @@ RED.editor = (function() {
|
||||
if (definition.oneditprepare) {
|
||||
definition.oneditprepare.call(node);
|
||||
}
|
||||
// Now invoke any change handlers added to the fields - passing true
|
||||
// to prevent full node validation from being triggered each time
|
||||
for (var d in definition.defaults) {
|
||||
if (definition.defaults.hasOwnProperty(d)) {
|
||||
$("#"+prefix+"-"+d).trigger("change",[true]);
|
||||
}
|
||||
}
|
||||
if (definition.credentials) {
|
||||
for (d in definition.credentials) {
|
||||
if (definition.credentials.hasOwnProperty(d)) {
|
||||
$("#"+prefix+"-"+d).trigger("change",[true]);
|
||||
}
|
||||
}
|
||||
}
|
||||
validateNodeEditor(node,prefix);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user