diff --git a/src/workspace.coffee b/src/workspace.coffee index 8ff1fc4ee..5b640b61b 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -596,6 +596,76 @@ class Workspace extends Model @paneContainer.destroy() @activeItemSubscriptions?.dispose() + + ### + Section: Panels + ### + + # Essential: Adds a panel item to the bottom of the editor window. + # + # * `options` {Object} + # * `item` Your panel content. It can be DOM element, a jQuery element, or + # a model with a view registered via {::addViewProvider}. We recommend the + # latter. See {::addViewProvider} for more information. + # * `visible` (optional) {Boolean} false if you want the panel to initially be hidden + # (default: true) + # * `priority` (optional) {Number} Determines stacking order. Lower priority items are + # forced closer to the edges of the window. (default: 100) + # + # Returns a {Panel} + addBottomPanel: (options) -> + @addPanel('bottom', options) + + # Essential: Adds a panel item to the left of the editor window. + # + # * `options` {Object} + # * `item` Your panel content. It can be DOM element, a jQuery element, or + # a model with a view registered via {::addViewProvider}. We recommend the + # latter. See {::addViewProvider} for more information. + # * `visible` (optional) {Boolean} false if you want the panel to initially be hidden + # (default: true) + # * `priority` (optional) {Number} Determines stacking order. Lower priority items are + # forced closer to the edges of the window. (default: 100) + # + # Returns a {Panel} + addLeftPanel: (options) -> + @addPanel('left', options) + + # Essential: Adds a panel item to the right of the editor window. + # + # * `options` {Object} + # * `item` Your panel content. It can be DOM element, a jQuery element, or + # a model with a view registered via {::addViewProvider}. We recommend the + # latter. See {::addViewProvider} for more information. + # * `visible` (optional) {Boolean} false if you want the panel to initially be hidden + # (default: true) + # * `priority` (optional) {Number} Determines stacking order. Lower priority items are + # forced closer to the edges of the window. (default: 100) + # + # Returns a {Panel} + addRightPanel: (options) -> + @addPanel('right', options) + + # Essential: Adds a panel item to the top of the editor window above the tabs. + # + # * `options` {Object} + # * `item` Your panel content. It can be DOM element, a jQuery element, or + # a model with a view registered via {::addViewProvider}. We recommend the + # latter. See {::addViewProvider} for more information. + # * `visible` (optional) {Boolean} false if you want the panel to initially be hidden + # (default: true) + # * `priority` (optional) {Number} Determines stacking order. Lower priority items are + # forced closer to the edges of the window. (default: 100) + # + # Returns a {Panel} + addTopPanel: (options) -> + @addPanel('top', options) + + addPanel: (location, options) -> + options ?= {} + options.viewRegistry = @viewRegistry + @panelContainers[location].addPanel(new Panel(options)) + ### Section: View Management ### @@ -646,7 +716,7 @@ class Workspace extends Model # makes [HTML 5 custom elements](http://www.html5rocks.com/en/tutorials/webcomponents/customelements/) # an ideal tool for implementing views in Atom. # - # ## Example + # ## Examples # # Text editors are divided into a model and a view layer, so when you interact # with methods like `atom.workspace.getActiveTextEditor()` you're only going @@ -677,72 +747,3 @@ class Workspace extends Model # added provider. addViewProvider: (providerSpec) -> @viewRegistry.addViewProvider(providerSpec) - - ### - Section: Panels - ### - - # Essential: Adds a panel item to the top of the editor window above the tabs. - # - # * `options` {Object} - # * `item` Your panel content. It can be DOM element, a jQuery element, or - # a model with a view registered via {::addViewProvider}. We recommend the - # latter. See {::addViewProvider} for more information. - # * `visible` (optional) {Boolean} false if you want the panel to initially be hidden - # (default: true) - # * `priority` (optional) {Number} Determines stacking order. Lower priority items are - # forced closer to the edges of the window. (default: 100) - # - # Returns a {Panel} - addTopPanel: (options) -> - @addPanel('top', options) - - # Essential: Adds a panel item to the bottom of the editor window. - # - # * `options` {Object} - # * `item` Your panel content. It can be DOM element, a jQuery element, or - # a model with a view registered via {::addViewProvider}. We recommend the - # latter. See {::addViewProvider} for more information. - # * `visible` (optional) {Boolean} false if you want the panel to initially be hidden - # (default: true) - # * `priority` (optional) {Number} Determines stacking order. Lower priority items are - # forced closer to the edges of the window. (default: 100) - # - # Returns a {Panel} - addBottomPanel: (options) -> - @addPanel('bottom', options) - - # Essential: Adds a panel item to the left of the editor window. - # - # * `options` {Object} - # * `item` Your panel content. It can be DOM element, a jQuery element, or - # a model with a view registered via {::addViewProvider}. We recommend the - # latter. See {::addViewProvider} for more information. - # * `visible` (optional) {Boolean} false if you want the panel to initially be hidden - # (default: true) - # * `priority` (optional) {Number} Determines stacking order. Lower priority items are - # forced closer to the edges of the window. (default: 100) - # - # Returns a {Panel} - addLeftPanel: (options) -> - @addPanel('left', options) - - # Essential: Adds a panel item to the right of the editor window. - # - # * `options` {Object} - # * `item` Your panel content. It can be DOM element, a jQuery element, or - # a model with a view registered via {::addViewProvider}. We recommend the - # latter. See {::addViewProvider} for more information. - # * `visible` (optional) {Boolean} false if you want the panel to initially be hidden - # (default: true) - # * `priority` (optional) {Number} Determines stacking order. Lower priority items are - # forced closer to the edges of the window. (default: 100) - # - # Returns a {Panel} - addRightPanel: (options) -> - @addPanel('right', options) - - addPanel: (location, options) -> - options ?= {} - options.viewRegistry = @viewRegistry - @panelContainers[location].addPanel(new Panel(options))