fix user options by making loader recursive (#318)

This commit is contained in:
end-4
2024-03-12 15:44:54 +07:00
parent 0fd23f69f0
commit f3d235c9a3
2 changed files with 12 additions and 11 deletions
@@ -94,11 +94,17 @@ let configOptions = {
}, },
} }
// Load user's options // Override defaults with user's options
Object.entries(userOverrides).forEach((override) => { function overrideConfigRecursive(userOverrides, configOptions = {}) {
const [key, value] = override; for (const [key, value] of Object.entries(userOverrides)) {
configOptions[key] = value; if (typeof value === 'object') {
}); overrideConfigRecursive(value, configOptions[key]);
} else {
configOptions[key] = value;
}
}
}
overrideConfigRecursive(userOverrides, configOptions);
globalThis['userOptions'] = configOptions; globalThis['userOptions'] = configOptions;
export default configOptions; export default configOptions;
-5
View File
@@ -5,12 +5,7 @@ const userConfigOptions = {
// Here's an example // Here's an example
'keybinds': { 'keybinds': {
'sidebar': { 'sidebar': {
'apis': {
'nextTab': "Page_Down",
'prevTab': "Page_Up",
},
'pin': "Ctrl+p", 'pin': "Ctrl+p",
'cycleTab': "Ctrl+Tab",
'nextTab': "Ctrl+Page_Down", 'nextTab': "Ctrl+Page_Down",
'prevTab': "Ctrl+Page_Up", 'prevTab': "Ctrl+Page_Up",
}, },