Skip to content

Commit

Permalink
Restore settings when importing data
Browse files Browse the repository at this point in the history
Closes #18
  • Loading branch information
qsantos committed Sep 15, 2024
1 parent 8856bb7 commit 824abdc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,10 @@ function onSettingsChange() {
settings.max_group_size = parseInt(getElement('settings-group-length-max', HTMLInputElement).value, 10);
settings.charset = getElement('settings-charset', HTMLTextAreaElement).value;
settings.session_debounce_time = parseFloat(getElement('settings-session-debounce-time', HTMLInputElement).value);
saveSettings();
}

function saveSettings() {
localStorage.setItem('settings', JSON.stringify(settings));
}

Expand Down Expand Up @@ -1134,6 +1138,11 @@ function importData() {
alert(`Failed to parse file: ${e}`);
return;
}
{
Object.assign(settings, j['settings']);
restoreSettings();
saveSettings();
}
const transaction = db.transaction(['sessions', 'characters'], 'readwrite');
{
const objectStore = transaction.objectStore('sessions');
Expand Down

0 comments on commit 824abdc

Please sign in to comment.