@blocknote/core 0.8.5 → 0.9.2

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 (65) hide show
  1. package/dist/blocknote.js +705 -572
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +5 -4
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/package.json +2 -2
  7. package/src/BlockNoteEditor.ts +13 -17
  8. package/src/BlockNoteExtensions.ts +42 -27
  9. package/src/api/blockManipulation/blockManipulation.test.ts +2 -2
  10. package/src/api/blockManipulation/blockManipulation.ts +1 -1
  11. package/src/api/formatConversions/formatConversions.test.ts +2 -2
  12. package/src/api/formatConversions/formatConversions.ts +47 -3
  13. package/src/api/nodeConversions/nodeConversions.test.ts +6 -6
  14. package/src/api/nodeConversions/nodeConversions.ts +6 -6
  15. package/src/editor.module.css +0 -11
  16. package/src/extensions/Blocks/PreviousBlockTypePlugin.ts +2 -2
  17. package/src/extensions/Blocks/api/block.ts +55 -22
  18. package/src/extensions/Blocks/api/blockTypes.ts +22 -3
  19. package/src/extensions/Blocks/helpers/getBlockInfoFromPos.ts +27 -5
  20. package/src/extensions/Blocks/index.ts +7 -12
  21. package/src/extensions/Blocks/nodes/Block.module.css +1 -1
  22. package/src/extensions/Blocks/nodes/BlockContainer.ts +20 -19
  23. package/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.ts +20 -2
  24. package/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +20 -2
  25. package/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +20 -2
  26. package/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.ts +29 -6
  27. package/src/extensions/Blocks/nodes/BlockGroup.ts +19 -11
  28. package/src/extensions/SideMenu/MultipleNodeSelection.ts +3 -3
  29. package/src/extensions/SideMenu/SideMenuPlugin.ts +9 -9
  30. package/src/extensions/UniqueID/UniqueID.ts +10 -9
  31. package/src/index.ts +1 -0
  32. package/src/shared/EventEmitter.ts +1 -0
  33. package/src/shared/plugins/suggestion/SuggestionPlugin.ts +6 -2
  34. package/src/shared/utils.ts +4 -0
  35. package/types/src/BlockNoteEditor.d.ts +4 -10
  36. package/types/src/BlockNoteExtensions.d.ts +2 -0
  37. package/types/src/extensions/Blocks/api/block.d.ts +6 -1
  38. package/types/src/extensions/Blocks/api/blockTypes.d.ts +15 -3
  39. package/types/src/extensions/Blocks/api/defaultBlocks.d.ts +36 -4
  40. package/types/src/extensions/Blocks/helpers/getBlockInfoFromPos.d.ts +9 -1
  41. package/types/src/extensions/Blocks/index.d.ts +4 -1
  42. package/types/src/extensions/Blocks/nodes/BlockContainer.d.ts +9 -4
  43. package/types/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.d.ts +9 -1
  44. package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.d.ts +9 -1
  45. package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +9 -1
  46. package/types/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.d.ts +9 -1
  47. package/types/src/extensions/Blocks/nodes/BlockGroup.d.ts +9 -1
  48. package/types/src/extensions/Blocks/nodes/TableCell.d.ts +5 -0
  49. package/types/src/extensions/Blocks/nodes/TableRow.d.ts +5 -0
  50. package/types/src/extensions/SideMenu/MultipleNodeSelection.d.ts +1 -1
  51. package/types/src/index.d.ts +1 -0
  52. package/types/src/shared/utils.d.ts +1 -0
  53. package/src/node_modules/.vitest/results.json +0 -1
  54. package/types/src/EventEmitter.d.ts +0 -11
  55. package/types/src/extensions/DraggableBlocks/BlockSideMenuFactoryTypes.d.ts +0 -0
  56. package/types/src/extensions/DraggableBlocks/DraggableBlocksExtension.d.ts +0 -16
  57. package/types/src/extensions/DraggableBlocks/DraggableBlocksPlugin.d.ts +0 -55
  58. package/types/src/extensions/DraggableBlocks/MultipleNodeSelection.d.ts +0 -24
  59. package/types/src/extensions/FormattingToolbar/FormattingToolbarExtension.d.ts +0 -11
  60. package/types/src/extensions/FormattingToolbar/FormattingToolbarFactoryTypes.d.ts +0 -10
  61. package/types/src/extensions/HyperlinkToolbar/HyperlinkMark.d.ts +0 -8
  62. package/types/src/extensions/HyperlinkToolbar/HyperlinkToolbarFactoryTypes.d.ts +0 -0
  63. package/types/src/extensions/SlashMenu/SlashMenuExtension.d.ts +0 -13
  64. package/types/src/extensions/SlashMenu/index.d.ts +0 -3
  65. package/types/src/shared/plugins/suggestion/SuggestionsMenuFactoryTypes.d.ts +0 -12
@@ -3,10 +3,22 @@ import { Node, NodeConfig } from "@tiptap/core";
3
3
  import { BlockNoteEditor } from "../../../BlockNoteEditor";
4
4
  import { InlineContent, PartialInlineContent } from "./inlineContentTypes";
5
5
  import { DefaultBlockSchema } from "./defaultBlocks";
6
- export type TipTapNodeConfig<Name extends string, Options = any, Storage = any> = {
6
+ export type BlockNoteDOMElement = "editor" | "blockContainer" | "blockGroup" | "blockContent" | "inlineContent";
7
+ export type BlockNoteDOMAttributes = Partial<{
8
+ [DOMElement in BlockNoteDOMElement]: Record<string, string>;
9
+ }>;
10
+ export type TipTapNodeConfig<Name extends string, Options extends {
11
+ domAttributes?: BlockNoteDOMAttributes;
12
+ } = {
13
+ domAttributes?: BlockNoteDOMAttributes;
14
+ }, Storage = any> = {
7
15
  [K in keyof NodeConfig<Options, Storage>]: K extends "name" ? Name : K extends "group" ? never : NodeConfig<Options, Storage>[K];
8
16
  };
9
- export type TipTapNode<Name extends string, Options = any, Storage = any> = Node<Options, Storage> & {
17
+ export type TipTapNode<Name extends string, Options extends {
18
+ domAttributes?: BlockNoteDOMAttributes;
19
+ } = {
20
+ domAttributes?: BlockNoteDOMAttributes;
21
+ }, Storage = any> = Node<Options, Storage> & {
10
22
  name: Name;
11
23
  group: "blockContent";
12
24
  };
@@ -45,7 +57,7 @@ export type BlockConfig<Type extends string, PSchema extends PropSchema, Contain
45
57
  };
46
58
  export type BlockSpec<Type extends string, PSchema extends PropSchema> = {
47
59
  readonly propSchema: PSchema;
48
- node: TipTapNode<Type>;
60
+ node: TipTapNode<Type, any>;
49
61
  };
50
62
  export type TypesMatch<Blocks extends Record<string, BlockSpec<string, PropSchema>>> = Blocks extends {
51
63
  [Type in keyof Blocks]: Type extends string ? Blocks[Type] extends BlockSpec<Type, PropSchema> ? Blocks[Type] : never : never;
@@ -26,7 +26,15 @@ export declare const defaultBlockSchema: {
26
26
  values: readonly ["left", "center", "right", "justify"];
27
27
  };
28
28
  };
29
- readonly node: import("./blockTypes").TipTapNode<"paragraph">;
29
+ readonly node: import("./blockTypes").TipTapNode<"paragraph", {
30
+ domAttributes?: Partial<{
31
+ blockContainer: Record<string, string>;
32
+ blockGroup: Record<string, string>;
33
+ editor: Record<string, string>;
34
+ blockContent: Record<string, string>;
35
+ inlineContent: Record<string, string>;
36
+ }> | undefined;
37
+ }, any>;
30
38
  };
31
39
  readonly heading: {
32
40
  readonly propSchema: {
@@ -45,7 +53,15 @@ export declare const defaultBlockSchema: {
45
53
  values: readonly ["left", "center", "right", "justify"];
46
54
  };
47
55
  };
48
- readonly node: import("./blockTypes").TipTapNode<"heading">;
56
+ readonly node: import("./blockTypes").TipTapNode<"heading", {
57
+ domAttributes?: Partial<{
58
+ blockContainer: Record<string, string>;
59
+ blockGroup: Record<string, string>;
60
+ editor: Record<string, string>;
61
+ blockContent: Record<string, string>;
62
+ inlineContent: Record<string, string>;
63
+ }> | undefined;
64
+ }, any>;
49
65
  };
50
66
  readonly bulletListItem: {
51
67
  readonly propSchema: {
@@ -60,7 +76,15 @@ export declare const defaultBlockSchema: {
60
76
  values: readonly ["left", "center", "right", "justify"];
61
77
  };
62
78
  };
63
- readonly node: import("./blockTypes").TipTapNode<"bulletListItem">;
79
+ readonly node: import("./blockTypes").TipTapNode<"bulletListItem", {
80
+ domAttributes?: Partial<{
81
+ blockContainer: Record<string, string>;
82
+ blockGroup: Record<string, string>;
83
+ editor: Record<string, string>;
84
+ blockContent: Record<string, string>;
85
+ inlineContent: Record<string, string>;
86
+ }> | undefined;
87
+ }, any>;
64
88
  };
65
89
  readonly numberedListItem: {
66
90
  readonly propSchema: {
@@ -75,7 +99,15 @@ export declare const defaultBlockSchema: {
75
99
  values: readonly ["left", "center", "right", "justify"];
76
100
  };
77
101
  };
78
- readonly node: import("./blockTypes").TipTapNode<"numberedListItem">;
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>;
79
111
  };
80
112
  };
81
113
  export type DefaultBlockSchema = TypesMatch<typeof defaultBlockSchema>;
@@ -1,14 +1,22 @@
1
1
  import { Node, NodeType } from "prosemirror-model";
2
- export type BlockInfo = {
2
+ export type BlockInfoWithoutPositions = {
3
3
  id: string;
4
4
  node: Node;
5
5
  contentNode: Node;
6
6
  contentType: NodeType;
7
7
  numChildBlocks: number;
8
+ };
9
+ export type BlockInfo = BlockInfoWithoutPositions & {
8
10
  startPos: number;
9
11
  endPos: number;
10
12
  depth: number;
11
13
  };
14
+ /**
15
+ * Helper function for `getBlockInfoFromPos`, returns information regarding
16
+ * provided blockContainer node.
17
+ * @param blockContainer The blockContainer node to retrieve info for.
18
+ */
19
+ export declare function getBlockInfo(blockContainer: Node): BlockInfoWithoutPositions;
12
20
  /**
13
21
  * Retrieves information regarding the nearest blockContainer node in a
14
22
  * ProseMirror doc, relative to a position.
@@ -1 +1,4 @@
1
- export declare const blocks: any[];
1
+ import { Node } from "@tiptap/core";
2
+ export { BlockContainer } from "./nodes/BlockContainer";
3
+ export { BlockGroup } from "./nodes/BlockGroup";
4
+ export declare const Doc: Node<any, any>;
@@ -1,8 +1,5 @@
1
1
  import { Node } from "@tiptap/core";
2
2
  import { BlockSchema, PartialBlock } from "../api/blockTypes";
3
- export interface IBlock {
4
- HTMLAttributes: Record<string, any>;
5
- }
6
3
  declare module "@tiptap/core" {
7
4
  interface Commands<ReturnType> {
8
5
  block: {
@@ -18,4 +15,12 @@ declare module "@tiptap/core" {
18
15
  /**
19
16
  * The main "Block node" documents consist of
20
17
  */
21
- export declare const BlockContainer: Node<IBlock, any>;
18
+ export declare const BlockContainer: Node<{
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>;
@@ -1 +1,9 @@
1
- export declare const HeadingBlockContent: import("../../../api/blockTypes").TipTapNode<"heading">;
1
+ export declare const HeadingBlockContent: import("../../../api/blockTypes").TipTapNode<"heading", {
2
+ domAttributes?: Partial<{
3
+ blockContainer: Record<string, string>;
4
+ blockGroup: Record<string, string>;
5
+ editor: Record<string, string>;
6
+ blockContent: Record<string, string>;
7
+ inlineContent: Record<string, string>;
8
+ }> | undefined;
9
+ }, any>;
@@ -1 +1,9 @@
1
- export declare const BulletListItemBlockContent: import("../../../../api/blockTypes").TipTapNode<"bulletListItem">;
1
+ export declare const BulletListItemBlockContent: import("../../../../api/blockTypes").TipTapNode<"bulletListItem", {
2
+ domAttributes?: Partial<{
3
+ blockContainer: Record<string, string>;
4
+ blockGroup: Record<string, string>;
5
+ editor: Record<string, string>;
6
+ blockContent: Record<string, string>;
7
+ inlineContent: Record<string, string>;
8
+ }> | undefined;
9
+ }, any>;
@@ -1 +1,9 @@
1
- export declare const NumberedListItemBlockContent: import("../../../../api/blockTypes").TipTapNode<"numberedListItem">;
1
+ export declare const NumberedListItemBlockContent: import("../../../../api/blockTypes").TipTapNode<"numberedListItem", {
2
+ domAttributes?: Partial<{
3
+ blockContainer: Record<string, string>;
4
+ blockGroup: Record<string, string>;
5
+ editor: Record<string, string>;
6
+ blockContent: Record<string, string>;
7
+ inlineContent: Record<string, string>;
8
+ }> | undefined;
9
+ }, any>;
@@ -1 +1,9 @@
1
- export declare const ParagraphBlockContent: import("../../../api/blockTypes").TipTapNode<"paragraph">;
1
+ export declare const ParagraphBlockContent: import("../../../api/blockTypes").TipTapNode<"paragraph", {
2
+ domAttributes?: Partial<{
3
+ blockContainer: Record<string, string>;
4
+ blockGroup: Record<string, string>;
5
+ editor: Record<string, string>;
6
+ blockContent: Record<string, string>;
7
+ inlineContent: Record<string, string>;
8
+ }> | undefined;
9
+ }, any>;
@@ -1,2 +1,10 @@
1
1
  import { Node } from "@tiptap/core";
2
- export declare const BlockGroup: Node<any, any>;
2
+ export declare const BlockGroup: Node<{
3
+ domAttributes?: Partial<{
4
+ blockContainer: Record<string, string>;
5
+ blockGroup: Record<string, string>;
6
+ editor: Record<string, string>;
7
+ blockContent: Record<string, string>;
8
+ inlineContent: Record<string, string>;
9
+ }> | undefined;
10
+ }, any>;
@@ -0,0 +1,5 @@
1
+ import { Node } from "@tiptap/core";
2
+ export interface TableCellOptions {
3
+ HTMLAttributes: Record<string, any>;
4
+ }
5
+ export declare const TableCell: Node<TableCellOptions, any>;
@@ -0,0 +1,5 @@
1
+ import { Node } from "@tiptap/core";
2
+ export interface TableRowOptions {
3
+ HTMLAttributes: Record<string, any>;
4
+ }
5
+ export declare const TableRow: Node<TableRowOptions, any>;
@@ -1,5 +1,5 @@
1
- import { Selection } from "prosemirror-state";
2
1
  import { Node, ResolvedPos, Slice } from "prosemirror-model";
2
+ import { Selection } from "prosemirror-state";
3
3
  import { Mappable } from "prosemirror-transform";
4
4
  /**
5
5
  * This class represents an editor selection which spans multiple nodes/blocks. It's currently only used to allow users
@@ -15,3 +15,4 @@ export { getDefaultSlashMenuItems } from "./extensions/SlashMenu/defaultSlashMen
15
15
  export * from "./shared/BaseUiElementTypes";
16
16
  export type { SuggestionItem } from "./shared/plugins/suggestion/SuggestionItem";
17
17
  export * from "./shared/plugins/suggestion/SuggestionPlugin";
18
+ export * from "./shared/utils";
@@ -1,5 +1,6 @@
1
1
  export declare const isAppleOS: () => boolean;
2
2
  export declare function formatKeyboardShortcut(shortcut: string): string;
3
+ export declare function mergeCSSClasses(...classes: string[]): string;
3
4
  export declare class UnreachableCaseError extends Error {
4
5
  constructor(val: never);
5
6
  }
@@ -1 +0,0 @@
1
- {"version":"0.28.5","results":[["/api/formatConversions/formatConversions.test.ts",{"duration":109,"failed":false}],["/api/nodeConversions/nodeConversions.test.ts",{"duration":32,"failed":false}],["/api/blockManipulation/blockManipulation.test.ts",{"duration":38,"failed":false}],["/BlockNoteEditor.test.ts",{"duration":4,"failed":false}]]}
@@ -1,11 +0,0 @@
1
- type StringKeyOf<T> = Extract<keyof T, string>;
2
- type CallbackType<T extends Record<string, any>, EventName extends StringKeyOf<T>> = T[EventName] extends any[] ? T[EventName] : [T[EventName]];
3
- type CallbackFunction<T extends Record<string, any>, EventName extends StringKeyOf<T>> = (...props: CallbackType<T, EventName>) => any;
4
- export declare class EventEmitter<T extends Record<string, any>> {
5
- private callbacks;
6
- on<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
7
- protected emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this;
8
- off<EventName extends StringKeyOf<T>>(event: EventName, fn?: CallbackFunction<T, EventName>): this;
9
- protected removeAllListeners(): void;
10
- }
11
- export {};
@@ -1,16 +0,0 @@
1
- import { Editor, Extension } from "@tiptap/core";
2
- import { BlockSideMenuFactory } from "./BlockSideMenuFactoryTypes";
3
- import { BlockNoteEditor } from "../../BlockNoteEditor";
4
- import { BlockSchema } from "../Blocks/api/blockTypes";
5
- export type DraggableBlocksOptions<BSchema extends BlockSchema> = {
6
- tiptapEditor: Editor;
7
- editor: BlockNoteEditor<BSchema>;
8
- blockSideMenuFactory: BlockSideMenuFactory<BSchema>;
9
- };
10
- /**
11
- * This extension adds a menu to the side of blocks which features various BlockNote functions such as adding and
12
- * removing blocks. More importantly, it adds a drag handle which allows the user to drag and drop blocks.
13
- *
14
- * code based on https://github.com/ueberdosis/tiptap/issues/323#issuecomment-506637799
15
- */
16
- export declare const createDraggableBlocksExtension: <BSchema extends Record<string, import("../Blocks/api/blockTypes").BlockSpec<string, import("../Blocks/api/blockTypes").PropSchema>>>() => Extension<DraggableBlocksOptions<BSchema>, any>;
@@ -1,55 +0,0 @@
1
- import { PluginView } from "@tiptap/pm/state";
2
- import { Plugin, PluginKey } from "prosemirror-state";
3
- import { BlockNoteEditor } from "../../BlockNoteEditor";
4
- import { BaseUiElementCallbacks, BaseUiElementState } from "../../shared/BaseUiElementTypes";
5
- import { Block, BlockSchema } from "../Blocks/api/blockTypes";
6
- import { Editor } from "@tiptap/core";
7
- export type SideMenuCallbacks = BaseUiElementCallbacks & {
8
- addBlock: () => void;
9
- freezeMenu: () => void;
10
- unfreezeMenu: () => void;
11
- blockDragStart: (event: DragEvent) => void;
12
- blockDragEnd: () => void;
13
- };
14
- export type SideMenuState<BSchema extends BlockSchema> = BaseUiElementState & {
15
- block: Block<BSchema>;
16
- };
17
- export declare class SideMenuView<BSchema extends BlockSchema> implements PluginView {
18
- editor: BlockNoteEditor<BSchema>;
19
- ttEditor: Editor;
20
- private sideMenuState?;
21
- updateSideMenu: () => void;
22
- horizontalPosAnchoredAtRoot: boolean;
23
- horizontalPosAnchor: number;
24
- hoveredBlock: HTMLElement | undefined;
25
- isDragging: boolean;
26
- menuFrozen: boolean;
27
- constructor(editor: BlockNoteEditor<BSchema>, tiptapEditor: Editor, updateSideMenu: (sideMenuState: SideMenuState<BSchema>) => void);
28
- /**
29
- * Sets isDragging when dragging text.
30
- */
31
- onDragStart: () => void;
32
- /**
33
- * If the event is outside the editor contents,
34
- * we dispatch a fake event, so that we can still drop the content
35
- * when dragging / dropping to the side of the editor
36
- */
37
- onDrop: (event: DragEvent) => void;
38
- /**
39
- * If the event is outside the editor contents,
40
- * we dispatch a fake event, so that we can still drop the content
41
- * when dragging / dropping to the side of the editor
42
- */
43
- onDragOver: (event: DragEvent) => void;
44
- onKeyDown: (_event: KeyboardEvent) => void;
45
- onMouseDown: (_event: MouseEvent) => void;
46
- onMouseMove: (event: MouseEvent) => void;
47
- onScroll: () => void;
48
- destroy(): void;
49
- addBlock(): void;
50
- }
51
- export declare const sideMenuPluginKey: PluginKey<any>;
52
- export declare function setupSideMenu<BSchema extends BlockSchema>(editor: BlockNoteEditor<BSchema>, tiptapEditor: Editor, updateSideMenu: (sideMenuState: SideMenuState<BSchema>) => void): {
53
- plugin: Plugin;
54
- callbacks: Omit<SideMenuCallbacks, "destroy">;
55
- };
@@ -1,24 +0,0 @@
1
- import { Selection } from "prosemirror-state";
2
- import { Node, ResolvedPos, Slice } from "prosemirror-model";
3
- import { Mappable } from "prosemirror-transform";
4
- /**
5
- * This class represents an editor selection which spans multiple nodes/blocks. It's currently only used to allow users
6
- * to drag multiple blocks at the same time. Expects the selection anchor and head to be between nodes, i.e. just before
7
- * the first target node and just after the last, and that anchor and head are at the same nesting level.
8
- *
9
- * Partially based on ProseMirror's NodeSelection implementation:
10
- * (https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.ts)
11
- * MultipleNodeSelection differs from NodeSelection in the following ways:
12
- * 1. Stores which nodes are included in the selection instead of just a single node.
13
- * 2. Already expects the selection to start just before the first target node and ends just after the last, while a
14
- * NodeSelection automatically sets both anchor and head to just before the single target node.
15
- */
16
- export declare class MultipleNodeSelection extends Selection {
17
- nodes: Array<Node>;
18
- constructor($anchor: ResolvedPos, $head: ResolvedPos);
19
- static create(doc: Node, from: number, to?: number): MultipleNodeSelection;
20
- content(): Slice;
21
- eq(selection: Selection): boolean;
22
- map(doc: Node, mapping: Mappable): Selection;
23
- toJSON(): any;
24
- }
@@ -1,11 +0,0 @@
1
- import { Extension } from "@tiptap/core";
2
- import { BlockNoteEditor, BlockSchema } from "../..";
3
- import { FormattingToolbarFactory } from "./FormattingToolbarFactoryTypes";
4
- export type FormattingToolbarOptions<BSchema extends BlockSchema> = {
5
- formattingToolbarFactory: FormattingToolbarFactory<BSchema>;
6
- editor: BlockNoteEditor<BSchema>;
7
- };
8
- /**
9
- * The menu that is displayed when selecting a piece of text.
10
- */
11
- export declare const createFormattingToolbarExtension: <BSchema extends Record<string, import("../..").BlockSpec<string, import("../..").PropSchema>>>() => Extension<FormattingToolbarOptions<BSchema>, any>;
@@ -1,10 +0,0 @@
1
- import { EditorElement, ElementFactory } from "../../shared/EditorElement";
2
- import { BlockNoteEditor } from "../../BlockNoteEditor";
3
- import { BlockSchema } from "../Blocks/api/blockTypes";
4
- export type FormattingToolbarStaticParams<BSchema extends BlockSchema> = {
5
- editor: BlockNoteEditor<BSchema>;
6
- getReferenceRect: () => DOMRect;
7
- };
8
- export type FormattingToolbarDynamicParams = {};
9
- export type FormattingToolbar = EditorElement<FormattingToolbarDynamicParams>;
10
- export type FormattingToolbarFactory<BSchema extends BlockSchema> = ElementFactory<FormattingToolbarStaticParams<BSchema>, FormattingToolbarDynamicParams>;
@@ -1,8 +0,0 @@
1
- import { HyperlinkToolbarPluginProps } from "./HyperlinkToolbarPlugin";
2
- /**
3
- * This custom link includes a special menu for editing/deleting/opening the link.
4
- * The menu will be triggered by hovering over the link with the mouse,
5
- * or by moving the cursor inside the link text
6
- */
7
- declare const Hyperlink: import("@tiptap/core").Mark<HyperlinkToolbarPluginProps, any>;
8
- export default Hyperlink;
@@ -1,13 +0,0 @@
1
- import { Extension } from "@tiptap/core";
2
- import { PluginKey } from "prosemirror-state";
3
- import { SuggestionsMenuFactory } from "../../shared/plugins/suggestion/SuggestionsMenuFactoryTypes";
4
- import { BaseSlashMenuItem } from "./BaseSlashMenuItem";
5
- import { BlockNoteEditor } from "../../BlockNoteEditor";
6
- import { BlockSchema } from "../Blocks/api/blockTypes";
7
- export type SlashMenuOptions<BSchema extends BlockSchema> = {
8
- editor: BlockNoteEditor<BSchema> | undefined;
9
- commands: BaseSlashMenuItem<BSchema>[] | undefined;
10
- slashMenuFactory: SuggestionsMenuFactory<any> | undefined;
11
- };
12
- export declare const SlashMenuPluginKey: PluginKey<any>;
13
- export declare const createSlashMenuExtension: <BSchema extends Record<string, import("../Blocks/api/blockTypes").BlockSpec<string, import("../Blocks/api/blockTypes").PropSchema>>>() => Extension<SlashMenuOptions<BSchema>, any>;
@@ -1,3 +0,0 @@
1
- import { getDefaultSlashMenuItems } from "./defaultSlashMenuItems";
2
- import { BaseSlashMenuItem } from "./BaseSlashMenuItem";
3
- export { getDefaultSlashMenuItems, BaseSlashMenuItem };
@@ -1,12 +0,0 @@
1
- import { EditorElement, ElementFactory } from "../../EditorElement";
2
- import { SuggestionItem } from "./SuggestionItem";
3
- export type SuggestionsMenuStaticParams<T extends SuggestionItem> = {
4
- itemCallback: (item: T) => void;
5
- getReferenceRect: () => DOMRect;
6
- };
7
- export type SuggestionsMenuDynamicParams<T extends SuggestionItem> = {
8
- items: T[];
9
- keyboardHoveredItemIndex: number;
10
- };
11
- export type SuggestionsMenu<T extends SuggestionItem> = EditorElement<SuggestionsMenuDynamicParams<T>>;
12
- export type SuggestionsMenuFactory<T extends SuggestionItem> = ElementFactory<SuggestionsMenuStaticParams<T>, SuggestionsMenuDynamicParams<T>>;