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 {