diff --git a/SwiftPamphletApp/InfoOrganizer/Info/EditInfoView.swift b/SwiftPamphletApp/InfoOrganizer/Info/EditInfoView.swift index 672374068..f7d043af1 100644 --- a/SwiftPamphletApp/InfoOrganizer/Info/EditInfoView.swift +++ b/SwiftPamphletApp/InfoOrganizer/Info/EditInfoView.swift @@ -342,11 +342,27 @@ struct EditInfoView: View { private var urlInputView: some View { HStack { TextField("地址:", text: $info.url, prompt: Text("输入或粘贴 url,例如 https://www.starming.com")).rounded() + .onSubmit { + info.name = "获取标题中......" + Task { + // MARK: 获取 Web 内容 + let re = await fetchTitleFromUrl(urlString:info.url) + DispatchQueue.main.async { + if re.title.isEmpty == false { + info.name = re.title + if re.imageUrl.isEmpty == false { + IOInfo.updateCoverImage(info: info, img: IOImg(url: re.imageUrl)) + } + info.imageUrls = re.imageUrls + } + } + } + } if info.url.isEmpty == false { Button { + info.name = "获取标题中......" Task { // MARK: 获取 Web 内容 - info.name = "获取标题中......" let re = await fetchTitleFromUrl(urlString:info.url) DispatchQueue.main.async { if re.title.isEmpty == false { diff --git a/SwiftPamphletApp/InfoOrganizer/Info/InfoListView.swift b/SwiftPamphletApp/InfoOrganizer/Info/InfoListView.swift index 27d872170..fc349ad70 100644 --- a/SwiftPamphletApp/InfoOrganizer/Info/InfoListView.swift +++ b/SwiftPamphletApp/InfoOrganizer/Info/InfoListView.swift @@ -101,6 +101,7 @@ struct InfoListView: View { filterCate = "" } label: { Image(systemName: "xmark.circle") + .symbolRenderingMode(.multicolor) Text("检索") } .help("CMD + d")