diff --git a/packages/editor/src/core/hooks/use-editor.ts b/packages/editor/src/core/hooks/use-editor.ts index 6de95557c8..769e17a354 100644 --- a/packages/editor/src/core/hooks/use-editor.ts +++ b/packages/editor/src/core/hooks/use-editor.ts @@ -241,10 +241,12 @@ export const useEditor = (props: CustomEditorProps) => { editorRef.current.chain().focus().deleteRange({ from, to }).insertContent(contentHTML).run(); } }, - documentInfo: { - characters: editorRef.current?.storage?.characterCount?.characters?.() ?? 0, - paragraphs: getParagraphCount(editorRef.current?.state), - words: editorRef.current?.storage?.characterCount?.words?.() ?? 0, + getDocumentInfo: () => { + return { + characters: editorRef?.current?.storage?.characterCount?.characters?.() ?? 0, + paragraphs: getParagraphCount(editorRef?.current?.state), + words: editorRef?.current?.storage?.characterCount?.words?.() ?? 0, + }; }, }), [editorRef, savedSelection]