diff --git a/Note/FormatLogViewController.swift b/Note/FormatLogViewController.swift index d32d536..37ba294 100644 --- a/Note/FormatLogViewController.swift +++ b/Note/FormatLogViewController.swift @@ -184,6 +184,19 @@ class FormatLogViewController: UIViewController { } @objc private func didTapResetButton() { + let alert = UIAlertController( + title: "确认重置", + message: "确定要清空当前内容吗?", + preferredStyle: .alert + ) + alert.addAction(UIAlertAction(title: "取消", style: .cancel)) + alert.addAction(UIAlertAction(title: "重置", style: .destructive) { [weak self] _ in + self?.performReset() + }) + present(alert, animated: true) + } + + private func performReset() { textView.text = "" isFormatted = false formatButton.setTitle("格式化", for: .normal) diff --git a/Note/FormatNoteViewController.swift b/Note/FormatNoteViewController.swift index 782bdd0..b4af1c1 100644 --- a/Note/FormatNoteViewController.swift +++ b/Note/FormatNoteViewController.swift @@ -192,6 +192,19 @@ class FormatNoteViewController: UIViewController { } @objc private func didTapResetButton() { + let alert = UIAlertController( + title: "确认重置", + message: "确定要清空当前内容吗?", + preferredStyle: .alert + ) + alert.addAction(UIAlertAction(title: "取消", style: .cancel)) + alert.addAction(UIAlertAction(title: "重置", style: .destructive) { [weak self] _ in + self?.performReset() + }) + present(alert, animated: true) + } + + private func performReset() { textView.text = "" rightBarButtonMode = .paste isCloudFormatted = false