Focus the root view when canceling the move dialog.

This is temporary, because we really want to focus the tree view, but less annoying for now than losing focus entirely.
This commit is contained in:
Nathan Sobo
2012-04-27 18:08:30 -06:00
parent 18ccee32b8
commit abcf71af8b
3 changed files with 19 additions and 2 deletions

View File

@@ -6,3 +6,4 @@ window.keymap.bindKeys '.tree-view'
window.keymap.bindKeys '.move-dialog .mini.editor'
'enter': 'tree-view:confirm'
'escape': 'tree-view:cancel'

View File

@@ -163,8 +163,9 @@ class MoveDialog extends View
initialize: (@project, @path) ->
@editor.focus()
@editor.on 'focusout', => @remove()
@on 'tree-view:confirm', => @confirm()
@on 'tree-view:cancel', => @cancel()
@editor.on 'focusout', => @remove()
relativePath = @project.relativize(@path)
@editor.setText(relativePath)
@@ -175,3 +176,9 @@ class MoveDialog extends View
confirm: ->
fs.move(@path, @project.resolve(@editor.getText()))
@remove()
$('#root-view').focus()
cancel: ->
@remove()
$('#root-view').focus()