Fix invalid default values for popupTheme and popupOuterTheme (#2180)

* Fix invalid default values for popupTheme and popupOuterTheme

* Options update
This commit is contained in:
toasted-nutbread 2022-08-20 11:29:31 -04:00 committed by GitHub
parent 0b1ad40347
commit ada4df1971
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -215,12 +215,12 @@
"popupTheme": { "popupTheme": {
"type": "string", "type": "string",
"enum": ["light", "dark", "browser"], "enum": ["light", "dark", "browser"],
"default": "default" "default": "light"
}, },
"popupOuterTheme": { "popupOuterTheme": {
"type": "string", "type": "string",
"enum": ["light", "dark", "browser", "site"], "enum": ["light", "dark", "browser", "site"],
"default": "default" "default": "light"
}, },
"customPopupCss": { "customPopupCss": {
"type": "string", "type": "string",

View File

@ -980,8 +980,17 @@ class OptionsUtil {
_updateVersion20(options) { _updateVersion20(options) {
// Version 20 changes: // Version 20 changes:
// Added anki.downloadTimeout. // Added anki.downloadTimeout.
// Fixed general.popupTheme invalid default.
// Fixed general.popupOuterTheme invalid default.
for (const profile of options.profiles) { for (const profile of options.profiles) {
profile.options.anki.downloadTimeout = 0; profile.options.anki.downloadTimeout = 0;
const {general} = profile.options;
if (general.popupTheme === 'default') {
general.popupTheme = 'light';
}
if (general.popupOuterTheme === 'default') {
general.popupOuterTheme = 'light';
}
} }
return options; return options;
} }