From b5edefcae888ca0418388b68dc092a426f1b1fa5 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 20 Nov 2014 11:13:40 -0700 Subject: [PATCH] Trigger editor:will-be-removed from SpacePen shim, not component By the time the component is getting unmounted, we have already called remove hooks on the SpacePen shim so subscriptions to the event have been removed. --- src/text-editor-component.coffee | 1 - src/text-editor-view.coffee | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 3b50b3997..15e8e0b08 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -199,7 +199,6 @@ TextEditorComponent = React.createClass componentWillUnmount: -> {editor, hostElement} = @props - hostElement.__spacePenView.trigger 'editor:will-be-removed', [hostElement.__spacePenView] @unsubscribe() @scopedConfigSubscriptions.dispose() window.removeEventListener 'resize', @requestHeightAndWidthMeasurement diff --git a/src/text-editor-view.coffee b/src/text-editor-view.coffee index f27b88e76..61869ddff 100644 --- a/src/text-editor-view.coffee +++ b/src/text-editor-view.coffee @@ -138,6 +138,7 @@ class TextEditorView extends View beforeRemove: -> @trigger 'editor:detached', [this] + @trigger 'editor:will-be-removed', [this] @attached = false remove: (selector, keepData) ->