UNPKG

@convex-dev/prosemirror-sync

Version:

Sync ProseMirror documents for Tiptap using this Convex component.

33 lines 1.49 kB
import type { SyncApi } from "../client"; import { type UseSyncOptions } from "../tiptap"; import { BlockNoteEditor, type BlockNoteEditorOptions } from "@blocknote/core"; export type BlockNoteSyncOptions = UseSyncOptions & { /** * If you pass options into the editor, you should pass them here, to ensure * the initialContent is parsed with the correct schema. */ editorOptions?: Partial<BlockNoteEditorOptions<any, any, any>>; }; export declare function useBlockNoteSync(syncApi: SyncApi, id: string, opts?: BlockNoteSyncOptions): { readonly editor: null; readonly isLoading: true; /** * Create the document without waiting to hear from the server. * Warning: Only call this if you just created the document id. * It's safer to wait until loading is false. * It's also best practice to pass in the same initial content everywhere, * so if two clients create the same document id, they'll both end up * with the same initial content. Otherwise the second client will * throw an exception on the snapshot creation. */ readonly create: (content: import("@tiptap/core").JSONContent) => Promise<void>; } | { readonly editor: null; readonly isLoading: false; readonly create: (content: import("@tiptap/core").JSONContent) => Promise<void>; } | { readonly editor: BlockNoteEditor<any, any, any>; readonly isLoading: false; readonly create?: undefined; }; //# sourceMappingURL=index.d.ts.map