carbon/build/static/chat-input.js

18 lines
400 B
JavaScript
Raw Normal View History

import {q} from "./basic.js"
const chat = q("#c-chat-textarea")
chat.addEventListener("keydown", event => {
if (event.key === "Enter" && !event.shiftKey && !event.ctrlKey) {
chat.value = ""
event.preventDefault()
}
})
chat.addEventListener("input", () => {
chat.style.height = "0px"
console.log(chat.clientHeight, chat.scrollHeight)
chat.style.height = (chat.scrollHeight + 1) + "px"
})