1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-21 06:31:28 +02:00

Fix cloneFragment to work with multiple Editor instances (#1728)

This commit is contained in:
David Hrdlicka
2018-03-26 17:52:03 -07:00
committed by Ian Storm Taylor
parent 25aa1ec952
commit 4346ad0e3f

View File

@@ -96,7 +96,7 @@ function cloneFragment(event, value, fragment = value.fragment) {
attach.setAttribute('data-slate-fragment', encoded)
// Add the phony content to the DOM, and select it, so it will be copied.
const editor = window.document.querySelector('[data-slate-editor]')
const editor = event.target.closest('[data-slate-editor]')
const div = window.document.createElement('div')
div.setAttribute('contenteditable', true)
div.style.position = 'absolute'