From f70fa7aa8e5c14b46c91e1d7e7819437655a0a41 Mon Sep 17 00:00:00 2001 From: ebolam Date: Fri, 7 Oct 2022 19:35:49 -0400 Subject: [PATCH] Untested commit to change WI box sizes --- static/koboldai.js | 15 +++++++++++---- templates/templates.html | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/static/koboldai.js b/static/koboldai.js index b96afa75..b31400a7 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -1785,7 +1785,6 @@ function world_info_entry(data) { send_world_info(this.getAttribute('uid')); this.classList.add("pulse"); } - manual_text.dispatchEvent(new Event('input', {bubbles:true})); comment = world_info_card.querySelector('#world_info_comment_'); comment.id = "world_info_comment_"+data.uid; comment.setAttribute("uid", data.uid); @@ -1795,7 +1794,6 @@ function world_info_entry(data) { send_world_info(this.getAttribute('uid')); this.classList.add("pulse"); } - comment.dispatchEvent(new Event('input', {bubbles:true})); constant_area = world_info_card.querySelector('#world_info_toggle_area_'); constant_area.id = "world_info_toggle_area_"+data.uid; constant = document.createElement("input"); @@ -1860,6 +1858,10 @@ function world_info_entry(data) { document.getElementById("world_info_basic_text_"+wpp_toggle.getAttribute('uid')).classList.remove("hidden"); } + //resize comments/text boxes + autoResize(comment, 100); + autoResize(manual_text, 100); + //put focus back where it was if (document.getElementById(original_focus)) { if (document.getElementById(original_focus).tagName != "BUTTON") { @@ -2565,9 +2567,14 @@ function show_save_preset() { document.getElementById("save_preset").classList.remove("hidden"); } -function autoResize(element) { +function autoResize(element, min_size=200) { + console.log(min_size); element.style.height = 'auto'; - element.style.height = element.scrollHeight + 'px'; + if (min_size > element.scrollHeight) { + element.style.height = min_size + "px"; + } else { + element.style.height = element.scrollHeight + 'px'; + } } diff --git a/templates/templates.html b/templates/templates.html index 727d26e7..bc646d4e 100644 --- a/templates/templates.html +++ b/templates/templates.html @@ -35,7 +35,7 @@
Text: - +
Comment: - +