Fixed buggy policy references in the Options dialog.

This commit is contained in:
hackademix 2020-07-29 16:10:09 +02:00
parent 35d82bd801
commit 93a2048699
1 changed files with 6 additions and 3 deletions

View File

@ -144,14 +144,17 @@
// SITES UI // SITES UI
let sitesUI = new UI.Sites(document.getElementById("sites")); let sitesUI = new UI.Sites(document.getElementById("sites"));
UI.onSettings = () => {
policy = UI.policy;
sitesUI.render(policy.sites);
}
{ {
sitesUI.onChange = () => { sitesUI.onChange = () => {
if (UI.local.debug) { if (UI.local.debug) {
updateRawPolicyEditor(); updateRawPolicyEditor();
} }
}; };
let sites = policy.sites; sitesUI.render(policy.sites);
sitesUI.render(sites);
let newSiteForm = document.querySelector("#form-newsite"); let newSiteForm = document.querySelector("#form-newsite");
let newSiteInput = newSiteForm.newsite; let newSiteInput = newSiteForm.newsite;
@ -194,7 +197,7 @@
if (!policyEditor.onchange) policyEditor.onchange = (e) => { if (!policyEditor.onchange) policyEditor.onchange = (e) => {
let ed = e.currentTarget let ed = e.currentTarget
try { try {
policy = new Policy(JSON.parse(ed.value)); UI.policy = policy = new Policy(JSON.parse(ed.value));
UI.updateSettings({policy}); UI.updateSettings({policy});
sitesUI.render(policy.sites); sitesUI.render(policy.sites);
ed.className = ""; ed.className = "";