@liveblocks/react-ui
Version:
A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.
29 lines (25 loc) • 922 B
JavaScript
var slate = require('slate');
function withNormalize(editor) {
const { normalizeNode } = editor;
editor.normalizeNode = (entry) => {
const [node, path] = entry;
if (slate.Element.isElement(node) && node.type === "paragraph") {
for (const [child, childPath] of slate.Node.children(editor, path)) {
if (slate.Element.isElement(child) && !editor.isInline(child)) {
slate.Transforms.unwrapNodes(editor, { at: childPath });
return;
}
}
}
if (slate.Element.isElement(node) && (node.type === "auto-link" || node.type === "custom-link")) {
if (node.children.length === 0 || node.children.length === 1 && node.children[0]?.text === "") {
slate.Transforms.removeNodes(editor, { at: path });
}
}
normalizeNode(entry);
};
return editor;
}
exports.withNormalize = withNormalize;
//# sourceMappingURL=normalize.cjs.map
;