I have been trying to implement simple html drag and drop into tauri + angular but I cannot get it to work. I only need a basic drag and drop.
Only the dragstart event fires. dragover and drop does not and I cannot find why.
Here is my component:
app.component.ts
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
greetingMessage = "";
onDragOver(event: DragEvent) {
event.preventDefault();
console.log("drag over", event);
}
onDrop(event: DragEvent) {
event.preventDefault();
console.log("drop event", event);
}
onDragStart(event: DragEvent) {
console.log("drag started", event);
}
}
app.component.html
<div id="dropzone" (dragover)="onDragOver($event)" (drop)="onDrop($event)"> DROP HERE</div>
<img draggable="true" src="https://picsum.photos/200/300" alt="a draggable image" (dragstart)="onDragStart($event)">
I tried not using angular's events and rather the default ones (ondragstart, ondrop, etc) and it would not work either. Whereas it would work in a plain html file.
Try this
app.component.html
app.component.ts