feat:add copy text align and separator feature

This commit is contained in:
Hufe921
2022-08-03 23:12:16 +08:00
parent 731a8e4b4d
commit d1d7e96287
2 changed files with 24 additions and 12 deletions
+6 -3
View File
@@ -1,4 +1,4 @@
import { ElementType } from '../..'
import { ElementType, IEditorOption } from '../..'
import { ZERO } from '../../dataset/constant/Common'
import { EDITOR_ELEMENT_COPY_ATTR } from '../../dataset/constant/Element'
import { ElementStyleKey } from '../../dataset/enum/ElementStyle'
@@ -20,6 +20,7 @@ import { Control } from '../draw/control/Control'
import { CheckboxControl } from '../draw/control/checkbox/CheckboxControl'
import { splitText } from '../../utils'
import { Previewer } from '../draw/particle/previewer/Previewer'
import { DeepRequired } from '../../interface/Common'
export class CanvasEvent {
@@ -28,6 +29,7 @@ export class CanvasEvent {
private mouseDownStartPosition: ICurrentPosition | null
private draw: Draw
private options: DeepRequired<IEditorOption>
private pageContainer: HTMLDivElement
private pageList: HTMLCanvasElement[]
private position: Position
@@ -48,6 +50,7 @@ export class CanvasEvent {
this.pageContainer = draw.getPageContainer()
this.pageList = draw.getPageList()
this.draw = draw
this.options = draw.getOptions()
this.cursor = null
this.position = this.draw.getPosition()
this.range = this.draw.getRange()
@@ -585,7 +588,7 @@ export class CanvasEvent {
const { startIndex, endIndex } = this.range.getRange()
const elementList = this.draw.getElementList()
if (startIndex !== endIndex) {
writeElementList(elementList.slice(startIndex + 1, endIndex + 1))
writeElementList(elementList.slice(startIndex + 1, endIndex + 1), this.options)
let curIndex: number
if (activeControl) {
curIndex = this.control.cut()
@@ -602,7 +605,7 @@ export class CanvasEvent {
const { startIndex, endIndex } = this.range.getRange()
const elementList = this.draw.getElementList()
if (startIndex !== endIndex) {
writeElementList(elementList.slice(startIndex + 1, endIndex + 1))
writeElementList(elementList.slice(startIndex + 1, endIndex + 1), this.options)
}
}