feat: copy entire line when cursor is inside
This commit is contained in:
@@ -4,10 +4,10 @@ import { CanvasEvent } from '../CanvasEvent'
|
|||||||
export function copy(host: CanvasEvent) {
|
export function copy(host: CanvasEvent) {
|
||||||
const draw = host.getDraw()
|
const draw = host.getDraw()
|
||||||
const rangeManager = draw.getRange()
|
const rangeManager = draw.getRange()
|
||||||
const { startIndex, endIndex } = rangeManager.getRange()
|
// 光标闭合时复制整行
|
||||||
if (startIndex !== endIndex) {
|
const copyElementList = rangeManager.getIsCollapsed()
|
||||||
const options = draw.getOptions()
|
? rangeManager.getRangeRowElementList()
|
||||||
const elementList = draw.getElementList()
|
: rangeManager.getSelectionElementList()
|
||||||
writeElementList(elementList.slice(startIndex + 1, endIndex + 1), options)
|
if (!copyElementList?.length) return
|
||||||
}
|
writeElementList(copyElementList, draw.getOptions())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user