fix: innerHTML may leads to script execution

This commit is contained in:
BaiMeow 2023-04-26 21:24:14 +08:00
parent fbacfba92a
commit 7ed8517771
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@ export function autoGrowTextArea(dom: HTMLTextAreaElement) {
const width = getDomContentWidth(dom);
measureDom.style.width = width + "px";
measureDom.innerHTML = dom.value.trim().length > 0 ? dom.value : "1";
measureDom.innerText = dom.value.trim().length > 0 ? dom.value : "1";
const lineWrapCount = Math.max(0, dom.value.split("\n").length - 1);
const height = parseFloat(window.getComputedStyle(measureDom).height);