async for resetScrollHeight, slightly faster WI/AF panel loads

This commit is contained in:
RossAscends
2024-08-05 12:03:46 +09:00
parent c13ca77bd9
commit 64e716bb62
7 changed files with 42 additions and 38 deletions

View File

@ -1480,7 +1480,7 @@ function getExampleMessagesBehavior() {
return 'normal';
}
function loadPowerUserSettings(settings, data) {
async function loadPowerUserSettings(settings, data) {
const defaultStscript = JSON.parse(JSON.stringify(power_user.stscript));
// Load from settings.json
if (settings.power_user !== undefined) {
@ -1740,7 +1740,7 @@ function loadPowerUserSettings(settings, data) {
switchCompactInputArea();
reloadMarkdownProcessor(power_user.render_formulas);
loadInstructMode(data);
loadContextSettings();
await loadContextSettings();
loadMaxContextUnlocked();
switchWaifuMode();
switchSpoilerMode();
@ -1872,7 +1872,7 @@ function getContextSettings() {
// TODO: Maybe add a refresh button to reset settings to preset
// TODO: Add "global state" if a preset doesn't set the power_user checkboxes
function loadContextSettings() {
async function loadContextSettings() {
contextControls.forEach(control => {
const $element = $(`#${control.id}`);
@ -1892,7 +1892,7 @@ function loadContextSettings() {
// If the setting already exists, no need to duplicate it
// TODO: Maybe check the power_user object for the setting instead of a flag?
$element.on('input', function () {
$element.on('input', async function () {
const value = control.isCheckbox ? !!$(this).prop('checked') : $(this).val();
if (control.isGlobalSetting) {
power_user[control.property] = value;
@ -1902,7 +1902,7 @@ function loadContextSettings() {
saveSettingsDebounced();
if (!control.isCheckbox) {
resetScrollHeight($element);
await resetScrollHeight($element);
}
});
});