Fix drag and drop

This commit is contained in:
An Phan 2016-08-03 18:41:22 +08:00
parent 8d76859df7
commit a87b456f9b
No known key found for this signature in database
GPG key ID: 05536BB4BCDC02A2
3 changed files with 5 additions and 7 deletions

View file

@ -107,11 +107,11 @@ export default {
handleDrop(e) {
this.removeDroppableState(e);
if (!e.dataTransfer.getData('text/plain')) {
if (!e.dataTransfer.getData('application/x-koel.text+plain')) {
return false;
}
const songs = songStore.byIds(e.dataTransfer.getData('text/plain').split(','));
const songs = songStore.byIds(e.dataTransfer.getData('application/x-koel.text+plain').split(','));
if (!songs.length) {
return false;

View file

@ -118,11 +118,11 @@ export default {
handleDrop(e) {
this.removeDroppableState(e);
if (!e.dataTransfer.getData('text/plain')) {
if (!e.dataTransfer.getData('application/x-koel.text+plain')) {
return false;
}
const songs = songStore.byIds(e.dataTransfer.getData('text/plain').split(','));
const songs = songStore.byIds(e.dataTransfer.getData('application/x-koel.text+plain').split(','));
if (!songs.length) {
return false;

View file

@ -343,10 +343,8 @@ export default {
}
this.$nextTick(() => {
// We can opt for something like application/x-koel.text+plain here to sound fancy,
// but forget it.
const songIds = map(this.selectedSongs, 'id');
e.dataTransfer.setData('text/plain', songIds);
e.dataTransfer.setData('application/x-koel.text+plain', songIds);
e.dataTransfer.effectAllowed = 'move';
// Set a fancy drop image using our ghost element.