From 50cf5f3e95ef922011f4c94b8ed7f42e15ba0a20 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 30 Sep 2014 09:33:50 -0700 Subject: [PATCH] Subscribe to editor commands We need to unsubscribe when the editor is removed! Closes #3651 --- src/text-editor-component.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 270404ef4..8519ac21d 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -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)