feat: copy entire line when cursor is inside

pr675
Hufe921 3 years ago
parent abcaa9b51c
commit 3c10be26fb

@ -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())
} }

Loading…
Cancel
Save