Fix node validation if property is not required

This commit is contained in:
GogoVega 2024-06-27 09:16:03 +02:00
parent 1b5b3f7f88
commit 19a8fa09a8
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B

View File

@ -148,12 +148,23 @@ RED.editor = (function() {
((typeof definition[property].label) == "string")) {
label = definition[property].label;
}
if ("required" in definition[property] && definition[property].required) {
valid = value !== "";
if (!valid && label) {
return RED._("validator.errors.missing-required-prop", {
prop: label
});
if ("required" in definition[property]) {
if (definition[property].required) {
valid = value !== "";
if (!valid && label) {
return RED._("validator.errors.missing-required-prop", {
prop: label
});
}
} else {
if (value === "") {
return true;
}
}
} else {
if (value === "") {
return true;
}
}
if (valid && "validate" in definition[property]) {