From cee9f7aaa0c7faf2d3a3d50827beff7621636e09 Mon Sep 17 00:00:00 2001 From: LanQin Date: Sat, 20 Jun 2026 02:37:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(mail):=20=E4=BC=98=E5=8C=96=E5=86=99?= =?UTF-8?q?=E4=BF=A1=E7=BC=96=E8=BE=91=E5=99=A8=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整正文容器与编辑区的伸缩关系,提升弹窗内滚动与内容填充体验。 - 精简并重排工具栏,优化小屏下按钮换行与对齐表现。 - 默认按设备宽度控制格式栏展开状态,改善移动端初始展示。 --- apps/web/src/pages/mail.tsx | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/apps/web/src/pages/mail.tsx b/apps/web/src/pages/mail.tsx index 283b966..bb07857 100644 --- a/apps/web/src/pages/mail.tsx +++ b/apps/web/src/pages/mail.tsx @@ -1780,14 +1780,14 @@ function ComposeDialog({ mailbox, open, draft, onOpenChange, onSent }: { mailbox -
+
+
@@ -1822,7 +1822,7 @@ function ComposeDialog({ mailbox, open, draft, onOpenChange, onSent }: { mailbox onRemoveFile={(index) => { setAttachmentsTouched(true); setFiles((current) => current.filter((_, itemIndex) => itemIndex !== index)) }} />
- + @@ -2056,13 +2056,19 @@ function MailBodyComposer({ defaultValue, defaultHtml, files, signatureText, onC const fileInputRef = React.useRef(null) const dirtyRef = React.useRef(false) const lastDefaultRef = React.useRef(`${defaultValue}\n${defaultHtml || ""}`) - const [formatOpen, setFormatOpen] = React.useState(true) + const isMobile = useIsMobile() + const [formatOpen, setFormatOpen] = React.useState(() => typeof window === "undefined" ? true : window.innerWidth >= 768) const [scheduleOpen, setScheduleOpen] = React.useState(false) const [emojiOpen, setEmojiOpen] = React.useState(false) const [insertDialog, setInsertDialog] = React.useState(null) const [previewOpen, setPreviewOpen] = React.useState(false) const [empty, setEmpty] = React.useState(!defaultValue.trim()) const [selectionVersion, setSelectionVersion] = React.useState(0) + + React.useEffect(() => { + setFormatOpen(!isMobile) + }, [isMobile]) + const editor = useEditor({ extensions: [ StarterKit.configure({ link: false }), @@ -2084,7 +2090,7 @@ function MailBodyComposer({ defaultValue, defaultHtml, files, signatureText, onC content: composerInitialHtml(defaultValue, defaultHtml), editorProps: { attributes: { - class: "mail-html min-h-[260px] overflow-y-auto px-4 py-4 text-base leading-7 outline-none sm:min-h-[280px] sm:px-6 sm:py-5", + class: "mail-html w-full outline-none", "aria-label": "正文", }, handlePaste(view, event) { @@ -2206,13 +2212,12 @@ function MailBodyComposer({ defaultValue, defaultHtml, files, signatureText, onC } return ( -
+
-
+
editor?.chain().focus().undo().run()}> editor?.chain().focus().redo().run()}> - } active={editor?.isActive("image")} disabled={!editor} onClick={() => openInsertDialog("image")} />