|
1 | 1 | {$, View, TextEditorView} = require 'atom-space-pen-views' |
| 2 | +{CompositeDisposable} = require 'atom' |
2 | 3 |
|
3 | 4 | module.exports = |
4 | 5 | class ConfigView extends View |
@@ -49,15 +50,16 @@ class ConfigView extends View |
49 | 50 | @input type: 'checkbox', outlet: 'uploadOnSave' |
50 | 51 |
|
51 | 52 | @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' |
54 | 55 |
|
55 | 56 | 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() |
61 | 63 |
|
62 | 64 | @transportGroup.on 'click', (e)=> |
63 | 65 | e.preventDefault() |
@@ -100,7 +102,8 @@ class ConfigView extends View |
100 | 102 | close: -> |
101 | 103 | @detach() |
102 | 104 | @panel.destroy() |
103 | | - panel = null |
| 105 | + @panel = null |
| 106 | + @disposables.dispose() |
104 | 107 |
|
105 | 108 | confirm: -> |
106 | 109 | @host.uploadOnSave = @uploadOnSave.prop('checked') |
|
0 commit comments