When FileFinder is canceled, it refocuses previously focused element

This commit is contained in:
Corey Johnson
2012-05-08 15:33:47 -07:00
parent bc3b982514
commit d35efb6241
2 changed files with 15 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ class FileFinder extends View
paths: null
maxResults: null
previouslyActiveElement: null
initialize: (@rootView) ->
requireStylesheet 'file-finder.css'
@@ -37,12 +38,14 @@ class FileFinder extends View
@attach() if @rootView.project.getPath()?
attach: ->
@previouslyActiveElement = document.activeElement
@rootView.project.getFilePaths().done (@paths) => @populatePathList()
@rootView.append(this)
@miniEditor.focus()
detach: ->
@rootView.focus()
console.log @previouslyActiveElement
(@previouslyActiveElement or @rootView).focus()
super
@miniEditor.setText('')