Merge pull request #3663 from atom/bo-subscribe-editor-commands

Subscribe to commands in TextEditorComponent so they are unsubscribed!
This commit is contained in:
Nathan Sobo
2014-09-30 10:56:05 -06:00
2 changed files with 6 additions and 2 deletions

View File

@@ -2264,6 +2264,10 @@ describe "TextEditorComponent", ->
wrapperView.detach()
wrapperView.attachToDom()
wrapperView.trigger('core:move-right')
expect(editor.getCursorBufferPosition()).toEqual [0, 1]
buildMouseEvent = (type, properties...) ->
properties = extend({bubbles: true, cancelable: true}, properties...)
properties.detail ?= 1

View File

@@ -514,8 +514,8 @@ TextEditorComponent = React.createClass
addCommandListeners: (listenersByCommandName) ->
{parentView} = @props
addListener = (command, listener) ->
parentView.command command, (event) ->
addListener = (command, listener) =>
@subscribe parentView.command command, (event) ->
event.stopPropagation()
listener(event)