mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
fix: resolve the issue of new settings clearing existing defaults
This commit is contained in:
@@ -21,9 +21,13 @@ function handleImportSettings() {
|
||||
reader.onload = (event: Event) => {
|
||||
const fileReaderTarget = event.target as FileReader
|
||||
const fileContent = fileReaderTarget.result as string
|
||||
const jsonObject = JSON.parse(fileContent)
|
||||
const jsonObject = JSON.parse(fileContent) as any
|
||||
|
||||
settings.value = jsonObject
|
||||
// Merge the new settings with the existing settings
|
||||
Object.keys(jsonObject).forEach((key) => {
|
||||
if (key in settings.value)
|
||||
(settings.value as any)[key] = jsonObject[key]
|
||||
})
|
||||
|
||||
importSettingsRef.value?.removeEventListener('change', handleChange)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user