mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
fixed WI entry scroll auto-height adjustments
This commit is contained in:
@ -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`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user