From 2bd846bae12c335f0e2a93813f080eaf074a7a48 Mon Sep 17 00:00:00 2001 From: Smith Date: Sun, 8 May 2022 21:48:15 +0200 Subject: [PATCH] fix form change detection --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 6a47d32..cb1e02e 100644 --- a/index.html +++ b/index.html @@ -134,6 +134,7 @@ #save-config .loading ._save_btn { display: none; } + @@ -485,7 +486,7 @@ }, false); const getFormVals = () => { - const formItems = $('#config-form input, #config-form textarea, #config-form select').toArray(); + const formItems = $('#config-form .tab-pane:not([style*="display: none"]) input, #config-form .tab-pane:not([style*="display: none"]) textarea, #config-form .tab-pane:not([style*="display: none"]) select').toArray(); return JSON.stringify(formItems.map(e => { if (e.type === 'checkbox') { return e.checked ? e.value : undefined; @@ -499,7 +500,6 @@ const checkForChanges = () => { if (formCurrVal !== getFormVals()) { - // console.log('CONFIG FORM CHANGED', formCurrVal, getFormVals()); unsavedChanges = true; $('#save-config').removeClass('d-none'); $('#save-config').removeClass('animate__fadeOutDown'); @@ -540,8 +540,8 @@ $('#save-config-reset').click(e => { e.preventDefault(); if (!configEditor.isEnabled()) return; - configEditor.setValue(editorCurrVal); + unsavedChanges = false; $('#save-config').addClass('animate__fadeOutDown'); }); });