mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Merge pull request #15264 from captbaritone/pane-destroy-item
Ensure Pane.destroyItem always returns a promise
This commit is contained in:
@@ -621,12 +621,15 @@ class Pane
|
||||
destroyItem: (item, force) ->
|
||||
index = @items.indexOf(item)
|
||||
if index isnt -1
|
||||
return false if not force and @getContainer()?.getLocation() isnt 'center' and item.isPermanentDockItem?()
|
||||
if not force and @getContainer()?.getLocation() isnt 'center' and item.isPermanentDockItem?()
|
||||
return Promise.resolve(false)
|
||||
|
||||
@emitter.emit 'will-destroy-item', {item, index}
|
||||
@container?.willDestroyPaneItem({item, index, pane: this})
|
||||
if force or not item?.shouldPromptToSave?()
|
||||
@removeItem(item, false)
|
||||
item.destroy?()
|
||||
Promise.resolve(true)
|
||||
else
|
||||
@promptToSaveItem(item).then (result) =>
|
||||
if result
|
||||
|
||||
Reference in New Issue
Block a user