From 0da31b468c69ea3639478be2cc576d08079a310b Mon Sep 17 00:00:00 2001 From: fish Date: Sun, 12 Jul 2026 17:02:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E9=A2=98=E6=A0=8F=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E8=8F=9C=E5=8D=95=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=92=8C=E6=B8=85=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Note/FormatterView.swift | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Note/FormatterView.swift b/Note/FormatterView.swift index 078a315..329c940 100644 --- a/Note/FormatterView.swift +++ b/Note/FormatterView.swift @@ -54,11 +54,18 @@ struct FormatterView: View { .font(.largeTitle.bold()) .foregroundStyle(.primary) Spacer() - if !inputText.isEmpty { + Menu { Button(action: copyText) { - Image(systemName: "doc.on.doc") + Label("复制", systemImage: "doc.on.doc") } - .font(.title3) + .disabled(inputText.isEmpty) + Button(role: .destructive, action: clearText) { + Label("清除", systemImage: "xmark.circle") + } + .disabled(inputText.isEmpty) + } label: { + Image(systemName: "ellipsis.circle") + .font(.title3) } } .frame(maxWidth: .infinity, minHeight: 44) @@ -175,6 +182,10 @@ struct FormatterView: View { } } } + + private func clearText() { + inputText = "" + } } #Preview {