From 9ebcbb7bd8130ba3e7e6d58f8c801ff16cf821e2 Mon Sep 17 00:00:00 2001 From: 01zulfi <85733202+01zulfi@users.noreply.github.com> Date: Wed, 19 Nov 2025 10:31:22 +0500 Subject: [PATCH] web: exclude empty paragraphs in editor stats Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> --- apps/web/src/components/editor/tiptap.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsx index 3463e4526..5e3e2712f 100644 --- a/apps/web/src/components/editor/tiptap.tsx +++ b/apps/web/src/components/editor/tiptap.tsx @@ -118,7 +118,7 @@ function countCharacters(text: string) { function countParagraphs(fragment: Fragment) { let count = 0; fragment.nodesBetween(0, fragment.size, (node) => { - if (node.type.name === "paragraph") { + if (node.type.name === "paragraph" && node.content.size > 0) { count++; } return true; @@ -737,7 +737,7 @@ function toIEditor(editor: Editor): IEditor { function getSelectedParagraphs(editor: Editor, selection: Selection): number { let count = 0; editor.state.doc.nodesBetween(selection.from, selection.to, (node) => { - if (node.type.name === "paragraph") { + if (node.type.name === "paragraph" && node.content.size > 0) { count++; } return true;