mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
web: exclude empty paragraphs in editor stats
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user