Skip to content

Commit

Permalink
🐛 Fix disabling delete preset for default preset
Browse files Browse the repository at this point in the history
  • Loading branch information
foosel committed May 25, 2024
1 parent 92abc7f commit 1d692f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/assets/cardfoldr.js
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ const updatePreset = (key) => {

const deletePreset = (key) => {
localStorage.removeItem(toStorageKey(key));
document.getElementById("deletePreset").disabled = true;
}

const _getPreset = (key) => {
Expand Down Expand Up @@ -819,13 +820,16 @@ const refreshPresetList = (key) => {

document.querySelectorAll('[data-preset]').forEach(element => {
element.addEventListener('change', () => {
document.getElementById("updatePreset").disabled = false;
if (document.getElementById("preset").value !== "") {
document.getElementById("updatePreset").disabled = false;
};
});
});

document.getElementById("preset").addEventListener("change", async (event) => {
const key = event.target.value;
if (key === "") {
document.getElementById("updatePreset").disabled = true;
document.getElementById("deletePreset").disabled = true;
return;
}
Expand Down

0 comments on commit 1d692f1

Please sign in to comment.