From 6d96b23dcc08ae044132c0553525667cfa307b2c Mon Sep 17 00:00:00 2001 From: RossAscends <124905043+RossAscends@users.noreply.github.com> Date: Thu, 4 May 2023 22:45:06 +0900 Subject: [PATCH] fixed WI entry scroll auto-height adjustments --- public/scripts/world-info.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 81f6c55ba..3bc092016 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -155,6 +155,7 @@ function appendWorldEntry(entry) { // Prevent closing the drawer on clicking the input event.stopPropagation(); }); + keyInput.on("input", function () { const uid = $(this).data("uid"); const value = $(this).val(); @@ -166,6 +167,7 @@ function appendWorldEntry(entry) { saveWorldInfo(); }); keyInput.val(entry.key.join(",")).trigger("input"); + initScrollHeight(keyInput); // keysecondary const keySecondaryInput = template.find('textarea[name="keysecondary"]'); @@ -304,12 +306,18 @@ function appendWorldEntry(entry) { }); template.appendTo("#world_popup_entries_list"); + return template; } async function resetScrollHeight(element) { + element.style.height = ''; + element.style.height = (element.scrollHeight) + 3 + 'px'; +} + +async function initScrollHeight(element) { await delay(1); - const height = Number($(element).prop("scrollHeight")) + 3; + const height = Number($(element).prop("scrollHeight") + 3); $(element).css("height", ""); $(element).css("height", `${height}px`); }