Skip to content

Commit 59962fe

Browse files
jenstroegerpeyerluk
authored andcommitted
fix(create-default-behavior): avoid duplicating first pasted element.
1 parent 373d654 commit 59962fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/create-default-behavior.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,10 @@ export default function createDefaultBehavior (editable) {
149149
},
150150

151151
paste (element, blocks, cursor) {
152-
cursor.insertBefore(blocks[0])
152+
if (blocks.length === 0) return
153153

154-
if (blocks.length <= 1) return cursor.setVisibleSelection()
154+
cursor.insertBefore(blocks.shift())
155+
if (blocks.length === 0) return cursor.setVisibleSelection()
155156

156157
var parent = element.parentNode
157158
var currentElement = element

0 commit comments

Comments
 (0)