slate-react 0.75.0 → 0.75.1-2022220111127

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/dist/index.es.js CHANGED
@@ -2829,7 +2829,13 @@ var ReactEditor = {
2829
2829
  if (parentNode) {
2830
2830
  var _domNode$textContent;
2831
2831
 
2832
- var voidNode = parentNode.closest('[data-slate-void="true"]');
2832
+ var editorEl = ReactEditor.toDOMNode(editor, editor);
2833
+ var potentialVoidNode = parentNode.closest('[data-slate-void="true"]'); // Need to ensure that the closest void node is actually a void node
2834
+ // within this editor, and not a void node within some parent editor. This can happen
2835
+ // if this editor is within a void node of another editor ("nested editors", like in
2836
+ // the "Editable Voids" example on the docs site).
2837
+
2838
+ var voidNode = potentialVoidNode && editorEl.contains(potentialVoidNode) ? potentialVoidNode : null;
2833
2839
  var leafNode = parentNode.closest('[data-slate-leaf]');
2834
2840
  var domNode = null; // Calculate how far into the text node the `nearestNode` is, so that we
2835
2841
  // can determine what the offset relative to the text node is.