mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
@ -2316,26 +2316,30 @@ async function saveTheme(name = undefined, theme = undefined) {
|
||||
body: JSON.stringify(theme),
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const themeIndex = themes.findIndex(x => x.name == name);
|
||||
|
||||
if (themeIndex == -1) {
|
||||
themes.push(theme);
|
||||
const option = document.createElement('option');
|
||||
option.selected = true;
|
||||
option.value = name;
|
||||
option.innerText = name;
|
||||
$('#themes').append(option);
|
||||
}
|
||||
else {
|
||||
themes[themeIndex] = theme;
|
||||
$(`#themes option[value="${name}"]`).attr('selected', true);
|
||||
}
|
||||
|
||||
power_user.theme = name;
|
||||
saveSettingsDebounced();
|
||||
if (!response.ok) {
|
||||
toastr.error('Check the server connection and reload the page to prevent data loss.', 'Theme could not be saved');
|
||||
console.error('Theme could not be saved', response);
|
||||
return;
|
||||
}
|
||||
|
||||
const themeIndex = themes.findIndex(x => x.name == name);
|
||||
|
||||
if (themeIndex == -1) {
|
||||
themes.push(theme);
|
||||
const option = document.createElement('option');
|
||||
option.selected = true;
|
||||
option.value = name;
|
||||
option.innerText = name;
|
||||
$('#themes').append(option);
|
||||
}
|
||||
else {
|
||||
themes[themeIndex] = theme;
|
||||
$(`#themes option[value="${name}"]`).attr('selected', true);
|
||||
}
|
||||
|
||||
power_user.theme = name;
|
||||
saveSettingsDebounced();
|
||||
|
||||
return theme;
|
||||
}
|
||||
|
||||
@ -2439,6 +2443,7 @@ async function saveMovingUI() {
|
||||
saveSettingsDebounced();
|
||||
} else {
|
||||
toastr.warning('failed to save MovingUI state.');
|
||||
console.error('MovingUI could not be saved', response);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user