editor: update word count immediately after note is loaded

Previously when opening note, the word count on mobile would
be 0, then update to actual word count. This has been fixed so
correct word count shows when opening not without any
delay.
This commit is contained in:
ammarahm-ed
2023-04-01 16:16:52 +05:00
committed by Ammar Ahmed
parent 28d718acf6
commit d838c2e8ad
3 changed files with 13 additions and 8 deletions

View File

@@ -123,12 +123,13 @@ export function useEditorController(update: () => void): EditorController {
from,
to
});
statusBar.current?.updateWords();
break;
}
case "native:html":
htmlContentRef.current = value;
update();
statusBar.current?.updateWords();
break;
case "native:theme":
useEditorThemeStore.getState().setColors(message.value);
@@ -156,7 +157,6 @@ export function useEditorController(update: () => void): EditorController {
if (isSafari) {
root = window;
}
console.log("recreating messaging");
root.addEventListener("message", onMessage);
return () => {