BlockNote
BlockNote copied to clipboard
Get plain text from editor
Is your feature request related to a problem? Please describe. Need to send text content to a search engine, like Typesense. According to docs, there are only HTML exports, markdown exports... https://www.blocknotejs.org/examples/interoperability/converting-blocks-to-html
Describe the solution you'd like A function that returns the complete plain text of the editor, including line breaks and spaces.
Describe alternatives you've considered Export to HTML, strip HTML. Might work.
Additional context n/a
@wondering639 if you have editor object, you can use editor._tiptapEditor.getText();
For example
const handleOnChangeEditorContent = (editor: BlockNoteEditor) => {
const document = editor.document;
const contentText = editor._tiptapEditor.getText();
console.log(contentText);
};
<Editor
ref={editorRef}
editable={true}
initialContent={getInitialContent()}
onChange={handleOnChangeEditorContent}
uploadFile={uploadFile}
/>
tracking here: https://github.com/TypeCellOS/BlockNote/issues/1530