@@ -33,17 +33,13 @@ private extension NSMenuItem {
3333 action: Selector ? = nil ,
3434 target: AnyObject ? = nil ,
3535 keyEquivalent: String = " " ,
36- keyEquivalentModifierMask: NSEvent . ModifierFlags = [ . command] ,
37- tag: Int ? = nil )
36+ keyEquivalentModifierMask: NSEvent . ModifierFlags = [ . command] )
3837 {
3938 self . init ( title: title, action: action, keyEquivalent: keyEquivalent)
4039 self . target = target
4140 if !keyEquivalent. isEmpty {
4241 self . keyEquivalentModifierMask = keyEquivalentModifierMask
4342 }
44- if let tag {
45- self . tag = tag
46- }
4743 }
4844
4945 convenience init ( submenu: String , items: [ NSMenuItem ] ) {
@@ -61,10 +57,9 @@ extension AppDelegate {
6157 func makeMainMenu( title: String ) -> NSMenu {
6258 NSMenu ( title: " Main Menu " , items: [
6359 makeAppMenuItem ( title: title) ,
64- makeFileMenuItem ( ) ,
60+ makeReactMenuItem ( ) ,
6561 makeEditMenuItem ( ) ,
6662 makeViewMenuItem ( ) ,
67- makeReactMenuItem ( ) ,
6863 makeWindowMenuItem ( ) ,
6964 makeHelpMenuItem ( title: title) ,
7065 ] )
@@ -94,29 +89,6 @@ extension AppDelegate {
9489 ] )
9590 }
9691
97- private func makeFileMenuItem( ) -> NSMenuItem {
98- NSMenuItem ( submenu: " File " , items: [
99- NSMenuItem ( title: " New " , action: #selector( NSDocumentController . newDocument ( _: ) ) , keyEquivalent: " n " ) ,
100- NSMenuItem ( title: " Open… " , action: #selector( NSDocumentController . openDocument ( _: ) ) , keyEquivalent: " o " ) ,
101- NSMenuItem ( submenu: " Open Recent " , items: [
102- NSMenuItem ( title: " Clear Menu " , action: #selector( NSDocumentController . clearRecentDocuments ( _: ) ) ) ,
103- ] ) ,
104- . separator( ) ,
105- NSMenuItem ( title: " Close " , action: #selector( NSWindow . performClose ( _: ) ) , keyEquivalent: " w " ) ,
106- NSMenuItem ( title: " Save… " , action: #selector( NSDocument . save ( _: ) ) , keyEquivalent: " s " ) ,
107- NSMenuItem ( title: " Save As… " , action: #selector( NSDocument . saveAs ( _: ) ) , keyEquivalent: " S " ) ,
108- NSMenuItem ( title: " Revert to Saved " , action: #selector( NSDocument . revertToSaved ( _: ) ) , keyEquivalent: " r " ) ,
109- . separator( ) ,
110- NSMenuItem (
111- title: " Page Setup… " ,
112- action: #selector( NSDocument . runPageLayout ( _: ) ) ,
113- keyEquivalent: " P " ,
114- keyEquivalentModifierMask: [ . shift, . command]
115- ) ,
116- NSMenuItem ( title: " Print… " , action: #selector( NSView . printView ( _: ) ) , keyEquivalent: " p " ) ,
117- ] )
118- }
119-
12092 private func makeEditMenuItem( ) -> NSMenuItem {
12193 NSMenuItem ( submenu: " Edit " , items: [
12294 NSMenuItem ( title: " Undo " , action: Selector ( ( " undo: " ) ) , keyEquivalent: " z " ) ,
@@ -125,147 +97,13 @@ extension AppDelegate {
12597 NSMenuItem ( title: " Cut " , action: #selector( NSText . cut ( _: ) ) , keyEquivalent: " x " ) ,
12698 NSMenuItem ( title: " Copy " , action: #selector( NSText . copy ( _: ) ) , keyEquivalent: " c " ) ,
12799 NSMenuItem ( title: " Paste " , action: #selector( NSText . paste ( _: ) ) , keyEquivalent: " v " ) ,
128- NSMenuItem (
129- title: " Paste and Match Style " ,
130- action: #selector( NSTextView . pasteAsPlainText ( _: ) ) ,
131- keyEquivalent: " V " ,
132- keyEquivalentModifierMask: [ . option, . command]
133- ) ,
134100 NSMenuItem ( title: " Delete " , action: #selector( NSText . delete ( _: ) ) ) ,
135101 NSMenuItem ( title: " Select All " , action: #selector( NSText . selectAll ( _: ) ) , keyEquivalent: " a " ) ,
136- . separator( ) ,
137- NSMenuItem ( submenu: " Find " , items: [
138- NSMenuItem (
139- title: " Find… " ,
140- action: #selector( NSTextView . performFindPanelAction ( _: ) ) ,
141- keyEquivalent: " f " ,
142- tag: 1
143- ) ,
144- NSMenuItem (
145- title: " Find and Replace… " ,
146- action: #selector( NSTextView . performFindPanelAction ( _: ) ) ,
147- keyEquivalent: " f " ,
148- keyEquivalentModifierMask: [ . option, . command] ,
149- tag: 12
150- ) ,
151- NSMenuItem (
152- title: " Find Next " ,
153- action: #selector( NSTextView . performFindPanelAction ( _: ) ) ,
154- keyEquivalent: " g " ,
155- tag: 2
156- ) ,
157- NSMenuItem (
158- title: " Find Previous " ,
159- action: #selector( NSTextView . performFindPanelAction ( _: ) ) ,
160- keyEquivalent: " G " ,
161- tag: 3
162- ) ,
163- NSMenuItem (
164- title: " Use Selection for Find " ,
165- action: #selector( NSTextView . performFindPanelAction ( _: ) ) ,
166- keyEquivalent: " e " ,
167- tag: 7
168- ) ,
169- NSMenuItem (
170- title: " Jump to Selection " ,
171- action: #selector( NSTextView . centerSelectionInVisibleArea ( _: ) ) ,
172- keyEquivalent: " j "
173- ) ,
174- ] ) ,
175- NSMenuItem ( submenu: " Spelling and Grammar " , items: [
176- NSMenuItem (
177- title: " Show Spelling and Grammar " ,
178- action: #selector( NSText . showGuessPanel ( _: ) ) ,
179- keyEquivalent: " : "
180- ) ,
181- NSMenuItem (
182- title: " Check Document Now " ,
183- action: #selector( NSText . checkSpelling ( _: ) ) ,
184- keyEquivalent: " ; "
185- ) ,
186- . separator( ) ,
187- NSMenuItem (
188- title: " Check Spelling While Typing " ,
189- action: #selector( NSTextView . toggleContinuousSpellChecking ( _: ) )
190- ) ,
191- NSMenuItem (
192- title: " Check Grammar With Spelling " ,
193- action: #selector( NSTextView . toggleGrammarChecking ( _: ) )
194- ) ,
195- NSMenuItem (
196- title: " Correct Spelling Automatically " ,
197- action: #selector( NSTextView . toggleAutomaticSpellingCorrection ( _: ) )
198- ) ,
199- ] ) ,
200- NSMenuItem ( submenu: " Substitutions " , items: [
201- NSMenuItem (
202- title: " Show Substitutions " ,
203- action: #selector( NSTextView . orderFrontSubstitutionsPanel ( _: ) )
204- ) ,
205- . separator( ) ,
206- NSMenuItem (
207- title: " Smart Copy/Paste " ,
208- action: #selector( NSTextView . toggleSmartInsertDelete ( _: ) )
209- ) ,
210- NSMenuItem (
211- title: " Smart Quotes " ,
212- action: #selector( NSTextView . toggleAutomaticQuoteSubstitution ( _: ) )
213- ) ,
214- NSMenuItem (
215- title: " Smart Dashes " ,
216- action: #selector( NSTextView . toggleAutomaticDashSubstitution ( _: ) )
217- ) ,
218- NSMenuItem (
219- title: " Smart Links " ,
220- action: #selector( NSTextView . toggleAutomaticLinkDetection ( _: ) )
221- ) ,
222- NSMenuItem (
223- title: " Data Detectors " ,
224- action: #selector( NSTextView . toggleAutomaticDataDetection ( _: ) )
225- ) ,
226- NSMenuItem (
227- title: " Text Replacement " ,
228- action: #selector( NSTextView . toggleAutomaticTextReplacement ( _: ) )
229- ) ,
230- ] ) ,
231- NSMenuItem ( submenu: " Transformations " , items: [
232- NSMenuItem ( title: " Make Upper Case " , action: #selector( NSTextView . uppercaseWord ( _: ) ) ) ,
233- NSMenuItem ( title: " Make Lower Case " , action: #selector( NSTextView . lowercaseWord ( _: ) ) ) ,
234- NSMenuItem ( title: " Capitalize " , action: #selector( NSTextView . capitalizeWord ( _: ) ) ) ,
235- ] ) ,
236- NSMenuItem ( submenu: " Speech " , items: [
237- NSMenuItem ( title: " Start Speaking " , action: #selector( NSTextView . startSpeaking ( _: ) ) ) ,
238- NSMenuItem ( title: " Stop Speaking " , action: #selector( NSTextView . stopSpeaking ( _: ) ) ) ,
239- ] ) ,
240102 ] )
241103 }
242104
243105 private func makeViewMenuItem( ) -> NSMenuItem {
244- NSMenuItem ( submenu: " View " , items: [
245- NSMenuItem (
246- title: " Show Toolbar " ,
247- action: #selector( NSWindow . toggleToolbarShown ( _: ) ) ,
248- keyEquivalent: " t " ,
249- keyEquivalentModifierMask: [ . option, . command]
250- ) ,
251- NSMenuItem (
252- title: " Customize Toolbar… " ,
253- action: #selector( NSWindow . runToolbarCustomizationPalette ( _: ) )
254- ) ,
255- . separator( ) ,
256- NSMenuItem (
257- title: " Show Sidebar " ,
258- action: #selector( NSSplitViewController . toggleSidebar ( _: ) ) ,
259- keyEquivalent: " s " ,
260- keyEquivalentModifierMask: [ . control, . command]
261- ) ,
262- NSMenuItem (
263- title: " Enter Full Screen " ,
264- action: #selector( NSWindow . toggleFullScreen ( _: ) ) ,
265- keyEquivalent: " f " ,
266- keyEquivalentModifierMask: [ . control, . command]
267- ) ,
268- ] )
106+ NSMenuItem ( submenu: " View " , items: [ ] )
269107 }
270108
271109 private func makeReactMenuItem( ) -> NSMenuItem {
0 commit comments