Only unmount ReactEditorView's component before removing if its mounted

Fixes #3108

Unmounting the component the first time can cause a focusout event,
which leads to a redundant removal and an attempt to unmount again. This
protects against that.
This commit is contained in:
Nathan Sobo
2014-07-29 20:02:01 -06:00
parent 662c2fc9d3
commit 0f77a2eef9

View File

@@ -115,7 +115,7 @@ class ReactEditorView extends View
@find('.lines').prepend(view)
beforeRemove: ->
React.unmountComponentAtNode(@element)
React.unmountComponentAtNode(@element) if @component.isMounted()
@attached = false
@trigger 'editor:detached', this