You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
768 B
48 lines
768 B
# 重写方法
|
|
|
|
## 使用方式
|
|
|
|
```javascript
|
|
import Editor from "@hufe921/canvas-editor"
|
|
|
|
const instance = new Editor(container, <IElement[]>data, options)
|
|
|
|
instance.override.overrideFunction = () => unknown | IOverrideResult
|
|
```
|
|
|
|
```typescript
|
|
interface IOverrideResult {
|
|
preventDefault?: boolean // 阻止执行内部默认方法。默认阻止
|
|
}
|
|
```
|
|
|
|
## paste
|
|
|
|
功能:重写粘贴方法
|
|
|
|
用法:
|
|
|
|
```javascript
|
|
instance.override.paste = (evt?: ClipboardEvent) => unknown | IOverrideResult
|
|
```
|
|
|
|
## copy
|
|
|
|
功能:重写复制方法
|
|
|
|
用法:
|
|
|
|
```javascript
|
|
instance.override.copy = () => unknown | IOverrideResult
|
|
```
|
|
|
|
## drop
|
|
|
|
功能:重写拖放方法
|
|
|
|
用法:
|
|
|
|
```javascript
|
|
instance.override.drop = (evt: DragEvent) => unknown | IOverrideResult
|
|
```
|