Skip to content

Commit 0f5a7df

Browse files
committed
检索可注释掉
1 parent 9d617d3 commit 0f5a7df

File tree

5 files changed

+46
-9
lines changed

5 files changed

+46
-9
lines changed

SwiftPamphletApp/HomeUI/DataLink.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ struct DataLink: Identifiable {
7474

7575
extension DataLink {
7676
static var dataLinks = [
77-
DataLink(title: "Github", imageName: "", children: [
78-
DataLink(title: "开发/仓库", imageName: "p5"),
79-
]),
8077
DataLink(title: "资料", imageName: "", children: [
8178
DataLink(title: "资料整理", imageName: "p11")
8279
]),
80+
DataLink(title: "Github", imageName: "", children: [
81+
DataLink(title: "开发/仓库", imageName: "p5"),
82+
]),
8383
DataLink(title: "Swift指南", imageName: "", children: [
8484
DataLink(title: "语法速查", imageName: "p23"),
8585
DataLink(title: "特性", imageName: "p10"),

SwiftPamphletApp/InfoOrganizer/Category/EditCustomSearchView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct EditCustomSearchView: View {
1212

1313
var body: some View {
1414
VStack {
15-
Text("自定义的搜索关键字,以换行作为间隔")
15+
Text("自定检索,换行间隔,同行逗号间隔")
1616
TextEditor(text: $term)
1717
.overlay {
1818
Rectangle()

SwiftPamphletApp/InfoOrganizer/Info/EditInfoView.swift

+14
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ struct EditInfoView: View {
206206
} label: {
207207
Label("设为封面图", image: "doc.text.image")
208208
}
209+
Button {
210+
let p = NSPasteboard.general
211+
p.declareTypes([.string], owner: nil)
212+
p.setString(img.url, forType: .string)
213+
} label: {
214+
Label("复制图片链接", image: "circle")
215+
}
209216
Button {
210217
info.imgs?.remove(at: i)
211218
IOImg.delete(img)
@@ -229,6 +236,13 @@ struct EditInfoView: View {
229236
} label: {
230237
Label("设为封面图", image: "doc.text.image")
231238
}
239+
Button {
240+
let p = NSPasteboard.general
241+
p.declareTypes([.string], owner: nil)
242+
p.setString(img, forType: .string)
243+
} label: {
244+
Label("复制图片链接", image: "circle")
245+
}
232246
}
233247
}
234248
}

SwiftPamphletApp/InfoOrganizer/Info/InfoListView.swift

+12-3
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,18 @@ struct InfoListView: View {
117117
searchTerms = [String]()
118118
for t in terms {
119119
if t.isEmpty == false {
120-
searchTerms.append(String(t))
121-
}
122-
}
120+
let tWithoutWhitespaces = t.trimmingCharacters(in: .whitespaces)
121+
if tWithoutWhitespaces.hasPrefix("//") { continue }
122+
let ts = t.trimmingCharacters(in: .whitespaces).split(separator: ",")
123+
if ts.count > 1 {
124+
for oneT in ts {
125+
searchTerms.append(String(oneT.trimmingCharacters(in: .whitespaces)))
126+
}
127+
} else {
128+
searchTerms.append(String(tWithoutWhitespaces))
129+
}
130+
} // end if
131+
} // end for
123132
}
124133
func customSearchLabel(_ string: String) -> String {
125134
let strs = string.split(separator: "/")

SwiftPamphletApp/InfoOrganizer/Info/InfoRowView.swift

+16-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,14 @@ struct InfoRowView: View {
3535
}
3636

3737
}
38-
Text(info.name)
39-
.fixedSize(horizontal: false, vertical: true)
38+
VStack(alignment: .leading) {
39+
Text(info.name)
40+
.fixedSize(horizontal: false, vertical: true)
41+
Text(shortDes())
42+
.fixedSize(horizontal: false, vertical: true)
43+
.font(.footnote)
44+
.foregroundColor(light: .secondary, dark: .secondary)
45+
}
4046
}
4147

4248

@@ -82,6 +88,14 @@ struct InfoRowView: View {
8288
}
8389
}
8490

91+
func shortDes() -> String {
92+
let shortDes = info.des.trimmingCharacters(in: .whitespacesAndNewlines).split(separator: "\n")
93+
if let re = shortDes.first {
94+
return String(re)
95+
}
96+
return ""
97+
}
98+
8599
}
86100

87101

0 commit comments

Comments
 (0)