@blocknote/core 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.js +1623 -1318
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +5 -5
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/BlockNoteEditor.ts +44 -12
- package/src/api/blockManipulation/__snapshots__/blockManipulation.test.ts.snap +21 -21
- package/src/api/blockManipulation/blockManipulation.test.ts +8 -11
- package/src/api/formatConversions/__snapshots__/formatConversions.test.ts.snap +3 -3
- package/src/api/formatConversions/formatConversions.test.ts +5 -5
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +3 -3
- package/src/api/nodeConversions/nodeConversions.test.ts +10 -4
- package/src/api/nodeConversions/nodeConversions.ts +9 -7
- package/src/api/nodeConversions/testUtil.ts +3 -3
- package/src/editor.module.css +1 -1
- package/src/extensions/BackgroundColor/BackgroundColorExtension.ts +5 -3
- package/src/extensions/BackgroundColor/BackgroundColorMark.ts +2 -1
- package/src/extensions/Blocks/NonEditableBlockPlugin.ts +17 -0
- package/src/extensions/Blocks/api/block.ts +29 -16
- package/src/extensions/Blocks/api/blockTypes.ts +79 -27
- package/src/extensions/Blocks/api/defaultBlocks.ts +13 -41
- package/src/extensions/Blocks/api/defaultProps.ts +16 -0
- package/src/extensions/Blocks/nodes/Block.module.css +78 -24
- package/src/extensions/Blocks/nodes/BlockContainer.ts +17 -41
- package/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.ts +59 -13
- package/src/extensions/Blocks/nodes/BlockContent/ImageBlockContent/ImageBlockContent.ts +305 -0
- package/src/extensions/Blocks/nodes/BlockContent/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +13 -0
- package/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +24 -2
- package/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +146 -120
- package/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.ts +12 -2
- package/src/extensions/ImageToolbar/ImageToolbarPlugin.ts +239 -0
- package/src/extensions/SlashMenu/defaultSlashMenuItems.ts +47 -6
- package/src/extensions/TextColor/TextColorExtension.ts +4 -3
- package/src/extensions/TextColor/TextColorMark.ts +2 -1
- package/src/index.ts +4 -0
- package/types/src/BlockNoteEditor.d.ts +9 -0
- package/types/src/BlockNoteExtensions.d.ts +1 -1
- package/types/src/extensions/Blocks/api/block.d.ts +7 -8
- package/types/src/extensions/Blocks/api/blockTypes.d.ts +29 -20
- package/types/src/extensions/Blocks/api/defaultBlocks.d.ts +55 -51
- package/types/src/extensions/Blocks/api/defaultProps.d.ts +2 -2
- package/types/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.d.ts +43 -9
- package/types/src/extensions/Blocks/nodes/BlockContent/ImageBlockContent/ImageBlockContent.d.ts +2 -2
- package/types/src/extensions/Blocks/nodes/BlockContent/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +1 -0
- package/types/src/extensions/Blocks/nodes/BlockContent/ImageBlockContent/uploadToTmpFilesOrg_DEV_ONLY.d.ts +1 -0
- package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.d.ts +35 -9
- package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +35 -9
- package/types/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.d.ts +36 -1
- package/types/src/extensions/SlashMenu/defaultSlashMenuItems.d.ts +1 -1
- package/types/src/index.d.ts +4 -0
- package/types/src/shared/plugins/suggestion/SuggestionPlugin.d.ts +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Mark } from "@tiptap/core";
|
|
2
|
+
import { defaultProps } from "../Blocks/api/defaultProps";
|
|
2
3
|
|
|
3
4
|
declare module "@tiptap/core" {
|
|
4
5
|
interface Commands<ReturnType> {
|
|
@@ -51,7 +52,7 @@ export const TextColorMark = Mark.create({
|
|
|
51
52
|
setTextColor:
|
|
52
53
|
(color) =>
|
|
53
54
|
({ commands }) => {
|
|
54
|
-
if (color !==
|
|
55
|
+
if (color !== defaultProps.textColor.default) {
|
|
55
56
|
return commands.setMark(this.name, { color: color });
|
|
56
57
|
}
|
|
57
58
|
|
package/src/index.ts
CHANGED
|
@@ -2,12 +2,16 @@ export * from "./BlockNoteEditor";
|
|
|
2
2
|
export * from "./BlockNoteExtensions";
|
|
3
3
|
export * from "./extensions/Blocks/api/block";
|
|
4
4
|
export * from "./extensions/Blocks/api/blockTypes";
|
|
5
|
+
export * from "./extensions/Blocks/api/defaultProps";
|
|
5
6
|
export * from "./extensions/Blocks/api/defaultBlocks";
|
|
6
7
|
export * from "./extensions/Blocks/api/inlineContentTypes";
|
|
8
|
+
export * from "./extensions/Blocks/api/selectionTypes";
|
|
7
9
|
export * from "./extensions/Blocks/api/serialization";
|
|
8
10
|
export * as blockStyles from "./extensions/Blocks/nodes/Block.module.css";
|
|
11
|
+
export * from "./extensions/Blocks/nodes/BlockContent/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY";
|
|
9
12
|
export * from "./extensions/FormattingToolbar/FormattingToolbarPlugin";
|
|
10
13
|
export * from "./extensions/HyperlinkToolbar/HyperlinkToolbarPlugin";
|
|
14
|
+
export * from "./extensions/ImageToolbar/ImageToolbarPlugin";
|
|
11
15
|
export * from "./extensions/SideMenu/SideMenuPlugin";
|
|
12
16
|
export * from "./extensions/SlashMenu/BaseSlashMenuItem";
|
|
13
17
|
export * from "./extensions/SlashMenu/SlashMenuPlugin";
|
|
@@ -8,6 +8,7 @@ import { Styles } from "./extensions/Blocks/api/inlineContentTypes";
|
|
|
8
8
|
import { Selection } from "./extensions/Blocks/api/selectionTypes";
|
|
9
9
|
import { FormattingToolbarProsemirrorPlugin } from "./extensions/FormattingToolbar/FormattingToolbarPlugin";
|
|
10
10
|
import { HyperlinkToolbarProsemirrorPlugin } from "./extensions/HyperlinkToolbar/HyperlinkToolbarPlugin";
|
|
11
|
+
import { ImageToolbarProsemirrorPlugin } from "./extensions/ImageToolbar/ImageToolbarPlugin";
|
|
11
12
|
import { SideMenuProsemirrorPlugin } from "./extensions/SideMenu/SideMenuPlugin";
|
|
12
13
|
import { BaseSlashMenuItem } from "./extensions/SlashMenu/BaseSlashMenuItem";
|
|
13
14
|
import { SlashMenuProsemirrorPlugin } from "./extensions/SlashMenu/SlashMenuPlugin";
|
|
@@ -62,6 +63,12 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema> = {
|
|
|
62
63
|
* A list of block types that should be available in the editor.
|
|
63
64
|
*/
|
|
64
65
|
blockSchema: BSchema;
|
|
66
|
+
/**
|
|
67
|
+
* A custom function to handle file uploads.
|
|
68
|
+
* @param file The file that should be uploaded.
|
|
69
|
+
* @returns The URL of the uploaded file.
|
|
70
|
+
*/
|
|
71
|
+
uploadFile: (file: File) => Promise<string>;
|
|
65
72
|
/**
|
|
66
73
|
* When enabled, allows for collaboration between multiple users.
|
|
67
74
|
*/
|
|
@@ -100,6 +107,8 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
100
107
|
readonly formattingToolbar: FormattingToolbarProsemirrorPlugin<BSchema>;
|
|
101
108
|
readonly slashMenu: SlashMenuProsemirrorPlugin<BSchema, any>;
|
|
102
109
|
readonly hyperlinkToolbar: HyperlinkToolbarProsemirrorPlugin<BSchema>;
|
|
110
|
+
readonly imageToolbar: ImageToolbarProsemirrorPlugin<BSchema>;
|
|
111
|
+
readonly uploadFile: ((file: File) => Promise<string>) | undefined;
|
|
103
112
|
constructor(options?: Partial<BlockNoteEditorOptions<BSchema>>);
|
|
104
113
|
get prosemirrorView(): import("prosemirror-view").EditorView;
|
|
105
114
|
get domElement(): HTMLDivElement;
|
|
@@ -5,7 +5,7 @@ import { BlockNoteDOMAttributes } from "./extensions/Blocks/api/blockTypes";
|
|
|
5
5
|
/**
|
|
6
6
|
* Get all the Tiptap extensions BlockNote is configured with by default
|
|
7
7
|
*/
|
|
8
|
-
export declare const getBlockNoteExtensions: <BSchema extends Record<string, import("./extensions/Blocks/api/blockTypes").BlockSpec<string, import("./extensions/Blocks/api/blockTypes").PropSchema>>>(opts: {
|
|
8
|
+
export declare const getBlockNoteExtensions: <BSchema extends Record<string, import("./extensions/Blocks/api/blockTypes").BlockSpec<string, import("./extensions/Blocks/api/blockTypes").PropSchema, boolean>>>(opts: {
|
|
9
9
|
editor: BlockNoteEditor<BSchema>;
|
|
10
10
|
domAttributes: Partial<BlockNoteDOMAttributes>;
|
|
11
11
|
blockSchema: BSchema;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Attributes } from "@tiptap/core";
|
|
2
2
|
import { BlockNoteDOMAttributes } from "../../..";
|
|
3
3
|
import { BlockConfig, BlockSchema, BlockSpec, PropSchema, TipTapNode, TipTapNodeConfig } from "./blockTypes";
|
|
4
|
+
import { ParseRule } from "prosemirror-model";
|
|
4
5
|
export declare function camelToDataKebab(str: string): string;
|
|
5
|
-
export declare function propsToAttributes<BType extends string, PSchema extends PropSchema, ContainsInlineContent extends boolean, BSchema extends BlockSchema>(blockConfig: Omit<BlockConfig<BType, PSchema, ContainsInlineContent, BSchema>, "render">):
|
|
6
|
-
export declare function parse<BType extends string, PSchema extends PropSchema, ContainsInlineContent extends boolean, BSchema extends BlockSchema>(blockConfig: Omit<BlockConfig<BType, PSchema, ContainsInlineContent, BSchema>, "render">):
|
|
7
|
-
tag: string;
|
|
8
|
-
}[];
|
|
6
|
+
export declare function propsToAttributes<BType extends string, PSchema extends PropSchema, ContainsInlineContent extends boolean, BSchema extends BlockSchema>(blockConfig: Omit<BlockConfig<BType, PSchema, ContainsInlineContent, BSchema>, "render">): Attributes;
|
|
7
|
+
export declare function parse<BType extends string, PSchema extends PropSchema, ContainsInlineContent extends boolean, BSchema extends BlockSchema>(blockConfig: Omit<BlockConfig<BType, PSchema, ContainsInlineContent, BSchema>, "render">): ParseRule[];
|
|
9
8
|
export declare function render<BType extends string, PSchema extends PropSchema, ContainsInlineContent extends boolean, BSchema extends BlockSchema>(blockConfig: Omit<BlockConfig<BType, PSchema, ContainsInlineContent, BSchema>, "render">, HTMLAttributes: Record<string, any>): {
|
|
10
9
|
dom: HTMLDivElement;
|
|
11
10
|
contentDOM: HTMLDivElement;
|
|
@@ -13,9 +12,9 @@ export declare function render<BType extends string, PSchema extends PropSchema,
|
|
|
13
12
|
dom: HTMLDivElement;
|
|
14
13
|
contentDOM?: undefined;
|
|
15
14
|
};
|
|
16
|
-
export declare function createBlockSpec<BType extends string, PSchema extends PropSchema, ContainsInlineContent extends
|
|
17
|
-
export declare function createTipTapBlock<Type extends string, Options extends {
|
|
15
|
+
export declare function createBlockSpec<BType extends string, PSchema extends PropSchema, ContainsInlineContent extends false, BSchema extends BlockSchema>(blockConfig: BlockConfig<BType, PSchema, ContainsInlineContent, BSchema>): BlockSpec<BType, PSchema, ContainsInlineContent>;
|
|
16
|
+
export declare function createTipTapBlock<Type extends string, ContainsInlineContent extends boolean, Options extends {
|
|
18
17
|
domAttributes?: BlockNoteDOMAttributes;
|
|
19
18
|
} = {
|
|
20
19
|
domAttributes?: BlockNoteDOMAttributes;
|
|
21
|
-
}, Storage = any>(config: TipTapNodeConfig<Type, Options, Storage>): TipTapNode<Type, Options, Storage>;
|
|
20
|
+
}, Storage = any>(config: TipTapNodeConfig<Type, ContainsInlineContent, Options, Storage>): TipTapNode<Type, ContainsInlineContent, Options, Storage>;
|
|
@@ -7,28 +7,35 @@ export type BlockNoteDOMElement = "editor" | "blockContainer" | "blockGroup" | "
|
|
|
7
7
|
export type BlockNoteDOMAttributes = Partial<{
|
|
8
8
|
[DOMElement in BlockNoteDOMElement]: Record<string, string>;
|
|
9
9
|
}>;
|
|
10
|
-
export type TipTapNodeConfig<Name extends string, Options extends {
|
|
10
|
+
export type TipTapNodeConfig<Name extends string, ContainsInlineContent extends boolean, Options extends {
|
|
11
11
|
domAttributes?: BlockNoteDOMAttributes;
|
|
12
12
|
} = {
|
|
13
13
|
domAttributes?: BlockNoteDOMAttributes;
|
|
14
14
|
}, Storage = any> = {
|
|
15
|
-
[K in keyof NodeConfig<Options, Storage>]: K extends "name" ? Name : K extends "group" ? never : NodeConfig<Options, Storage>[K];
|
|
15
|
+
[K in keyof NodeConfig<Options, Storage>]: K extends "name" ? Name : K extends "content" ? ContainsInlineContent extends true ? "inline*" : "" : K extends "group" ? never : NodeConfig<Options, Storage>[K];
|
|
16
|
+
} & {
|
|
17
|
+
name: Name;
|
|
18
|
+
content: ContainsInlineContent extends true ? "inline*" : "";
|
|
16
19
|
};
|
|
17
|
-
export type TipTapNode<Name extends string, Options extends {
|
|
20
|
+
export type TipTapNode<Name extends string, ContainsInlineContent extends boolean, Options extends {
|
|
18
21
|
domAttributes?: BlockNoteDOMAttributes;
|
|
19
22
|
} = {
|
|
20
23
|
domAttributes?: BlockNoteDOMAttributes;
|
|
21
|
-
}, Storage = any> =
|
|
22
|
-
name:
|
|
23
|
-
|
|
24
|
+
}, Storage = any> = {
|
|
25
|
+
[Key in keyof Node<Options, Storage>]: Key extends "name" ? Name : Key extends "config" ? {
|
|
26
|
+
[ConfigKey in keyof Node<Options, Storage>["config"]]: ConfigKey extends "group" ? "blockContent" : ConfigKey extends "content" ? ContainsInlineContent extends true ? "inline*" : "" : NodeConfig<Options, Storage>["config"][ConfigKey];
|
|
27
|
+
} & {
|
|
28
|
+
group: "blockContent";
|
|
29
|
+
content: ContainsInlineContent extends true ? "inline*" : "";
|
|
30
|
+
} : Node<Options, Storage>["config"][Key];
|
|
24
31
|
};
|
|
25
|
-
export type PropSpec = {
|
|
26
|
-
values?: readonly
|
|
27
|
-
default:
|
|
32
|
+
export type PropSpec<PType extends boolean | number | string> = {
|
|
33
|
+
values?: readonly PType[];
|
|
34
|
+
default: PType;
|
|
28
35
|
};
|
|
29
|
-
export type PropSchema = Record<string, PropSpec
|
|
36
|
+
export type PropSchema = Record<string, PropSpec<boolean | number | string>>;
|
|
30
37
|
export type Props<PSchema extends PropSchema> = {
|
|
31
|
-
[
|
|
38
|
+
[PName in keyof PSchema]: PSchema[PName]["default"] extends boolean ? PSchema[PName]["values"] extends readonly boolean[] ? PSchema[PName]["values"][number] : boolean : PSchema[PName]["default"] extends number ? PSchema[PName]["values"] extends readonly number[] ? PSchema[PName]["values"][number] : number : PSchema[PName]["default"] extends string ? PSchema[PName]["values"] extends readonly string[] ? PSchema[PName]["values"][number] : string : never;
|
|
32
39
|
};
|
|
33
40
|
export type BlockConfig<Type extends string, PSchema extends PropSchema, ContainsInlineContent extends boolean, BSchema extends BlockSchema> = {
|
|
34
41
|
type: Type;
|
|
@@ -39,7 +46,7 @@ export type BlockConfig<Type extends string, PSchema extends PropSchema, Contain
|
|
|
39
46
|
* The custom block to render
|
|
40
47
|
*/
|
|
41
48
|
block: SpecificBlock<BSchema & {
|
|
42
|
-
[k in Type]: BlockSpec<Type, PSchema>;
|
|
49
|
+
[k in Type]: BlockSpec<Type, PSchema, ContainsInlineContent>;
|
|
43
50
|
}, Type>,
|
|
44
51
|
/**
|
|
45
52
|
* The BlockNote editor instance
|
|
@@ -47,28 +54,30 @@ export type BlockConfig<Type extends string, PSchema extends PropSchema, Contain
|
|
|
47
54
|
* cast it manually, e.g.: `const e = editor as BlockNoteEditor<typeof mySchema>;`
|
|
48
55
|
*/
|
|
49
56
|
editor: BlockNoteEditor<BSchema & {
|
|
50
|
-
[k in Type]: BlockSpec<Type, PSchema>;
|
|
57
|
+
[k in Type]: BlockSpec<Type, PSchema, ContainsInlineContent>;
|
|
51
58
|
}>) => ContainsInlineContent extends true ? {
|
|
52
59
|
dom: HTMLElement;
|
|
53
60
|
contentDOM: HTMLElement;
|
|
61
|
+
destroy?: () => void;
|
|
54
62
|
} : {
|
|
55
63
|
dom: HTMLElement;
|
|
64
|
+
destroy?: () => void;
|
|
56
65
|
};
|
|
57
66
|
};
|
|
58
|
-
export type BlockSpec<Type extends string, PSchema extends PropSchema> = {
|
|
67
|
+
export type BlockSpec<Type extends string, PSchema extends PropSchema, ContainsInlineContent extends boolean> = {
|
|
68
|
+
node: TipTapNode<Type, ContainsInlineContent, any>;
|
|
59
69
|
readonly propSchema: PSchema;
|
|
60
|
-
node: TipTapNode<Type, any>;
|
|
61
70
|
};
|
|
62
|
-
|
|
63
|
-
[Type in keyof Blocks]: Type extends string ? Blocks[Type] extends BlockSpec<Type, PropSchema> ? Blocks[Type] : never : never;
|
|
71
|
+
type NamesMatch<Blocks extends Record<string, BlockSpec<string, PropSchema, boolean>>> = Blocks extends {
|
|
72
|
+
[Type in keyof Blocks]: Type extends string ? Blocks[Type] extends BlockSpec<Type, PropSchema, boolean> ? Blocks[Type] : never : never;
|
|
64
73
|
} ? Blocks : never;
|
|
65
|
-
export type BlockSchema =
|
|
74
|
+
export type BlockSchema = NamesMatch<Record<string, BlockSpec<string, PropSchema, boolean>>>;
|
|
66
75
|
type BlocksWithoutChildren<BSchema extends BlockSchema> = {
|
|
67
76
|
[BType in keyof BSchema]: {
|
|
68
77
|
id: string;
|
|
69
78
|
type: BType;
|
|
70
79
|
props: Props<BSchema[BType]["propSchema"]>;
|
|
71
|
-
content: InlineContent[];
|
|
80
|
+
content: BSchema[BType]["node"]["config"]["content"] extends "inline*" ? InlineContent[] : undefined;
|
|
72
81
|
};
|
|
73
82
|
};
|
|
74
83
|
export type Block<BSchema extends BlockSchema = DefaultBlockSchema> = BlocksWithoutChildren<BSchema>[keyof BlocksWithoutChildren<BSchema>] & {
|
|
@@ -82,7 +91,7 @@ type PartialBlocksWithoutChildren<BSchema extends BlockSchema> = {
|
|
|
82
91
|
id: string;
|
|
83
92
|
type: BType;
|
|
84
93
|
props: Partial<Props<BSchema[BType]["propSchema"]>>;
|
|
85
|
-
content: PartialInlineContent[] | string;
|
|
94
|
+
content: BSchema[BType]["node"]["config"]["content"] extends "inline*" ? PartialInlineContent[] | string : undefined;
|
|
86
95
|
}>;
|
|
87
96
|
};
|
|
88
97
|
export type PartialBlock<BSchema extends BlockSchema = DefaultBlockSchema> = PartialBlocksWithoutChildren<BSchema>[keyof PartialBlocksWithoutChildren<BSchema>] & Partial<{
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
import { TypesMatch } from "./blockTypes";
|
|
2
|
-
export declare const defaultProps: {
|
|
3
|
-
backgroundColor: {
|
|
4
|
-
default: "transparent";
|
|
5
|
-
};
|
|
6
|
-
textColor: {
|
|
7
|
-
default: "black";
|
|
8
|
-
};
|
|
9
|
-
textAlignment: {
|
|
10
|
-
default: "left";
|
|
11
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export type DefaultProps = typeof defaultProps;
|
|
15
1
|
export declare const defaultBlockSchema: {
|
|
16
2
|
readonly paragraph: {
|
|
17
|
-
|
|
3
|
+
node: import("./blockTypes").TipTapNode<"paragraph", true, {
|
|
4
|
+
domAttributes?: Partial<{
|
|
5
|
+
blockContainer: Record<string, string>;
|
|
6
|
+
blockGroup: Record<string, string>;
|
|
7
|
+
editor: Record<string, string>;
|
|
8
|
+
blockContent: Record<string, string>;
|
|
9
|
+
inlineContent: Record<string, string>;
|
|
10
|
+
}> | undefined;
|
|
11
|
+
}, any>;
|
|
12
|
+
propSchema: {
|
|
18
13
|
backgroundColor: {
|
|
19
|
-
default: "
|
|
14
|
+
default: "default";
|
|
20
15
|
};
|
|
21
16
|
textColor: {
|
|
22
|
-
default: "
|
|
17
|
+
default: "default";
|
|
23
18
|
};
|
|
24
19
|
textAlignment: {
|
|
25
20
|
default: "left";
|
|
26
21
|
values: readonly ["left", "center", "right", "justify"];
|
|
27
22
|
};
|
|
28
23
|
};
|
|
29
|
-
|
|
24
|
+
};
|
|
25
|
+
readonly heading: {
|
|
26
|
+
node: import("./blockTypes").TipTapNode<"heading", true, {
|
|
30
27
|
domAttributes?: Partial<{
|
|
31
28
|
blockContainer: Record<string, string>;
|
|
32
29
|
blockGroup: Record<string, string>;
|
|
@@ -35,25 +32,25 @@ export declare const defaultBlockSchema: {
|
|
|
35
32
|
inlineContent: Record<string, string>;
|
|
36
33
|
}> | undefined;
|
|
37
34
|
}, any>;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
readonly default: "1";
|
|
43
|
-
readonly values: readonly ["1", "2", "3"];
|
|
35
|
+
propSchema: {
|
|
36
|
+
level: {
|
|
37
|
+
default: number;
|
|
38
|
+
values: readonly [1, 2, 3];
|
|
44
39
|
};
|
|
45
|
-
|
|
46
|
-
default: "
|
|
40
|
+
backgroundColor: {
|
|
41
|
+
default: "default";
|
|
47
42
|
};
|
|
48
|
-
|
|
49
|
-
default: "
|
|
43
|
+
textColor: {
|
|
44
|
+
default: "default";
|
|
50
45
|
};
|
|
51
|
-
|
|
46
|
+
textAlignment: {
|
|
52
47
|
default: "left";
|
|
53
48
|
values: readonly ["left", "center", "right", "justify"];
|
|
54
49
|
};
|
|
55
50
|
};
|
|
56
|
-
|
|
51
|
+
};
|
|
52
|
+
readonly bulletListItem: {
|
|
53
|
+
node: import("./blockTypes").TipTapNode<"bulletListItem", true, {
|
|
57
54
|
domAttributes?: Partial<{
|
|
58
55
|
blockContainer: Record<string, string>;
|
|
59
56
|
blockGroup: Record<string, string>;
|
|
@@ -62,21 +59,21 @@ export declare const defaultBlockSchema: {
|
|
|
62
59
|
inlineContent: Record<string, string>;
|
|
63
60
|
}> | undefined;
|
|
64
61
|
}, any>;
|
|
65
|
-
|
|
66
|
-
readonly bulletListItem: {
|
|
67
|
-
readonly propSchema: {
|
|
62
|
+
propSchema: {
|
|
68
63
|
backgroundColor: {
|
|
69
|
-
default: "
|
|
64
|
+
default: "default";
|
|
70
65
|
};
|
|
71
66
|
textColor: {
|
|
72
|
-
default: "
|
|
67
|
+
default: "default";
|
|
73
68
|
};
|
|
74
69
|
textAlignment: {
|
|
75
70
|
default: "left";
|
|
76
71
|
values: readonly ["left", "center", "right", "justify"];
|
|
77
72
|
};
|
|
78
73
|
};
|
|
79
|
-
|
|
74
|
+
};
|
|
75
|
+
readonly numberedListItem: {
|
|
76
|
+
node: import("./blockTypes").TipTapNode<"numberedListItem", true, {
|
|
80
77
|
domAttributes?: Partial<{
|
|
81
78
|
blockContainer: Record<string, string>;
|
|
82
79
|
blockGroup: Record<string, string>;
|
|
@@ -85,29 +82,36 @@ export declare const defaultBlockSchema: {
|
|
|
85
82
|
inlineContent: Record<string, string>;
|
|
86
83
|
}> | undefined;
|
|
87
84
|
}, any>;
|
|
88
|
-
|
|
89
|
-
readonly numberedListItem: {
|
|
90
|
-
readonly propSchema: {
|
|
85
|
+
propSchema: {
|
|
91
86
|
backgroundColor: {
|
|
92
|
-
default: "
|
|
87
|
+
default: "default";
|
|
93
88
|
};
|
|
94
89
|
textColor: {
|
|
95
|
-
default: "
|
|
90
|
+
default: "default";
|
|
96
91
|
};
|
|
97
92
|
textAlignment: {
|
|
98
93
|
default: "left";
|
|
99
94
|
values: readonly ["left", "center", "right", "justify"];
|
|
100
95
|
};
|
|
101
96
|
};
|
|
102
|
-
readonly node: import("./blockTypes").TipTapNode<"numberedListItem", {
|
|
103
|
-
domAttributes?: Partial<{
|
|
104
|
-
blockContainer: Record<string, string>;
|
|
105
|
-
blockGroup: Record<string, string>;
|
|
106
|
-
editor: Record<string, string>;
|
|
107
|
-
blockContent: Record<string, string>;
|
|
108
|
-
inlineContent: Record<string, string>;
|
|
109
|
-
}> | undefined;
|
|
110
|
-
}, any>;
|
|
111
97
|
};
|
|
98
|
+
readonly image: import("./blockTypes").BlockSpec<"image", {
|
|
99
|
+
textAlignment: {
|
|
100
|
+
default: "left";
|
|
101
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
102
|
+
};
|
|
103
|
+
backgroundColor: {
|
|
104
|
+
default: "default";
|
|
105
|
+
};
|
|
106
|
+
url: {
|
|
107
|
+
default: "";
|
|
108
|
+
};
|
|
109
|
+
caption: {
|
|
110
|
+
default: "";
|
|
111
|
+
};
|
|
112
|
+
width: {
|
|
113
|
+
default: 512;
|
|
114
|
+
};
|
|
115
|
+
}, false>;
|
|
112
116
|
};
|
|
113
|
-
export type DefaultBlockSchema =
|
|
117
|
+
export type DefaultBlockSchema = typeof defaultBlockSchema;
|
package/types/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.d.ts
CHANGED
|
@@ -1,9 +1,43 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
1
|
+
export declare const headingPropSchema: {
|
|
2
|
+
level: {
|
|
3
|
+
default: number;
|
|
4
|
+
values: readonly [1, 2, 3];
|
|
5
|
+
};
|
|
6
|
+
backgroundColor: {
|
|
7
|
+
default: "default";
|
|
8
|
+
};
|
|
9
|
+
textColor: {
|
|
10
|
+
default: "default";
|
|
11
|
+
};
|
|
12
|
+
textAlignment: {
|
|
13
|
+
default: "left";
|
|
14
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare const Heading: {
|
|
18
|
+
node: import("../../../api/blockTypes").TipTapNode<"heading", true, {
|
|
19
|
+
domAttributes?: Partial<{
|
|
20
|
+
blockContainer: Record<string, string>;
|
|
21
|
+
blockGroup: Record<string, string>;
|
|
22
|
+
editor: Record<string, string>;
|
|
23
|
+
blockContent: Record<string, string>;
|
|
24
|
+
inlineContent: Record<string, string>;
|
|
25
|
+
}> | undefined;
|
|
26
|
+
}, any>;
|
|
27
|
+
propSchema: {
|
|
28
|
+
level: {
|
|
29
|
+
default: number;
|
|
30
|
+
values: readonly [1, 2, 3];
|
|
31
|
+
};
|
|
32
|
+
backgroundColor: {
|
|
33
|
+
default: "default";
|
|
34
|
+
};
|
|
35
|
+
textColor: {
|
|
36
|
+
default: "default";
|
|
37
|
+
};
|
|
38
|
+
textAlignment: {
|
|
39
|
+
default: "left";
|
|
40
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
package/types/src/extensions/Blocks/nodes/BlockContent/ImageBlockContent/ImageBlockContent.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const imagePropSchema: {
|
|
|
5
5
|
values: readonly ["left", "center", "right", "justify"];
|
|
6
6
|
};
|
|
7
7
|
backgroundColor: {
|
|
8
|
-
default: "
|
|
8
|
+
default: "default";
|
|
9
9
|
};
|
|
10
10
|
url: {
|
|
11
11
|
default: "";
|
|
@@ -23,7 +23,7 @@ export declare const Image: BlockSpec<"image", {
|
|
|
23
23
|
values: readonly ["left", "center", "right", "justify"];
|
|
24
24
|
};
|
|
25
25
|
backgroundColor: {
|
|
26
|
-
default: "
|
|
26
|
+
default: "default";
|
|
27
27
|
};
|
|
28
28
|
url: {
|
|
29
29
|
default: "";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const uploadToTmpFilesDotOrg_DEV_ONLY: (file: File) => Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const uploadToTmpFilesOrg: (file: File) => Promise<any>;
|
|
@@ -1,9 +1,35 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export declare const bulletListItemPropSchema: {
|
|
2
|
+
backgroundColor: {
|
|
3
|
+
default: "default";
|
|
4
|
+
};
|
|
5
|
+
textColor: {
|
|
6
|
+
default: "default";
|
|
7
|
+
};
|
|
8
|
+
textAlignment: {
|
|
9
|
+
default: "left";
|
|
10
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const BulletListItem: {
|
|
14
|
+
node: import("../../../../api/blockTypes").TipTapNode<"bulletListItem", true, {
|
|
15
|
+
domAttributes?: Partial<{
|
|
16
|
+
blockContainer: Record<string, string>;
|
|
17
|
+
blockGroup: Record<string, string>;
|
|
18
|
+
editor: Record<string, string>;
|
|
19
|
+
blockContent: Record<string, string>;
|
|
20
|
+
inlineContent: Record<string, string>;
|
|
21
|
+
}> | undefined;
|
|
22
|
+
}, any>;
|
|
23
|
+
propSchema: {
|
|
24
|
+
backgroundColor: {
|
|
25
|
+
default: "default";
|
|
26
|
+
};
|
|
27
|
+
textColor: {
|
|
28
|
+
default: "default";
|
|
29
|
+
};
|
|
30
|
+
textAlignment: {
|
|
31
|
+
default: "left";
|
|
32
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -1,9 +1,35 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export declare const numberedListItemPropSchema: {
|
|
2
|
+
backgroundColor: {
|
|
3
|
+
default: "default";
|
|
4
|
+
};
|
|
5
|
+
textColor: {
|
|
6
|
+
default: "default";
|
|
7
|
+
};
|
|
8
|
+
textAlignment: {
|
|
9
|
+
default: "left";
|
|
10
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const NumberedListItem: {
|
|
14
|
+
node: import("../../../../api/blockTypes").TipTapNode<"numberedListItem", true, {
|
|
15
|
+
domAttributes?: Partial<{
|
|
16
|
+
blockContainer: Record<string, string>;
|
|
17
|
+
blockGroup: Record<string, string>;
|
|
18
|
+
editor: Record<string, string>;
|
|
19
|
+
blockContent: Record<string, string>;
|
|
20
|
+
inlineContent: Record<string, string>;
|
|
21
|
+
}> | undefined;
|
|
22
|
+
}, any>;
|
|
23
|
+
propSchema: {
|
|
24
|
+
backgroundColor: {
|
|
25
|
+
default: "default";
|
|
26
|
+
};
|
|
27
|
+
textColor: {
|
|
28
|
+
default: "default";
|
|
29
|
+
};
|
|
30
|
+
textAlignment: {
|
|
31
|
+
default: "left";
|
|
32
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const paragraphPropSchema: {
|
|
2
|
+
backgroundColor: {
|
|
3
|
+
default: "default";
|
|
4
|
+
};
|
|
5
|
+
textColor: {
|
|
6
|
+
default: "default";
|
|
7
|
+
};
|
|
8
|
+
textAlignment: {
|
|
9
|
+
default: "left";
|
|
10
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const ParagraphBlockContent: import("../../../api/blockTypes").TipTapNode<"paragraph", true, {
|
|
2
14
|
domAttributes?: Partial<{
|
|
3
15
|
blockContainer: Record<string, string>;
|
|
4
16
|
blockGroup: Record<string, string>;
|
|
@@ -7,3 +19,26 @@ export declare const ParagraphBlockContent: import("../../../api/blockTypes").Ti
|
|
|
7
19
|
inlineContent: Record<string, string>;
|
|
8
20
|
}> | undefined;
|
|
9
21
|
}, any>;
|
|
22
|
+
export declare const Paragraph: {
|
|
23
|
+
node: import("../../../api/blockTypes").TipTapNode<"paragraph", true, {
|
|
24
|
+
domAttributes?: Partial<{
|
|
25
|
+
blockContainer: Record<string, string>;
|
|
26
|
+
blockGroup: Record<string, string>;
|
|
27
|
+
editor: Record<string, string>;
|
|
28
|
+
blockContent: Record<string, string>;
|
|
29
|
+
inlineContent: Record<string, string>;
|
|
30
|
+
}> | undefined;
|
|
31
|
+
}, any>;
|
|
32
|
+
propSchema: {
|
|
33
|
+
backgroundColor: {
|
|
34
|
+
default: "default";
|
|
35
|
+
};
|
|
36
|
+
textColor: {
|
|
37
|
+
default: "default";
|
|
38
|
+
};
|
|
39
|
+
textAlignment: {
|
|
40
|
+
default: "left";
|
|
41
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { BaseSlashMenuItem } from "./BaseSlashMenuItem";
|
|
2
|
-
export declare const getDefaultSlashMenuItems: <BSchema extends Record<string, import("../Blocks/api/blockTypes").BlockSpec<string, import("../Blocks/api/blockTypes").PropSchema>>>(schema?: BSchema) => BaseSlashMenuItem<BSchema>[];
|
|
2
|
+
export declare const getDefaultSlashMenuItems: <BSchema extends Record<string, import("../Blocks/api/blockTypes").BlockSpec<string, import("../Blocks/api/blockTypes").PropSchema, boolean>>>(schema?: BSchema) => BaseSlashMenuItem<BSchema>[];
|
package/types/src/index.d.ts
CHANGED
|
@@ -2,12 +2,16 @@ export * from "./BlockNoteEditor";
|
|
|
2
2
|
export * from "./BlockNoteExtensions";
|
|
3
3
|
export * from "./extensions/Blocks/api/block";
|
|
4
4
|
export * from "./extensions/Blocks/api/blockTypes";
|
|
5
|
+
export * from "./extensions/Blocks/api/defaultProps";
|
|
5
6
|
export * from "./extensions/Blocks/api/defaultBlocks";
|
|
6
7
|
export * from "./extensions/Blocks/api/inlineContentTypes";
|
|
8
|
+
export * from "./extensions/Blocks/api/selectionTypes";
|
|
7
9
|
export * from "./extensions/Blocks/api/serialization";
|
|
8
10
|
export * as blockStyles from "./extensions/Blocks/nodes/Block.module.css";
|
|
11
|
+
export * from "./extensions/Blocks/nodes/BlockContent/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY";
|
|
9
12
|
export * from "./extensions/FormattingToolbar/FormattingToolbarPlugin";
|
|
10
13
|
export * from "./extensions/HyperlinkToolbar/HyperlinkToolbarPlugin";
|
|
14
|
+
export * from "./extensions/ImageToolbar/ImageToolbarPlugin";
|
|
11
15
|
export * from "./extensions/SideMenu/SideMenuPlugin";
|
|
12
16
|
export * from "./extensions/SlashMenu/BaseSlashMenuItem";
|
|
13
17
|
export * from "./extensions/SlashMenu/SlashMenuPlugin";
|
|
@@ -25,7 +25,7 @@ type SuggestionPluginState<T extends SuggestionItem> = {
|
|
|
25
25
|
* - This version hides some unnecessary complexity from the user of the plugin.
|
|
26
26
|
* - This version handles key events differently
|
|
27
27
|
*/
|
|
28
|
-
export declare const setupSuggestionsMenu: <T extends SuggestionItem, BSchema extends Record<string, import("../../../extensions/Blocks/api/blockTypes").BlockSpec<string, import("../../../extensions/Blocks/api/blockTypes").PropSchema>>>(editor: BlockNoteEditor<BSchema>, updateSuggestionsMenu: (suggestionsMenuState: SuggestionsMenuState<T>) => void, pluginKey: PluginKey, defaultTriggerCharacter: string, items?: (query: string) => T[], onSelectItem?: (props: {
|
|
28
|
+
export declare const setupSuggestionsMenu: <T extends SuggestionItem, BSchema extends Record<string, import("../../../extensions/Blocks/api/blockTypes").BlockSpec<string, import("../../../extensions/Blocks/api/blockTypes").PropSchema, boolean>>>(editor: BlockNoteEditor<BSchema>, updateSuggestionsMenu: (suggestionsMenuState: SuggestionsMenuState<T>) => void, pluginKey: PluginKey, defaultTriggerCharacter: string, items?: (query: string) => T[], onSelectItem?: (props: {
|
|
29
29
|
item: T;
|
|
30
30
|
editor: BlockNoteEditor<BSchema>;
|
|
31
31
|
}) => void) => {
|