fix copy/copyadd/delete of clips via menu

This commit is contained in:
j 2015-10-04 14:18:29 +01:00
parent 6f4c010be0
commit b20a655fa8

View file

@ -411,29 +411,34 @@ pandora.ui.mainMenu = function() {
}); });
} }
} else if (data.id == 'copy' || data.id == 'copyadd') { } else if (data.id == 'copy' || data.id == 'copyadd') {
var action = data.id == 'copy' ? 'copy' : 'add'; var action = data.id == 'copy' ? 'copy' : 'add',
type = 'clip', clips;
fromMenu = true; fromMenu = true;
pandora.isVideoView() && !pandora.$ui.browser.hasFocus() ? pandora.clipboard[action]([{ function formatClip(clip) {
annotation: ui.videoPoints[ui.item].annotation, return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out;
'in': pandora.user.ui.videoPoints[ui.item]['in'], }
item: ui.item, if (pandora.isVideoView() && !pandora.$ui.browser.hasFocus()) {
out: ui.videoPoints[ui.item].out clips = [formatClip(ui.videoPoints[ui.item])];
}], 'clip') } else if (pandora.isClipView() && !pandora.$ui.browser.hasFocus()) {
: pandora.isClipView() && !pandora.$ui.browser.hasFocus() ? pandora.clipboard[action]( clips = pandora.$ui.clipList.options('selected');
pandora.$ui.clipList.options('selected'), 'clip' } else if (ui.section == 'edits') {
) clips = pandora.$ui.editPanel.getSelectedClips();
: ui.section == 'edits' ? pandora.clipboard[action](ui.editSelection, 'clip') } else {
: pandora.clipboard[action](ui.listSelection, 'item'); clips = ui.listSelection;
section = 'item';
}
pandora.clipboard[action](clips, type);
} else if (data.id == 'paste') { } else if (data.id == 'paste') {
var items = pandora.clipboard.paste();
fromMenu = true; fromMenu = true;
if (ui.section == 'items') { if (ui.section == 'items') {
pandora.doHistory('paste', items, ui._list, function() { var items = pandora.clipboard.paste('item');
items.length && pandora.doHistory('paste', items, ui._list, function() {
pandora.UI.set({listSelection: items}); pandora.UI.set({listSelection: items});
pandora.reloadList(); pandora.reloadList();
}); });
} else { } else if (ui.section == 'edits') {
pandora.doHistory('paste', items, ui.edit, function(result) { var clips = pandora.clipboard.paste('clip');
clips.length && pandora.doHistory('paste', clips, ui.edit, function(result) {
pandora.$ui.editPanel.updatePanel(function() { pandora.$ui.editPanel.updatePanel(function() {
pandora.UI.set({editSelection: result.data.clips.map(function(clip) { pandora.UI.set({editSelection: result.data.clips.map(function(clip) {
return clip.id; return clip.id;
@ -444,10 +449,17 @@ pandora.ui.mainMenu = function() {
} else if (data.id == 'clearclipboard') { } else if (data.id == 'clearclipboard') {
pandora.clipboard.clear(); pandora.clipboard.clear();
} else if (data.id == 'delete') { } else if (data.id == 'delete') {
pandora.doHistory('delete', ui.listSelection, ui._list, function() { if (ui.section == 'items') {
pandora.UI.set({listSelection: []}); pandora.doHistory('delete', ui.listSelection, ui._list, function() {
pandora.reloadList(); pandora.UI.set({listSelection: []});
}); pandora.reloadList();
});
} else if (ui.section == 'edits') {
var clips = pandora.$ui.editPanel.getSelectedClips();
pandora.doHistory('delete', clips, ui.edit, function(result) {
pandora.$ui.editPanel.updatePanel(function() {});
});
}
} else if (data.id == 'undo') { } else if (data.id == 'undo') {
fromMenu = true; fromMenu = true;
pandora.undoHistory(); pandora.undoHistory();