Skip to content

Commit 5ad6f87

Browse files
committed
fix: Make "None" option clickable in select dialog on formatter settings
The "None" option in the select dialog was unclickable because the click handler was prematurely returning when the item's value was falsy. This affected options with a `null` value, such as the "None" option for formatters. This commit modifies the click handler to allow `null` values to be selected. The handler now only returns early if the item's value is `undefined`. Also when selected None on formatters settings then delete the key saved in settings for that language, as it is not require in case of null
1 parent 13390c5 commit 5ad6f87

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/dialogs/select.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function select(title, items, options = {}) {
144144
target = target.parentElement;
145145
}
146146

147-
if (!itemOptions.value) return;
147+
if (itemOptions.value === undefined) return;
148148
if (hideOnSelect) hide();
149149
res(itemOptions.value);
150150
};

src/settings/formatterSettings.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ export default function formatterSettings(languageName) {
3333
page.show(languageName);
3434

3535
function callback(key, value) {
36-
values.formatter[key] = value;
36+
if (value === null) {
37+
// Delete the key when "none" is selected
38+
delete values.formatter[key];
39+
} else {
40+
values.formatter[key] = value;
41+
}
3742
appSettings.update();
3843
}
3944
}

0 commit comments

Comments
 (0)