mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Add RootView.getActiveView and .getActivePaneItem
They will replace getActiveEditor/getActiveEditSession
This commit is contained in:
committed by
probablycorey
parent
58228f7ff7
commit
80e736d4ee
@@ -7,10 +7,8 @@ describe "GrammarView", ->
|
||||
|
||||
beforeEach ->
|
||||
window.rootView = new RootView
|
||||
project.removeGrammarOverrideForPath('sample.js')
|
||||
rootView.open('sample.js')
|
||||
editor = rootView.getActiveEditor()
|
||||
rootView.attachToDom()
|
||||
editor = rootView.getActiveView()
|
||||
textGrammar = _.find syntax.grammars, (grammar) -> grammar.name is 'Plain Text'
|
||||
expect(textGrammar).toBeTruthy()
|
||||
jsGrammar = _.find syntax.grammars, (grammar) -> grammar.name is 'JavaScript'
|
||||
|
||||
@@ -35,6 +35,11 @@ class PaneContainer extends View
|
||||
getActivePane: ->
|
||||
@find('.pane.active').view() ? @find('.pane:first').view()
|
||||
|
||||
getActivePaneItem: ->
|
||||
@getActivePane()?.currentItem
|
||||
|
||||
getActiveView: ->
|
||||
@getActivePane()?.currentView
|
||||
|
||||
adjustPaneDimensions: ->
|
||||
if root = @getRoot()
|
||||
|
||||
@@ -71,8 +71,8 @@ class RootView extends View
|
||||
packageStates: atom.serializeAtomPackages()
|
||||
|
||||
handleFocus: (e) ->
|
||||
if @getActiveEditor()
|
||||
@getActiveEditor().focus()
|
||||
if @getActivePane()
|
||||
@getActivePane().focus()
|
||||
false
|
||||
else
|
||||
@setTitle(null)
|
||||
@@ -163,9 +163,13 @@ class RootView extends View
|
||||
editor.view()
|
||||
else
|
||||
@panes.find('.editor:first').view()
|
||||
getActivePaneItem: ->
|
||||
@panes.getActivePaneItem()
|
||||
|
||||
getActiveEditSession: ->
|
||||
@getActiveEditor()?.activeEditSession
|
||||
getActiveView: ->
|
||||
@panes.getActiveView()
|
||||
|
||||
focusNextPane: -> @panes.focusNextPane()
|
||||
getFocusedPane: -> @panes.getFocusedPane()
|
||||
|
||||
Reference in New Issue
Block a user