归档增加标题并统一分隔符
This commit is contained in:
@@ -88,12 +88,25 @@ class ClipInboxViewController: UIViewController {
|
||||
return
|
||||
}
|
||||
|
||||
let archivedText = clips.map(\.text).joined(separator: "\n\n---\n\n")
|
||||
let title = self.archiveTitle()
|
||||
let itemsText = clips.map { "\($0.text)\n\n---" }.joined(separator: "\n\n")
|
||||
let archivedText = "\(title)\n\n\(itemsText)"
|
||||
let viewController = FormatNoteViewController()
|
||||
viewController.initialText = archivedText
|
||||
navigationController?.pushViewController(viewController, animated: true)
|
||||
}
|
||||
|
||||
private func archiveTitle() -> String {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.locale = Locale(identifier: "zh_CN")
|
||||
dateFormatter.dateFormat = "yyyy年MM月dd日"
|
||||
let dateString = dateFormatter.string(from: Date())
|
||||
let weekdays = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
|
||||
let weekdayIndex = Calendar.current.component(.weekday, from: Date()) - 1
|
||||
let weekday = (weekdayIndex >= 0 && weekdayIndex < weekdays.count) ? weekdays[weekdayIndex] : ""
|
||||
return "【读书摘抄】\(dateString) \(weekday)"
|
||||
}
|
||||
|
||||
private func setupEmptyLabel() {
|
||||
emptyLabel = UILabel()
|
||||
emptyLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
Reference in New Issue
Block a user