Fix edit shortcuts with checkbox

This commit is contained in:
Lim Chee Aun 2023-04-08 22:37:05 +08:00
parent 1f4d4dfea7
commit b2f9dd010e

View file

@ -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];
}
}
});
}