feat:copy with style
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { debounce } from '../../utils'
|
||||
import { getElementListByClipboardHTML } from '../../utils/clipboard'
|
||||
import { getElementListByHTML } from '../../utils/clipboard'
|
||||
import { Draw } from '../draw/Draw'
|
||||
import { CanvasEvent } from '../event/CanvasEvent'
|
||||
|
||||
@@ -67,7 +67,7 @@ export class CursorAgent {
|
||||
}
|
||||
if (item.type === 'text/html' && isHTML) {
|
||||
item.getAsString(htmlText => {
|
||||
const elementList = getElementListByClipboardHTML(htmlText)
|
||||
const elementList = getElementListByHTML(htmlText)
|
||||
this.draw.insertElementList(elementList)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MouseEventButton } from '../../dataset/enum/Event'
|
||||
import { KeyMap } from '../../dataset/enum/Keymap'
|
||||
import { IElement } from '../../interface/Element'
|
||||
import { ICurrentPosition } from '../../interface/Position'
|
||||
import { writeTextByElementList } from '../../utils/clipboard'
|
||||
import { writeElementList } from '../../utils/clipboard'
|
||||
import { Cursor } from '../cursor/Cursor'
|
||||
import { Draw } from '../draw/Draw'
|
||||
import { HyperlinkParticle } from '../draw/particle/HyperlinkParticle'
|
||||
@@ -571,7 +571,7 @@ export class CanvasEvent {
|
||||
const { startIndex, endIndex } = this.range.getRange()
|
||||
const elementList = this.draw.getElementList()
|
||||
if (startIndex !== endIndex) {
|
||||
writeTextByElementList(elementList.slice(startIndex + 1, endIndex + 1))
|
||||
writeElementList(elementList.slice(startIndex + 1, endIndex + 1))
|
||||
let curIndex: number
|
||||
if (activeControl) {
|
||||
curIndex = this.control.cut()
|
||||
@@ -588,7 +588,7 @@ export class CanvasEvent {
|
||||
const { startIndex, endIndex } = this.range.getRange()
|
||||
const elementList = this.draw.getElementList()
|
||||
if (startIndex !== endIndex) {
|
||||
writeTextByElementList(elementList.slice(startIndex + 1, endIndex + 1))
|
||||
writeElementList(elementList.slice(startIndex + 1, endIndex + 1))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user