Skip to content

Commit

Permalink
检索可注释掉
Browse files Browse the repository at this point in the history
  • Loading branch information
ming1016 committed Apr 11, 2024
1 parent 9d617d3 commit 0f5a7df
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 9 deletions.
6 changes: 3 additions & 3 deletions SwiftPamphletApp/HomeUI/DataLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ struct DataLink: Identifiable {

extension DataLink {
static var dataLinks = [
DataLink(title: "Github", imageName: "", children: [
DataLink(title: "开发/仓库", imageName: "p5"),
]),
DataLink(title: "资料", imageName: "", children: [
DataLink(title: "资料整理", imageName: "p11")
]),
DataLink(title: "Github", imageName: "", children: [
DataLink(title: "开发/仓库", imageName: "p5"),
]),
DataLink(title: "Swift指南", imageName: "", children: [
DataLink(title: "语法速查", imageName: "p23"),
DataLink(title: "特性", imageName: "p10"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct EditCustomSearchView: View {

var body: some View {
VStack {
Text("自定义的搜索关键字,以换行作为间隔")
Text("自定检索,换行间隔,同行逗号间隔")
TextEditor(text: $term)
.overlay {
Rectangle()
Expand Down
14 changes: 14 additions & 0 deletions SwiftPamphletApp/InfoOrganizer/Info/EditInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ struct EditInfoView: View {
} label: {
Label("设为封面图", image: "doc.text.image")
}
Button {
let p = NSPasteboard.general
p.declareTypes([.string], owner: nil)
p.setString(img.url, forType: .string)
} label: {
Label("复制图片链接", image: "circle")
}
Button {
info.imgs?.remove(at: i)
IOImg.delete(img)
Expand All @@ -229,6 +236,13 @@ struct EditInfoView: View {
} label: {
Label("设为封面图", image: "doc.text.image")
}
Button {
let p = NSPasteboard.general
p.declareTypes([.string], owner: nil)
p.setString(img, forType: .string)
} label: {
Label("复制图片链接", image: "circle")
}
}
}
}
Expand Down
15 changes: 12 additions & 3 deletions SwiftPamphletApp/InfoOrganizer/Info/InfoListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,18 @@ struct InfoListView: View {
searchTerms = [String]()
for t in terms {
if t.isEmpty == false {
searchTerms.append(String(t))
}
}
let tWithoutWhitespaces = t.trimmingCharacters(in: .whitespaces)
if tWithoutWhitespaces.hasPrefix("//") { continue }
let ts = t.trimmingCharacters(in: .whitespaces).split(separator: ",")
if ts.count > 1 {
for oneT in ts {
searchTerms.append(String(oneT.trimmingCharacters(in: .whitespaces)))
}
} else {
searchTerms.append(String(tWithoutWhitespaces))
}
} // end if
} // end for
}
func customSearchLabel(_ string: String) -> String {
let strs = string.split(separator: "/")
Expand Down
18 changes: 16 additions & 2 deletions SwiftPamphletApp/InfoOrganizer/Info/InfoRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ struct InfoRowView: View {
}

}
Text(info.name)
.fixedSize(horizontal: false, vertical: true)
VStack(alignment: .leading) {
Text(info.name)
.fixedSize(horizontal: false, vertical: true)
Text(shortDes())
.fixedSize(horizontal: false, vertical: true)
.font(.footnote)
.foregroundColor(light: .secondary, dark: .secondary)
}
}


Expand Down Expand Up @@ -82,6 +88,14 @@ struct InfoRowView: View {
}
}

func shortDes() -> String {
let shortDes = info.des.trimmingCharacters(in: .whitespacesAndNewlines).split(separator: "\n")
if let re = shortDes.first {
return String(re)
}
return ""
}

}


0 comments on commit 0f5a7df

Please sign in to comment.