[UI] drop-target directive: Correctly remove --available class

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2022-02-27 14:43:16 +01:00
parent 5b4c46f521
commit d13e29c685
1 changed files with 6 additions and 0 deletions

View File

@ -43,6 +43,12 @@ export default {
el.classList.remove('dropTarget--available')
})
})
window.document.body.addEventListener('dragend', (e) => {
const targets = document.querySelectorAll('.dropTarget--available')
targets.forEach(el => {
el.classList.remove('dropTarget--available')
})
})
window.document.body.addEventListener('dragstart', (e) => {
if (allowDrop(e)) {
el.classList.add('dropTarget--available')