@portabletext/editor 6.6.6 → 6.6.8

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
@@ -1046,7 +1046,7 @@ typeof globalThis < "u" && globalThis.InputEvent && typeof globalThis.InputEvent
1046
1046
  return current;
1047
1047
  if (current.parentElement)
1048
1048
  current = current.parentElement;
1049
- else if (current.parentNode && "host" in current.parentNode)
1049
+ else if (isShadowRoot(current.parentNode))
1050
1050
  current = current.parentNode.host;
1051
1051
  else
1052
1052
  return null;
@@ -1062,12 +1062,12 @@ typeof globalThis < "u" && globalThis.InputEvent && typeof globalThis.InputEvent
1062
1062
  if (current === parent)
1063
1063
  return !0;
1064
1064
  if (current.parentNode)
1065
- "host" in current.parentNode ? current = current.parentNode.host : current = current.parentNode;
1065
+ isShadowRoot(current.parentNode) ? current = current.parentNode.host : current = current.parentNode;
1066
1066
  else
1067
1067
  return !1;
1068
1068
  }
1069
1069
  return !1;
1070
- };
1070
+ }, isShadowRoot = (value) => isDOMNode(value) && value.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in value;
1071
1071
  function getDomNodePath(domNode) {
1072
1072
  let element = isDOMElement(domNode) ? domNode : domNode.parentElement;
1073
1073
  if (element && !element.hasAttribute("data-pt-path") && (element = element.closest("[data-pt-path]")), !element)
@@ -3842,10 +3842,8 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({
3842
3842
  const domSelection = getSelection(root2);
3843
3843
  if (activeElement === el2)
3844
3844
  state.latestElement = activeElement, editor.focused = !0;
3845
- else {
3846
- editor.focused = !1;
3845
+ else if (editor.focused = !1, !readOnly)
3847
3846
  return;
3848
- }
3849
3847
  if (!domSelection)
3850
3848
  return deselect(editor);
3851
3849
  const {