@@ -92,59 +92,65 @@ struct ContentView: View {
92
92
93
93
var toolBarGroup : some View {
94
94
return Group {
95
- RichTextExportMenu . init (
96
- formatAction: { format in
97
- exportFormat = format
98
- } ,
99
- otherOptionAction: { format in
100
- otherExportFormat = format
101
- }
102
- )
103
- #if !os(macOS)
95
+ RichTextExportMenu . init (
96
+ formatAction: { format in
97
+ exportFormat = format
98
+ } ,
99
+ otherOptionAction: { format in
100
+ otherExportFormat = format
101
+ }
102
+ )
103
+ #if !os(macOS)
104
104
. frame( width: 25 , alignment: . center)
105
105
#endif
106
- Button (
107
- action: {
108
- print ( " Exported JSON == \( state. outputAsString ( ) ) " )
109
- } ,
110
- label: {
111
- Image ( systemName: " printer.inverse " )
112
- }
113
- )
114
- #if !os(macOS)
115
- . frame( width: 25 , alignment: . center)
116
- #endif
117
- Toggle ( isOn: $isInspectorPresented) {
118
- Image . richTextFormatBrush
119
- . resizable ( )
120
- . aspectRatio ( 1 , contentMode: . fit)
106
+ Button (
107
+ action: {
108
+ print ( " Exported JSON == \( state. outputAsString ( ) ) " )
109
+ } ,
110
+ label: {
111
+ Image ( systemName: " printer.inverse " )
121
112
}
122
- #if !os(macOS)
113
+ )
114
+ #if !os(macOS)
123
115
. frame( width: 25 , alignment: . center)
124
- #endif
116
+ #endif
117
+ Toggle ( isOn: $isInspectorPresented) {
118
+ Image . richTextFormatBrush
119
+ . resizable ( )
120
+ . aspectRatio ( 1 , contentMode: . fit)
125
121
}
122
+ #if !os(macOS)
123
+ . frame( width: 25 , alignment: . center)
124
+ #endif
125
+ }
126
126
}
127
127
128
128
func getBindingAlert( ) -> Binding < Bool > {
129
- . init( get: { exportFormat != nil || otherExportFormat != nil } , set: { newValue in
130
- exportFormat = nil
131
- otherExportFormat = nil
132
- } )
129
+ . init(
130
+ get: { exportFormat != nil || otherExportFormat != nil } ,
131
+ set: { newValue in
132
+ exportFormat = nil
133
+ otherExportFormat = nil
134
+ } )
133
135
}
134
136
135
137
func submit( ) {
136
138
guard !fileName. isEmpty else { return }
137
139
var path : URL ?
138
140
139
141
if let exportFormat {
140
- path = try ? exportService. generateExportFile ( withName: fileName, content: state. attributedString, format: exportFormat)
142
+ path = try ? exportService. generateExportFile (
143
+ withName: fileName, content: state. attributedString,
144
+ format: exportFormat)
141
145
}
142
146
if let otherExportFormat {
143
147
switch otherExportFormat {
144
148
case . pdf:
145
- path = try ? exportService. generatePdfExportFile ( withName: fileName, content: state. attributedString)
149
+ path = try ? exportService. generatePdfExportFile (
150
+ withName: fileName, content: state. attributedString)
146
151
case . json:
147
- path = try ? exportService. generateJsonExportFile ( withName: fileName, content: state. richText)
152
+ path = try ? exportService. generateJsonExportFile (
153
+ withName: fileName, content: state. richText)
148
154
}
149
155
}
150
156
if let path {
@@ -153,14 +159,14 @@ struct ContentView: View {
153
159
}
154
160
}
155
161
156
- private extension ContentView {
162
+ extension ContentView {
157
163
158
164
var isMac : Bool {
159
- #if os(macOS)
160
- true
161
- #else
162
- false
163
- #endif
165
+ #if os(macOS)
166
+ true
167
+ #else
168
+ false
169
+ #endif
164
170
}
165
171
166
172
var colorPickers : [ RichTextColor ] {
0 commit comments