From 22d664a450e268693ba62de24d25129c3509201b Mon Sep 17 00:00:00 2001 From: Alice Hernandez Date: Mon, 15 Jun 2026 22:02:20 +1000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20wpm=20calc=20again?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/Editor/MarkdownEditor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/Editor/MarkdownEditor.tsx b/src/renderer/components/Editor/MarkdownEditor.tsx index 8cff397..f03183e 100644 --- a/src/renderer/components/Editor/MarkdownEditor.tsx +++ b/src/renderer/components/Editor/MarkdownEditor.tsx @@ -122,7 +122,7 @@ export function MarkdownEditor(): JSX.Element { const now = Date.now() // Close active interval if still ongoing const activeMs = s.activeMs + (now - s.lastKeystroke < IDLE_MS ? now - s.intervalStart : 0) - const wordsEnd = wordCount(useBorgesStore.getState().activeStoryContent) + const wordsEnd = wordCount(viewRef.current?.state.doc.toString() ?? useBorgesStore.getState().activeStoryContent) const durationMs = now - s.startedAt const typedWords = wordsEnd - s.wordsStart - s.pastedWords const wpm = activeMs > 0 ? Math.round(Math.max(0, typedWords) / (activeMs / 60_000)) : 0