From cc446f99ee627511bb89fdf6d2b8e35867ffd6cf Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Tue, 14 Feb 2023 12:32:25 +0500 Subject: [PATCH] mobile: use word-counter from editor --- packages/editor-mobile/src/components/statusbar.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/editor-mobile/src/components/statusbar.tsx b/packages/editor-mobile/src/components/statusbar.tsx index 4dbe6411c..bfaec4236 100644 --- a/packages/editor-mobile/src/components/statusbar.tsx +++ b/packages/editor-mobile/src/components/statusbar.tsx @@ -18,6 +18,7 @@ along with this program. If not, see . */ import React, { RefObject, useEffect, useRef, useState } from "react"; +import { getTotalWords, Editor } from "@notesnook/editor"; function StatusBar({ container }: { container: RefObject }) { const [status, setStatus] = useState({ @@ -66,7 +67,7 @@ function StatusBar({ container }: { container: RefObject }) { useEffect(() => { clearInterval(interval.current); interval.current = setInterval(() => { - const words = editor?.storage?.characterCount?.words() + " words"; + const words = getTotalWords(editor as Editor) + " words"; if (currentWords.current === words) return; setWords(words); }, 3000) as unknown as number;