 $ = require 'jquery'
-SortableView = require 'sortable-view'
+SortableList = require 'sortable-list'
 Tab = require 'tabs/src/tab'
 
 module.exports =
-class Tabs extends SortableView
+class Tabs extends SortableList
   @activate: (rootView) ->
     rootView.eachEditor (editor) =>
       @prependToEditorPane(rootView, editor) if editor.attached

      pane.prepend(new Tabs(editor))

  @content: ->
    @ul class: 'tabs'

  initialize: (@editor) ->
    super


  removeTabAtIndex: (index) ->
    @find(".tab:eq(#{index})").remove()

  onDrop: (event) =>
    super
    sessions = @editor.editSessions
    el = @sortableElement(event)
    previousIndex = event.originalEvent.dataTransfer.getData('index')
    currentIndex  = el.index() - 1

    sessions.splice(currentIndex, 0, sessions.splice(previousIndex, 1)[0])

    @setActiveTab(currentIndex)
    @editor.setActiveEditSessionIndex(currentIndex)
    @editor.focus()
