diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index 2170895..8ce7d67 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -14,9 +14,11 @@ export default function RootLayout({ }: { children: React.ReactNode; }) { + // suppressHydrationWarning:浏览器扩展(如 Dark Reader/翻译插件)常在 html/body + // 注入 class/attr,水合前改 DOM → 仅这一层属性的水合告警,非本应用 bug。 return ( - - + + {children} diff --git a/apps/web/components/workbench/Editor.tsx b/apps/web/components/workbench/Editor.tsx index fedcd19..2a92fe7 100644 --- a/apps/web/components/workbench/Editor.tsx +++ b/apps/web/components/workbench/Editor.tsx @@ -1,5 +1,7 @@ "use client"; +import { useEffect, useRef } from "react"; + interface EditorProps { value: string; onChange: (value: string) => void; @@ -9,19 +11,32 @@ interface EditorProps { // 中栏正文编辑器:宋体、720px 居中、行高 1.9(UX §2.3 / §6.3)。 // 流式中显示朱砂光标提示(prefers-reduced-motion 下不闪烁,见 globals.css)。 export function Editor({ value, onChange, streaming }: EditorProps) { + const ref = useRef(null); + + // 自适应高度:textarea 高度=内容高度(overflow-hidden 不内部滚动),由外层写作区 + // 单一滚动条统管。修复正文出现嵌套滚动条 + 定高 60vh 不铺满展示区的怪象。 + // min-h-[60vh] 仍作空稿时的最小可写高度(内容更长时按内容增高、外层滚动)。 + useEffect(() => { + const el = ref.current; + if (!el) return; + el.style.height = "auto"; + el.style.height = `${el.scrollHeight}px`; + }, [value]); + return (