Your IP : 216.73.216.86


Current Path : /var/www/homesaver/www/bitrix/js/ui/text-editor/src/helpers/
Upload File :
Current File : /var/www/homesaver/www/bitrix/js/ui/text-editor/src/helpers/is-paragraph-empty.js

import { $isParagraphNode, $isTextNode, $isLineBreakNode, type ElementNode } from 'ui.lexical.core';

export function $isParagraphEmpty(node: ElementNode): boolean
{
	if (!$isParagraphNode(node))
	{
		return false;
	}

	if (node.isEmpty())
	{
		return true;
	}

	return node.getChildren().every((child) => {
		return (
			$isLineBreakNode(child)
			|| ($isTextNode(child) && /^\s*$/.test(child.getTextContent()))
		);
	});
}