mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-19 22:18:38 +08:00
Merge pull request #1102 from BaiMeow/main
fix: use innerHTML may leads unexpected script execution
This commit is contained in:
@@ -129,7 +129,7 @@ export function autoGrowTextArea(dom: HTMLTextAreaElement) {
|
|||||||
|
|
||||||
const width = getDomContentWidth(dom);
|
const width = getDomContentWidth(dom);
|
||||||
measureDom.style.width = width + "px";
|
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 lineWrapCount = Math.max(0, dom.value.split("\n").length - 1);
|
||||||
const height = parseFloat(window.getComputedStyle(measureDom).height);
|
const height = parseFloat(window.getComputedStyle(measureDom).height);
|
||||||
|
Reference in New Issue
Block a user