🚱 Fix mini editor leak

Previously, we were overriding Editor::destroy, which is now provided
by telepath. Since the real destroy wasn't being called, we were failing
to remove editors associated with mini editor views.
This commit is contained in:
Nathan Sobo
2013-12-18 17:02:40 -07:00
parent d7d4a990a5
commit 42b203d502
7 changed files with 19 additions and 21 deletions

View File

@@ -192,7 +192,7 @@ class Pane extends View
handleItemEvents: (item) ->
if _.isFunction(item.on)
@subscribe item, 'destroyed', =>
@destroyItem(item) if @state.isAlive()
@destroyItem(item, updateState: false) if @state.isAlive()
# Public: Remove the currently active item.
destroyActiveItem: =>
@@ -200,13 +200,13 @@ class Pane extends View
false
# Public: Remove the specified item.
destroyItem: (item) ->
destroyItem: (item, options) ->
@unsubscribe(item) if _.isFunction(item.off)
@trigger 'pane:before-item-destroyed', [item]
if @promptToSaveItem(item)
@getContainer()?.itemDestroyed(item)
@removeItem(item)
@removeItem(item, options)
item.destroy?()
true
else