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.
- package/dist/components/element.d.ts.map +1 -1
- package/dist/index.es.js +10 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/slate-react.js +16 -0
- package/dist/slate-react.min.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/element.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAU,OAAO,IAAI,YAAY,EAAQ,cAAc,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/element.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAU,OAAO,IAAI,YAAY,EAAQ,cAAc,EAAE,MAAM,OAAO,CAAA;AAY7E,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,eAAe,EAChB,MAAM,YAAY,CAAA;AAsLnB,QAAA,MAAM,eAAe,oCAxIG;IACtB,WAAW,EAAE,cAAc,EAAE,CAAA;IAC7B,OAAO,EAAE,YAAY,CAAA;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,KAAK,CAAC,GAAG,CAAC,OAAO,CAAA;IAChE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,KAAK,CAAC,GAAG,CAAC,OAAO,CAAA;IAC5D,iBAAiB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,KAAK,CAAC,GAAG,CAAC,OAAO,CAAA;IACvE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,GAAG,CAAC,OAAO,CAAA;IAC1D,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,GAAG,CAAC,OAAO,CAAA;CAC3D,iBA0IC,CAAA;AAEF;;GAEG;AAEH,eAAO,MAAM,cAAc,GAAI,OAAO,kBAAkB,gBASvD,CAAA;AAED,eAAe,eAAe,CAAA"}
|
package/dist/index.es.js
CHANGED
|
@@ -1477,6 +1477,8 @@ const getEmptyBlockDirection = element => {
|
|
|
1477
1477
|
const after = parent.children.slice(index + 1);
|
|
1478
1478
|
return (_findSiblingDirection = findSiblingDirection(before)) !== null && _findSiblingDirection !== void 0 ? _findSiblingDirection : findSiblingDirection(after);
|
|
1479
1479
|
};
|
|
1480
|
+
const getMountedChildren = (editor, element) => Editor.isVoid(editor, element) ? [Node.texts(element).next().value[0]] : element.children;
|
|
1481
|
+
const findUnmountedChild = (editor, element) => getMountedChildren(editor, element).findIndex(child => !NODE_TO_ELEMENT.has(child));
|
|
1480
1482
|
const defaultRenderElement = props => (/*#__PURE__*/React.createElement(DefaultElement, _objectSpread$3({}, props)));
|
|
1481
1483
|
/**
|
|
1482
1484
|
* Element.
|
|
@@ -1508,6 +1510,14 @@ const Element = props => {
|
|
|
1508
1510
|
NODE_TO_ELEMENT.delete(element);
|
|
1509
1511
|
}
|
|
1510
1512
|
}, [editor, key, element]);
|
|
1513
|
+
useIsomorphicLayoutEffect(() => {
|
|
1514
|
+
const index = findUnmountedChild(editor, element);
|
|
1515
|
+
if (index !== -1) {
|
|
1516
|
+
const type = element.type;
|
|
1517
|
+
const path = ReactEditor.findPath(editor, element);
|
|
1518
|
+
editor.onDOMError(new Error(`renderElement didn't render the children of the ${typeof type === 'string' ? `"${type}" ` : ''}element at path ${JSON.stringify(path)}: child ${index} has no DOM node. Render the \`children\` prop inside the element.`));
|
|
1519
|
+
}
|
|
1520
|
+
}, [editor, element]);
|
|
1511
1521
|
let children = useChildren({
|
|
1512
1522
|
decorations,
|
|
1513
1523
|
node: element,
|