Skip to content

Commit

Permalink
feat:paste image element
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Feb 1, 2023
1 parent 77d546f commit 0c07db7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/editor/utils/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ export function getElementListByHTML(htmlText: string): IElement[] {
value: '\n',
type: ElementType.SEPARATOR,
})
} else if (node.nodeName === 'IMG') {
const { src, width, height } = node as HTMLImageElement
if (src && width && height) {
elementList.push({
width,
height,
value: src,
type: ElementType.IMAGE
})
}
} else if (node.nodeName === 'INPUT' && (<HTMLInputElement>node).type === ControlComponent.CHECKBOX) {
elementList.push({
type: ElementType.CHECKBOX,
Expand Down

0 comments on commit 0c07db7

Please sign in to comment.