mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Preserve scrollTop on popup reopen
This commit is contained in:
@ -690,7 +690,12 @@ async function showExtensionsDetails() {
|
|||||||
let popupPromise;
|
let popupPromise;
|
||||||
try {
|
try {
|
||||||
// If we are updating an extension, the "old" popup is still active. We should close that.
|
// If we are updating an extension, the "old" popup is still active. We should close that.
|
||||||
await Popup.util.popups.find(popup => popup.content.querySelector('.extensions_info'))?.completeCancelled();
|
let initialScrollTop = 0;
|
||||||
|
const oldPopup = Popup.util.popups.find(popup => popup.content.querySelector('.extensions_info'));
|
||||||
|
if (oldPopup) {
|
||||||
|
initialScrollTop = oldPopup.content.scrollTop;
|
||||||
|
await oldPopup.completeCancelled();
|
||||||
|
}
|
||||||
const htmlDefault = $('<div class="marginBot10"><h3 class="textAlignCenter">Built-in Extensions:</h3></div>');
|
const htmlDefault = $('<div class="marginBot10"><h3 class="textAlignCenter">Built-in Extensions:</h3></div>');
|
||||||
const htmlExternal = $('<div class="marginBot10"><h3 class="textAlignCenter">Installed Extensions:</h3></div>');
|
const htmlExternal = $('<div class="marginBot10"><h3 class="textAlignCenter">Installed Extensions:</h3></div>');
|
||||||
const htmlLoading = $(`<div class="flex-container alignItemsCenter justifyCenter marginTop10 marginBot5">
|
const htmlLoading = $(`<div class="flex-container alignItemsCenter justifyCenter marginTop10 marginBot5">
|
||||||
@ -749,6 +754,7 @@ async function showExtensionsDetails() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
popupPromise = popup.show();
|
popupPromise = popup.show();
|
||||||
|
popup.content.scrollTop = initialScrollTop;
|
||||||
checkForUpdatesManual(abortController.signal).finally(() => htmlLoading.remove());
|
checkForUpdatesManual(abortController.signal).finally(() => htmlLoading.remove());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toastr.error(t`Error loading extensions. See browser console for details.`);
|
toastr.error(t`Error loading extensions. See browser console for details.`);
|
||||||
|
Reference in New Issue
Block a user