Jsoneditor, Correct translation for default values

This commit is contained in:
LordGrey 2021-05-17 08:48:20 +02:00
parent cfb34e6bfc
commit 80d60c2406

View File

@ -1839,7 +1839,14 @@ JSONEditor.AbstractEditor = Class.extend({
this.parent = null;
},
getDefault: function() {
if(this.schema["default"]) return $.i18n(this.schema["default"]);
var def = this.schema["default"];
if(def) {
if (typeof def === "string") {
return $.i18n(def);
} else {
return def;
}
}
if(this.schema["enum"]) return this.schema["enum"][0];
var type = this.schema.type || this.schema.oneOf;