Open erbill opened 7 months ago
They this looks like a type error SetStateAction<EditorContent | null>
because the editor export type for json is JSONContent
New version exports a type for it:
import {type JSONContent} from "novel";
Also see usage here: https://github.com/steven-tey/novel/blob/main/apps/web/components/tailwind/editor.tsx
I'm using npm i novel and trying to customize Editor to export JSON data on save. Currently using
<Editor onUpdate={(editor) => { if (editor) { const content = editor.getJSON(); // Get the editor's content in JSON format console.log(content); // Log the content to the console setEditorData(content); } }} />
Property 'blocks' is missing in type 'JSONContent' but required in type 'EditorContent'.ts(2345) page.tsx(17, 3): 'blocks' is declared here. Error
I tried adding `type Block = { type: string; data: { text: string; [key: string]: any; // Additional properties for different block types }; };
type EditorContent = { blocks: Block[]; };` but still not having JSON output.
Is there any default function for controlling exports?