slate-react 0.147.0 → 0.147.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.
@@ -5860,6 +5860,14 @@
5860
5860
  var after = parent.children.slice(index + 1);
5861
5861
  return (_findSiblingDirection = findSiblingDirection(before)) !== null && _findSiblingDirection !== void 0 ? _findSiblingDirection : findSiblingDirection(after);
5862
5862
  };
5863
+ var getMountedChildren = function getMountedChildren(editor, element) {
5864
+ return slate.Editor.isVoid(editor, element) ? [slate.Node.texts(element).next().value[0]] : element.children;
5865
+ };
5866
+ var findUnmountedChild = function findUnmountedChild(editor, element) {
5867
+ return getMountedChildren(editor, element).findIndex(function (child) {
5868
+ return !NODE_TO_ELEMENT.has(child);
5869
+ });
5870
+ };
5863
5871
  var defaultRenderElement = function defaultRenderElement(props) {
5864
5872
  return /*#__PURE__*/React.createElement(DefaultElement, _objectSpread$3({}, props));
5865
5873
  };
@@ -5892,6 +5900,14 @@
5892
5900
  NODE_TO_ELEMENT["delete"](element);
5893
5901
  }
5894
5902
  }, [editor, key, element]);
5903
+ useIsomorphicLayoutEffect(function () {
5904
+ var index = findUnmountedChild(editor, element);
5905
+ if (index !== -1) {
5906
+ var type = element.type;
5907
+ var path = ReactEditor.findPath(editor, element);
5908
+ editor.onDOMError(new Error("renderElement didn't render the children of the ".concat(typeof type === 'string' ? "\"".concat(type, "\" ") : '', "element at path ").concat(JSON.stringify(path), ": child ").concat(index, " has no DOM node. Render the `children` prop inside the element.")));
5909
+ }
5910
+ }, [editor, element]);
5895
5911
  var children = useChildren({
5896
5912
  decorations: decorations,
5897
5913
  node: element,