@blocknote/core 0.11.2 → 0.12.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.
Files changed (138) hide show
  1. package/README.md +13 -17
  2. package/dist/blocknote.js +1662 -1447
  3. package/dist/blocknote.js.map +1 -1
  4. package/dist/blocknote.umd.cjs +6 -6
  5. package/dist/blocknote.umd.cjs.map +1 -1
  6. package/dist/style.css +1 -1
  7. package/dist/webpack-stats.json +1 -1
  8. package/package.json +7 -3
  9. package/src/api/blockManipulation/blockManipulation.test.ts +19 -15
  10. package/src/api/blockManipulation/blockManipulation.ts +107 -17
  11. package/src/api/exporters/html/externalHTMLExporter.ts +3 -7
  12. package/src/api/exporters/html/htmlConversion.test.ts +6 -3
  13. package/src/api/exporters/html/internalHTMLSerializer.ts +3 -7
  14. package/src/api/exporters/html/util/sharedHTMLConversion.ts +3 -3
  15. package/src/api/exporters/markdown/markdownExporter.test.ts +7 -3
  16. package/src/api/exporters/markdown/markdownExporter.ts +2 -6
  17. package/src/api/getCurrentBlockContentType.ts +14 -0
  18. package/src/api/nodeConversions/nodeConversions.test.ts +14 -7
  19. package/src/api/nodeConversions/nodeConversions.ts +1 -2
  20. package/src/api/parsers/html/parseHTML.test.ts +5 -1
  21. package/src/api/parsers/html/parseHTML.ts +2 -6
  22. package/src/api/parsers/html/util/nestedLists.ts +11 -1
  23. package/src/api/parsers/markdown/parseMarkdown.test.ts +3 -0
  24. package/src/api/parsers/markdown/parseMarkdown.ts +2 -6
  25. package/src/api/testUtil/cases/customBlocks.ts +18 -16
  26. package/src/api/testUtil/cases/customInlineContent.ts +12 -13
  27. package/src/api/testUtil/cases/customStyles.ts +12 -10
  28. package/src/api/testUtil/index.ts +4 -2
  29. package/src/api/testUtil/partialBlockTestUtil.ts +2 -6
  30. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +50 -21
  31. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +1 -2
  32. package/src/blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +8 -1
  33. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +18 -5
  34. package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +7 -1
  35. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +18 -5
  36. package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +14 -5
  37. package/src/blocks/defaultBlockHelpers.ts +3 -3
  38. package/src/blocks/defaultBlockTypeGuards.ts +84 -0
  39. package/src/blocks/defaultBlocks.ts +29 -3
  40. package/src/editor/Block.css +2 -31
  41. package/src/editor/BlockNoteEditor.ts +223 -267
  42. package/src/editor/BlockNoteExtensions.ts +5 -2
  43. package/src/editor/BlockNoteSchema.ts +98 -0
  44. package/src/editor/BlockNoteTipTapEditor.ts +162 -0
  45. package/src/editor/cursorPositionTypes.ts +2 -6
  46. package/src/editor/editor.css +0 -1
  47. package/src/editor/selectionTypes.ts +2 -6
  48. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +22 -29
  49. package/src/extensions/{ImageToolbar → ImagePanel}/ImageToolbarPlugin.ts +54 -60
  50. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +330 -0
  51. package/src/extensions/Placeholder/PlaceholderExtension.ts +81 -88
  52. package/src/extensions/SideMenu/SideMenuPlugin.ts +55 -56
  53. package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +8 -0
  54. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +353 -0
  55. package/src/extensions/{SlashMenu/defaultSlashMenuItems.ts → SuggestionMenu/getDefaultSlashMenuItems.ts} +119 -89
  56. package/src/extensions/TableHandles/TableHandlesPlugin.ts +62 -45
  57. package/src/extensions-shared/UiElementPosition.ts +4 -0
  58. package/src/index.ts +8 -8
  59. package/src/pm-nodes/BlockContainer.ts +5 -5
  60. package/src/schema/blocks/types.ts +15 -15
  61. package/src/schema/inlineContent/createSpec.ts +2 -2
  62. package/src/schema/inlineContent/types.ts +1 -1
  63. package/src/util/browser.ts +6 -4
  64. package/src/util/typescript.ts +7 -4
  65. package/types/src/api/blockManipulation/blockManipulation.d.ts +6 -1
  66. package/types/src/api/exporters/html/externalHTMLExporter.d.ts +2 -1
  67. package/types/src/api/exporters/html/internalHTMLSerializer.d.ts +2 -1
  68. package/types/src/api/exporters/markdown/markdownExporter.d.ts +2 -1
  69. package/types/src/api/getCurrentBlockContentType.d.ts +2 -0
  70. package/types/src/api/nodeConversions/nodeConversions.d.ts +2 -1
  71. package/types/src/api/parsers/html/parseHTML.d.ts +2 -1
  72. package/types/src/api/parsers/markdown/parseMarkdown.d.ts +2 -1
  73. package/types/src/api/testUtil/cases/customBlocks.d.ts +72 -13
  74. package/types/src/api/testUtil/cases/customInlineContent.d.ts +281 -6
  75. package/types/src/api/testUtil/cases/customStyles.d.ts +247 -13
  76. package/types/src/api/testUtil/index.d.ts +4 -2
  77. package/types/src/api/testUtil/partialBlockTestUtil.d.ts +2 -1
  78. package/types/src/blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +6 -1
  79. package/types/src/blocks/defaultBlockHelpers.d.ts +2 -2
  80. package/types/src/blocks/defaultBlockTypeGuards.d.ts +24 -0
  81. package/types/src/blocks/defaultBlocks.d.ts +21 -15
  82. package/types/src/editor/BlockNoteEditor.d.ts +51 -56
  83. package/types/src/editor/BlockNoteExtensions.d.ts +1 -0
  84. package/types/src/editor/BlockNoteSchema.d.ts +34 -0
  85. package/types/src/editor/BlockNoteTipTapEditor.d.ts +28 -0
  86. package/types/src/editor/cursorPositionTypes.d.ts +2 -1
  87. package/types/src/editor/selectionTypes.d.ts +2 -1
  88. package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +5 -6
  89. package/types/src/extensions/ImagePanel/ImageToolbarPlugin.d.ts +32 -0
  90. package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +40 -0
  91. package/types/src/extensions/Placeholder/PlaceholderExtension.d.ts +2 -15
  92. package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +8 -7
  93. package/types/src/extensions/SuggestionMenu/DefaultSuggestionItem.d.ts +8 -0
  94. package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +31 -0
  95. package/types/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.d.ts +10 -0
  96. package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +7 -7
  97. package/types/src/extensions-shared/UiElementPosition.d.ts +4 -0
  98. package/types/src/index.d.ts +8 -8
  99. package/types/src/pm-nodes/BlockContainer.d.ts +3 -2
  100. package/types/src/pm-nodes/BlockGroup.d.ts +1 -1
  101. package/types/src/schema/blocks/types.d.ts +15 -15
  102. package/types/src/schema/inlineContent/types.d.ts +1 -1
  103. package/types/src/util/browser.d.ts +1 -0
  104. package/types/src/util/typescript.d.ts +1 -0
  105. package/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.ts +0 -335
  106. package/src/extensions/SlashMenu/BaseSlashMenuItem.ts +0 -12
  107. package/src/extensions/SlashMenu/SlashMenuPlugin.ts +0 -53
  108. package/src/extensions-shared/BaseUiElementTypes.ts +0 -8
  109. package/src/extensions-shared/README.md +0 -3
  110. package/src/extensions-shared/suggestion/SuggestionItem.ts +0 -3
  111. package/src/extensions-shared/suggestion/SuggestionPlugin.ts +0 -448
  112. package/types/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.d.ts +0 -38
  113. package/types/src/extensions/ImageToolbar/ImageToolbarPlugin.d.ts +0 -31
  114. package/types/src/extensions/SlashMenu/BaseSlashMenuItem.d.ts +0 -7
  115. package/types/src/extensions/SlashMenu/SlashMenuPlugin.d.ts +0 -13
  116. package/types/src/extensions/SlashMenu/defaultSlashMenuItems.d.ts +0 -3
  117. package/types/src/extensions-shared/BaseUiElementTypes.d.ts +0 -7
  118. package/types/src/extensions-shared/suggestion/SuggestionItem.d.ts +0 -3
  119. package/types/src/extensions-shared/suggestion/SuggestionPlugin.d.ts +0 -36
  120. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-100.woff +0 -0
  121. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-100.woff2 +0 -0
  122. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-200.woff +0 -0
  123. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-200.woff2 +0 -0
  124. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-300.woff +0 -0
  125. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-300.woff2 +0 -0
  126. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-500.woff +0 -0
  127. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-500.woff2 +0 -0
  128. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-600.woff +0 -0
  129. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-600.woff2 +0 -0
  130. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-700.woff +0 -0
  131. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-700.woff2 +0 -0
  132. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-800.woff +0 -0
  133. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-800.woff2 +0 -0
  134. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-900.woff +0 -0
  135. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-900.woff2 +0 -0
  136. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-regular.woff +0 -0
  137. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-regular.woff2 +0 -0
  138. /package/src/{assets/fonts-inter.css → fonts/inter.css} +0 -0
@@ -1,3 +1,4 @@
1
+ import { BlockNoDefaults, BlockSchema, InlineContentSchema, PartialBlockNoDefaults, StyleSchema } from "../schema";
1
2
  export declare const defaultBlockSpecs: {
2
3
  paragraph: {
3
4
  config: {
@@ -31,7 +32,7 @@ export declare const defaultBlockSpecs: {
31
32
  values: readonly ["left", "center", "right", "justify"];
32
33
  };
33
34
  };
34
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
35
+ }, any, InlineContentSchema, StyleSchema>;
35
36
  };
36
37
  heading: {
37
38
  config: {
@@ -73,7 +74,7 @@ export declare const defaultBlockSpecs: {
73
74
  values: readonly ["left", "center", "right", "justify"];
74
75
  };
75
76
  };
76
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
77
+ }, any, InlineContentSchema, StyleSchema>;
77
78
  };
78
79
  bulletListItem: {
79
80
  config: {
@@ -107,7 +108,7 @@ export declare const defaultBlockSpecs: {
107
108
  values: readonly ["left", "center", "right", "justify"];
108
109
  };
109
110
  };
110
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
111
+ }, any, InlineContentSchema, StyleSchema>;
111
112
  };
112
113
  numberedListItem: {
113
114
  config: {
@@ -141,7 +142,7 @@ export declare const defaultBlockSpecs: {
141
142
  values: readonly ["left", "center", "right", "justify"];
142
143
  };
143
144
  };
144
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
145
+ }, any, InlineContentSchema, StyleSchema>;
145
146
  };
146
147
  image: {
147
148
  config: {
@@ -187,7 +188,7 @@ export declare const defaultBlockSpecs: {
187
188
  };
188
189
  };
189
190
  content: "none";
190
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
191
+ }, any, InlineContentSchema, StyleSchema>;
191
192
  };
192
193
  table: {
193
194
  config: {
@@ -221,7 +222,7 @@ export declare const defaultBlockSpecs: {
221
222
  values: readonly ["left", "center", "right", "justify"];
222
223
  };
223
224
  };
224
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
225
+ }, any, InlineContentSchema, StyleSchema>;
225
226
  };
226
227
  };
227
228
  export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpecs<{
@@ -257,7 +258,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
257
258
  values: readonly ["left", "center", "right", "justify"];
258
259
  };
259
260
  };
260
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
261
+ }, any, InlineContentSchema, StyleSchema>;
261
262
  };
262
263
  heading: {
263
264
  config: {
@@ -299,7 +300,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
299
300
  values: readonly ["left", "center", "right", "justify"];
300
301
  };
301
302
  };
302
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
303
+ }, any, InlineContentSchema, StyleSchema>;
303
304
  };
304
305
  bulletListItem: {
305
306
  config: {
@@ -333,7 +334,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
333
334
  values: readonly ["left", "center", "right", "justify"];
334
335
  };
335
336
  };
336
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
337
+ }, any, InlineContentSchema, StyleSchema>;
337
338
  };
338
339
  numberedListItem: {
339
340
  config: {
@@ -367,7 +368,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
367
368
  values: readonly ["left", "center", "right", "justify"];
368
369
  };
369
370
  };
370
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
371
+ }, any, InlineContentSchema, StyleSchema>;
371
372
  };
372
373
  image: {
373
374
  config: {
@@ -413,7 +414,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
413
414
  };
414
415
  };
415
416
  content: "none";
416
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
417
+ }, any, InlineContentSchema, StyleSchema>;
417
418
  };
418
419
  table: {
419
420
  config: {
@@ -447,10 +448,11 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
447
448
  values: readonly ["left", "center", "right", "justify"];
448
449
  };
449
450
  };
450
- }, any, import("../schema").InlineContentSchema, import("../schema").StyleSchema>;
451
+ }, any, InlineContentSchema, StyleSchema>;
451
452
  };
452
453
  }>;
453
- export type DefaultBlockSchema = typeof defaultBlockSchema;
454
+ export type _DefaultBlockSchema = typeof defaultBlockSchema;
455
+ export type DefaultBlockSchema = _DefaultBlockSchema;
454
456
  export declare const defaultStyleSpecs: {
455
457
  bold: {
456
458
  config: {
@@ -553,7 +555,8 @@ export declare const defaultStyleSchema: import("../schema").StyleSchemaFromSpec
553
555
  implementation: import("../schema").StyleImplementation;
554
556
  };
555
557
  }>;
556
- export type DefaultStyleSchema = typeof defaultStyleSchema;
558
+ export type _DefaultStyleSchema = typeof defaultStyleSchema;
559
+ export type DefaultStyleSchema = _DefaultStyleSchema;
557
560
  export declare const defaultInlineContentSpecs: {
558
561
  text: {
559
562
  config: "text";
@@ -574,4 +577,7 @@ export declare const defaultInlineContentSchema: import("../schema").InlineConte
574
577
  implementation: any;
575
578
  };
576
579
  }>;
577
- export type DefaultInlineContentSchema = typeof defaultInlineContentSchema;
580
+ export type _DefaultInlineContentSchema = typeof defaultInlineContentSchema;
581
+ export type DefaultInlineContentSchema = _DefaultInlineContentSchema;
582
+ export type PartialBlock<BSchema extends BlockSchema = DefaultBlockSchema, I extends InlineContentSchema = DefaultInlineContentSchema, S extends StyleSchema = DefaultStyleSchema> = PartialBlockNoDefaults<BSchema, I, S>;
583
+ export type Block<BSchema extends BlockSchema = DefaultBlockSchema, I extends InlineContentSchema = DefaultInlineContentSchema, S extends StyleSchema = DefaultStyleSchema> = BlockNoDefaults<BSchema, I, S>;
@@ -1,73 +1,41 @@
1
1
  import { EditorOptions } from "@tiptap/core";
2
2
  import { Node } from "prosemirror-model";
3
- import { Editor as TiptapEditor } from "@tiptap/core/dist/packages/core/src/Editor";
4
3
  import * as Y from "yjs";
5
- import { DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, defaultBlockSpecs, defaultInlineContentSpecs, defaultStyleSpecs } from "../blocks/defaultBlocks";
4
+ import { Block, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, PartialBlock } from "../blocks/defaultBlocks";
6
5
  import { FormattingToolbarProsemirrorPlugin } from "../extensions/FormattingToolbar/FormattingToolbarPlugin";
7
- import { HyperlinkToolbarProsemirrorPlugin } from "../extensions/HyperlinkToolbar/HyperlinkToolbarPlugin";
8
- import { ImageToolbarProsemirrorPlugin } from "../extensions/ImageToolbar/ImageToolbarPlugin";
6
+ import { LinkToolbarProsemirrorPlugin } from "../extensions/LinkToolbar/LinkToolbarPlugin";
9
7
  import { SideMenuProsemirrorPlugin } from "../extensions/SideMenu/SideMenuPlugin";
10
- import { BaseSlashMenuItem } from "../extensions/SlashMenu/BaseSlashMenuItem";
11
- import { SlashMenuProsemirrorPlugin } from "../extensions/SlashMenu/SlashMenuPlugin";
8
+ import { SuggestionMenuProseMirrorPlugin } from "../extensions/SuggestionMenu/SuggestionPlugin";
9
+ import { ImagePanelProsemirrorPlugin } from "../extensions/ImagePanel/ImageToolbarPlugin";
12
10
  import { TableHandlesProsemirrorPlugin } from "../extensions/TableHandles/TableHandlesPlugin";
13
- import { Block, BlockIdentifier, BlockNoteDOMAttributes, BlockSchema, BlockSchemaFromSpecs, BlockSchemaWithBlock, BlockSpecs, InlineContentSchema, InlineContentSchemaFromSpecs, InlineContentSpecs, PartialBlock, StyleSchema, StyleSchemaFromSpecs, StyleSpecs, Styles } from "../schema";
11
+ import { BlockIdentifier, BlockNoteDOMAttributes, BlockSchema, BlockSpecs, InlineContentSchema, InlineContentSpecs, PartialInlineContent, StyleSchema, StyleSpecs, Styles } from "../schema";
12
+ import { NoInfer } from "../util/typescript";
14
13
  import { TextCursorPosition } from "./cursorPositionTypes";
15
14
  import { Selection } from "./selectionTypes";
15
+ import { BlockNoteSchema } from "./BlockNoteSchema";
16
+ import { BlockNoteTipTapEditor } from "./BlockNoteTipTapEditor";
16
17
  import "./Block.css";
17
18
  import "./editor.css";
18
- export type BlockNoteEditorOptions<BSpecs extends BlockSpecs, ISpecs extends InlineContentSpecs, SSpecs extends StyleSpecs> = {
19
+ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema> = {
19
20
  enableBlockNoteExtensions: boolean;
20
- /**
21
- *
22
- * (couldn't fix any type, see https://github.com/TypeCellOS/BlockNote/pull/191#discussion_r1210708771)
23
- *
24
- * @default defaultSlashMenuItems from `./extensions/SlashMenu`
25
- */
26
- slashMenuItems: BaseSlashMenuItem<any, any, any>[];
27
- /**
28
- * The HTML element that should be used as the parent element for the editor.
29
- *
30
- * @default: undefined, the editor is not attached to the DOM
31
- */
32
- parentElement: HTMLElement;
21
+ placeholders: Record<string | "default", string>;
33
22
  /**
34
23
  * An object containing attributes that should be added to HTML elements of the editor.
35
24
  *
36
25
  * @example { editor: { class: "my-editor-class" } }
37
26
  */
38
27
  domAttributes: Partial<BlockNoteDOMAttributes>;
39
- /**
40
- * A callback function that runs when the editor is ready to be used.
41
- */
42
- onEditorReady: (editor: BlockNoteEditor<BlockSchemaFromSpecs<BSpecs>, InlineContentSchemaFromSpecs<ISpecs>, StyleSchemaFromSpecs<SSpecs>>) => void;
43
- /**
44
- * A callback function that runs whenever the editor's contents change.
45
- */
46
- onEditorContentChange: (editor: BlockNoteEditor<BlockSchemaFromSpecs<BSpecs>, InlineContentSchemaFromSpecs<ISpecs>, StyleSchemaFromSpecs<SSpecs>>) => void;
47
- /**
48
- * A callback function that runs whenever the text cursor position changes.
49
- */
50
- onTextCursorPositionChange: (editor: BlockNoteEditor<BlockSchemaFromSpecs<BSpecs>, InlineContentSchemaFromSpecs<ISpecs>, StyleSchemaFromSpecs<SSpecs>>) => void;
51
- /**
52
- * Locks the editor from being editable by the user if set to `false`.
53
- */
54
- editable: boolean;
55
28
  /**
56
29
  * The content that should be in the editor when it's created, represented as an array of partial block objects.
57
30
  */
58
- initialContent: PartialBlock<BlockSchemaFromSpecs<BSpecs>, InlineContentSchemaFromSpecs<ISpecs>, StyleSchemaFromSpecs<SSpecs>>[];
31
+ initialContent: PartialBlock<NoInfer<BSchema>, NoInfer<ISchema>, NoInfer<SSchema>>[];
59
32
  /**
60
33
  * Use default BlockNote font and reset the styles of <p> <li> <h1> elements etc., that are used in BlockNote.
61
34
  *
62
35
  * @default true
63
36
  */
64
37
  defaultStyles: boolean;
65
- /**
66
- * A list of block types that should be available in the editor.
67
- */
68
- blockSpecs: BSpecs;
69
- styleSpecs: SSpecs;
70
- inlineContentSpecs: ISpecs;
38
+ schema: BlockNoteSchema<BSchema, ISchema, SSchema>;
71
39
  /**
72
40
  * A custom function to handle file uploads.
73
41
  * @param file The file that should be uploaded.
@@ -102,35 +70,42 @@ export type BlockNoteEditorOptions<BSpecs extends BlockSpecs, ISpecs extends Inl
102
70
  };
103
71
  export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema> {
104
72
  private readonly options;
105
- readonly _tiptapEditor: TiptapEditor & {
73
+ readonly _tiptapEditor: BlockNoteTipTapEditor & {
106
74
  contentComponent: any;
107
75
  };
108
76
  blockCache: WeakMap<Node, Block<any, any, any>>;
109
- readonly blockSchema: BSchema;
110
- readonly inlineContentSchema: ISchema;
111
- readonly styleSchema: SSchema;
77
+ readonly schema: BlockNoteSchema<BSchema, ISchema, SSchema>;
112
78
  readonly blockImplementations: BlockSpecs;
113
79
  readonly inlineContentImplementations: InlineContentSpecs;
114
80
  readonly styleImplementations: StyleSpecs;
115
- ready: boolean;
116
- readonly sideMenu: SideMenuProsemirrorPlugin<BSchema, ISchema, SSchema>;
117
81
  readonly formattingToolbar: FormattingToolbarProsemirrorPlugin;
118
- readonly slashMenu: SlashMenuProsemirrorPlugin<BSchema, ISchema, SSchema, any>;
119
- readonly hyperlinkToolbar: HyperlinkToolbarProsemirrorPlugin<BSchema, ISchema, SSchema>;
120
- readonly imageToolbar: ImageToolbarProsemirrorPlugin<BSchema, ISchema, SSchema>;
121
- readonly tableHandles: TableHandlesProsemirrorPlugin<BSchema extends BlockSchemaWithBlock<"table", DefaultBlockSchema["table"]> ? BSchema : any, ISchema, SSchema> | undefined;
82
+ readonly linkToolbar: LinkToolbarProsemirrorPlugin<BSchema, ISchema, SSchema>;
83
+ readonly sideMenu: SideMenuProsemirrorPlugin<BSchema, ISchema, SSchema>;
84
+ readonly suggestionMenus: SuggestionMenuProseMirrorPlugin<BSchema, ISchema, SSchema>;
85
+ readonly imagePanel?: ImagePanelProsemirrorPlugin<ISchema, SSchema>;
86
+ readonly tableHandles?: TableHandlesProsemirrorPlugin<ISchema, SSchema>;
122
87
  readonly uploadFile: ((file: File) => Promise<string>) | undefined;
123
- static create<BSpecs extends BlockSpecs = typeof defaultBlockSpecs, ISpecs extends InlineContentSpecs = typeof defaultInlineContentSpecs, SSpecs extends StyleSpecs = typeof defaultStyleSpecs>(options?: Partial<BlockNoteEditorOptions<BSpecs, ISpecs, SSpecs>>): BlockNoteEditor<BlockSchemaFromSpecs<BSpecs>, InlineContentSchemaFromSpecs<ISpecs>, StyleSchemaFromSpecs<SSpecs>>;
88
+ static create<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema>(options?: Partial<BlockNoteEditorOptions<BSchema, ISchema, SSchema>>): BlockNoteEditor<BSchema, ISchema, SSchema>;
124
89
  private constructor();
90
+ /**
91
+ * Mount the editor to a parent DOM element. Call mount(undefined) to clean up
92
+ *
93
+ * @warning Not needed for React, use BlockNoteView to take care of this
94
+ */
95
+ mount(parentElement?: HTMLElement | null): void;
125
96
  get prosemirrorView(): import("prosemirror-view").EditorView;
126
97
  get domElement(): HTMLDivElement;
127
98
  isFocused(): boolean;
128
99
  focus(): void;
100
+ /**
101
+ * @deprecated, use `editor.document` instead
102
+ */
103
+ get topLevelBlocks(): Block<BSchema, ISchema, SSchema>[];
129
104
  /**
130
105
  * Gets a snapshot of all top-level (non-nested) blocks in the editor.
131
106
  * @returns A snapshot of all top-level (non-nested) blocks in the editor.
132
107
  */
133
- get topLevelBlocks(): Block<BSchema, ISchema, SSchema>[];
108
+ get document(): Block<BSchema, ISchema, SSchema>[];
134
109
  /**
135
110
  * Gets a snapshot of an existing block from the editor.
136
111
  * @param blockIdentifier The identifier of an existing block that should be retrieved.
@@ -212,6 +187,12 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
212
187
  insertedBlocks: Block<BSchema, ISchema, SSchema>[];
213
188
  removedBlocks: Block<BSchema, ISchema, SSchema>[];
214
189
  };
190
+ /**
191
+ * Insert a piece of content at the current cursor position.
192
+ *
193
+ * @param content can be a string, or array of partial inline content elements
194
+ */
195
+ insertInlineContent(content: PartialInlineContent<ISchema, SSchema>): void;
215
196
  /**
216
197
  * Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
217
198
  */
@@ -298,4 +279,18 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
298
279
  name: string;
299
280
  color: string;
300
281
  }): void;
282
+ /**
283
+ * A callback function that runs whenever the editor's contents change.
284
+ *
285
+ * @param callback The callback to execute.
286
+ * @returns A function to remove the callback.
287
+ */
288
+ onChange(callback: (editor: BlockNoteEditor<BSchema, ISchema, SSchema>) => void): () => void;
289
+ /**
290
+ * A callback function that runs whenever the text cursor position or selection changes.
291
+ *
292
+ * @param callback The callback to execute.
293
+ * @returns A function to remove the callback.
294
+ */
295
+ onSelectionChange(callback: (editor: BlockNoteEditor<BSchema, ISchema, SSchema>) => void): () => void;
301
296
  }
@@ -7,6 +7,7 @@ import { BlockNoteDOMAttributes, BlockSpecs, InlineContentSchema, InlineContentS
7
7
  */
8
8
  export declare const getBlockNoteExtensions: <BSchema extends Record<string, import("../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(opts: {
9
9
  editor: BlockNoteEditor<BSchema, I, S>;
10
+ placeholders?: Record<string, string> | undefined;
10
11
  domAttributes: Partial<BlockNoteDOMAttributes>;
11
12
  blockSchema: BSchema;
12
13
  blockSpecs: BlockSpecs;
@@ -0,0 +1,34 @@
1
+ import { defaultBlockSpecs, defaultInlineContentSpecs, defaultStyleSpecs } from "../blocks/defaultBlocks";
2
+ import { BlockSchema, BlockSchemaFromSpecs, BlockSpecs, InlineContentSchema, InlineContentSchemaFromSpecs, InlineContentSpecs, StyleSchema, StyleSchemaFromSpecs, StyleSpecs } from "../schema";
3
+ import type { BlockNoDefaults, PartialBlockNoDefaults } from "../schema/blocks/types";
4
+ import type { BlockNoteEditor } from "./BlockNoteEditor";
5
+ export declare class BlockNoteSchema<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema> {
6
+ readonly blockSpecs: BlockSpecs;
7
+ readonly inlineContentSpecs: InlineContentSpecs;
8
+ readonly styleSpecs: StyleSpecs;
9
+ readonly blockSchema: BSchema;
10
+ readonly inlineContentSchema: ISchema;
11
+ readonly styleSchema: SSchema;
12
+ readonly BlockNoteEditor: BlockNoteEditor<BSchema, ISchema, SSchema>;
13
+ readonly Block: BlockNoDefaults<BSchema, ISchema, SSchema>;
14
+ readonly PartialBlock: PartialBlockNoDefaults<BSchema, ISchema, SSchema>;
15
+ static create<BSpecs extends BlockSpecs = typeof defaultBlockSpecs, ISpecs extends InlineContentSpecs = typeof defaultInlineContentSpecs, SSpecs extends StyleSpecs = typeof defaultStyleSpecs>(options?: {
16
+ /**
17
+ * A list of custom block types that should be available in the editor.
18
+ */
19
+ blockSpecs?: BSpecs;
20
+ /**
21
+ * A list of custom InlineContent types that should be available in the editor.
22
+ */
23
+ inlineContentSpecs?: ISpecs;
24
+ /**
25
+ * A list of custom Styles that should be available in the editor.
26
+ */
27
+ styleSpecs?: SSpecs;
28
+ }): BlockNoteSchema<BlockSchemaFromSpecs<BSpecs>, InlineContentSchemaFromSpecs<ISpecs>, StyleSchemaFromSpecs<SSpecs>>;
29
+ constructor(opts?: {
30
+ blockSpecs?: BlockSpecs;
31
+ inlineContentSpecs?: InlineContentSpecs;
32
+ styleSpecs?: StyleSpecs;
33
+ });
34
+ }
@@ -0,0 +1,28 @@
1
+ import { EditorOptions } from "@tiptap/core";
2
+ import { Editor as TiptapEditor } from "@tiptap/core";
3
+ import { EditorState } from "prosemirror-state";
4
+ import { PartialBlock } from "../blocks/defaultBlocks";
5
+ import { StyleSchema } from "../schema";
6
+ export type BlockNoteTipTapEditorOptions = Partial<Omit<EditorOptions, "content">> & {
7
+ content: PartialBlock<any, any, any>[];
8
+ };
9
+ /**
10
+ * Custom Editor class that extends TiptapEditor and separates
11
+ * the creation of the view from the constructor.
12
+ */
13
+ export declare class BlockNoteTipTapEditor extends TiptapEditor {
14
+ private _state;
15
+ constructor(options: BlockNoteTipTapEditorOptions, styleSchema: StyleSchema);
16
+ get state(): EditorState;
17
+ createView(): void;
18
+ /**
19
+ * Replace the default `createView` method with a custom one - which we call on mount
20
+ */
21
+ private createViewAlternative;
22
+ /**
23
+ * Mounts / unmounts the editor to a dom element
24
+ *
25
+ * @param element DOM element to mount to, ur null / undefined to destroy
26
+ */
27
+ mount: (element?: HTMLElement | null) => void;
28
+ }
@@ -1,4 +1,5 @@
1
- import { Block, BlockSchema, InlineContentSchema, StyleSchema } from "../schema";
1
+ import { Block } from "../blocks/defaultBlocks";
2
+ import { BlockSchema, InlineContentSchema, StyleSchema } from "../schema";
2
3
  export type TextCursorPosition<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = {
3
4
  block: Block<BSchema, I, S>;
4
5
  prevBlock: Block<BSchema, I, S> | undefined;
@@ -1,4 +1,5 @@
1
- import { Block, BlockSchema, InlineContentSchema, StyleSchema } from "../schema";
1
+ import { Block } from "../blocks/defaultBlocks";
2
+ import { BlockSchema, InlineContentSchema, StyleSchema } from "../schema";
2
3
  export type Selection<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = {
3
4
  blocks: Block<BSchema, I, S>[];
4
5
  };
@@ -1,16 +1,15 @@
1
1
  import { EditorState, Plugin, PluginKey } from "prosemirror-state";
2
2
  import { EditorView } from "prosemirror-view";
3
3
  import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
4
- import { BaseUiElementCallbacks, BaseUiElementState } from "../../extensions-shared/BaseUiElementTypes";
4
+ import { UiElementPosition } from "../../extensions-shared/UiElementPosition";
5
5
  import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
6
6
  import { EventEmitter } from "../../util/EventEmitter";
7
- export type FormattingToolbarCallbacks = BaseUiElementCallbacks;
8
- export type FormattingToolbarState = BaseUiElementState;
7
+ export type FormattingToolbarState = UiElementPosition;
9
8
  export declare class FormattingToolbarView {
10
9
  private readonly editor;
11
10
  private readonly pmView;
12
- private formattingToolbarState?;
13
- updateFormattingToolbar: () => void;
11
+ state?: FormattingToolbarState;
12
+ emitUpdate: () => void;
14
13
  preventHide: boolean;
15
14
  preventShow: boolean;
16
15
  prevWasEditable: boolean | null;
@@ -20,7 +19,7 @@ export declare class FormattingToolbarView {
20
19
  from: number;
21
20
  to: number;
22
21
  }) => boolean;
23
- constructor(editor: BlockNoteEditor<BlockSchema, InlineContentSchema, StyleSchema>, pmView: EditorView, updateFormattingToolbar: (formattingToolbarState: FormattingToolbarState) => void);
22
+ constructor(editor: BlockNoteEditor<BlockSchema, InlineContentSchema, StyleSchema>, pmView: EditorView, emitUpdate: (state: FormattingToolbarState) => void);
24
23
  viewMousedownHandler: () => void;
25
24
  viewMouseupHandler: () => void;
26
25
  dragHandler: () => void;
@@ -0,0 +1,32 @@
1
+ import { EditorState, Plugin, PluginKey } from "prosemirror-state";
2
+ import { EditorView } from "prosemirror-view";
3
+ import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
4
+ import type { BlockFromConfig, InlineContentSchema, StyleSchema } from "../../schema";
5
+ import { UiElementPosition } from "../../extensions-shared/UiElementPosition";
6
+ import { EventEmitter } from "../../util/EventEmitter";
7
+ import { DefaultBlockSchema } from "../../blocks/defaultBlocks";
8
+ export type ImagePanelState<I extends InlineContentSchema, S extends StyleSchema> = UiElementPosition & {
9
+ block: BlockFromConfig<DefaultBlockSchema["image"], I, S>;
10
+ };
11
+ export declare class ImagePanelView<I extends InlineContentSchema, S extends StyleSchema> {
12
+ private readonly pluginKey;
13
+ private readonly pmView;
14
+ state?: ImagePanelState<I, S>;
15
+ emitUpdate: () => void;
16
+ prevWasEditable: boolean | null;
17
+ constructor(pluginKey: PluginKey, pmView: EditorView, emitUpdate: (state: ImagePanelState<I, S>) => void);
18
+ mouseDownHandler: () => void;
19
+ dragstartHandler: () => void;
20
+ blurHandler: (event: FocusEvent) => void;
21
+ scrollHandler: () => void;
22
+ update(view: EditorView, prevState: EditorState): void;
23
+ destroy(): void;
24
+ }
25
+ export declare class ImagePanelProsemirrorPlugin<I extends InlineContentSchema, S extends StyleSchema> extends EventEmitter<any> {
26
+ private view;
27
+ readonly plugin: Plugin;
28
+ constructor(_editor: BlockNoteEditor<{
29
+ image: DefaultBlockSchema["image"];
30
+ }, I, S>);
31
+ onUpdate(callback: (state: ImagePanelState<I, S>) => void): () => void;
32
+ }
@@ -0,0 +1,40 @@
1
+ import { Plugin, PluginKey } from "prosemirror-state";
2
+ import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
3
+ import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
4
+ import { UiElementPosition } from "../../extensions-shared/UiElementPosition";
5
+ import { EventEmitter } from "../../util/EventEmitter";
6
+ export type LinkToolbarState = UiElementPosition & {
7
+ url: string;
8
+ text: string;
9
+ };
10
+ export declare const linkToolbarPluginKey: PluginKey<any>;
11
+ export declare class LinkToolbarProsemirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends EventEmitter<any> {
12
+ private view;
13
+ readonly plugin: Plugin;
14
+ constructor(editor: BlockNoteEditor<BSchema, I, S>);
15
+ onUpdate(callback: (state: LinkToolbarState) => void): () => void;
16
+ /**
17
+ * Edit the currently hovered link.
18
+ */
19
+ editLink: (url: string, text: string) => void;
20
+ /**
21
+ * Delete the currently hovered link.
22
+ */
23
+ deleteLink: () => void;
24
+ /**
25
+ * When hovering on/off links using the mouse cursor, the link toolbar will
26
+ * open & close with a delay.
27
+ *
28
+ * This function starts the delay timer, and should be used for when the mouse
29
+ * cursor enters the link toolbar.
30
+ */
31
+ startHideTimer: () => void;
32
+ /**
33
+ * When hovering on/off links using the mouse cursor, the link toolbar will
34
+ * open & close with a delay.
35
+ *
36
+ * This function stops the delay timer, and should be used for when the mouse
37
+ * cursor exits the link toolbar.
38
+ */
39
+ stopHideTimer: () => void;
40
+ }
@@ -1,5 +1,4 @@
1
- import { Editor, Extension } from "@tiptap/core";
2
- import { Node as ProsemirrorNode } from "prosemirror-model";
1
+ import { Extension } from "@tiptap/core";
3
2
  /**
4
3
  * This is a modified version of the tiptap
5
4
  * placeholder plugin, that also sets hasAnchorClass
@@ -8,18 +7,6 @@ import { Node as ProsemirrorNode } from "prosemirror-model";
8
7
  *
9
8
  */
10
9
  export interface PlaceholderOptions {
11
- emptyEditorClass: string;
12
- emptyNodeClass: string;
13
- isFilterClass: string;
14
- hasAnchorClass: string;
15
- placeholder: ((PlaceholderProps: {
16
- editor: Editor;
17
- node: ProsemirrorNode;
18
- pos: number;
19
- hasAnchor: boolean;
20
- }) => string) | string;
21
- showOnlyWhenEditable: boolean;
22
- showOnlyCurrent: boolean;
23
- includeChildren: boolean;
10
+ placeholders: Record<string | "default", string>;
24
11
  }
25
12
  export declare const Placeholder: Extension<PlaceholderOptions, any>;
@@ -1,11 +1,12 @@
1
1
  import { PluginView } from "@tiptap/pm/state";
2
2
  import { Plugin, PluginKey } from "prosemirror-state";
3
3
  import { EditorView } from "prosemirror-view";
4
+ import { Block } from "../../blocks/defaultBlocks";
4
5
  import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
5
- import { BaseUiElementState } from "../../extensions-shared/BaseUiElementTypes";
6
- import { Block, BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
6
+ import { UiElementPosition } from "../../extensions-shared/UiElementPosition";
7
+ import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
7
8
  import { EventEmitter } from "../../util/EventEmitter";
8
- export type SideMenuState<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = BaseUiElementState & {
9
+ export type SideMenuState<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = UiElementPosition & {
9
10
  block: Block<BSchema, I, S>;
10
11
  };
11
12
  export declare function getDraggableBlockFromCoords(coords: {
@@ -18,14 +19,14 @@ export declare function getDraggableBlockFromCoords(coords: {
18
19
  export declare class SideMenuView<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> implements PluginView {
19
20
  private readonly editor;
20
21
  private readonly pmView;
21
- private readonly updateSideMenu;
22
- private sideMenuState?;
22
+ private state?;
23
+ private readonly emitUpdate;
23
24
  private horizontalPosAnchoredAtRoot;
24
25
  private horizontalPosAnchor;
25
26
  private hoveredBlock;
26
27
  isDragging: boolean;
27
28
  menuFrozen: boolean;
28
- constructor(editor: BlockNoteEditor<BSchema, I, S>, pmView: EditorView, updateSideMenu: (sideMenuState: SideMenuState<BSchema, I, S>) => void);
29
+ constructor(editor: BlockNoteEditor<BSchema, I, S>, pmView: EditorView, emitUpdate: (state: SideMenuState<BSchema, I, S>) => void);
29
30
  /**
30
31
  * Sets isDragging when dragging text.
31
32
  */
@@ -52,7 +53,7 @@ export declare class SideMenuView<BSchema extends BlockSchema, I extends InlineC
52
53
  export declare const sideMenuPluginKey: PluginKey<any>;
53
54
  export declare class SideMenuProsemirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends EventEmitter<any> {
54
55
  private readonly editor;
55
- private sideMenuView;
56
+ view: SideMenuView<BSchema, I, S> | undefined;
56
57
  readonly plugin: Plugin;
57
58
  constructor(editor: BlockNoteEditor<BSchema, I, S>);
58
59
  onUpdate(callback: (state: SideMenuState<BSchema, I, S>) => void): () => void;
@@ -0,0 +1,8 @@
1
+ export type DefaultSuggestionItem = {
2
+ title: string;
3
+ onItemClick: () => void;
4
+ subtext?: string;
5
+ badge?: string;
6
+ aliases?: string[];
7
+ group?: string;
8
+ };
@@ -0,0 +1,31 @@
1
+ import { Plugin, PluginKey } from "prosemirror-state";
2
+ import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
3
+ import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
4
+ import { UiElementPosition } from "../../extensions-shared/UiElementPosition";
5
+ import { EventEmitter } from "../../util/EventEmitter";
6
+ export type SuggestionMenuState = UiElementPosition & {
7
+ query: string;
8
+ };
9
+ export declare const suggestionMenuPluginKey: PluginKey<any>;
10
+ /**
11
+ * A ProseMirror plugin for suggestions, designed to make '/'-commands possible as well as mentions.
12
+ *
13
+ * This is basically a simplified version of TipTap's [Suggestions](https://github.com/ueberdosis/tiptap/tree/db92a9b313c5993b723c85cd30256f1d4a0b65e1/packages/suggestion) plugin.
14
+ *
15
+ * This version is adapted from the aforementioned version in the following ways:
16
+ * - This version supports generic items instead of only strings (to allow for more advanced filtering for example)
17
+ * - This version hides some unnecessary complexity from the user of the plugin.
18
+ * - This version handles key events differently
19
+ */
20
+ export declare class SuggestionMenuProseMirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends EventEmitter<any> {
21
+ private view;
22
+ readonly plugin: Plugin;
23
+ private triggerCharacters;
24
+ constructor(editor: BlockNoteEditor<BSchema, I, S>);
25
+ onUpdate(triggerCharacter: string, callback: (state: SuggestionMenuState) => void): () => void;
26
+ addTriggerCharacter: (triggerCharacter: string) => void;
27
+ removeTriggerCharacter: (triggerCharacter: string) => void;
28
+ closeMenu: () => void;
29
+ clearQuery: () => void;
30
+ }
31
+ export declare function createSuggestionMenu<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, triggerCharacter: string): void;
@@ -0,0 +1,10 @@
1
+ import { Block, PartialBlock } from "../../blocks/defaultBlocks";
2
+ import { BlockNoteEditor } from "../../editor/BlockNoteEditor";
3
+ import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
4
+ import { DefaultSuggestionItem } from "./DefaultSuggestionItem";
5
+ export declare function insertOrUpdateBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, block: PartialBlock<BSchema, I, S>): Block<BSchema, I, S>;
6
+ export declare function getDefaultSlashMenuItems<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>): DefaultSuggestionItem[];
7
+ export declare function filterSuggestionItems<T extends {
8
+ title: string;
9
+ aliases?: readonly string[];
10
+ }>(items: T[], query: string): T[];