feat: add override internal drop function api #643

This commit is contained in:
Hufe921
2024-06-08 18:04:10 +08:00
parent 3f5ddbb6cc
commit ec7e0760c1
4 changed files with 28 additions and 0 deletions
+7
View File
@@ -2,6 +2,13 @@ import { CanvasEvent } from '../CanvasEvent'
import { pasteImage } from './paste'
export function drop(evt: DragEvent, host: CanvasEvent) {
const draw = host.getDraw()
// 自定义拖放事件
const { drop } = draw.getOverride()
if (drop) {
drop(evt)
return
}
evt.preventDefault()
const data = evt.dataTransfer?.getData('text')
if (data) {
+1
View File
@@ -1,4 +1,5 @@
export class Override {
public paste: ((evt?: ClipboardEvent) => void) | undefined
public copy: (() => void) | undefined
public drop: ((evt: DragEvent) => void) | undefined
}