Skip to content

Commit

Permalink
Merge branch 'master' of github.com:lukakerr/twig
Browse files Browse the repository at this point in the history
  • Loading branch information
lukakerr committed Aug 7, 2018
2 parents 0c9c37c + 68f2112 commit b72b02a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Twig/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@
<action selector="togglePreviewWithSender:" target="Ady-hI-5gd" id="98T-ho-mLk"/>
</connections>
</menuItem>
<menuItem title="Toggle Editor" keyEquivalent="e" id="FEt-FA-N8C">
<connections>
<action selector="toggleEditorWithSender:" target="Ady-hI-5gd" id="vaH-cd-iQ9"/>
</connections>
</menuItem>
<menuItem title="Hide Sidebar" keyEquivalent="l" id="fqn-9F-7fK">
<connections>
<action selector="toggleSidebar:" target="Ady-hI-5gd" id="888-8e-YNx"/>
Expand Down
13 changes: 13 additions & 0 deletions Twig/Controllers/WindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,17 @@ class WindowController: NSWindowController, NSWindowDelegate {
}
}

@IBAction func toggleEditor(sender: NSMenuItem) {
guard let editor = editorSplitViewController?.splitViewItems.first else { return }

editor.collapseBehavior = .preferResizingSplitViewWithFixedSiblings
editor.animator().isCollapsed = !editor.isCollapsed

// If the editor is open after toggling, send a notification to re-generate the preview
if !editor.isCollapsed {
NotificationCenter.send(.appearanceChanged)
}
}


}

0 comments on commit b72b02a

Please sign in to comment.