@@ -26,7 +26,13 @@ struct EditInfoView: View {
26
26
VStack {
27
27
Form {
28
28
Section {
29
- TextField ( " 标题: " , text: $info. name)
29
+ HStack {
30
+ TextField ( " 标题: " , text: $info. name)
31
+ Toggle ( isOn: $info. star) {
32
+ Image ( systemName: info. star ? " star.fill " : " star " )
33
+ }
34
+ . toggleStyle ( . button)
35
+ }
30
36
HStack {
31
37
TextField ( " 地址: " , text: $info. url)
32
38
. onSubmit {
@@ -41,9 +47,9 @@ struct EditInfoView: View {
41
47
}
42
48
} // end Task
43
49
}
44
- // .onChange(of: info.url) { oldValue, newValue in
45
- //
46
- // }
50
+ . onChange ( of: info. url) { oldValue, newValue in
51
+
52
+ }
47
53
if info. url. isEmpty == false {
48
54
Button {
49
55
gotoWebBrowser ( urlStr: info. url)
@@ -70,29 +76,28 @@ struct EditInfoView: View {
70
76
} // end Section
71
77
72
78
Section {
73
- Picker ( " 分类: " , selection: $info. category) {
74
- Text ( " 未分类 " )
75
- . tag ( Optional< IOCategory> . none)
76
- if categories. isEmpty == false {
77
- Divider ( )
78
- ForEach ( categories) { cate in
79
- Text ( cate. name)
80
- . tag ( Optional ( cate) )
79
+
80
+ HStack {
81
+ Picker ( " 分类: " , selection: $info. category) {
82
+ Text ( " 未分类 " )
83
+ . tag ( Optional< IOCategory> . none)
84
+ if categories. isEmpty == false {
85
+ Divider ( )
86
+ ForEach ( categories) { cate in
87
+ Text ( cate. name)
88
+ . tag ( Optional ( cate) )
89
+ }
81
90
}
82
91
}
83
- }
84
- . onChange ( of: info. category) { oldValue, newValue in
85
- info. category? . updateDate = Date . now
86
- }
87
- HStack {
92
+ . onHover ( perform: { hovering in
93
+ info. category? . updateDate = Date . now
94
+ } )
88
95
Button ( " 添加分类 " , action: addCate)
89
96
Button ( " 管理分类 " , action: manageCate)
90
97
}
91
98
}
92
99
93
- Section {
94
- // TextEditor(text: $info.des)
95
- // .tabItem { Label("文本", systemImage: "circle") }
100
+ Section ( footer: Text ( " 支持 markdown 格式的文本 " ) ) {
96
101
// TODO: markdown 获取图片链接,并能显示
97
102
TabView {
98
103
TextEditor ( text: $info. des)
@@ -102,7 +107,6 @@ struct EditInfoView: View {
102
107
}
103
108
}
104
109
} // end form
105
- . navigationTitle ( " 编辑资料 " )
106
110
. padding ( 10 )
107
111
. inspector ( isPresented: $isShowInspector) {
108
112
EditCategoryView ( cate: cate ?? IOCategory ( name: " unavailable.com " , createDate: Date . now, updateDate: Date . now) )
0 commit comments