UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

24 lines (22 loc) 601 B
/** * Temporary file which extracts function from `editor-common`. * * Eventually we will deprecate and delete EditorActions. This is here to * help decouple it from editor-common */ /** * Checks if node is an empty paragraph. */ export function isEmptyParagraph(node) { return !!node && node.type.name === 'paragraph' && !node.childCount; } /** * Checks if a node looks like an empty document */ export function isEmptyDocument(node) { const nodeChild = node.content.firstChild; if (node.childCount !== 1 || !nodeChild) { return false; } return isEmptyParagraph(nodeChild); }