@blocknote/core 0.26.0 → 0.27.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 (147) hide show
  1. package/dist/blocknote.cjs +11 -10
  2. package/dist/blocknote.cjs.map +1 -1
  3. package/dist/blocknote.js +3685 -9960
  4. package/dist/blocknote.js.map +1 -1
  5. package/dist/comments.cjs.map +1 -1
  6. package/dist/comments.js.map +1 -1
  7. package/dist/en-B7ycW7c8.js +360 -0
  8. package/dist/en-B7ycW7c8.js.map +1 -0
  9. package/dist/en-D4taoCs4.cjs +2 -0
  10. package/dist/en-D4taoCs4.cjs.map +1 -0
  11. package/dist/locales.cjs +2 -0
  12. package/dist/locales.cjs.map +1 -0
  13. package/dist/locales.js +6129 -0
  14. package/dist/locales.js.map +1 -0
  15. package/dist/style.css +1 -1
  16. package/dist/tsconfig.tsbuildinfo +1 -1
  17. package/dist/webpack-stats.json +1 -1
  18. package/package.json +36 -31
  19. package/src/api/clipboard/__snapshots__/internal/basicBlocks.html +1 -1
  20. package/src/api/clipboard/__snapshots__/internal/basicBlocksWithProps.html +1 -1
  21. package/src/api/clipboard/clipboardExternal.test.ts +1 -1
  22. package/src/api/clipboard/clipboardInternal.test.ts +1 -1
  23. package/src/api/clipboard/fromClipboard/acceptedMIMETypes.ts +1 -0
  24. package/src/api/clipboard/fromClipboard/pasteExtension.ts +96 -42
  25. package/src/api/exporters/html/__snapshots__/codeBlock/contains-newlines/external.html +1 -1
  26. package/src/api/exporters/html/__snapshots__/codeBlock/contains-newlines/internal.html +1 -1
  27. package/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/external.html +1 -1
  28. package/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/internal.html +1 -1
  29. package/src/api/exporters/html/__snapshots__/codeBlock/empty/external.html +1 -1
  30. package/src/api/exporters/html/__snapshots__/codeBlock/empty/internal.html +1 -1
  31. package/src/api/exporters/html/__snapshots__/codeBlock/python/external.html +1 -1
  32. package/src/api/exporters/html/__snapshots__/codeBlock/python/internal.html +1 -1
  33. package/src/api/exporters/html/htmlConversion.test.ts +2 -2
  34. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +4 -4
  35. package/src/api/exporters/markdown/__snapshots__/codeBlock/defaultLanguage/markdown.md +1 -1
  36. package/src/api/exporters/markdown/__snapshots__/codeBlock/empty/markdown.md +1 -1
  37. package/src/api/exporters/markdown/__snapshots__/complex/misc/markdown.md +1 -1
  38. package/src/api/exporters/markdown/__snapshots__/lists/basic/markdown.md +8 -6
  39. package/src/api/exporters/markdown/__snapshots__/lists/nested/markdown.md +6 -6
  40. package/src/api/exporters/markdown/markdownExporter.test.ts +2 -2
  41. package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +2 -2
  42. package/src/api/parsers/html/__snapshots__/parse-codeblocks.json +1 -1
  43. package/src/api/parsers/html/parseHTML.test.ts +1 -1
  44. package/src/api/parsers/markdown/__snapshots__/pasted/whitespace bold.json +42 -0
  45. package/src/api/parsers/markdown/__snapshots__/whitespace bold.json +19 -0
  46. package/src/api/parsers/markdown/detectMarkdown.ts +60 -0
  47. package/src/api/parsers/markdown/parseMarkdown.test.ts +7 -2
  48. package/src/api/parsers/markdown/parseMarkdown.ts +19 -18
  49. package/src/api/testUtil/cases/defaultSchema.ts +13 -0
  50. package/src/blocks/CodeBlockContent/CodeBlockContent.ts +100 -69
  51. package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +98 -0
  52. package/src/blocks/TableBlockContent/TableExtension.ts +1 -1
  53. package/src/blocks/defaultBlocks.ts +2 -2
  54. package/src/editor/Block.css +13 -0
  55. package/src/editor/BlockNoteEditor.ts +102 -10
  56. package/src/editor/BlockNoteExtensions.ts +18 -4
  57. package/src/extensions/Comments/CommentsPlugin.ts +1 -1
  58. package/src/extensions/HardBreak/HardBreak.ts +35 -0
  59. package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +100 -3
  60. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +3 -1
  61. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +12 -0
  62. package/src/i18n/index.ts +2 -0
  63. package/src/i18n/locales/ar.ts +6 -0
  64. package/src/i18n/locales/de.ts +6 -0
  65. package/src/i18n/locales/en.ts +6 -0
  66. package/src/i18n/locales/es.ts +6 -0
  67. package/src/i18n/locales/fr.ts +6 -0
  68. package/src/i18n/locales/hr.ts +6 -0
  69. package/src/i18n/locales/is.ts +6 -0
  70. package/src/i18n/locales/it.ts +6 -0
  71. package/src/i18n/locales/ja.ts +6 -0
  72. package/src/i18n/locales/ko.ts +6 -0
  73. package/src/i18n/locales/nl.ts +6 -0
  74. package/src/i18n/locales/no.ts +6 -0
  75. package/src/i18n/locales/pl.ts +6 -0
  76. package/src/i18n/locales/pt.ts +6 -0
  77. package/src/i18n/locales/ru.ts +6 -0
  78. package/src/i18n/locales/uk.ts +6 -0
  79. package/src/i18n/locales/vi.ts +6 -0
  80. package/src/i18n/locales/zh.ts +6 -0
  81. package/src/index.ts +2 -3
  82. package/src/locales.ts +1 -0
  83. package/src/schema/blocks/types.ts +1 -0
  84. package/types/src/api/blockManipulation/commands/updateBlock/updateBlock.d.ts +1 -1
  85. package/types/src/api/blockManipulation/setupTestEnv.d.ts +34 -2
  86. package/types/src/api/clipboard/fromClipboard/acceptedMIMETypes.d.ts +1 -1
  87. package/types/src/api/clipboard/fromClipboard/fileDropExtension.d.ts +2 -2
  88. package/types/src/api/clipboard/fromClipboard/pasteExtension.d.ts +3 -3
  89. package/types/src/api/clipboard/testUtil.d.ts +66 -34
  90. package/types/src/api/clipboard/toClipboard/copyExtension.d.ts +1 -1
  91. package/types/src/api/exporters/html/externalHTMLExporter.d.ts +2 -2
  92. package/types/src/api/exporters/html/internalHTMLSerializer.d.ts +2 -2
  93. package/types/src/api/exporters/html/util/serializeBlocksExternalHTML.d.ts +1 -1
  94. package/types/src/api/exporters/html/util/serializeBlocksInternalHTML.d.ts +1 -1
  95. package/types/src/api/parsers/markdown/detectMarkdown.d.ts +6 -0
  96. package/types/src/api/parsers/markdown/parseMarkdown.d.ts +1 -0
  97. package/types/src/api/testUtil/cases/customBlocks.d.ts +72 -40
  98. package/types/src/api/testUtil/cases/customInlineContent.d.ts +34 -2
  99. package/types/src/api/testUtil/cases/customStyles.d.ts +34 -2
  100. package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +3 -3
  101. package/types/src/blocks/CodeBlockContent/CodeBlockContent.d.ts +46 -34
  102. package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +3 -3
  103. package/types/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.d.ts +1 -1
  104. package/types/src/blocks/HeadingBlockContent/HeadingBlockContent.d.ts +2 -2
  105. package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +2 -2
  106. package/types/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.d.ts +2 -2
  107. package/types/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.d.ts +2 -2
  108. package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +2 -2
  109. package/types/src/blocks/PageBreakBlockContent/PageBreakBlockContent.d.ts +2 -2
  110. package/types/src/blocks/PageBreakBlockContent/schema.d.ts +13 -13
  111. package/types/src/blocks/ParagraphBlockContent/ParagraphBlockContent.d.ts +2 -2
  112. package/types/src/blocks/QuoteBlockContent/QuoteBlockContent.d.ts +52 -0
  113. package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +2 -2
  114. package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +2 -2
  115. package/types/src/blocks/defaultBlockHelpers.d.ts +2 -2
  116. package/types/src/blocks/defaultBlocks.d.ts +107 -44
  117. package/types/src/comments/threadstore/yjs/YjsThreadStore.d.ts +3 -3
  118. package/types/src/editor/BlockNoteEditor.d.ts +58 -0
  119. package/types/src/editor/BlockNoteExtensions.d.ts +3 -2
  120. package/types/src/exporter/mapping.d.ts +2 -2
  121. package/types/src/extensions/BackgroundColor/BackgroundColorMark.d.ts +1 -1
  122. package/types/src/extensions/Collaboration/createCollaborationExtensions.d.ts +1 -1
  123. package/types/src/extensions/HardBreak/HardBreak.d.ts +2 -0
  124. package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +4 -4
  125. package/types/src/extensions/TextColor/TextColorMark.d.ts +1 -1
  126. package/types/src/i18n/index.d.ts +2 -0
  127. package/types/src/i18n/locales/en.d.ts +7 -1
  128. package/types/src/index.d.ts +1 -2
  129. package/types/src/locales.d.ts +1 -0
  130. package/types/src/pm-nodes/BlockContainer.d.ts +2 -7
  131. package/types/src/pm-nodes/BlockGroup.d.ts +2 -7
  132. package/types/src/schema/blocks/types.d.ts +1 -0
  133. package/types/src/schema/inlineContent/internal.d.ts +1 -1
  134. package/README.md +0 -125
  135. package/src/blocks/CodeBlockContent/defaultSupportedLanguages.ts +0 -116
  136. package/types/src/blocks/CodeBlockContent/defaultSupportedLanguages.d.ts +0 -6
  137. package/types/src/extensions/Comments/threadstore/DefaultThreadStoreAuth.d.ts +0 -47
  138. package/types/src/extensions/Comments/threadstore/ThreadStore.d.ts +0 -121
  139. package/types/src/extensions/Comments/threadstore/ThreadStoreAuth.d.ts +0 -12
  140. package/types/src/extensions/Comments/threadstore/TipTapThreadStore.d.ts +0 -97
  141. package/types/src/extensions/Comments/threadstore/yjs/RESTYjsThreadStore.d.ts +0 -83
  142. package/types/src/extensions/Comments/threadstore/yjs/YjsThreadStore.d.ts +0 -79
  143. package/types/src/extensions/Comments/threadstore/yjs/YjsThreadStore.test.d.ts +0 -1
  144. package/types/src/extensions/Comments/threadstore/yjs/YjsThreadStoreBase.d.ts +0 -15
  145. package/types/src/extensions/Comments/threadstore/yjs/yjsHelpers.d.ts +0 -13
  146. package/types/src/extensions/Comments/types.d.ts +0 -109
  147. package/types/src/models/User.d.ts +0 -5
@@ -1,79 +0,0 @@
1
- import * as Y from "yjs";
2
- import { CommentBody, ThreadData } from "../../types.js";
3
- import { ThreadStoreAuth } from "../ThreadStoreAuth.js";
4
- import { YjsThreadStoreBase } from "./YjsThreadStoreBase.js";
5
- /**
6
- * This is a Yjs-based implementation of the ThreadStore interface.
7
- *
8
- * It reads and writes thread / comments information directly to the underlying Yjs Document.
9
- *
10
- * @important While this is the easiest to add to your app, there are two challenges:
11
- * - The user needs to be able to write to the Yjs document to store the information.
12
- * So a user without write access to the Yjs document cannot leave any comments.
13
- * - Even with write access, the operations are not secure. Unless your Yjs server
14
- * guards against malicious operations, it's technically possible for one user to make changes to another user's comments, etc.
15
- * (even though these options are not visible in the UI, a malicious user can make unauthorized changes to the underlying Yjs document)
16
- */
17
- export declare class YjsThreadStore extends YjsThreadStoreBase {
18
- private readonly userId;
19
- constructor(userId: string, threadsYMap: Y.Map<any>, auth: ThreadStoreAuth);
20
- private transact;
21
- createThread: (options: {
22
- initialComment: {
23
- body: CommentBody;
24
- metadata?: any;
25
- };
26
- metadata?: any;
27
- }) => Promise<ThreadData>;
28
- addThreadToDocument: undefined;
29
- addComment: (options: {
30
- comment: {
31
- body: CommentBody;
32
- metadata?: any;
33
- };
34
- threadId: string;
35
- }) => Promise<{
36
- type: "comment";
37
- id: string;
38
- userId: string;
39
- createdAt: Date;
40
- updatedAt: Date;
41
- reactions: import("../../types.js").CommentReactionData[];
42
- metadata: any;
43
- } & {
44
- deletedAt?: undefined;
45
- body: any;
46
- }>;
47
- updateComment: (options: {
48
- comment: {
49
- body: CommentBody;
50
- metadata?: any;
51
- };
52
- threadId: string;
53
- commentId: string;
54
- }) => Promise<void>;
55
- deleteComment: (options: {
56
- threadId: string;
57
- commentId: string;
58
- softDelete?: boolean | undefined;
59
- }) => Promise<void>;
60
- deleteThread: (options: {
61
- threadId: string;
62
- }) => Promise<void>;
63
- resolveThread: (options: {
64
- threadId: string;
65
- }) => Promise<void>;
66
- unresolveThread: (options: {
67
- threadId: string;
68
- }) => Promise<void>;
69
- addReaction: (options: {
70
- threadId: string;
71
- commentId: string;
72
- emoji: string;
73
- }) => Promise<void>;
74
- deleteReaction: (options: {
75
- threadId: string;
76
- commentId: string;
77
- emoji: string;
78
- }) => Promise<void>;
79
- }
@@ -1,15 +0,0 @@
1
- import * as Y from "yjs";
2
- import { ThreadData } from "../../types.js";
3
- import { ThreadStore } from "../ThreadStore.js";
4
- import { ThreadStoreAuth } from "../ThreadStoreAuth.js";
5
- /**
6
- * This is an abstract class that only implements the READ methods required by the ThreadStore interface.
7
- * The data is read from a Yjs Map.
8
- */
9
- export declare abstract class YjsThreadStoreBase extends ThreadStore {
10
- protected readonly threadsYMap: Y.Map<any>;
11
- constructor(threadsYMap: Y.Map<any>, auth: ThreadStoreAuth);
12
- getThread(threadId: string): ThreadData;
13
- getThreads(): Map<string, ThreadData>;
14
- subscribe(cb: (threads: Map<string, ThreadData>) => void): () => void;
15
- }
@@ -1,13 +0,0 @@
1
- import * as Y from "yjs";
2
- import { CommentData, ThreadData } from "../../types.js";
3
- export declare function commentToYMap(comment: CommentData): Y.Map<any>;
4
- export declare function threadToYMap(thread: ThreadData): Y.Map<unknown>;
5
- type SingleUserCommentReactionData = {
6
- emoji: string;
7
- createdAt: Date;
8
- userId: string;
9
- };
10
- export declare function yMapToReaction(yMap: Y.Map<any>): SingleUserCommentReactionData;
11
- export declare function yMapToComment(yMap: Y.Map<any>): CommentData;
12
- export declare function yMapToThread(yMap: Y.Map<any>): ThreadData;
13
- export {};
@@ -1,109 +0,0 @@
1
- /**
2
- * The body of a comment. This actually is a BlockNote document (array of blocks)
3
- */
4
- export type CommentBody = any;
5
- /**
6
- * A reaction to a comment.
7
- */
8
- export type CommentReactionData = {
9
- /**
10
- * The emoji that was reacted to the comment.
11
- */
12
- emoji: string;
13
- /**
14
- * The date the first user reacted to the comment with this emoji.
15
- */
16
- createdAt: Date;
17
- /**
18
- * The user ids of the users that have reacted to the comment with this emoji
19
- */
20
- userIds: string[];
21
- };
22
- /**
23
- * Information about a comment.
24
- */
25
- export type CommentData = {
26
- type: "comment";
27
- /**
28
- * The unique identifier for the comment.
29
- */
30
- id: string;
31
- /**
32
- * The user id of the author of the comment.
33
- */
34
- userId: string;
35
- /**
36
- * The date when the comment was created.
37
- */
38
- createdAt: Date;
39
- /**
40
- * The date when the comment was last updated.
41
- */
42
- updatedAt: Date;
43
- /**
44
- * The reactions (emoji reactions) to the comment.
45
- */
46
- reactions: CommentReactionData[];
47
- /**
48
- * You can use this store any additional information about the comment.
49
- */
50
- metadata: any;
51
- } & ({
52
- /**
53
- * The date when the comment was deleted. This applies only for "soft deletes",
54
- * otherwise the comment is removed entirely.
55
- */
56
- deletedAt: Date;
57
- /**
58
- * The body of the comment is undefined if the comment is deleted.
59
- */
60
- body: undefined;
61
- } | {
62
- /**
63
- * In case of a non-deleted comment, this is not set
64
- */
65
- deletedAt?: never;
66
- /**
67
- * The body of the comment.
68
- */
69
- body: CommentBody;
70
- });
71
- /**
72
- * Information about a thread. A thread holds a list of comments.
73
- */
74
- export type ThreadData = {
75
- type: "thread";
76
- /**
77
- * The unique identifier for the thread.
78
- */
79
- id: string;
80
- /**
81
- * The date when the thread was created.
82
- */
83
- createdAt: Date;
84
- /**
85
- * The date when the thread was last updated.
86
- */
87
- updatedAt: Date;
88
- /**
89
- * The comments in the thread.
90
- */
91
- comments: CommentData[];
92
- /**
93
- * Whether the thread has been marked as resolved.
94
- */
95
- resolved: boolean;
96
- /**
97
- * The date when the thread was marked as resolved.
98
- */
99
- resolvedUpdatedAt?: Date;
100
- /**
101
- * You can use this store any additional information about the thread.
102
- */
103
- metadata: any;
104
- /**
105
- * The date when the thread was deleted. (or undefined if it is not deleted)
106
- * This only applies for "soft deletes", otherwise the thread is removed entirely.
107
- */
108
- deletedAt?: Date;
109
- };
@@ -1,5 +0,0 @@
1
- export type User = {
2
- id: string;
3
- username: string;
4
- avatarUrl: string;
5
- };