mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:49:24 +02:00
cleanup and handle a bug when changing from normal text userdata to another field
This commit is contained in:
parent
45e3f926a1
commit
384c3dd543
1 changed files with 11 additions and 15 deletions
|
@ -333,11 +333,7 @@ function userDataChanger(groupName, keyName, checkBoxElement, userDataElement, d
|
|||
var properties = {};
|
||||
var parsedData = {};
|
||||
try {
|
||||
if ($('#userdata-editor').css('height') === "0px") {
|
||||
parsedData = editor.getJSON();
|
||||
} else {
|
||||
parsedData = JSON.parse(userDataElement.value);
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
if (!(groupName in parsedData)) {
|
||||
|
@ -493,7 +489,10 @@ function bindAllNonJSONEditorElements() {
|
|||
if (e.target.id === "userdata-new-editor" || e.target.id === "userdata-clear") {
|
||||
return;
|
||||
} else {
|
||||
if ($('#userdata-editor').css('height') !== "0px") {
|
||||
saveJSONUserData(true);
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -843,11 +842,8 @@ function loaded() {
|
|||
hideUserDataTextArea();
|
||||
var json = null;
|
||||
try {
|
||||
json = JSON.parse(properties.userData)
|
||||
//its json
|
||||
if (Object.keys(json).length === 0 && json.constructor === Object) {
|
||||
//it's an empty object
|
||||
}
|
||||
json = JSON.parse(properties.userData);
|
||||
|
||||
if (editor === null) {
|
||||
createJSONEditor();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue