diff --git a/build/server.ts b/build/server.ts index c637e02..aa95834 100644 --- a/build/server.ts +++ b/build/server.ts @@ -22,7 +22,7 @@ Bun.serve({ { production: url.searchParams.get('production') === 'true', // to debug production builds portable: url.searchParams.get('portable') === 'true', // to skip AssemblyScript compilation, - mobile: detectedBrowser.mobile, + mobile: detectedBrowser.mobile || url.searchParams.get('mobile') === 'true', } ); if (html) { diff --git a/src/games/ai/components/autoTextarea.tsx b/src/games/ai/components/autoTextarea.tsx index 65a26bd..d0c592b 100644 --- a/src/games/ai/components/autoTextarea.tsx +++ b/src/games/ai/components/autoTextarea.tsx @@ -2,6 +2,7 @@ import { useEffect, useRef } from "preact/hooks"; import type { JSX } from "preact/jsx-runtime" import { useIsVisible } from '@common/hooks/useIsVisible'; +import { DOMTools } from "../dom"; export const AutoTextarea = (props: JSX.HTMLAttributes) => { const { value } = props; @@ -12,12 +13,10 @@ export const AutoTextarea = (props: JSX.HTMLAttributes) => if (ref.current && isVisible) { const area = ref.current; - area.style.height = '0'; // reset - area.style.height = `${area.scrollHeight}px`; + const { height } = DOMTools.calculateNodeHeight(area); + area.style.height = `${height}px`; } }, [value, isVisible]); - - return