import { Editor, Element, Transforms } from '@src/components/slate-packages/slate'; import { delChildrenNotAllowComponent, ELEMENTNODE, isNodeChildrenIsTargetType } from '@src/utils/normalize'; import { ELTYPE } from '../config'; export function normalizeDivide(editor: Editor, entry: [ELEMENTNODE, number[]]): boolean { const [node, path] = entry; const { type, children } = node; if (Element.isElement(node) && type === ELTYPE.DIVIDE) { const componentsOk = [undefined]; if (!isNodeChildrenIsTargetType(children, [componentsOk])) { delChildrenNotAllowComponent(editor, children, componentsOk, path); return true; } } return false; }