Fix drag-drop behavior when dropping onto root.
This commit is contained in:
parent
00bc7e6eac
commit
169fd4945d
2 changed files with 20 additions and 5 deletions
|
@ -424,14 +424,29 @@ function on_album_drag_drop(event)
|
|||
return;
|
||||
}
|
||||
|
||||
let prompt;
|
||||
if (parent_id === "root")
|
||||
{
|
||||
const child_title = child.querySelector('.album_card_title').textContent.trim();
|
||||
prompt = `Remove child\n${child_title}?`;
|
||||
}
|
||||
else
|
||||
{
|
||||
const child_title = child.querySelector('.album_card_title').textContent.trim();
|
||||
const parent_title = parent.querySelector('.album_card_title').textContent.trim();
|
||||
const prompt = `Move\n${child_title}\ninto\n${parent_title}?`;
|
||||
prompt = `Move\n${child_title}\ninto\n${parent_title}?`;
|
||||
}
|
||||
|
||||
if (! confirm(prompt))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ALBUM_ID)
|
||||
|
||||
if (parent_id === "root")
|
||||
{
|
||||
api.albums.remove_child(ALBUM_ID, child_id, common.refresh);
|
||||
}
|
||||
else if (ALBUM_ID)
|
||||
{
|
||||
api.albums.add_child(parent_id, child_id, null);
|
||||
api.albums.remove_child(ALBUM_ID, child_id, common.refresh);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div
|
||||
id="{{id}}"
|
||||
class="album_card album_card_{{view}}"
|
||||
data-id="{{album.id}}"
|
||||
data-id="{{'root' if album == 'root' else album.id}}"
|
||||
ondragstart="return on_album_drag_start(event);"
|
||||
ondragend="return on_album_drag_end(event);"
|
||||
ondragover="return on_album_drag_over(event);"
|
||||
|
|
Loading…
Reference in a new issue