Set correct MIME when dragging (fixes #410)

This commit is contained in:
An Phan 2016-08-21 22:51:09 +08:00
parent 48dc6e62fd
commit aaaa3e1a4e
No known key found for this signature in database
GPG key ID: 05536BB4BCDC02A2
3 changed files with 7 additions and 8 deletions

View file

@ -91,7 +91,7 @@ export default {
*/
dragStart(e) {
const songIds = map(this.album.songs, '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.

View file

@ -82,7 +82,7 @@ export default {
*/
dragStart(e) {
const songIds = map(this.artist.songs, '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.

View file

@ -378,23 +378,22 @@ export default {
*/
handleDrop(songId, e) {
if (this.type !== 'queue') {
return;
return this.removeDroppableState(e) && false;
}
if (!e.dataTransfer.getData('text/plain')) {
return false;
if (!e.dataTransfer.getData('application/x-koel.text+plain')) {
return this.removeDroppableState(e) && false;
}
const songs = this.selectedSongs;
if (!songs.length) {
return false;
return this.removeDroppableState(e) && false;
}
queueStore.move(songs, songStore.byId(songId));
this.removeDroppableState(e);
return false;
return this.removeDroppableState(e) && false;
},
/**