mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
basics of drag and drop support
This commit is contained in:
@@ -4,6 +4,8 @@ Tab = require 'tabs/src/tab'
|
||||
|
||||
module.exports =
|
||||
class Tabs extends View
|
||||
dndType: 'text/x-atom-tab'
|
||||
|
||||
@activate: (rootView) ->
|
||||
rootView.eachEditor (editor) =>
|
||||
@prependToEditorPane(rootView, editor) if editor.attached
|
||||
@@ -33,8 +35,25 @@ class Tabs extends View
|
||||
@editor.destroyEditSessionIndex(index)
|
||||
false
|
||||
|
||||
@on 'dragstart', '.tab', (e) ->
|
||||
console.log 'TAB DRAGGED', e
|
||||
@on 'dragstart', '.tab', @onDragStart
|
||||
@on 'dragend', '.tab', @onDragEnd
|
||||
@on 'dragenter', '.tab', @onDragEnter
|
||||
@on 'dragleave', '.tab', @onDragLeave
|
||||
|
||||
onDragStart: (event) =>
|
||||
$(event.target).addClass 'is-dragging'
|
||||
|
||||
onDragEnd: (event) =>
|
||||
$(event.target).removeClass 'is-dragging'
|
||||
|
||||
onDragEnter: (event) =>
|
||||
el = $(event.target)
|
||||
el = el.closest('.tab') if !el.hasClass('tab')
|
||||
el.addClass 'is-drop-target'
|
||||
|
||||
onDragLeave: (event) =>
|
||||
el = $(event.target)
|
||||
el.removeClass 'is-drop-target' if el.hasClass 'tab'
|
||||
|
||||
addTabForEditSession: (editSession) ->
|
||||
@append(new Tab(editSession, @editor))
|
||||
|
||||
@@ -76,4 +76,13 @@
|
||||
.tab.file-modified:hover .close-icon:before {
|
||||
content: "\f081";
|
||||
color: #66a6ff;
|
||||
}
|
||||
}
|
||||
|
||||
/* Drag and Drop */
|
||||
.tab.is-dragging {
|
||||
-webkit-box-flex: 1;
|
||||
color: red;
|
||||
}
|
||||
|
||||
|
||||
sdfsdf
|
||||
Reference in New Issue
Block a user