webui: clamp input area width, default caret to end of textarea

This commit is contained in:
mappu 2023-04-08 19:22:30 +12:00
parent 575f7ac4bc
commit 8e378c0734

View File

@ -23,7 +23,9 @@ html {
textarea { textarea {
border-radius: 4px; border-radius: 4px;
display: block; display: block;
min-width: 100%;
width: 100%; width: 100%;
max-width: 100%;
min-height: 100px; min-height: 100px;
background: #fff; background: #fff;
@ -56,6 +58,8 @@ function main() {
const $main = document.getElementById("main"); const $main = document.getElementById("main");
const $state = document.getElementById("state"); const $state = document.getElementById("state");
$main.setSelectionRange($main.value.length, $main.value.length);
$generate.addEventListener('click', async function() { $generate.addEventListener('click', async function() {
const content = $main.value; const content = $main.value;
if (content.split(" ").length >= (contextSize-4)) { if (content.split(" ").length >= (contextSize-4)) {