UNPKG

@liveblocks/react-blocknote

Version:

An integration of BlockNote + React to enable collaboration, comments, live cursors, and more with Liveblocks.

259 lines (249 loc) 9.25 kB
import * as _tiptap_core from '@tiptap/core'; import { Extension } from '@tiptap/core'; import { useLiveblocksExtension as useLiveblocksExtension$1, AnchoredThreads as AnchoredThreads$1, FloatingComposer as FloatingComposer$1, FloatingThreads as FloatingThreads$1, HistoryVersionPreview as HistoryVersionPreview$1 } from '@liveblocks/react-tiptap'; export { useIsEditorReady } from '@liveblocks/react-tiptap'; import * as react_jsx_runtime from 'react/jsx-runtime'; import * as _blocknote_core from '@blocknote/core'; import { BlockSchema, DefaultBlockSchema, InlineContentSchema, DefaultInlineContentSchema, StyleSchema, DefaultStyleSchema, BlockNoteEditor, BlockNoteEditorOptions, BlockNoteSchema } from '@blocknote/core'; import { DependencyList } from 'react'; type LiveblocksExtensionOptions = Parameters<typeof useLiveblocksExtension$1>[0]; declare const useLiveblocksExtension: (options?: LiveblocksExtensionOptions) => _tiptap_core.Extension<any, any>; type AnchoredThreadsProps<B extends BlockSchema = DefaultBlockSchema, I extends InlineContentSchema = DefaultInlineContentSchema, S extends StyleSchema = DefaultStyleSchema> = Omit<Parameters<typeof AnchoredThreads$1>[0], "editor"> & { editor: BlockNoteEditor<B, I, S>; }; declare function AnchoredThreads(props: AnchoredThreadsProps): react_jsx_runtime.JSX.Element; type FloatingComposerProps<B extends BlockSchema = DefaultBlockSchema, I extends InlineContentSchema = DefaultInlineContentSchema, S extends StyleSchema = DefaultStyleSchema> = Omit<Parameters<typeof FloatingComposer$1>[0], "editor"> & { editor: BlockNoteEditor<B, I, S>; }; declare function FloatingComposer(props: FloatingComposerProps): react_jsx_runtime.JSX.Element; type FloatingThreadsProps<B extends BlockSchema = DefaultBlockSchema, I extends InlineContentSchema = DefaultInlineContentSchema, S extends StyleSchema = DefaultStyleSchema> = Omit<Parameters<typeof FloatingThreads$1>[0], "editor"> & { editor: BlockNoteEditor<B, I, S>; }; declare function FloatingThreads(props: FloatingThreadsProps): react_jsx_runtime.JSX.Element; /** * Helper function to add Liveblocks support to BlockNoteEditorOptions */ declare const withLiveblocksEditorOptions: <B extends BlockSchema = _blocknote_core._DefaultBlockSchema, I extends InlineContentSchema = _blocknote_core.InlineContentSchemaFromSpecs<{ text: { config: "text"; implementation: any; }; link: { config: "link"; implementation: any; }; }>, S extends StyleSchema = _blocknote_core.StyleSchemaFromSpecs<{ bold: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; italic: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; underline: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; strike: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; code: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; textColor: _blocknote_core.StyleSpec<{ readonly type: "textColor"; readonly propSchema: "string"; }>; backgroundColor: _blocknote_core.StyleSpec<{ readonly type: "backgroundColor"; readonly propSchema: "string"; }>; }>>(liveblocksExtension: Extension<any, any>, blocknoteOptions?: Partial<BlockNoteEditorOptions<B, I, S>>, liveblocksOptions?: Partial<{ mentions: boolean; }>) => Partial<BlockNoteEditorOptions<B, I, S>>; /** * Adds the Liveblocks Mention and Group Mention nodes as inline content to the BlockNote schema * * This makes sure BlockNote knows about Liveblocks mentions and that you can read/write mentions via the BlockNote API */ declare const withLiveblocksSchema: <B extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(schema?: BlockNoteSchema<B, I, S>, liveblocksOptions?: Partial<{ mentions: boolean; }>) => BlockNoteSchema<B, I, S>; /** * Function that can be used instead of standard useCreateBlockNote to add Liveblocks support */ declare const useCreateBlockNoteWithLiveblocks: <B extends BlockSchema = _blocknote_core._DefaultBlockSchema, I extends InlineContentSchema = _blocknote_core.InlineContentSchemaFromSpecs<{ text: { config: "text"; implementation: any; }; link: { config: "link"; implementation: any; }; }>, S extends StyleSchema = _blocknote_core.StyleSchemaFromSpecs<{ bold: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; italic: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; underline: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; strike: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; code: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; textColor: _blocknote_core.StyleSpec<{ readonly type: "textColor"; readonly propSchema: "string"; }>; backgroundColor: _blocknote_core.StyleSpec<{ readonly type: "backgroundColor"; readonly propSchema: "string"; }>; }>>(blocknoteOptions?: Partial<BlockNoteEditorOptions<B, I, S>>, liveblocksOptions?: LiveblocksExtensionOptions, deps?: DependencyList) => _blocknote_core.BlockNoteEditor<_blocknote_core._DefaultBlockSchema, _blocknote_core.InlineContentSchemaFromSpecs<{ text: { config: "text"; implementation: any; }; link: { config: "link"; implementation: any; }; }>, _blocknote_core.StyleSchemaFromSpecs<{ bold: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; italic: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; underline: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; strike: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; code: { config: { type: string; propSchema: "boolean"; }; implementation: _blocknote_core.StyleImplementation<{ type: string; propSchema: "boolean"; }>; }; textColor: _blocknote_core.StyleSpec<{ readonly type: "textColor"; readonly propSchema: "string"; }>; backgroundColor: _blocknote_core.StyleSpec<{ readonly type: "backgroundColor"; readonly propSchema: "string"; }>; }>>; type HistoryVersionPreviewProps<B extends BlockSchema = DefaultBlockSchema, I extends InlineContentSchema = DefaultInlineContentSchema, S extends StyleSchema = DefaultStyleSchema> = Omit<Parameters<typeof HistoryVersionPreview$1>[0], "editor"> & { editor: BlockNoteEditor<B, I, S>; }; declare function HistoryVersionPreview(props: HistoryVersionPreviewProps): react_jsx_runtime.JSX.Element; export { AnchoredThreads, FloatingComposer, FloatingThreads, HistoryVersionPreview, useCreateBlockNoteWithLiveblocks, useLiveblocksExtension, withLiveblocksEditorOptions, withLiveblocksSchema };