added drag away support

This commit is contained in:
dcore94 2023-02-01 18:33:24 +01:00
parent 893934b43e
commit 2a32bd5f63
1 changed files with 10 additions and 1 deletions

View File

@ -82,7 +82,7 @@ class CCPExecutionHistory extends HTMLElement {
<span name="accepted" title="Accepted executions" class="badge badge-secondary float-right mr-1">X</span>
</summary>
<ul class="ccp-execution-list list-group" style="list-style:none">
<li class="ccp-execution-item list-group-item-secondary my-2 p-2">
<li class="ccp-execution-item list-group-item-secondary my-2 p-2" draggable="true">
<details>
<summary>
<span name="version" class="badge badge-primary"></span>
@ -311,6 +311,15 @@ class CCPExecutionHistory extends HTMLElement {
target : "li.ccp-execution-item",
"in" : (e,d)=>this.#filtered[d],
apply : (e,d)=>e.setAttribute("data-index", d.id),
on_dragstart : ev=>{
ev.dataTransfer.effectAllowed = 'move'
ev.dataTransfer.setData('text/html', ev.currentTarget.innerHTML)
ev.dataTransfer.setData('text/plain+ccpexecution', ev.currentTarget.getAttribute("data-index"))
ev.dataTransfer.setData('application/json+ccpexecution', JSON.stringify(ev.currentTarget.bss_input.data))
},
on_dragend : ev=>{
ev.preventDefault()
},
on_click: ev=>{
if(ev.target.getAttribute("name") === "delete"){
if(window.confirm("Confirm deletion of this execution?")){