Fix bugs with loading of themes

This commit is contained in:
Pieter Vander Vennet 2020-10-17 03:19:14 +02:00
parent 07e611bf10
commit e0694fee9d
4 changed files with 12 additions and 6 deletions

View file

@ -41,9 +41,13 @@ export default class SavePanel extends UIElement {
this.json = jsonTextField;
this.loadFromJson = new SubtleButton("./assets/reload.svg", "<b>Load the JSON file below</b>")
.onClick(() => {
const json = jsonTextField.GetValue().data;
const parsed : LayoutConfigJson = JSON.parse(json);
config.setData(parsed);
try{
const json = jsonTextField.GetValue().data;
const parsed : LayoutConfigJson = JSON.parse(json);
config.setData(parsed);
}catch(e){
alert("Invalid JSON: "+e)
}
});
}