mirror of
https://github.com/atom/atom.git
synced 2026-01-22 13:28:01 -05:00
Merge pull request #3663 from atom/bo-subscribe-editor-commands
Subscribe to commands in TextEditorComponent so they are unsubscribed!
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user