@blocknote/core 0.42.2 → 0.43.0

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 (200) hide show
  1. package/dist/BlockNoteExtension-BWw0r8Gy.cjs +2 -0
  2. package/dist/BlockNoteExtension-BWw0r8Gy.cjs.map +1 -0
  3. package/dist/BlockNoteExtension-C2X7LW-V.js +25 -0
  4. package/dist/BlockNoteExtension-C2X7LW-V.js.map +1 -0
  5. package/dist/BlockNoteSchema-CbSavEwr.js +270 -0
  6. package/dist/BlockNoteSchema-CbSavEwr.js.map +1 -0
  7. package/dist/BlockNoteSchema-D8TyvlfU.cjs +2 -0
  8. package/dist/BlockNoteSchema-D8TyvlfU.cjs.map +1 -0
  9. package/dist/EventEmitter-CLwfmbqG.cjs +2 -0
  10. package/dist/EventEmitter-CLwfmbqG.cjs.map +1 -0
  11. package/dist/EventEmitter-CjSwpTbz.js +27 -0
  12. package/dist/EventEmitter-CjSwpTbz.js.map +1 -0
  13. package/dist/ShowSelection-BW37oJ6h.cjs +2 -0
  14. package/dist/ShowSelection-BW37oJ6h.cjs.map +1 -0
  15. package/dist/ShowSelection-Dz-NEase.js +43 -0
  16. package/dist/ShowSelection-Dz-NEase.js.map +1 -0
  17. package/dist/TrailingNode-BUhuMJrB.js +2096 -0
  18. package/dist/TrailingNode-BUhuMJrB.js.map +1 -0
  19. package/dist/TrailingNode-CaT_wbho.cjs +2 -0
  20. package/dist/TrailingNode-CaT_wbho.cjs.map +1 -0
  21. package/dist/{blockToNode-DIfPWLH8.js → blockToNode-DBNbhwwC.js} +33 -33
  22. package/dist/blockToNode-DBNbhwwC.js.map +1 -0
  23. package/dist/blockToNode-w7H99R6p.cjs.map +1 -1
  24. package/dist/blocknote.cjs +4 -4
  25. package/dist/blocknote.cjs.map +1 -1
  26. package/dist/blocknote.js +2401 -5592
  27. package/dist/blocknote.js.map +1 -1
  28. package/dist/blocks.cjs +1 -1
  29. package/dist/blocks.js +71 -70
  30. package/dist/blocks.js.map +1 -1
  31. package/dist/comments.cjs +1 -1
  32. package/dist/comments.cjs.map +1 -1
  33. package/dist/comments.js +451 -137
  34. package/dist/comments.js.map +1 -1
  35. package/dist/{BlockNoteSchema-Bi-eeHal.js → defaultBlocks-BJtxTOM2.js} +991 -1047
  36. package/dist/defaultBlocks-BJtxTOM2.js.map +1 -0
  37. package/dist/defaultBlocks-BxFclIGP.cjs +6 -0
  38. package/dist/defaultBlocks-BxFclIGP.cjs.map +1 -0
  39. package/dist/extensions.cjs +2 -0
  40. package/dist/extensions.cjs.map +1 -0
  41. package/dist/extensions.js +57 -0
  42. package/dist/extensions.js.map +1 -0
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/dist/webpack-stats.json +1 -1
  45. package/dist/yjs.js +1 -1
  46. package/package.json +12 -6
  47. package/src/api/nodeConversions/blockToNode.ts +1 -1
  48. package/src/api/nodeConversions/nodeToBlock.ts +1 -1
  49. package/src/blocks/Code/block.ts +4 -4
  50. package/src/blocks/Divider/block.ts +2 -2
  51. package/src/blocks/File/helpers/render/createAddFileButton.ts +7 -5
  52. package/src/blocks/Heading/block.ts +23 -20
  53. package/src/blocks/ListItem/BulletListItem/block.ts +2 -2
  54. package/src/blocks/ListItem/CheckListItem/block.ts +2 -2
  55. package/src/blocks/ListItem/NumberedListItem/block.ts +3 -3
  56. package/src/blocks/ListItem/ToggleListItem/block.ts +2 -2
  57. package/src/blocks/PageBreak/getPageBreakSlashMenuItems.ts +2 -2
  58. package/src/blocks/Paragraph/block.ts +2 -2
  59. package/src/blocks/Quote/block.ts +2 -2
  60. package/src/blocks/Table/block.ts +4 -3
  61. package/src/blocks/ToggleWrapper/createToggleWrapper.ts +2 -1
  62. package/src/comments/extension.ts +353 -0
  63. package/src/comments/index.ts +2 -1
  64. package/src/comments/types.ts +8 -0
  65. package/src/{extensions/Comments → comments}/userstore/UserStore.ts +2 -2
  66. package/src/editor/BlockNoteEditor.test.ts +2 -23
  67. package/src/editor/BlockNoteEditor.ts +66 -453
  68. package/src/editor/BlockNoteExtension.test.ts +103 -0
  69. package/src/editor/BlockNoteExtension.ts +174 -56
  70. package/src/editor/managers/EventManager.ts +64 -35
  71. package/src/editor/managers/ExtensionManager/extensions.ts +214 -0
  72. package/src/editor/managers/ExtensionManager/index.ts +514 -0
  73. package/src/editor/managers/ExtensionManager/symbol.ts +6 -0
  74. package/src/editor/managers/SelectionManager.ts +5 -1
  75. package/src/editor/managers/StateManager.ts +29 -17
  76. package/src/editor/managers/index.ts +1 -5
  77. package/src/extensions/BlockChange/{BlockChangePlugin.ts → BlockChange.ts} +27 -29
  78. package/src/extensions/Collaboration/{ForkYDocPlugin.test.ts → ForkYDoc.test.ts} +6 -5
  79. package/src/extensions/Collaboration/ForkYDoc.ts +158 -0
  80. package/src/extensions/Collaboration/YCursorPlugin.ts +183 -0
  81. package/src/extensions/Collaboration/YSync.ts +16 -0
  82. package/src/extensions/Collaboration/YUndo.ts +12 -0
  83. package/src/extensions/Collaboration/schemaMigration/SchemaMigration.ts +59 -0
  84. package/src/extensions/DropCursor/DropCursor.ts +26 -0
  85. package/src/extensions/FilePanel/FilePanel.ts +41 -0
  86. package/src/extensions/FormattingToolbar/FormattingToolbar.ts +119 -0
  87. package/src/extensions/History/History.ts +11 -0
  88. package/src/extensions/LinkToolbar/LinkToolbar.ts +121 -0
  89. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.ts +74 -0
  90. package/src/extensions/Placeholder/Placeholder.ts +148 -0
  91. package/src/extensions/PreviousBlockType/{PreviousBlockTypePlugin.ts → PreviousBlockType.ts} +9 -13
  92. package/src/extensions/ShowSelection/{ShowSelectionPlugin.ts → ShowSelection.ts} +27 -33
  93. package/src/extensions/SideMenu/{SideMenuPlugin.ts → SideMenu.ts} +63 -83
  94. package/src/extensions/SuggestionMenu/{SuggestionPlugin.ts → SuggestionMenu.ts} +71 -77
  95. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +29 -44
  96. package/src/extensions/TableHandles/{TableHandlesPlugin.ts → TableHandles.ts} +416 -437
  97. package/src/extensions/TrailingNode/{TrailingNodeExtension.ts → TrailingNode.ts} +8 -17
  98. package/src/extensions/index.ts +24 -0
  99. package/src/extensions/{BackgroundColor → tiptap-extensions/BackgroundColor}/BackgroundColorExtension.ts +1 -1
  100. package/src/extensions/{KeyboardShortcuts → tiptap-extensions/KeyboardShortcuts}/KeyboardShortcutsExtension.ts +21 -16
  101. package/src/extensions/{TextColor → tiptap-extensions/TextColor}/TextColorExtension.ts +1 -1
  102. package/src/extensions/tiptap-extensions/index.ts +31 -0
  103. package/src/index.ts +1 -13
  104. package/src/schema/blocks/createSpec.ts +14 -11
  105. package/src/schema/blocks/internal.ts +2 -2
  106. package/src/schema/blocks/types.ts +8 -5
  107. package/src/schema/schema.ts +11 -36
  108. package/src/util/topo-sort.ts +46 -0
  109. package/types/src/comments/extension.d.ts +70 -0
  110. package/types/src/comments/index.d.ts +2 -1
  111. package/types/src/comments/types.d.ts +8 -0
  112. package/types/src/{extensions/Comments → comments}/userstore/UserStore.d.ts +2 -2
  113. package/types/src/editor/BlockNoteEditor.d.ts +34 -105
  114. package/types/src/editor/BlockNoteExtension.d.ts +87 -22
  115. package/types/src/editor/managers/EventManager.d.ts +25 -16
  116. package/types/src/editor/managers/ExtensionManager/extensions.d.ts +8 -0
  117. package/types/src/editor/managers/ExtensionManager/index.d.ts +83 -0
  118. package/types/src/editor/managers/ExtensionManager/symbol.d.ts +5 -0
  119. package/types/src/editor/managers/StateManager.d.ts +1 -12
  120. package/types/src/editor/managers/index.d.ts +1 -2
  121. package/types/src/extensions/BlockChange/BlockChange.d.ts +16 -0
  122. package/types/src/extensions/Collaboration/ForkYDoc.d.ts +34 -0
  123. package/types/src/extensions/Collaboration/ForkYDoc.test.d.ts +1 -0
  124. package/types/src/extensions/Collaboration/YCursorPlugin.d.ts +24 -0
  125. package/types/src/extensions/Collaboration/YSync.d.ts +8 -0
  126. package/types/src/extensions/Collaboration/YUndo.d.ts +12 -0
  127. package/types/src/extensions/Collaboration/schemaMigration/SchemaMigration.d.ts +8 -0
  128. package/types/src/extensions/DropCursor/DropCursor.d.ts +5 -0
  129. package/types/src/extensions/FilePanel/FilePanel.d.ts +11 -0
  130. package/types/src/extensions/FormattingToolbar/FormattingToolbar.d.ts +9 -0
  131. package/types/src/extensions/History/History.d.ts +6 -0
  132. package/types/src/extensions/LinkToolbar/LinkToolbar.d.ts +24 -0
  133. package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.d.ts +5 -0
  134. package/types/src/extensions/Placeholder/Placeholder.d.ts +6 -0
  135. package/types/src/extensions/PreviousBlockType/{PreviousBlockTypePlugin.d.ts → PreviousBlockType.d.ts} +9 -5
  136. package/types/src/extensions/ShowSelection/ShowSelection.d.ts +21 -0
  137. package/types/src/extensions/SideMenu/{SideMenuPlugin.d.ts → SideMenu.d.ts} +11 -15
  138. package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +54 -0
  139. package/types/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.d.ts +1 -1
  140. package/types/src/extensions/TableHandles/{TableHandlesPlugin.d.ts → TableHandles.d.ts} +28 -31
  141. package/types/src/extensions/TrailingNode/TrailingNode.d.ts +8 -0
  142. package/types/src/extensions/index.d.ts +24 -0
  143. package/types/src/extensions/{KeyboardShortcuts → tiptap-extensions/KeyboardShortcuts}/KeyboardShortcutsExtension.d.ts +1 -1
  144. package/types/src/extensions/tiptap-extensions/index.d.ts +11 -0
  145. package/types/src/index.d.ts +1 -13
  146. package/types/src/schema/blocks/createSpec.d.ts +4 -4
  147. package/types/src/schema/blocks/internal.d.ts +2 -2
  148. package/types/src/schema/blocks/types.d.ts +5 -5
  149. package/types/src/util/topo-sort.d.ts +8 -0
  150. package/dist/BlockNoteSchema-Bi-eeHal.js.map +0 -1
  151. package/dist/BlockNoteSchema-DjDaA2C3.cjs +0 -6
  152. package/dist/BlockNoteSchema-DjDaA2C3.cjs.map +0 -1
  153. package/dist/blockToNode-DIfPWLH8.js.map +0 -1
  154. package/src/comments/models/User.ts +0 -8
  155. package/src/editor/BlockNoteExtensions.ts +0 -325
  156. package/src/editor/managers/CollaborationManager.ts +0 -212
  157. package/src/editor/managers/ExtensionManager.ts +0 -130
  158. package/src/extensions/Collaboration/CursorPlugin.ts +0 -189
  159. package/src/extensions/Collaboration/ForkYDocPlugin.ts +0 -192
  160. package/src/extensions/Collaboration/SyncPlugin.ts +0 -18
  161. package/src/extensions/Collaboration/UndoPlugin.ts +0 -18
  162. package/src/extensions/Collaboration/schemaMigration/SchemaMigrationPlugin.ts +0 -59
  163. package/src/extensions/Comments/CommentsPlugin.ts +0 -392
  164. package/src/extensions/FilePanel/FilePanelPlugin.ts +0 -206
  165. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +0 -363
  166. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +0 -380
  167. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +0 -75
  168. package/src/extensions/Placeholder/PlaceholderPlugin.ts +0 -147
  169. package/types/src/comments/models/User.d.ts +0 -8
  170. package/types/src/editor/BlockNoteExtensions.d.ts +0 -43
  171. package/types/src/editor/managers/CollaborationManager.d.ts +0 -115
  172. package/types/src/editor/managers/ExtensionManager.d.ts +0 -68
  173. package/types/src/extensions/BlockChange/BlockChangePlugin.d.ts +0 -15
  174. package/types/src/extensions/Collaboration/CursorPlugin.d.ts +0 -37
  175. package/types/src/extensions/Collaboration/ForkYDocPlugin.d.ts +0 -41
  176. package/types/src/extensions/Collaboration/SyncPlugin.d.ts +0 -7
  177. package/types/src/extensions/Collaboration/UndoPlugin.d.ts +0 -9
  178. package/types/src/extensions/Collaboration/schemaMigration/SchemaMigrationPlugin.d.ts +0 -7
  179. package/types/src/extensions/Comments/CommentsPlugin.d.ts +0 -66
  180. package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +0 -31
  181. package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +0 -41
  182. package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +0 -42
  183. package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.d.ts +0 -5
  184. package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +0 -6
  185. package/types/src/extensions/ShowSelection/ShowSelectionPlugin.d.ts +0 -15
  186. package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +0 -31
  187. package/types/src/extensions/TrailingNode/TrailingNodeExtension.d.ts +0 -13
  188. /package/src/{extensions/Comments/CommentMark.ts → comments/mark.ts} +0 -0
  189. /package/src/extensions/{HardBreak → tiptap-extensions/HardBreak}/HardBreak.ts +0 -0
  190. /package/src/extensions/{Suggestions → tiptap-extensions/Suggestions}/SuggestionMarks.ts +0 -0
  191. /package/src/extensions/{TextAlignment → tiptap-extensions/TextAlignment}/TextAlignmentExtension.ts +0 -0
  192. /package/src/extensions/{UniqueID → tiptap-extensions/UniqueID}/UniqueID.ts +0 -0
  193. /package/types/src/{extensions/Comments/CommentMark.d.ts → comments/mark.d.ts} +0 -0
  194. /package/types/src/{extensions/Collaboration/ForkYDocPlugin.test.d.ts → editor/BlockNoteExtension.test.d.ts} +0 -0
  195. /package/types/src/extensions/{BackgroundColor → tiptap-extensions/BackgroundColor}/BackgroundColorExtension.d.ts +0 -0
  196. /package/types/src/extensions/{HardBreak → tiptap-extensions/HardBreak}/HardBreak.d.ts +0 -0
  197. /package/types/src/extensions/{Suggestions → tiptap-extensions/Suggestions}/SuggestionMarks.d.ts +0 -0
  198. /package/types/src/extensions/{TextAlignment → tiptap-extensions/TextAlignment}/TextAlignmentExtension.d.ts +0 -0
  199. /package/types/src/extensions/{TextColor → tiptap-extensions/TextColor}/TextColorExtension.d.ts +0 -0
  200. /package/types/src/extensions/{UniqueID → tiptap-extensions/UniqueID}/UniqueID.d.ts +0 -0
@@ -1,115 +0,0 @@
1
- import * as Y from "yjs";
2
- import { CommentsPlugin } from "../../extensions/Comments/CommentsPlugin.js";
3
- import { ForkYDocPlugin } from "../../extensions/Collaboration/ForkYDocPlugin.js";
4
- import { SyncPlugin } from "../../extensions/Collaboration/SyncPlugin.js";
5
- import { UndoPlugin } from "../../extensions/Collaboration/UndoPlugin.js";
6
- import { CursorPlugin } from "../../extensions/Collaboration/CursorPlugin.js";
7
- import type { ThreadStore, User } from "../../comments/index.js";
8
- import type { BlockNoteEditor } from "../BlockNoteEditor.js";
9
- import { CustomBlockNoteSchema } from "../../schema/schema.js";
10
- export interface CollaborationOptions {
11
- /**
12
- * The Yjs XML fragment that's used for collaboration.
13
- */
14
- fragment: Y.XmlFragment;
15
- /**
16
- * The user info for the current user that's shown to other collaborators.
17
- */
18
- user: {
19
- name: string;
20
- color: string;
21
- };
22
- /**
23
- * A Yjs provider (used for awareness / cursor information)
24
- * Can be null for comments-only mode
25
- */
26
- provider: any;
27
- /**
28
- * Optional function to customize how cursors of users are rendered
29
- */
30
- renderCursor?: (user: any) => HTMLElement;
31
- /**
32
- * Optional flag to set when the user label should be shown with the default
33
- * collaboration cursor. Setting to "always" will always show the label,
34
- * while "activity" will only show the label when the user moves the cursor
35
- * or types. Defaults to "activity".
36
- */
37
- showCursorLabels?: "always" | "activity";
38
- /**
39
- * Comments configuration - can be used with or without collaboration
40
- */
41
- comments?: {
42
- schema?: CustomBlockNoteSchema<any, any, any>;
43
- threadStore: ThreadStore;
44
- };
45
- /**
46
- * Function to resolve user IDs to user objects - required for comments
47
- */
48
- resolveUsers?: (userIds: string[]) => Promise<User[]>;
49
- }
50
- /**
51
- * CollaborationManager handles all collaboration-related functionality
52
- * This manager is completely optional and can be tree-shaken if not used
53
- */
54
- export declare class CollaborationManager {
55
- private editor;
56
- private options;
57
- private _commentsPlugin?;
58
- private _forkYDocPlugin?;
59
- private _syncPlugin?;
60
- private _undoPlugin?;
61
- private _cursorPlugin?;
62
- constructor(editor: BlockNoteEditor, options: CollaborationOptions);
63
- /**
64
- * Get the sync plugin instance
65
- */
66
- get syncPlugin(): SyncPlugin | undefined;
67
- /**
68
- * Get the undo plugin instance
69
- */
70
- get undoPlugin(): UndoPlugin | undefined;
71
- /**
72
- * Get the cursor plugin instance
73
- */
74
- get cursorPlugin(): CursorPlugin | undefined;
75
- /**
76
- * Get the fork YDoc plugin instance
77
- */
78
- get forkYDocPlugin(): ForkYDocPlugin | undefined;
79
- initExtensions(): Record<string, unknown>;
80
- /**
81
- * Update the user info for the current user that's shown to other collaborators
82
- */
83
- updateUserInfo(user: {
84
- name: string;
85
- color: string;
86
- }): void;
87
- /**
88
- * Get the collaboration undo command
89
- */
90
- getUndoCommand(): import("prosemirror-state").Command;
91
- /**
92
- * Get the collaboration redo command
93
- */
94
- getRedoCommand(): import("prosemirror-state").Command;
95
- /**
96
- * Check if initial content should be avoided due to collaboration
97
- */
98
- shouldAvoidInitialContent(): boolean;
99
- /**
100
- * Get the collaboration options
101
- */
102
- getOptions(): CollaborationOptions;
103
- /**
104
- * Get the comments plugin if available
105
- */
106
- get comments(): CommentsPlugin | undefined;
107
- /**
108
- * Check if comments are enabled
109
- */
110
- get hasComments(): boolean;
111
- /**
112
- * Get the resolveUsers function
113
- */
114
- get resolveUsers(): ((userIds: string[]) => Promise<User[]>) | undefined;
115
- }
@@ -1,68 +0,0 @@
1
- import { FilePanelProsemirrorPlugin } from "../../extensions/FilePanel/FilePanelPlugin.js";
2
- import { FormattingToolbarProsemirrorPlugin } from "../../extensions/FormattingToolbar/FormattingToolbarPlugin.js";
3
- import { LinkToolbarProsemirrorPlugin } from "../../extensions/LinkToolbar/LinkToolbarPlugin.js";
4
- import { ShowSelectionPlugin } from "../../extensions/ShowSelection/ShowSelectionPlugin.js";
5
- import { SideMenuProsemirrorPlugin } from "../../extensions/SideMenu/SideMenuPlugin.js";
6
- import { SuggestionMenuProseMirrorPlugin } from "../../extensions/SuggestionMenu/SuggestionPlugin.js";
7
- import { TableHandlesProsemirrorPlugin } from "../../extensions/TableHandles/TableHandlesPlugin.js";
8
- import { BlockNoteExtension } from "../BlockNoteExtension.js";
9
- import { BlockNoteEditor } from "../BlockNoteEditor.js";
10
- export declare class ExtensionManager {
11
- private editor;
12
- constructor(editor: BlockNoteEditor);
13
- /**
14
- * Shorthand to get a typed extension from the editor, by
15
- * just passing in the extension class.
16
- *
17
- * @param ext - The extension class to get
18
- * @param key - optional, the key of the extension in the extensions object (defaults to the extension name)
19
- * @returns The extension instance
20
- */
21
- extension<T extends BlockNoteExtension>(ext: {
22
- new (...args: any[]): T;
23
- } & typeof BlockNoteExtension, key?: string): T;
24
- /**
25
- * Get all extensions
26
- */
27
- getExtensions(): Record<string, import("../BlockNoteEditor.js").SupportedExtension>;
28
- /**
29
- * Get a specific extension by key
30
- */
31
- getExtension(key: string): import("../BlockNoteEditor.js").SupportedExtension;
32
- /**
33
- * Check if an extension exists
34
- */
35
- hasExtension(key: string): boolean;
36
- /**
37
- * Get the formatting toolbar plugin
38
- */
39
- get formattingToolbar(): FormattingToolbarProsemirrorPlugin;
40
- /**
41
- * Get the link toolbar plugin
42
- */
43
- get linkToolbar(): LinkToolbarProsemirrorPlugin<any, any, any>;
44
- /**
45
- * Get the side menu plugin
46
- */
47
- get sideMenu(): SideMenuProsemirrorPlugin<any, any, any>;
48
- /**
49
- * Get the suggestion menus plugin
50
- */
51
- get suggestionMenus(): SuggestionMenuProseMirrorPlugin<any, any, any>;
52
- /**
53
- * Get the file panel plugin (if available)
54
- */
55
- get filePanel(): FilePanelProsemirrorPlugin<any, any> | undefined;
56
- /**
57
- * Get the table handles plugin (if available)
58
- */
59
- get tableHandles(): TableHandlesProsemirrorPlugin<any, any> | undefined;
60
- /**
61
- * Get the show selection plugin
62
- */
63
- get showSelectionPlugin(): ShowSelectionPlugin;
64
- /**
65
- * Check if collaboration is enabled (Yjs or Liveblocks)
66
- */
67
- get isCollaborationEnabled(): boolean;
68
- }
@@ -1,15 +0,0 @@
1
- import { Transaction } from "prosemirror-state";
2
- import { BlocksChanged } from "../../api/getBlocksChangedByTransaction.js";
3
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
4
- /**
5
- * This plugin can filter transactions before they are applied to the editor, but with a higher-level API than `filterTransaction` from prosemirror.
6
- */
7
- export declare class BlockChangePlugin extends BlockNoteExtension {
8
- static key(): string;
9
- private beforeChangeCallbacks;
10
- constructor();
11
- subscribe(callback: (context: {
12
- getChanges: () => BlocksChanged<any, any, any>;
13
- tr: Transaction;
14
- }) => boolean | void): () => void;
15
- }
@@ -1,37 +0,0 @@
1
- import { Awareness } from "y-protocols/awareness.js";
2
- import * as Y from "yjs";
3
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
4
- export type CollaborationUser = {
5
- name: string;
6
- color: string;
7
- [key: string]: string;
8
- };
9
- export declare class CursorPlugin extends BlockNoteExtension {
10
- private collaboration;
11
- static key(): string;
12
- private provider;
13
- private recentlyUpdatedCursors;
14
- constructor(collaboration: {
15
- fragment: Y.XmlFragment;
16
- user: CollaborationUser;
17
- provider: {
18
- awareness: Awareness;
19
- };
20
- renderCursor?: (user: CollaborationUser) => HTMLElement;
21
- showCursorLabels?: "always" | "activity";
22
- });
23
- get priority(): number;
24
- private renderCursor;
25
- updateUser: (user: {
26
- name: string;
27
- color: string;
28
- [key: string]: string;
29
- }) => void;
30
- /**
31
- * Determine whether the foreground color should be white or black based on a provided background color
32
- * Inspired by: https://stackoverflow.com/a/3943023
33
- *
34
- */
35
- static isDarkColor(bgColor: string): boolean;
36
- static defaultCursorRender: (user: CollaborationUser) => HTMLSpanElement;
37
- }
@@ -1,41 +0,0 @@
1
- import { BlockNoteEditor, BlockNoteEditorOptions } from "../../editor/BlockNoteEditor.js";
2
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
3
- export declare class ForkYDocPlugin extends BlockNoteExtension<{
4
- forked: boolean;
5
- }> {
6
- static key(): string;
7
- private editor;
8
- private collaboration;
9
- constructor({ editor, collaboration, }: {
10
- editor: BlockNoteEditor<any, any, any>;
11
- collaboration: BlockNoteEditorOptions<any, any, any>["collaboration"];
12
- });
13
- /**
14
- * To find a fragment in another ydoc, we need to search for it.
15
- */
16
- private findTypeInOtherYdoc;
17
- /**
18
- * Whether the editor is editing a forked document,
19
- * preserving a reference to the original document and the forked document.
20
- */
21
- get isForkedFromRemote(): boolean;
22
- /**
23
- * Stores whether the editor is editing a forked document,
24
- * preserving a reference to the original document and the forked document.
25
- */
26
- private forkedState;
27
- /**
28
- * Fork the Y.js document from syncing to the remote,
29
- * allowing modifications to the document without affecting the remote.
30
- * These changes can later be rolled back or applied to the remote.
31
- */
32
- fork(): void;
33
- /**
34
- * Resume syncing the Y.js document to the remote
35
- * If `keepChanges` is true, any changes that have been made to the forked document will be applied to the original document.
36
- * Otherwise, the original document will be restored and the changes will be discarded.
37
- */
38
- merge({ keepChanges }: {
39
- keepChanges: boolean;
40
- }): void;
41
- }
@@ -1,7 +0,0 @@
1
- import type * as Y from "yjs";
2
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
3
- export declare class SyncPlugin extends BlockNoteExtension {
4
- static key(): string;
5
- constructor(fragment: Y.XmlFragment);
6
- get priority(): number;
7
- }
@@ -1,9 +0,0 @@
1
- import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
2
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
3
- export declare class UndoPlugin extends BlockNoteExtension {
4
- static key(): string;
5
- constructor({ editor }: {
6
- editor: BlockNoteEditor<any, any, any>;
7
- });
8
- get priority(): number;
9
- }
@@ -1,7 +0,0 @@
1
- import * as Y from "yjs";
2
- import { BlockNoteExtension } from "../../../editor/BlockNoteExtension.js";
3
- export declare class SchemaMigrationPlugin extends BlockNoteExtension {
4
- private migrationDone;
5
- static key(): string;
6
- constructor(fragment: Y.XmlFragment);
7
- }
@@ -1,66 +0,0 @@
1
- import type { CommentBody, ThreadStore, User } from "../../comments/index.js";
2
- import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
3
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
4
- import { CustomBlockNoteSchema } from "../../schema/schema.js";
5
- import { UserStore } from "./userstore/UserStore.js";
6
- export declare class CommentsPlugin extends BlockNoteExtension {
7
- private readonly editor;
8
- readonly threadStore: ThreadStore;
9
- private readonly markType;
10
- readonly resolveUsers: undefined | ((userIds: string[]) => Promise<User[]>);
11
- readonly commentEditorSchema?: CustomBlockNoteSchema<any, any, any> | undefined;
12
- static key(): string;
13
- readonly userStore: UserStore<User>;
14
- /**
15
- * Whether a comment is currently being composed
16
- */
17
- private pendingComment;
18
- /**
19
- * The currently selected thread id
20
- */
21
- private selectedThreadId;
22
- /**
23
- * Store the positions of all threads in the document.
24
- * this can be used later to implement a floating sidebar
25
- */
26
- private threadPositions;
27
- private emitStateUpdate;
28
- /**
29
- * when a thread is resolved or deleted, we need to update the marks to reflect the new state
30
- */
31
- private updateMarksFromThreads;
32
- constructor(editor: BlockNoteEditor<any, any, any>, threadStore: ThreadStore, markType: string, resolveUsers: undefined | ((userIds: string[]) => Promise<User[]>), commentEditorSchema?: CustomBlockNoteSchema<any, any, any> | undefined);
33
- /**
34
- * Subscribe to state updates
35
- */
36
- onUpdate(callback: (state: {
37
- pendingComment: boolean;
38
- selectedThreadId: string | undefined;
39
- threadPositions: Map<string, {
40
- from: number;
41
- to: number;
42
- }>;
43
- }) => void): () => void;
44
- /**
45
- * Set the selected thread
46
- */
47
- selectThread(threadId: string | undefined): void;
48
- /**
49
- * Start a pending comment (e.g.: when clicking the "Add comment" button)
50
- */
51
- startPendingComment(): void;
52
- /**
53
- * Stop a pending comment (e.g.: user closes the comment composer)
54
- */
55
- stopPendingComment(): void;
56
- /**
57
- * Create a thread at the current selection
58
- */
59
- createThread(options: {
60
- initialComment: {
61
- body: CommentBody;
62
- metadata?: any;
63
- };
64
- metadata?: any;
65
- }): Promise<void>;
66
- }
@@ -1,31 +0,0 @@
1
- import { EditorState, PluginKey, PluginView } from "prosemirror-state";
2
- import { EditorView } from "prosemirror-view";
3
- import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
4
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
5
- import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
6
- import type { BlockFromConfig, InlineContentSchema, StyleSchema } from "../../schema/index.js";
7
- export type FilePanelState<I extends InlineContentSchema, S extends StyleSchema> = UiElementPosition & {
8
- block: BlockFromConfig<any, I, S>;
9
- };
10
- export declare class FilePanelView<I extends InlineContentSchema, S extends StyleSchema> implements PluginView {
11
- private readonly editor;
12
- private readonly pluginKey;
13
- private readonly pmView;
14
- state?: FilePanelState<I, S>;
15
- emitUpdate: () => void;
16
- constructor(editor: BlockNoteEditor<Record<string, any>, I, S>, pluginKey: PluginKey<FilePanelState<I, S>>, pmView: EditorView, emitUpdate: (state: FilePanelState<I, S>) => void);
17
- mouseDownHandler: () => void;
18
- dragstartHandler: () => void;
19
- scrollHandler: () => void;
20
- update(view: EditorView, prevState: EditorState): void;
21
- closeMenu: () => void;
22
- destroy(): void;
23
- }
24
- export declare class FilePanelProsemirrorPlugin<I extends InlineContentSchema, S extends StyleSchema> extends BlockNoteExtension {
25
- static key(): string;
26
- private view;
27
- constructor(editor: BlockNoteEditor<Record<string, any>, I, S>);
28
- get shown(): boolean;
29
- onUpdate(callback: (state: FilePanelState<I, S>) => void): () => void;
30
- closeMenu: () => void | undefined;
31
- }
@@ -1,41 +0,0 @@
1
- import { EditorState, PluginKey, PluginView } from "prosemirror-state";
2
- import { EditorView } from "prosemirror-view";
3
- import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
4
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
5
- import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
6
- import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema/index.js";
7
- export type FormattingToolbarState = UiElementPosition;
8
- export declare class FormattingToolbarView implements PluginView {
9
- private readonly editor;
10
- private readonly pmView;
11
- state?: FormattingToolbarState;
12
- emitUpdate: () => void;
13
- preventHide: boolean;
14
- preventShow: boolean;
15
- shouldShow: (props: {
16
- view: EditorView;
17
- state: EditorState;
18
- from: number;
19
- to: number;
20
- }) => boolean;
21
- constructor(editor: BlockNoteEditor<BlockSchema, InlineContentSchema, StyleSchema>, pmView: EditorView, emitUpdate: (state: FormattingToolbarState) => void);
22
- blurHandler: (event: FocusEvent) => void;
23
- isElementWithinEditorWrapper: (element: Node | null) => boolean;
24
- viewMousedownHandler: (e: MouseEvent) => void;
25
- mouseupHandler: () => void;
26
- dragHandler: () => void;
27
- scrollHandler: () => void;
28
- update(view: EditorView, oldState?: EditorState): void;
29
- destroy(): void;
30
- closeMenu: () => void;
31
- getSelectionBoundingBox(): DOMRect;
32
- }
33
- export declare const formattingToolbarPluginKey: PluginKey<any>;
34
- export declare class FormattingToolbarProsemirrorPlugin extends BlockNoteExtension {
35
- static key(): string;
36
- private view;
37
- constructor(editor: BlockNoteEditor<any, any, any>);
38
- get shown(): boolean;
39
- onUpdate(callback: (state: FormattingToolbarState) => void): () => void;
40
- closeMenu: () => void;
41
- }
@@ -1,42 +0,0 @@
1
- import { PluginKey } from "prosemirror-state";
2
- import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
3
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
4
- import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
5
- import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema/index.js";
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 BlockNoteExtension {
12
- static key(): string;
13
- private view;
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
- get shown(): boolean;
41
- closeMenu: () => void;
42
- }
@@ -1,5 +0,0 @@
1
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
2
- export declare class NodeSelectionKeyboardPlugin extends BlockNoteExtension {
3
- static key(): string;
4
- constructor();
5
- }
@@ -1,6 +0,0 @@
1
- import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
2
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
3
- export declare class PlaceholderPlugin extends BlockNoteExtension {
4
- static key(): string;
5
- constructor(editor: BlockNoteEditor<any, any, any>, placeholders: Record<string | "default" | "emptyDocument", string | undefined>);
6
- }
@@ -1,15 +0,0 @@
1
- import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
2
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
3
- /**
4
- * Plugin that shows adds a decoration around the current selection
5
- * This can be used to highlight the current selection in the UI even when the
6
- * text editor is not focused.
7
- */
8
- export declare class ShowSelectionPlugin extends BlockNoteExtension {
9
- private readonly editor;
10
- static key(): string;
11
- private enabled;
12
- constructor(editor: BlockNoteEditor<any, any, any>);
13
- setEnabled(enabled: boolean): void;
14
- getEnabled(): boolean;
15
- }
@@ -1,31 +0,0 @@
1
- import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
2
- import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
3
- import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
4
- import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema/index.js";
5
- export type SuggestionMenuState = UiElementPosition & {
6
- query: string;
7
- ignoreQueryLength?: boolean;
8
- };
9
- /**
10
- * A ProseMirror plugin for suggestions, designed to make '/'-commands possible as well as mentions.
11
- *
12
- * This is basically a simplified version of TipTap's [Suggestions](https://github.com/ueberdosis/tiptap/tree/db92a9b313c5993b723c85cd30256f1d4a0b65e1/packages/suggestion) plugin.
13
- *
14
- * This version is adapted from the aforementioned version in the following ways:
15
- * - This version supports generic items instead of only strings (to allow for more advanced filtering for example)
16
- * - This version hides some unnecessary complexity from the user of the plugin.
17
- * - This version handles key events differently
18
- */
19
- export declare class SuggestionMenuProseMirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends BlockNoteExtension {
20
- static key(): string;
21
- private view;
22
- private triggerCharacters;
23
- constructor(editor: BlockNoteEditor<BSchema, I, S>);
24
- onUpdate(triggerCharacter: string, callback: (state: SuggestionMenuState) => void): () => void;
25
- addTriggerCharacter: (triggerCharacter: string) => void;
26
- removeTriggerCharacter: (triggerCharacter: string) => void;
27
- closeMenu: () => void;
28
- clearQuery: () => void;
29
- get shown(): boolean;
30
- }
31
- export declare function createSuggestionMenu<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, triggerCharacter: string): void;
@@ -1,13 +0,0 @@
1
- import { Extension } from "@tiptap/core";
2
- /**
3
- * Extension based on:
4
- * - https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/extensions/TrailingNode.js
5
- * - https://github.com/remirror/remirror/blob/e0f1bec4a1e8073ce8f5500d62193e52321155b9/packages/prosemirror-trailing-node/src/trailing-node-plugin.ts
6
- */
7
- export interface TrailingNodeOptions {
8
- node: string;
9
- }
10
- /**
11
- * Add a trailing node to the document so the user can always click at the bottom of the document and start typing
12
- */
13
- export declare const TrailingNode: Extension<TrailingNodeOptions, any>;