feat: add override internal drop function api #643
This commit is contained in:
@@ -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,4 +1,5 @@
|
||||
export class Override {
|
||||
public paste: ((evt?: ClipboardEvent) => void) | undefined
|
||||
public copy: (() => void) | undefined
|
||||
public drop: ((evt: DragEvent) => void) | undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user