From 4346ad0e3f4a956e40a71f3cfd36682be6f90f4a Mon Sep 17 00:00:00 2001 From: David Hrdlicka Date: Mon, 26 Mar 2018 17:52:03 -0700 Subject: [PATCH] Fix cloneFragment to work with multiple Editor instances (#1728) --- packages/slate-react/src/utils/clone-fragment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/slate-react/src/utils/clone-fragment.js b/packages/slate-react/src/utils/clone-fragment.js index 2af482d91..ecd8a7af9 100644 --- a/packages/slate-react/src/utils/clone-fragment.js +++ b/packages/slate-react/src/utils/clone-fragment.js @@ -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'