mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-12 18:24:03 +02:00
Fix iframe crash (#4219)
* fixes #4170 * add smoke test for iframe example * add changeset * update changeset wording
This commit is contained in:
committed by
GitHub
parent
c70e30f83d
commit
737aaa9cde
@@ -106,6 +106,10 @@ export const ReactEditor = {
|
||||
const el = ReactEditor.toDOMNode(editor, editor)
|
||||
const root = el.getRootNode()
|
||||
|
||||
// The below exception will always be thrown for iframes because the document inside an iframe
|
||||
// does not inherit it's prototype from the parent document, therefore we return early
|
||||
if (el.ownerDocument !== document) return el.ownerDocument
|
||||
|
||||
if (!(root instanceof Document || root instanceof ShadowRoot))
|
||||
throw new Error(
|
||||
`Unable to find DocumentOrShadowRoot for editor element: ${el}`
|
||||
|
Reference in New Issue
Block a user