@blocknote/core 0.7.1-alpha.0 → 0.8.1
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 +1711 -1469
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -2
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/BlockNoteEditor.ts +104 -53
- package/src/BlockNoteExtensions.ts +24 -14
- package/src/api/blockManipulation/blockManipulation.test.ts +6 -3
- package/src/api/blockManipulation/blockManipulation.ts +7 -6
- package/src/api/formatConversions/formatConversions.test.ts +13 -8
- package/src/api/formatConversions/formatConversions.ts +15 -12
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +292 -0
- package/src/api/nodeConversions/nodeConversions.test.ts +265 -10
- package/src/api/nodeConversions/nodeConversions.ts +199 -47
- package/src/api/nodeConversions/testUtil.ts +8 -4
- package/src/editor.module.css +5 -6
- package/src/extensions/Blocks/api/block.ts +229 -0
- package/src/extensions/Blocks/api/blockTypes.ts +158 -71
- package/src/extensions/Blocks/api/cursorPositionTypes.ts +5 -5
- package/src/extensions/Blocks/api/defaultBlocks.ts +44 -0
- package/src/extensions/Blocks/api/selectionTypes.ts +3 -3
- package/src/extensions/Blocks/api/serialization.ts +29 -0
- package/src/extensions/Blocks/index.ts +0 -8
- package/src/extensions/Blocks/nodes/Block.module.css +28 -16
- package/src/extensions/Blocks/nodes/BlockContainer.ts +8 -4
- package/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.ts +4 -4
- package/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +5 -5
- package/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +100 -97
- package/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.ts +4 -4
- package/src/extensions/DraggableBlocks/BlockSideMenuFactoryTypes.ts +11 -9
- package/src/extensions/DraggableBlocks/DraggableBlocksExtension.ts +6 -5
- package/src/extensions/DraggableBlocks/DraggableBlocksPlugin.ts +57 -14
- package/src/extensions/FormattingToolbar/FormattingToolbarExtension.ts +21 -16
- package/src/extensions/FormattingToolbar/FormattingToolbarFactoryTypes.ts +9 -5
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +38 -58
- package/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.ts +19 -0
- package/src/extensions/Placeholder/PlaceholderExtension.ts +1 -0
- package/src/extensions/SlashMenu/BaseSlashMenuItem.ts +5 -2
- package/src/extensions/SlashMenu/SlashMenuExtension.ts +37 -33
- package/src/extensions/SlashMenu/defaultSlashMenuItems.tsx +14 -10
- package/src/extensions/SlashMenu/index.ts +2 -2
- package/src/index.ts +4 -0
- package/src/shared/plugins/suggestion/SuggestionPlugin.ts +29 -13
- package/types/src/BlockNoteEditor.d.ts +38 -23
- package/types/src/BlockNoteExtensions.d.ts +15 -8
- package/types/src/api/blockManipulation/blockManipulation.d.ts +4 -4
- package/types/src/api/formatConversions/formatConversions.d.ts +5 -5
- package/types/src/api/nodeConversions/nodeConversions.d.ts +3 -3
- package/types/src/api/nodeConversions/testUtil.d.ts +2 -2
- package/types/src/extensions/Blocks/api/block.d.ts +2 -4
- package/types/src/extensions/Blocks/api/blockTypes.d.ts +77 -33
- package/types/src/extensions/Blocks/api/cursorPositionTypes.d.ts +5 -5
- package/types/src/extensions/Blocks/api/defaultBlocks.d.ts +4 -4
- package/types/src/extensions/Blocks/api/selectionTypes.d.ts +3 -3
- package/types/src/extensions/Blocks/api/serialization.d.ts +2 -0
- package/types/src/extensions/Blocks/nodes/BlockContainer.d.ts +3 -3
- package/types/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.d.ts +1 -2
- package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.d.ts +1 -2
- package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +1 -2
- package/types/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.d.ts +1 -2
- package/types/src/extensions/DraggableBlocks/BlockSideMenuFactoryTypes.d.ts +7 -7
- package/types/src/extensions/DraggableBlocks/DraggableBlocksExtension.d.ts +5 -4
- package/types/src/extensions/DraggableBlocks/DraggableBlocksPlugin.d.ts +12 -11
- package/types/src/extensions/FormattingToolbar/FormattingToolbarExtension.d.ts +6 -5
- package/types/src/extensions/FormattingToolbar/FormattingToolbarFactoryTypes.d.ts +4 -3
- package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +16 -19
- package/types/src/extensions/Placeholder/localisation/index.d.ts +2 -0
- package/types/src/extensions/Placeholder/localisation/translation.d.ts +51 -0
- package/types/src/extensions/SlashMenu/BaseSlashMenuItem.d.ts +4 -3
- package/types/src/extensions/SlashMenu/SlashMenuExtension.d.ts +5 -4
- package/types/src/extensions/SlashMenu/defaultSlashMenuItems.d.ts +66 -1
- package/types/src/extensions/SlashMenu/index.d.ts +2 -2
- package/types/src/index.d.ts +4 -0
- package/types/src/shared/plugins/suggestion/SuggestionPlugin.d.ts +5 -4
- package/types/src/extensions/Blocks/api/alertBlock.d.ts +0 -13
- package/types/src/extensions/Blocks/api/alertBlock2.d.ts +0 -13
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Extension } from "@tiptap/core";
|
|
2
|
-
import { BlockNoteEditor } from "../..";
|
|
2
|
+
import { BlockNoteEditor, BlockSchema } from "../..";
|
|
3
3
|
import { FormattingToolbarFactory } from "./FormattingToolbarFactoryTypes";
|
|
4
|
+
export type FormattingToolbarOptions<BSchema extends BlockSchema> = {
|
|
5
|
+
formattingToolbarFactory: FormattingToolbarFactory<BSchema>;
|
|
6
|
+
editor: BlockNoteEditor<BSchema>;
|
|
7
|
+
};
|
|
4
8
|
/**
|
|
5
9
|
* The menu that is displayed when selecting a piece of text.
|
|
6
10
|
*/
|
|
7
|
-
export declare const
|
|
8
|
-
formattingToolbarFactory: FormattingToolbarFactory;
|
|
9
|
-
editor: BlockNoteEditor;
|
|
10
|
-
}, any>;
|
|
11
|
+
export declare const createFormattingToolbarExtension: <BSchema extends Record<string, import("../..").BlockSpec<string, import("../..").PropSchema>>>() => Extension<FormattingToolbarOptions<BSchema>, any>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { EditorElement, ElementFactory } from "../../shared/EditorElement";
|
|
2
2
|
import { BlockNoteEditor } from "../../BlockNoteEditor";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { BlockSchema } from "../Blocks/api/blockTypes";
|
|
4
|
+
export type FormattingToolbarStaticParams<BSchema extends BlockSchema> = {
|
|
5
|
+
editor: BlockNoteEditor<BSchema>;
|
|
5
6
|
};
|
|
6
7
|
export type FormattingToolbarDynamicParams = {
|
|
7
8
|
referenceRect: DOMRect;
|
|
8
9
|
};
|
|
9
10
|
export type FormattingToolbar = EditorElement<FormattingToolbarDynamicParams>;
|
|
10
|
-
export type FormattingToolbarFactory = ElementFactory<FormattingToolbarStaticParams
|
|
11
|
+
export type FormattingToolbarFactory<BSchema extends BlockSchema> = ElementFactory<FormattingToolbarStaticParams<BSchema>, FormattingToolbarDynamicParams>;
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import { Editor } from "@tiptap/core";
|
|
2
2
|
import { EditorState, Plugin, PluginKey } from "prosemirror-state";
|
|
3
3
|
import { EditorView } from "prosemirror-view";
|
|
4
|
-
import { BlockNoteEditor } from "../..";
|
|
4
|
+
import { BlockNoteEditor, BlockSchema } from "../..";
|
|
5
5
|
import { FormattingToolbar, FormattingToolbarDynamicParams, FormattingToolbarFactory, FormattingToolbarStaticParams } from "./FormattingToolbarFactoryTypes";
|
|
6
|
-
export interface FormattingToolbarPluginProps {
|
|
6
|
+
export interface FormattingToolbarPluginProps<BSchema extends BlockSchema> {
|
|
7
7
|
pluginKey: PluginKey;
|
|
8
8
|
tiptapEditor: Editor;
|
|
9
|
-
editor: BlockNoteEditor
|
|
10
|
-
formattingToolbarFactory: FormattingToolbarFactory
|
|
11
|
-
shouldShow?: ((props: {
|
|
12
|
-
editor: BlockNoteEditor;
|
|
13
|
-
view: EditorView;
|
|
14
|
-
state: EditorState;
|
|
15
|
-
oldState?: EditorState;
|
|
16
|
-
from: number;
|
|
17
|
-
to: number;
|
|
18
|
-
}) => boolean) | null;
|
|
9
|
+
editor: BlockNoteEditor<BSchema>;
|
|
10
|
+
formattingToolbarFactory: FormattingToolbarFactory<BSchema>;
|
|
19
11
|
}
|
|
20
|
-
export type FormattingToolbarViewProps = FormattingToolbarPluginProps & {
|
|
12
|
+
export type FormattingToolbarViewProps<BSchema extends BlockSchema> = FormattingToolbarPluginProps<BSchema> & {
|
|
21
13
|
view: EditorView;
|
|
22
14
|
};
|
|
23
|
-
export declare class FormattingToolbarView {
|
|
24
|
-
editor: BlockNoteEditor
|
|
15
|
+
export declare class FormattingToolbarView<BSchema extends BlockSchema> {
|
|
16
|
+
editor: BlockNoteEditor<BSchema>;
|
|
25
17
|
private ttEditor;
|
|
26
18
|
view: EditorView;
|
|
27
19
|
formattingToolbar: FormattingToolbar;
|
|
@@ -29,8 +21,13 @@ export declare class FormattingToolbarView {
|
|
|
29
21
|
preventShow: boolean;
|
|
30
22
|
toolbarIsOpen: boolean;
|
|
31
23
|
prevWasEditable: boolean | null;
|
|
32
|
-
shouldShow:
|
|
33
|
-
|
|
24
|
+
shouldShow: (props: {
|
|
25
|
+
view: EditorView;
|
|
26
|
+
state: EditorState;
|
|
27
|
+
from: number;
|
|
28
|
+
to: number;
|
|
29
|
+
}) => boolean;
|
|
30
|
+
constructor({ editor, tiptapEditor, formattingToolbarFactory, view, }: FormattingToolbarViewProps<BSchema>);
|
|
34
31
|
viewMousedownHandler: () => void;
|
|
35
32
|
viewMouseupHandler: () => void;
|
|
36
33
|
dragstartHandler: () => void;
|
|
@@ -42,7 +39,7 @@ export declare class FormattingToolbarView {
|
|
|
42
39
|
update(view: EditorView, oldState?: EditorState): void;
|
|
43
40
|
destroy(): void;
|
|
44
41
|
getSelectionBoundingBox(): DOMRect;
|
|
45
|
-
getStaticParams(): FormattingToolbarStaticParams
|
|
42
|
+
getStaticParams(): FormattingToolbarStaticParams<BSchema>;
|
|
46
43
|
getDynamicParams(): FormattingToolbarDynamicParams;
|
|
47
44
|
}
|
|
48
|
-
export declare const createFormattingToolbarPlugin: (options: FormattingToolbarPluginProps) => Plugin<any>;
|
|
45
|
+
export declare const createFormattingToolbarPlugin: <BSchema extends Record<string, import("../..").BlockSpec<string, import("../..").PropSchema>>>(options: FormattingToolbarPluginProps<BSchema>) => Plugin<any>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare const translation: {
|
|
2
|
+
en: {
|
|
3
|
+
translation: {
|
|
4
|
+
placeholder: string;
|
|
5
|
+
heading: string;
|
|
6
|
+
list: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
de: {
|
|
10
|
+
translation: {
|
|
11
|
+
placeholder: string;
|
|
12
|
+
heading: string;
|
|
13
|
+
list: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
it: {
|
|
17
|
+
translation: {
|
|
18
|
+
placeholder: string;
|
|
19
|
+
heading: string;
|
|
20
|
+
list: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
es: {
|
|
24
|
+
translation: {
|
|
25
|
+
placeholder: string;
|
|
26
|
+
heading: string;
|
|
27
|
+
list: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
fr: {
|
|
31
|
+
translation: {
|
|
32
|
+
placeholder: string;
|
|
33
|
+
heading: string;
|
|
34
|
+
list: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
fi: {
|
|
38
|
+
translation: {
|
|
39
|
+
placeholder: string;
|
|
40
|
+
heading: string;
|
|
41
|
+
list: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
sv: {
|
|
45
|
+
translation: {
|
|
46
|
+
placeholder: string;
|
|
47
|
+
heading: string;
|
|
48
|
+
list: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { SuggestionItem } from "../../shared/plugins/suggestion/SuggestionItem";
|
|
2
2
|
import { BlockNoteEditor } from "../../BlockNoteEditor";
|
|
3
|
+
import { BlockSchema } from "../Blocks/api/blockTypes";
|
|
3
4
|
/**
|
|
4
5
|
* A class that defines a slash command (/<command>).
|
|
5
6
|
*
|
|
6
7
|
* (Not to be confused with ProseMirror commands nor TipTap commands.)
|
|
7
8
|
*/
|
|
8
|
-
export declare class BaseSlashMenuItem extends SuggestionItem {
|
|
9
|
+
export declare class BaseSlashMenuItem<BSchema extends BlockSchema> extends SuggestionItem {
|
|
9
10
|
readonly name: string;
|
|
10
|
-
readonly execute: (editor: BlockNoteEditor) => void;
|
|
11
|
+
readonly execute: (editor: BlockNoteEditor<BSchema>) => void;
|
|
11
12
|
readonly aliases: string[];
|
|
12
13
|
/**
|
|
13
14
|
* Constructs a new slash-command.
|
|
@@ -16,5 +17,5 @@ export declare class BaseSlashMenuItem extends SuggestionItem {
|
|
|
16
17
|
* @param execute The callback for creating a new node
|
|
17
18
|
* @param aliases Aliases for this command
|
|
18
19
|
*/
|
|
19
|
-
constructor(name: string, execute: (editor: BlockNoteEditor) => void, aliases?: string[]);
|
|
20
|
+
constructor(name: string, execute: (editor: BlockNoteEditor<BSchema>) => void, aliases?: string[]);
|
|
20
21
|
}
|
|
@@ -3,10 +3,11 @@ import { PluginKey } from "prosemirror-state";
|
|
|
3
3
|
import { SuggestionsMenuFactory } from "../../shared/plugins/suggestion/SuggestionsMenuFactoryTypes";
|
|
4
4
|
import { BaseSlashMenuItem } from "./BaseSlashMenuItem";
|
|
5
5
|
import { BlockNoteEditor } from "../../BlockNoteEditor";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { BlockSchema } from "../Blocks/api/blockTypes";
|
|
7
|
+
export type SlashMenuOptions<BSchema extends BlockSchema> = {
|
|
8
|
+
editor: BlockNoteEditor<BSchema> | undefined;
|
|
9
|
+
commands: BaseSlashMenuItem<BSchema>[] | undefined;
|
|
9
10
|
slashMenuFactory: SuggestionsMenuFactory<any> | undefined;
|
|
10
11
|
};
|
|
11
12
|
export declare const SlashMenuPluginKey: PluginKey<any>;
|
|
12
|
-
export declare const
|
|
13
|
+
export declare const createSlashMenuExtension: <BSchema extends Record<string, import("../Blocks/api/blockTypes").BlockSpec<string, import("../Blocks/api/blockTypes").PropSchema>>>() => Extension<SlashMenuOptions<BSchema>, any>;
|
|
@@ -2,4 +2,69 @@ import { BaseSlashMenuItem } from "./BaseSlashMenuItem";
|
|
|
2
2
|
/**
|
|
3
3
|
* An array containing commands for creating all default blocks.
|
|
4
4
|
*/
|
|
5
|
-
export declare const defaultSlashMenuItems: BaseSlashMenuItem
|
|
5
|
+
export declare const defaultSlashMenuItems: BaseSlashMenuItem<{
|
|
6
|
+
readonly paragraph: {
|
|
7
|
+
readonly propSchema: {
|
|
8
|
+
backgroundColor: {
|
|
9
|
+
default: "transparent";
|
|
10
|
+
};
|
|
11
|
+
textColor: {
|
|
12
|
+
default: "black";
|
|
13
|
+
};
|
|
14
|
+
textAlignment: {
|
|
15
|
+
default: "left";
|
|
16
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly node: import("../Blocks/api/blockTypes").TipTapNode<"paragraph">;
|
|
20
|
+
};
|
|
21
|
+
readonly heading: {
|
|
22
|
+
readonly propSchema: {
|
|
23
|
+
readonly level: {
|
|
24
|
+
readonly default: "1";
|
|
25
|
+
readonly values: readonly ["1", "2", "3"];
|
|
26
|
+
};
|
|
27
|
+
readonly backgroundColor: {
|
|
28
|
+
default: "transparent";
|
|
29
|
+
};
|
|
30
|
+
readonly textColor: {
|
|
31
|
+
default: "black";
|
|
32
|
+
};
|
|
33
|
+
readonly textAlignment: {
|
|
34
|
+
default: "left";
|
|
35
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
readonly node: import("../Blocks/api/blockTypes").TipTapNode<"heading">;
|
|
39
|
+
};
|
|
40
|
+
readonly bulletListItem: {
|
|
41
|
+
readonly propSchema: {
|
|
42
|
+
backgroundColor: {
|
|
43
|
+
default: "transparent";
|
|
44
|
+
};
|
|
45
|
+
textColor: {
|
|
46
|
+
default: "black";
|
|
47
|
+
};
|
|
48
|
+
textAlignment: {
|
|
49
|
+
default: "left";
|
|
50
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
readonly node: import("../Blocks/api/blockTypes").TipTapNode<"bulletListItem">;
|
|
54
|
+
};
|
|
55
|
+
readonly numberedListItem: {
|
|
56
|
+
readonly propSchema: {
|
|
57
|
+
backgroundColor: {
|
|
58
|
+
default: "transparent";
|
|
59
|
+
};
|
|
60
|
+
textColor: {
|
|
61
|
+
default: "black";
|
|
62
|
+
};
|
|
63
|
+
textAlignment: {
|
|
64
|
+
default: "left";
|
|
65
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
readonly node: import("../Blocks/api/blockTypes").TipTapNode<"numberedListItem">;
|
|
69
|
+
};
|
|
70
|
+
}>[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { defaultSlashMenuItems } from "./defaultSlashMenuItems";
|
|
2
|
-
import {
|
|
2
|
+
import { createSlashMenuExtension } from "./SlashMenuExtension";
|
|
3
3
|
import { BaseSlashMenuItem } from "./BaseSlashMenuItem";
|
|
4
|
-
export { defaultSlashMenuItems, BaseSlashMenuItem,
|
|
4
|
+
export { defaultSlashMenuItems, BaseSlashMenuItem, createSlashMenuExtension };
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from "./BlockNoteEditor";
|
|
2
2
|
export * from "./BlockNoteExtensions";
|
|
3
|
+
export * from "./extensions/Blocks/api/block";
|
|
3
4
|
export * from "./extensions/Blocks/api/blockTypes";
|
|
5
|
+
export * from "./extensions/Blocks/api/defaultBlocks";
|
|
4
6
|
export * from "./extensions/DraggableBlocks/BlockSideMenuFactoryTypes";
|
|
5
7
|
export * from "./extensions/FormattingToolbar/FormattingToolbarFactoryTypes";
|
|
6
8
|
export * from "./extensions/HyperlinkToolbar/HyperlinkToolbarFactoryTypes";
|
|
@@ -10,3 +12,5 @@ export * from "./shared/EditorElement";
|
|
|
10
12
|
export type { SuggestionItem } from "./shared/plugins/suggestion/SuggestionItem";
|
|
11
13
|
export * from "./shared/plugins/suggestion/SuggestionsMenuFactoryTypes";
|
|
12
14
|
export * from "./extensions/Blocks/api/inlineContentTypes";
|
|
15
|
+
export * from "./extensions/Blocks/api/serialization";
|
|
16
|
+
export * as blockStyles from "./extensions/Blocks/nodes/Block.module.css";
|
|
@@ -3,7 +3,8 @@ import { Plugin, PluginKey } from "prosemirror-state";
|
|
|
3
3
|
import { SuggestionsMenuFactory } from "./SuggestionsMenuFactoryTypes";
|
|
4
4
|
import { SuggestionItem } from "./SuggestionItem";
|
|
5
5
|
import { BlockNoteEditor } from "../../../BlockNoteEditor";
|
|
6
|
-
|
|
6
|
+
import { BlockSchema } from "../../../extensions/Blocks/api/blockTypes";
|
|
7
|
+
export type SuggestionPluginOptions<T extends SuggestionItem, BSchema extends BlockSchema> = {
|
|
7
8
|
/**
|
|
8
9
|
* The name of the plugin.
|
|
9
10
|
*
|
|
@@ -13,7 +14,7 @@ export type SuggestionPluginOptions<T extends SuggestionItem> = {
|
|
|
13
14
|
/**
|
|
14
15
|
* The BlockNote editor.
|
|
15
16
|
*/
|
|
16
|
-
editor: BlockNoteEditor
|
|
17
|
+
editor: BlockNoteEditor<BSchema>;
|
|
17
18
|
/**
|
|
18
19
|
* The character that should trigger the suggestion menu to pop up (e.g. a '/' for commands), when typed by the user.
|
|
19
20
|
*/
|
|
@@ -28,7 +29,7 @@ export type SuggestionPluginOptions<T extends SuggestionItem> = {
|
|
|
28
29
|
*/
|
|
29
30
|
onSelectItem?: (props: {
|
|
30
31
|
item: T;
|
|
31
|
-
editor: BlockNoteEditor
|
|
32
|
+
editor: BlockNoteEditor<BSchema>;
|
|
32
33
|
}) => void;
|
|
33
34
|
/**
|
|
34
35
|
* A function that should supply the plugin with items to suggest, based on a certain query string.
|
|
@@ -61,5 +62,5 @@ type SuggestionPluginState<T extends SuggestionItem> = {
|
|
|
61
62
|
* @param options options for configuring the plugin
|
|
62
63
|
* @returns the prosemirror plugin
|
|
63
64
|
*/
|
|
64
|
-
export declare function createSuggestionPlugin<T extends SuggestionItem>({ pluginKey, editor, defaultTriggerCharacter, suggestionsMenuFactory, onSelectItem: selectItemCallback, items, }: SuggestionPluginOptions<T>): Plugin<SuggestionPluginState<T>>;
|
|
65
|
+
export declare function createSuggestionPlugin<T extends SuggestionItem, BSchema extends BlockSchema>({ pluginKey, editor, defaultTriggerCharacter, suggestionsMenuFactory, onSelectItem: selectItemCallback, items, }: SuggestionPluginOptions<T, BSchema>): Plugin<SuggestionPluginState<T>>;
|
|
65
66
|
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const Alert: import("./blockTypes").BlockSpec<"alert", {
|
|
2
|
-
readonly textAlignment: {
|
|
3
|
-
default: "left";
|
|
4
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
5
|
-
};
|
|
6
|
-
readonly textColor: {
|
|
7
|
-
default: "black";
|
|
8
|
-
};
|
|
9
|
-
readonly type: {
|
|
10
|
-
readonly default: "warning";
|
|
11
|
-
readonly values: readonly ["warning", "error", "info", "success"];
|
|
12
|
-
};
|
|
13
|
-
}>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const Alert2: import("./blockTypes").BlockSpec<"alert2", {
|
|
2
|
-
readonly textAlignment: {
|
|
3
|
-
default: "left";
|
|
4
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
5
|
-
};
|
|
6
|
-
readonly textColor: {
|
|
7
|
-
default: "black";
|
|
8
|
-
};
|
|
9
|
-
readonly type: {
|
|
10
|
-
readonly default: "warning";
|
|
11
|
-
readonly values: readonly ["warning", "error", "info", "success"];
|
|
12
|
-
};
|
|
13
|
-
}>;
|