From 0b139ba4ff73911454cd7959c60ec69dd717aa82 Mon Sep 17 00:00:00 2001 From: Abel 'Akronix' Serrano Juste Date: Thu, 27 Oct 2016 18:02:34 +0200 Subject: [PATCH] maximize pane hide tree view as well. Resolves santip/maximize-panes#20 --- lib/maximize-panes.coffee | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/maximize-panes.coffee b/lib/maximize-panes.coffee index 559eb5a..7dcdc86 100644 --- a/lib/maximize-panes.coffee +++ b/lib/maximize-panes.coffee @@ -3,6 +3,8 @@ $ = require 'jquery' module.exports = subscriptions: null + treeView: null + restoreTreeView: false activate: (state) -> @subscriptions = new CompositeDisposable @@ -10,8 +12,27 @@ module.exports = maximize: -> $('html').toggleClass('maximize-pane-on') + @treeView = @getTreeView() + if @treeView? + if $('html').hasClass('maximize-pane-on') and @treeView.panel? + @treeView.detach() + @restoreTreeView = true + else if @restoreTreeView + @treeView.attach() + @restoreTreeView = false deactivate: -> @subscriptions.dispose() serialize: -> + + getTreeView: -> + if not @treeView? + if atom.packages.getActivePackage('tree-view')? + treeViewPkg = atom.packages.getActivePackage('tree-view') + if treeViewPkg?.mainModule?.treeView? + return treeViewPkg.mainModule.treeView + else + return null + else + return @treeView