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`); }