mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Create hasFocus method
This commit is contained in:
@@ -55,7 +55,7 @@ class TreeView extends View
|
||||
@on 'tree-view:add', => @add()
|
||||
@on 'tree-view:remove', => @removeSelectedEntry()
|
||||
@on 'tree-view:directory-modified', =>
|
||||
if @is(':focus')
|
||||
if @hasFocus()
|
||||
@selectEntryForPath(@selectedPath) if @selectedPath
|
||||
else
|
||||
@selectActiveFile()
|
||||
@@ -74,7 +74,7 @@ class TreeView extends View
|
||||
serialize: ->
|
||||
directoryExpansionStates: @root?.serializeEntryExpansionStates()
|
||||
selectedPath: @selectedEntry()?.getPath()
|
||||
hasFocus: @is(':focus')
|
||||
hasFocus: @hasFocus()
|
||||
attached: @hasParent()
|
||||
scrollTop: @scrollTop()
|
||||
|
||||
@@ -82,7 +82,7 @@ class TreeView extends View
|
||||
@root?.unwatchEntries()
|
||||
|
||||
toggle: ->
|
||||
if @is(':focus')
|
||||
if @hasFocus()
|
||||
@detach()
|
||||
@rootView.focus()
|
||||
else
|
||||
@@ -96,6 +96,9 @@ class TreeView extends View
|
||||
@scrollTopAfterAttach = @scrollTop()
|
||||
super
|
||||
|
||||
hasFocus: ->
|
||||
@is(':focus')
|
||||
|
||||
entryClicked: (e) ->
|
||||
entry = $(e.currentTarget).view()
|
||||
switch e.originalEvent?.detail ? 1
|
||||
|
||||
Reference in New Issue
Block a user