@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.
26 lines (23 loc) • 672 B
JavaScript
import { Editor } from 'slate';
import { isEmptyString } from './is-empty-string.js';
import { isText } from './is-text.js';
function isEmpty(editor, children) {
for (const child of children) {
if (isText(child)) {
if (!isEmptyString(child.text)) {
return false;
}
} else if (child.type === "paragraph") {
if (child.children.length > 1 || child.children[0] && !(isText(child.children[0]) && isEmptyString(child.children[0].text))) {
return false;
}
} else {
if (!Editor.isEmpty(editor, child)) {
return false;
}
}
}
return true;
}
export { isEmpty };
//# sourceMappingURL=is-empty.js.map