@blocknote/react
Version:
A "Notion-style" block-based extensible text editor built on top of Prosemirror and Tiptap.
298 lines (297 loc) • 9.79 kB
TypeScript
/// <reference types="react" />
import { BlockNoteEditor, BlockNoteSchema, BlockSchema, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, InlineContentSchema, StyleSchema } from "@blocknote/core";
type BlockNoteContextValue<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema> = {
editor?: BlockNoteEditor<BSchema, ISchema, SSchema>;
colorSchemePreference?: "light" | "dark";
};
export declare const BlockNoteContext: import("react").Context<BlockNoteContextValue<import("@blocknote/core").BlockSchemaFromSpecs<{
paragraph: {
config: {
type: "paragraph";
content: "inline";
propSchema: {
backgroundColor: {
default: "default";
};
textColor: {
default: "default";
};
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
};
};
implementation: import("@blocknote/core").TiptapBlockImplementation<{
type: "paragraph";
content: "inline";
propSchema: {
backgroundColor: {
default: "default";
};
textColor: {
default: "default";
};
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
};
}, any, InlineContentSchema, StyleSchema>;
};
heading: {
config: {
type: "heading";
content: "inline";
propSchema: {
level: {
default: number;
values: readonly [1, 2, 3];
};
backgroundColor: {
default: "default";
};
textColor: {
default: "default";
};
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
};
};
implementation: import("@blocknote/core").TiptapBlockImplementation<{
type: "heading";
content: "inline";
propSchema: {
level: {
default: number;
values: readonly [1, 2, 3];
};
backgroundColor: {
default: "default";
};
textColor: {
default: "default";
};
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
};
}, any, InlineContentSchema, StyleSchema>;
};
bulletListItem: {
config: {
type: "bulletListItem";
content: "inline";
propSchema: {
backgroundColor: {
default: "default";
};
textColor: {
default: "default";
};
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
};
};
implementation: import("@blocknote/core").TiptapBlockImplementation<{
type: "bulletListItem";
content: "inline";
propSchema: {
backgroundColor: {
default: "default";
};
textColor: {
default: "default";
};
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
};
}, any, InlineContentSchema, StyleSchema>;
};
numberedListItem: {
config: {
type: "numberedListItem";
content: "inline";
propSchema: {
backgroundColor: {
default: "default";
};
textColor: {
default: "default";
};
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
};
};
implementation: import("@blocknote/core").TiptapBlockImplementation<{
type: "numberedListItem";
content: "inline";
propSchema: {
backgroundColor: {
default: "default";
};
textColor: {
default: "default";
};
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
};
}, any, InlineContentSchema, StyleSchema>;
};
image: {
config: {
type: "image";
propSchema: {
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
backgroundColor: {
default: "default";
};
url: {
default: "";
};
caption: {
default: "";
};
width: {
default: 512;
};
};
content: "none";
};
implementation: import("@blocknote/core").TiptapBlockImplementation<{
type: "image";
propSchema: {
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
backgroundColor: {
default: "default";
};
url: {
default: "";
};
caption: {
default: "";
};
width: {
default: 512;
};
};
content: "none";
}, any, InlineContentSchema, StyleSchema>;
};
table: {
config: {
type: "table";
content: "table";
propSchema: {
backgroundColor: {
default: "default";
};
textColor: {
default: "default";
};
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
};
};
implementation: import("@blocknote/core").TiptapBlockImplementation<{
type: "table";
content: "table";
propSchema: {
backgroundColor: {
default: "default";
};
textColor: {
default: "default";
};
textAlignment: {
default: "left";
values: readonly ["left", "center", "right", "justify"];
};
};
}, any, InlineContentSchema, StyleSchema>;
};
}>, import("@blocknote/core").InlineContentSchemaFromSpecs<{
text: {
config: "text";
implementation: any;
};
link: {
config: "link";
implementation: any;
};
}>, import("@blocknote/core").StyleSchemaFromSpecs<{
bold: {
config: {
type: string;
propSchema: "boolean";
};
implementation: import("@blocknote/core").StyleImplementation;
};
italic: {
config: {
type: string;
propSchema: "boolean";
};
implementation: import("@blocknote/core").StyleImplementation;
};
underline: {
config: {
type: string;
propSchema: "boolean";
};
implementation: import("@blocknote/core").StyleImplementation;
};
strike: {
config: {
type: string;
propSchema: "boolean";
};
implementation: import("@blocknote/core").StyleImplementation;
};
code: {
config: {
type: string;
propSchema: "boolean";
};
implementation: import("@blocknote/core").StyleImplementation;
};
textColor: {
config: {
type: string;
propSchema: "string";
};
implementation: import("@blocknote/core").StyleImplementation;
};
backgroundColor: {
config: {
type: string;
propSchema: "string";
};
implementation: import("@blocknote/core").StyleImplementation;
};
}>> | undefined>;
/**
* Get the BlockNoteContext instance from the nearest BlockNoteContext provider
* @param _schema: optional, pass in the schema to return type-safe Context if you're using a custom schema
*/
export declare function useBlockNoteContext<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema>(_schema?: BlockNoteSchema<BSchema, ISchema, SSchema>): BlockNoteContextValue<BSchema, ISchema, SSchema> | undefined;
export {};