@portabletext/editor 2.9.0 → 2.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -2284,8 +2284,12 @@ PortableTextEditable.displayName = "ForwardRef(PortableTextEditable)";
2284
2284
  function validateSelection(slateEditor, activeElement) {
2285
2285
  if (!slateEditor.selection)
2286
2286
  return;
2287
- const root = ReactEditor.findDocumentOrShadowRoot(slateEditor);
2288
- if (activeElement !== root.activeElement)
2287
+ let root;
2288
+ try {
2289
+ root = ReactEditor.findDocumentOrShadowRoot(slateEditor);
2290
+ } catch {
2291
+ }
2292
+ if (!root || activeElement !== root.activeElement)
2289
2293
  return;
2290
2294
  const domSelection = ReactEditor.getWindow(slateEditor).getSelection();
2291
2295
  if (!domSelection || domSelection.rangeCount === 0)