mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Add 'pane:close' event, which destroys all pane items.
Still have some issues with the presentation order of dialogs with multiple unsaved buffers and no paths. But for the 99% case this works as is.
This commit is contained in:
committed by
probablycorey
parent
da986b6a6c
commit
48c693d756
@@ -270,6 +270,15 @@ describe "Pane", ->
|
||||
|
||||
expect(containerCloseHandler).not.toHaveBeenCalled()
|
||||
|
||||
describe "pane:close", ->
|
||||
it "destroys all items and removes the pane", ->
|
||||
pane.showItem(editSession1)
|
||||
initialItemCount = pane.getItems().length
|
||||
pane.trigger 'pane:close'
|
||||
expect(pane.hasParent()).toBeFalsy()
|
||||
expect(editSession2.destroyed).toBeTruthy()
|
||||
expect(editSession1.destroyed).toBeTruthy()
|
||||
|
||||
describe "core:save", ->
|
||||
describe "when the current item has a path", ->
|
||||
describe "when the current item has a save method", ->
|
||||
|
||||
@@ -30,6 +30,7 @@ class Pane extends View
|
||||
@command 'pane:split-right', => @splitRight()
|
||||
@command 'pane:split-up', => @splitUp()
|
||||
@command 'pane:split-down', => @splitDown()
|
||||
@command 'pane:close', => @destroyItems()
|
||||
@on 'focus', => @activeView.focus(); false
|
||||
@on 'focusin', => @makeActive()
|
||||
|
||||
@@ -108,6 +109,9 @@ class Pane extends View
|
||||
else
|
||||
reallyDestroyItem()
|
||||
|
||||
destroyItems: ->
|
||||
@destroyItem(item) for item in @getItems()
|
||||
|
||||
promptToSaveItem: (item, nextAction) ->
|
||||
path = item.getPath()
|
||||
atom.confirm(
|
||||
|
||||
Reference in New Issue
Block a user