feat: add override internal copy function api
This commit is contained in:
@@ -18,3 +18,13 @@ Usage:
|
|||||||
```javascript
|
```javascript
|
||||||
instance.override.paste = (evt: ClipboardEvent) => void
|
instance.override.paste = (evt: ClipboardEvent) => void
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## copy
|
||||||
|
|
||||||
|
Feature: Override internal copy function
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
instance.override.copy = () => void
|
||||||
|
```
|
||||||
|
|||||||
@@ -18,3 +18,13 @@ instance.override.overrideFunction = ()=>{}
|
|||||||
```javascript
|
```javascript
|
||||||
instance.override.paste = (evt: ClipboardEvent) => void
|
instance.override.paste = (evt: ClipboardEvent) => void
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## copy
|
||||||
|
|
||||||
|
功能:重写复制方法
|
||||||
|
|
||||||
|
用法:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
instance.override.copy = () => void
|
||||||
|
```
|
||||||
|
|||||||
@@ -3,6 +3,12 @@ import { CanvasEvent } from '../CanvasEvent'
|
|||||||
|
|
||||||
export function copy(host: CanvasEvent) {
|
export function copy(host: CanvasEvent) {
|
||||||
const draw = host.getDraw()
|
const draw = host.getDraw()
|
||||||
|
// 自定义粘贴事件
|
||||||
|
const { copy } = draw.getOverride()
|
||||||
|
if (copy) {
|
||||||
|
copy()
|
||||||
|
return
|
||||||
|
}
|
||||||
const rangeManager = draw.getRange()
|
const rangeManager = draw.getRange()
|
||||||
// 光标闭合时复制整行
|
// 光标闭合时复制整行
|
||||||
const copyElementList = rangeManager.getIsCollapsed()
|
const copyElementList = rangeManager.getIsCollapsed()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
export class Override {
|
export class Override {
|
||||||
public paste: ((evt: ClipboardEvent) => void) | undefined
|
public paste: ((evt: ClipboardEvent) => void) | undefined
|
||||||
|
public copy: (() => void) | undefined
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user