diff --git a/public/scripts/extensions/stable-diffusion/index.js b/public/scripts/extensions/stable-diffusion/index.js index a55d5efd0..a81c3dc83 100644 --- a/public/scripts/extensions/stable-diffusion/index.js +++ b/public/scripts/extensions/stable-diffusion/index.js @@ -712,6 +712,10 @@ function onChatChanged() { } function adjustElementScrollHeight(){ + if (!$('.sd_settings').is(':visible')) { + return; + } + resetScrollHeight($('#sd_prompt_prefix')); resetScrollHeight($('#sd_negative_prompt')); resetScrollHeight($('#sd_character_prompt')); diff --git a/public/scripts/utils.js b/public/scripts/utils.js index f688d5aa4..c6f638f7c 100644 --- a/public/scripts/utils.js +++ b/public/scripts/utils.js @@ -292,6 +292,9 @@ export function throttle(func, limit = 300) { * @returns {boolean} True if the element is in the viewport, false otherwise. */ export function isElementInViewport(el) { + if (!el) { + return false; + } if (typeof jQuery === 'function' && el instanceof jQuery) { el = el[0]; }