Skip to content

Commit c34cab2

Browse files
committed
fix #145
1 parent 49b246a commit c34cab2

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

lib/view/host-view.coffee

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{$, View, TextEditorView} = require 'atom-space-pen-views'
2+
{CompositeDisposable} = require 'atom'
23

34
module.exports =
45
class ConfigView extends View
@@ -49,15 +50,16 @@ class ConfigView extends View
4950
@input type: 'checkbox', outlet: 'uploadOnSave'
5051

5152
@div class: 'block pull-right', =>
52-
@button class: 'inline-block-tight btn', outlet: 'cancelButton', 'Cancel'
53-
@button class: 'inline-block-tight btn', outlet: 'saveButton', 'Save'
53+
@button class: 'inline-block-tight btn', outlet: 'cancelButton', click: 'close', 'Cancel'
54+
@button class: 'inline-block-tight btn', outlet: 'saveButton', click: 'confirm', 'Save'
5455

5556
initialize: (@host) ->
56-
@on 'core:confirm', => @confirm()
57-
@saveButton.on 'click', => @confirm()
58-
59-
@on 'core:cancel', => @close()
60-
@cancelButton.on 'click', => @close()
57+
@disposables = new CompositeDisposable
58+
@disposables.add atom.commands.add 'atom-workspace',
59+
'core:confirm': => @confirm()
60+
'core:cancel': (event) =>
61+
@close()
62+
event.stopPropagation()
6163

6264
@transportGroup.on 'click', (e)=>
6365
e.preventDefault()
@@ -100,7 +102,8 @@ class ConfigView extends View
100102
close: ->
101103
@detach()
102104
@panel.destroy()
103-
panel = null
105+
@panel = null
106+
@disposables.dispose()
104107

105108
confirm: ->
106109
@host.uploadOnSave = @uploadOnSave.prop('checked')

0 commit comments

Comments
 (0)