forked from 0x2620/pandora
fix drag and drop from edit to edit and from clips to edit fixes #2247
This commit is contained in:
parent
5ce83cbe63
commit
1022e3debf
3 changed files with 30 additions and 24 deletions
|
@ -136,22 +136,10 @@ pandora.ui.clipList = function(videoRatio) {
|
|||
.addClass('OxMedia')
|
||||
.bindEvent({
|
||||
copy: function(data) {
|
||||
var items = data.ids.map(function(id) {
|
||||
var item = !ui.item ? id.split('/')[0] : ui.item,
|
||||
annotations = that.value(id, 'annotations') || [],
|
||||
annotation = annotations.length ? annotations[0].id : null;
|
||||
return annotation || item + '/' + that.value(id, 'in') + '-' + that.value(id, 'out');
|
||||
})
|
||||
pandora.clipboard.copy(items, 'clip');
|
||||
pandora.clipboard.copy(serializeClips(data.ids), 'clip');
|
||||
},
|
||||
copyadd: function(data) {
|
||||
var items = data.ids.map(function(id) {
|
||||
var item = !ui.item ? id.split('/')[0] : ui.item,
|
||||
annotations = that.value(id, 'annotations') || [],
|
||||
annotation = annotations.length ? annotations[0].id : null;
|
||||
return annotation || item + '/' + that.value(id, 'in') + '-' + that.value(id, 'out');
|
||||
})
|
||||
pandora.clipboard.add(items, 'clip');
|
||||
pandora.clipboard.add(serializeClips(data.ids), 'clip');
|
||||
},
|
||||
gainfocus: function() {
|
||||
pandora.$ui.mainMenu.replaceItemMenu();
|
||||
|
@ -290,7 +278,18 @@ pandora.ui.clipList = function(videoRatio) {
|
|||
}
|
||||
});
|
||||
|
||||
pandora.enableDragAndDrop(that, true, 'edits');
|
||||
function serializeClips(ids) {
|
||||
return ids.map(function(id) {
|
||||
var item = !ui.item ? id.split('/')[0] : ui.item,
|
||||
annotations = that.value(id, 'annotations') || [],
|
||||
annotation = annotations.length ? annotations[0].id : null;
|
||||
return annotation || item + '/' + that.value(id, 'in') + '-' + that.value(id, 'out');
|
||||
});
|
||||
}
|
||||
|
||||
pandora.enableDragAndDrop(that, true, 'edits', function($list) {
|
||||
return serializeClips($list.options('selected'));
|
||||
});
|
||||
return that;
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,13 @@ pandora.ui.editPanel = function(isEmbed) {
|
|||
function enableDragAndDrop() {
|
||||
pandora.enableDragAndDrop(
|
||||
Ox.$elements[that.find('.OxIconList').data('oxid')],
|
||||
edit.editable
|
||||
edit.editable,
|
||||
'edits',
|
||||
function($list) {
|
||||
return serializeClips($list.options('selected')).map(function(id) {
|
||||
return id.split('/').slice(0, 2).join('/');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -520,7 +520,7 @@ pandora.createLinks = function($element) {
|
|||
|
||||
}());
|
||||
|
||||
pandora.enableDragAndDrop = function($list, canMove, section) {
|
||||
pandora.enableDragAndDrop = function($list, canMove, section, getItems) {
|
||||
|
||||
section = section || pandora.user.ui.section;
|
||||
|
||||
|
@ -532,17 +532,18 @@ pandora.enableDragAndDrop = function($list, canMove, section) {
|
|||
|
||||
$list.bindEvent({
|
||||
draganddropstart: function(data) {
|
||||
if (section != pandora.user.ui.section) {
|
||||
var ui = pandora.user.ui;
|
||||
if (section != ui.section) {
|
||||
pandora.$ui.mainPanel.replaceElement(0,
|
||||
pandora.$ui.leftPanel = pandora.ui.leftPanel(section)
|
||||
);
|
||||
}
|
||||
drag.action = 'copy';
|
||||
drag.ids = $list.options('selected'),
|
||||
drag.ids = getItems ? getItems($list) : $list.options('selected');
|
||||
drag.item = drag.ids.length == 1
|
||||
? $list.value(drag.ids[0], 'title') || 1
|
||||
: drag.ids.length;
|
||||
drag.source = pandora.getListData(),
|
||||
drag.source = pandora.getListData();
|
||||
drag.targets = {};
|
||||
//fixme instead of a fixed timeout,
|
||||
//bind to lists and update if they get new items
|
||||
|
@ -564,7 +565,7 @@ pandora.enableDragAndDrop = function($list, canMove, section) {
|
|||
}
|
||||
});
|
||||
});
|
||||
}, section != pandora.user.ui.section ? 2000 : 0);
|
||||
}, section != ui.section ? 2000 : 0);
|
||||
$tooltip.options({title: getTitle()}).show(data.event);
|
||||
canMove && Ox.$window.on({
|
||||
keydown: keydown,
|
||||
|
@ -647,7 +648,7 @@ pandora.enableDragAndDrop = function($list, canMove, section) {
|
|||
if (section == 'items') {
|
||||
var targets = drag.action == 'copy' ? drag.target.id
|
||||
: [pandora.user.ui._list, drag.target.id];
|
||||
pandora.doHistory(drag.action, data.ids, targets, function() {
|
||||
pandora.doHistory(drag.action, drag.ids, targets, function() {
|
||||
Ox.Request.clearCache('find');
|
||||
pandora.api.find({
|
||||
query: {
|
||||
|
@ -666,8 +667,8 @@ pandora.enableDragAndDrop = function($list, canMove, section) {
|
|||
} else if (section == 'edits') {
|
||||
var targets = drag.action == 'copy' ? drag.target.id
|
||||
: [pandora.user.ui.edit, drag.target.id];
|
||||
pandora.doHistory(drag.action, data.ids, targets, function() {
|
||||
Ox.print('FIXME, reload clipslist on move');
|
||||
pandora.doHistory(drag.action, drag.ids, targets, function() {
|
||||
Ox.print('FIXME, reload clipslist on drag', drag.ids);
|
||||
pandora.$ui.editPanel && pandora.$ui.editPanel.updatePanel();
|
||||
cleanup(250);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue