From b2f9dd010e97a95d2d26c5a90340403bbcd64713 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sat, 8 Apr 2023 22:37:05 +0800 Subject: [PATCH] Fix edit shortcuts with checkbox --- src/components/shortcuts-settings.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/shortcuts-settings.jsx b/src/components/shortcuts-settings.jsx index 7f92f521..12f0749d 100644 --- a/src/components/shortcuts-settings.jsx +++ b/src/components/shortcuts-settings.jsx @@ -471,10 +471,14 @@ function ShortcutForm({ if (editMode && currentType && TYPE_PARAMS[currentType]) { // Populate form const form = formRef.current; - TYPE_PARAMS[currentType].forEach(({ name }) => { + TYPE_PARAMS[currentType].forEach(({ name, type }) => { const input = form.querySelector(`[name="${name}"]`); if (input && shortcut[name]) { - input.value = shortcut[name]; + if (type === 'checkbox') { + input.checked = shortcut[name] === 'on' ? true : false; + } else { + input.value = shortcut[name]; + } } }); }