mirror of
https://github.com/atom/atom.git
synced 2026-02-14 16:45:14 -05:00
Add Pane.moveItem(item, index)
This is the precursor to supporting drag/drop of tabs within and between panes.
This commit is contained in:
committed by
probablycorey
parent
21990cf986
commit
887b5ea007
@@ -104,6 +104,12 @@ class Pane extends View
|
||||
@trigger 'pane:item-removed', [item, index]
|
||||
@remove() unless @items.length
|
||||
|
||||
moveItem: (item, newIndex) ->
|
||||
oldIndex = @items.indexOf(item)
|
||||
@items.splice(oldIndex, 1)
|
||||
@items.splice(newIndex, 0, item)
|
||||
@trigger 'pane:item-moved', [item, newIndex]
|
||||
|
||||
itemForPath: (path) ->
|
||||
_.detect @items, (item) -> item.getPath?() is path
|
||||
|
||||
|
||||
Reference in New Issue
Block a user