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

@ -17,7 +17,6 @@ export class ElementStorage {
addElement(element): UIEventSource<any> { addElement(element): UIEventSource<any> {
const eventSource = new UIEventSource<any>(element.properties); const eventSource = new UIEventSource<any>(element.properties);
console.log("Creating a new tag storate for ", element.properties.id)
this._elements[element.properties.id] = eventSource; this._elements[element.properties.id] = eventSource;
return eventSource; return eventSource;
} }

View file

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

View file

@ -43,6 +43,9 @@ export class RadioButton<T> extends InputElement<T> {
self._selectedElementIndex.setData(i); self._selectedElementIndex.setData(i);
} }
}) })
elements[i].GetValue().addCallback(() => {
self._selectedElementIndex.setData(i);
})
} }
} }

View file

@ -73,12 +73,12 @@ export class TextField extends InputElement<string> {
label = this._label.Render(); label = this._label.Render();
} }
return new Combine([ return new Combine([
`<div id="${this.id}">`, `<span id="${this.id}">`,
`<form onSubmit='return false' class='form-text-field'>`, `<form onSubmit='return false' class='form-text-field'>`,
label, label,
`<input type='${this._htmlType}' placeholder='${placeholder}' id='txt-${this.id}'/>`, `<input type='${this._htmlType}' placeholder='${placeholder}' id='txt-${this.id}'/>`,
`</form>`, `</form>`,
`</div>` `</span>`
]).Render(); ]).Render();
} }