From 7ed85177719f035367bbc186ddf7ee3684624647 Mon Sep 17 00:00:00 2001 From: BaiMeow Date: Wed, 26 Apr 2023 21:24:14 +0800 Subject: [PATCH 1/2] fix: innerHTML may leads to script execution --- app/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/utils.ts b/app/utils.ts index dfec8d3e..1da65c99 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -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); From 0f9fe92fa3c1fd4894bf45d48ecb5ba0a56e3a80 Mon Sep 17 00:00:00 2001 From: Shi Liang <7258605+shih-liang@users.noreply.github.com> Date: Wed, 26 Apr 2023 21:42:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E5=BE=88=E7=9F=AD=E6=B2=A1=E6=9C=89=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E6=95=B4=E4=B8=AA=E5=8C=BA=E5=9F=9F=E6=97=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=9B=9E=E5=88=B0=E5=BA=95=E9=83=A8=E6=8C=89=E9=92=AE=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/chat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index b80bf5a1..cb163cff 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -438,7 +438,7 @@ export function Chat() { const [isLoading, setIsLoading] = useState(false); const { submitKey, shouldSubmit } = useSubmitHandler(); const { scrollRef, setAutoScroll, scrollToBottom } = useScrollToBottom(); - const [hitBottom, setHitBottom] = useState(false); + const [hitBottom, setHitBottom] = useState(true); const isMobileScreen = useMobileScreen(); const navigate = useNavigate();