@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,8 +1,233 @@
1
1
  import { EditorTestCases } from "../index";
2
2
  import { DefaultBlockSchema, DefaultStyleSchema } from "../../../blocks/defaultBlocks";
3
- import { InlineContentSchemaFromSpecs } from "../../../schema/inlineContent/types";
4
- declare const customInlineContent: {
5
- mention: import("../../../schema/inlineContent/types").InlineContentSpec<{
3
+ import { BlockNoteSchema } from "../../../editor/BlockNoteSchema";
4
+ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
5
+ paragraph: {
6
+ config: {
7
+ type: "paragraph";
8
+ content: "inline";
9
+ propSchema: {
10
+ backgroundColor: {
11
+ default: "default";
12
+ };
13
+ textColor: {
14
+ default: "default";
15
+ };
16
+ textAlignment: {
17
+ default: "left";
18
+ values: readonly ["left", "center", "right", "justify"];
19
+ };
20
+ };
21
+ };
22
+ implementation: import("../../..").TiptapBlockImplementation<{
23
+ type: "paragraph";
24
+ content: "inline";
25
+ propSchema: {
26
+ backgroundColor: {
27
+ default: "default";
28
+ };
29
+ textColor: {
30
+ default: "default";
31
+ };
32
+ textAlignment: {
33
+ default: "left";
34
+ values: readonly ["left", "center", "right", "justify"];
35
+ };
36
+ };
37
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
38
+ };
39
+ heading: {
40
+ config: {
41
+ type: "heading";
42
+ content: "inline";
43
+ propSchema: {
44
+ level: {
45
+ default: number;
46
+ values: readonly [1, 2, 3];
47
+ };
48
+ backgroundColor: {
49
+ default: "default";
50
+ };
51
+ textColor: {
52
+ default: "default";
53
+ };
54
+ textAlignment: {
55
+ default: "left";
56
+ values: readonly ["left", "center", "right", "justify"];
57
+ };
58
+ };
59
+ };
60
+ implementation: import("../../..").TiptapBlockImplementation<{
61
+ type: "heading";
62
+ content: "inline";
63
+ propSchema: {
64
+ level: {
65
+ default: number;
66
+ values: readonly [1, 2, 3];
67
+ };
68
+ backgroundColor: {
69
+ default: "default";
70
+ };
71
+ textColor: {
72
+ default: "default";
73
+ };
74
+ textAlignment: {
75
+ default: "left";
76
+ values: readonly ["left", "center", "right", "justify"];
77
+ };
78
+ };
79
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
80
+ };
81
+ bulletListItem: {
82
+ config: {
83
+ type: "bulletListItem";
84
+ content: "inline";
85
+ propSchema: {
86
+ backgroundColor: {
87
+ default: "default";
88
+ };
89
+ textColor: {
90
+ default: "default";
91
+ };
92
+ textAlignment: {
93
+ default: "left";
94
+ values: readonly ["left", "center", "right", "justify"];
95
+ };
96
+ };
97
+ };
98
+ implementation: import("../../..").TiptapBlockImplementation<{
99
+ type: "bulletListItem";
100
+ content: "inline";
101
+ propSchema: {
102
+ backgroundColor: {
103
+ default: "default";
104
+ };
105
+ textColor: {
106
+ default: "default";
107
+ };
108
+ textAlignment: {
109
+ default: "left";
110
+ values: readonly ["left", "center", "right", "justify"];
111
+ };
112
+ };
113
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
114
+ };
115
+ numberedListItem: {
116
+ config: {
117
+ type: "numberedListItem";
118
+ content: "inline";
119
+ propSchema: {
120
+ backgroundColor: {
121
+ default: "default";
122
+ };
123
+ textColor: {
124
+ default: "default";
125
+ };
126
+ textAlignment: {
127
+ default: "left";
128
+ values: readonly ["left", "center", "right", "justify"];
129
+ };
130
+ };
131
+ };
132
+ implementation: import("../../..").TiptapBlockImplementation<{
133
+ type: "numberedListItem";
134
+ content: "inline";
135
+ propSchema: {
136
+ backgroundColor: {
137
+ default: "default";
138
+ };
139
+ textColor: {
140
+ default: "default";
141
+ };
142
+ textAlignment: {
143
+ default: "left";
144
+ values: readonly ["left", "center", "right", "justify"];
145
+ };
146
+ };
147
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
148
+ };
149
+ image: {
150
+ config: {
151
+ type: "image";
152
+ propSchema: {
153
+ textAlignment: {
154
+ default: "left";
155
+ values: readonly ["left", "center", "right", "justify"];
156
+ };
157
+ backgroundColor: {
158
+ default: "default";
159
+ };
160
+ url: {
161
+ default: "";
162
+ };
163
+ caption: {
164
+ default: "";
165
+ };
166
+ width: {
167
+ default: 512;
168
+ };
169
+ };
170
+ content: "none";
171
+ };
172
+ implementation: import("../../..").TiptapBlockImplementation<{
173
+ type: "image";
174
+ propSchema: {
175
+ textAlignment: {
176
+ default: "left";
177
+ values: readonly ["left", "center", "right", "justify"];
178
+ };
179
+ backgroundColor: {
180
+ default: "default";
181
+ };
182
+ url: {
183
+ default: "";
184
+ };
185
+ caption: {
186
+ default: "";
187
+ };
188
+ width: {
189
+ default: 512;
190
+ };
191
+ };
192
+ content: "none";
193
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
194
+ };
195
+ table: {
196
+ config: {
197
+ type: "table";
198
+ content: "table";
199
+ propSchema: {
200
+ backgroundColor: {
201
+ default: "default";
202
+ };
203
+ textColor: {
204
+ default: "default";
205
+ };
206
+ textAlignment: {
207
+ default: "left";
208
+ values: readonly ["left", "center", "right", "justify"];
209
+ };
210
+ };
211
+ };
212
+ implementation: import("../../..").TiptapBlockImplementation<{
213
+ type: "table";
214
+ content: "table";
215
+ propSchema: {
216
+ backgroundColor: {
217
+ default: "default";
218
+ };
219
+ textColor: {
220
+ default: "default";
221
+ };
222
+ textAlignment: {
223
+ default: "left";
224
+ values: readonly ["left", "center", "right", "justify"];
225
+ };
226
+ };
227
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
228
+ };
229
+ }>, import("../../..").InlineContentSchemaFromSpecs<{
230
+ mention: import("../../..").InlineContentSpec<{
6
231
  type: "mention";
7
232
  propSchema: {
8
233
  user: {
@@ -11,7 +236,7 @@ declare const customInlineContent: {
11
236
  };
12
237
  content: "none";
13
238
  }>;
14
- tag: import("../../../schema/inlineContent/types").InlineContentSpec<{
239
+ tag: import("../../..").InlineContentSpec<{
15
240
  type: "tag";
16
241
  propSchema: {};
17
242
  content: "styled";
@@ -24,6 +249,56 @@ declare const customInlineContent: {
24
249
  config: "link";
25
250
  implementation: any;
26
251
  };
27
- };
28
- export declare const customInlineContentTestCases: EditorTestCases<DefaultBlockSchema, InlineContentSchemaFromSpecs<typeof customInlineContent>, DefaultStyleSchema>;
252
+ }>, import("../../..").StyleSchemaFromSpecs<{
253
+ bold: {
254
+ config: {
255
+ type: string;
256
+ propSchema: "boolean";
257
+ };
258
+ implementation: import("../../..").StyleImplementation;
259
+ };
260
+ italic: {
261
+ config: {
262
+ type: string;
263
+ propSchema: "boolean";
264
+ };
265
+ implementation: import("../../..").StyleImplementation;
266
+ };
267
+ underline: {
268
+ config: {
269
+ type: string;
270
+ propSchema: "boolean";
271
+ };
272
+ implementation: import("../../..").StyleImplementation;
273
+ };
274
+ strike: {
275
+ config: {
276
+ type: string;
277
+ propSchema: "boolean";
278
+ };
279
+ implementation: import("../../..").StyleImplementation;
280
+ };
281
+ code: {
282
+ config: {
283
+ type: string;
284
+ propSchema: "boolean";
285
+ };
286
+ implementation: import("../../..").StyleImplementation;
287
+ };
288
+ textColor: {
289
+ config: {
290
+ type: string;
291
+ propSchema: "string";
292
+ };
293
+ implementation: import("../../..").StyleImplementation;
294
+ };
295
+ backgroundColor: {
296
+ config: {
297
+ type: string;
298
+ propSchema: "string";
299
+ };
300
+ implementation: import("../../..").StyleImplementation;
301
+ };
302
+ }>>;
303
+ export declare const customInlineContentTestCases: EditorTestCases<DefaultBlockSchema, typeof schema.inlineContentSchema, DefaultStyleSchema>;
29
304
  export {};
@@ -1,12 +1,246 @@
1
1
  import { EditorTestCases } from "../index";
2
2
  import { DefaultBlockSchema, DefaultInlineContentSchema } from "../../../blocks/defaultBlocks";
3
- import { StyleSchemaFromSpecs } from "../../../schema/styles/types";
4
- declare const customStyles: {
5
- small: import("../../../schema/styles/types").StyleSpec<{
3
+ import { BlockNoteSchema } from "../../../editor/BlockNoteSchema";
4
+ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
5
+ paragraph: {
6
+ config: {
7
+ type: "paragraph";
8
+ content: "inline";
9
+ propSchema: {
10
+ backgroundColor: {
11
+ default: "default";
12
+ };
13
+ textColor: {
14
+ default: "default";
15
+ };
16
+ textAlignment: {
17
+ default: "left";
18
+ values: readonly ["left", "center", "right", "justify"];
19
+ };
20
+ };
21
+ };
22
+ implementation: import("../../..").TiptapBlockImplementation<{
23
+ type: "paragraph";
24
+ content: "inline";
25
+ propSchema: {
26
+ backgroundColor: {
27
+ default: "default";
28
+ };
29
+ textColor: {
30
+ default: "default";
31
+ };
32
+ textAlignment: {
33
+ default: "left";
34
+ values: readonly ["left", "center", "right", "justify"];
35
+ };
36
+ };
37
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
38
+ };
39
+ heading: {
40
+ config: {
41
+ type: "heading";
42
+ content: "inline";
43
+ propSchema: {
44
+ level: {
45
+ default: number;
46
+ values: readonly [1, 2, 3];
47
+ };
48
+ backgroundColor: {
49
+ default: "default";
50
+ };
51
+ textColor: {
52
+ default: "default";
53
+ };
54
+ textAlignment: {
55
+ default: "left";
56
+ values: readonly ["left", "center", "right", "justify"];
57
+ };
58
+ };
59
+ };
60
+ implementation: import("../../..").TiptapBlockImplementation<{
61
+ type: "heading";
62
+ content: "inline";
63
+ propSchema: {
64
+ level: {
65
+ default: number;
66
+ values: readonly [1, 2, 3];
67
+ };
68
+ backgroundColor: {
69
+ default: "default";
70
+ };
71
+ textColor: {
72
+ default: "default";
73
+ };
74
+ textAlignment: {
75
+ default: "left";
76
+ values: readonly ["left", "center", "right", "justify"];
77
+ };
78
+ };
79
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
80
+ };
81
+ bulletListItem: {
82
+ config: {
83
+ type: "bulletListItem";
84
+ content: "inline";
85
+ propSchema: {
86
+ backgroundColor: {
87
+ default: "default";
88
+ };
89
+ textColor: {
90
+ default: "default";
91
+ };
92
+ textAlignment: {
93
+ default: "left";
94
+ values: readonly ["left", "center", "right", "justify"];
95
+ };
96
+ };
97
+ };
98
+ implementation: import("../../..").TiptapBlockImplementation<{
99
+ type: "bulletListItem";
100
+ content: "inline";
101
+ propSchema: {
102
+ backgroundColor: {
103
+ default: "default";
104
+ };
105
+ textColor: {
106
+ default: "default";
107
+ };
108
+ textAlignment: {
109
+ default: "left";
110
+ values: readonly ["left", "center", "right", "justify"];
111
+ };
112
+ };
113
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
114
+ };
115
+ numberedListItem: {
116
+ config: {
117
+ type: "numberedListItem";
118
+ content: "inline";
119
+ propSchema: {
120
+ backgroundColor: {
121
+ default: "default";
122
+ };
123
+ textColor: {
124
+ default: "default";
125
+ };
126
+ textAlignment: {
127
+ default: "left";
128
+ values: readonly ["left", "center", "right", "justify"];
129
+ };
130
+ };
131
+ };
132
+ implementation: import("../../..").TiptapBlockImplementation<{
133
+ type: "numberedListItem";
134
+ content: "inline";
135
+ propSchema: {
136
+ backgroundColor: {
137
+ default: "default";
138
+ };
139
+ textColor: {
140
+ default: "default";
141
+ };
142
+ textAlignment: {
143
+ default: "left";
144
+ values: readonly ["left", "center", "right", "justify"];
145
+ };
146
+ };
147
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
148
+ };
149
+ image: {
150
+ config: {
151
+ type: "image";
152
+ propSchema: {
153
+ textAlignment: {
154
+ default: "left";
155
+ values: readonly ["left", "center", "right", "justify"];
156
+ };
157
+ backgroundColor: {
158
+ default: "default";
159
+ };
160
+ url: {
161
+ default: "";
162
+ };
163
+ caption: {
164
+ default: "";
165
+ };
166
+ width: {
167
+ default: 512;
168
+ };
169
+ };
170
+ content: "none";
171
+ };
172
+ implementation: import("../../..").TiptapBlockImplementation<{
173
+ type: "image";
174
+ propSchema: {
175
+ textAlignment: {
176
+ default: "left";
177
+ values: readonly ["left", "center", "right", "justify"];
178
+ };
179
+ backgroundColor: {
180
+ default: "default";
181
+ };
182
+ url: {
183
+ default: "";
184
+ };
185
+ caption: {
186
+ default: "";
187
+ };
188
+ width: {
189
+ default: 512;
190
+ };
191
+ };
192
+ content: "none";
193
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
194
+ };
195
+ table: {
196
+ config: {
197
+ type: "table";
198
+ content: "table";
199
+ propSchema: {
200
+ backgroundColor: {
201
+ default: "default";
202
+ };
203
+ textColor: {
204
+ default: "default";
205
+ };
206
+ textAlignment: {
207
+ default: "left";
208
+ values: readonly ["left", "center", "right", "justify"];
209
+ };
210
+ };
211
+ };
212
+ implementation: import("../../..").TiptapBlockImplementation<{
213
+ type: "table";
214
+ content: "table";
215
+ propSchema: {
216
+ backgroundColor: {
217
+ default: "default";
218
+ };
219
+ textColor: {
220
+ default: "default";
221
+ };
222
+ textAlignment: {
223
+ default: "left";
224
+ values: readonly ["left", "center", "right", "justify"];
225
+ };
226
+ };
227
+ }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
228
+ };
229
+ }>, import("../../..").InlineContentSchemaFromSpecs<{
230
+ text: {
231
+ config: "text";
232
+ implementation: any;
233
+ };
234
+ link: {
235
+ config: "link";
236
+ implementation: any;
237
+ };
238
+ }>, import("../../..").StyleSchemaFromSpecs<{
239
+ small: import("../../..").StyleSpec<{
6
240
  type: string;
7
241
  propSchema: "boolean";
8
242
  }>;
9
- fontSize: import("../../../schema/styles/types").StyleSpec<{
243
+ fontSize: import("../../..").StyleSpec<{
10
244
  type: string;
11
245
  propSchema: "string";
12
246
  }>;
@@ -15,50 +249,50 @@ declare const customStyles: {
15
249
  type: string;
16
250
  propSchema: "boolean";
17
251
  };
18
- implementation: import("../../../schema/styles/types").StyleImplementation;
252
+ implementation: import("../../..").StyleImplementation;
19
253
  };
20
254
  italic: {
21
255
  config: {
22
256
  type: string;
23
257
  propSchema: "boolean";
24
258
  };
25
- implementation: import("../../../schema/styles/types").StyleImplementation;
259
+ implementation: import("../../..").StyleImplementation;
26
260
  };
27
261
  underline: {
28
262
  config: {
29
263
  type: string;
30
264
  propSchema: "boolean";
31
265
  };
32
- implementation: import("../../../schema/styles/types").StyleImplementation;
266
+ implementation: import("../../..").StyleImplementation;
33
267
  };
34
268
  strike: {
35
269
  config: {
36
270
  type: string;
37
271
  propSchema: "boolean";
38
272
  };
39
- implementation: import("../../../schema/styles/types").StyleImplementation;
273
+ implementation: import("../../..").StyleImplementation;
40
274
  };
41
275
  code: {
42
276
  config: {
43
277
  type: string;
44
278
  propSchema: "boolean";
45
279
  };
46
- implementation: import("../../../schema/styles/types").StyleImplementation;
280
+ implementation: import("../../..").StyleImplementation;
47
281
  };
48
282
  textColor: {
49
283
  config: {
50
284
  type: string;
51
285
  propSchema: "string";
52
286
  };
53
- implementation: import("../../../schema/styles/types").StyleImplementation;
287
+ implementation: import("../../..").StyleImplementation;
54
288
  };
55
289
  backgroundColor: {
56
290
  config: {
57
291
  type: string;
58
292
  propSchema: "string";
59
293
  };
60
- implementation: import("../../../schema/styles/types").StyleImplementation;
294
+ implementation: import("../../..").StyleImplementation;
61
295
  };
62
- };
63
- export declare const customStylesTestCases: EditorTestCases<DefaultBlockSchema, DefaultInlineContentSchema, StyleSchemaFromSpecs<typeof customStyles>>;
296
+ }>>;
297
+ export declare const customStylesTestCases: EditorTestCases<DefaultBlockSchema, DefaultInlineContentSchema, typeof schema.styleSchema>;
64
298
  export {};
@@ -1,12 +1,14 @@
1
+ import { PartialBlock } from "../../blocks/defaultBlocks";
1
2
  import { BlockNoteEditor } from "../../editor/BlockNoteEditor";
2
- import { BlockSchema, PartialBlock } from "../../schema/blocks/types";
3
+ import { BlockSchema } from "../../schema/blocks/types";
3
4
  import { InlineContentSchema } from "../../schema/inlineContent/types";
4
5
  import { StyleSchema } from "../../schema/styles/types";
6
+ import { NoInfer } from "../../util/typescript";
5
7
  export type EditorTestCases<B extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = {
6
8
  name: string;
7
9
  createEditor: () => BlockNoteEditor<B, I, S>;
8
10
  documents: Array<{
9
11
  name: string;
10
- blocks: PartialBlock<B, I, S>[];
12
+ blocks: PartialBlock<NoInfer<B>, NoInfer<I>, NoInfer<S>>[];
11
13
  }>;
12
14
  };
@@ -1,4 +1,5 @@
1
- import { Block, BlockSchema, PartialBlock } from "../../schema/blocks/types";
1
+ import { Block, PartialBlock } from "../../blocks/defaultBlocks";
2
+ import { BlockSchema } from "../../schema/blocks/types";
2
3
  import { InlineContentSchema } from "../../schema/inlineContent/types";
3
4
  import { StyleSchema } from "../../schema/styles/types";
4
5
  export declare function partialBlocksToBlocksForTesting<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(schema: BSchema, partialBlocks: Array<PartialBlock<BSchema, I, S>>): Array<Block<BSchema, I, S>>;
@@ -1 +1,6 @@
1
- export declare const uploadToTmpFilesDotOrg_DEV_ONLY: (file: File) => Promise<any>;
1
+ /**
2
+ * Uploads a file to tmpfiles.org and returns the URL to the uploaded file.
3
+ *
4
+ * @warning This function should only be used for development purposes, replace with your own backend!
5
+ */
6
+ export declare const uploadToTmpFilesDotOrg_DEV_ONLY: (file: File) => Promise<string>;
@@ -1,10 +1,10 @@
1
1
  import type { BlockNoteEditor } from "../editor/BlockNoteEditor";
2
- import type { Block, InlineContentSchema, StyleSchema } from "../schema";
2
+ import type { BlockNoDefaults, InlineContentSchema, StyleSchema } from "../schema";
3
3
  export declare function createDefaultBlockDOMOutputSpec(blockName: string, htmlTag: string, blockContentHTMLAttributes: Record<string, string>, inlineContentHTMLAttributes: Record<string, string>): {
4
4
  dom: HTMLDivElement;
5
5
  contentDOM: HTMLElement;
6
6
  };
7
- export declare const defaultBlockToHTML: <BSchema extends Record<string, import("../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(block: Block<BSchema, I, S>, editor: BlockNoteEditor<BSchema, I, S>) => {
7
+ export declare const defaultBlockToHTML: <BSchema extends Record<string, import("../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(block: BlockNoDefaults<BSchema, I, S>, editor: BlockNoteEditor<BSchema, I, S>) => {
8
8
  dom: HTMLElement;
9
9
  contentDOM?: HTMLElement;
10
10
  };
@@ -0,0 +1,24 @@
1
+ import type { BlockNoteEditor } from "../editor/BlockNoteEditor";
2
+ import { BlockFromConfig, InlineContentSchema, StyleSchema } from "../schema";
3
+ import { Block, DefaultBlockSchema } from "./defaultBlocks";
4
+ import { defaultProps } from "./defaultProps";
5
+ export declare function checkDefaultBlockTypeInSchema<BlockType extends keyof DefaultBlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blockType: BlockType, editor: BlockNoteEditor<any, I, S>): editor is BlockNoteEditor<{
6
+ Type: DefaultBlockSchema[BlockType];
7
+ }, I, S>;
8
+ export declare function checkBlockIsDefaultType<BlockType extends keyof DefaultBlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blockType: BlockType, block: Block<any, I, S>, editor: BlockNoteEditor<any, I, S>): block is BlockFromConfig<DefaultBlockSchema[BlockType], I, S>;
9
+ export declare function checkBlockTypeHasDefaultProp<Prop extends keyof typeof defaultProps, I extends InlineContentSchema, S extends StyleSchema>(prop: Prop, blockType: string, editor: BlockNoteEditor<any, I, S>): editor is BlockNoteEditor<{
10
+ [BT in string]: {
11
+ type: BT;
12
+ propSchema: {
13
+ [P in Prop]: (typeof defaultProps)[P];
14
+ };
15
+ content: "table" | "inline" | "none";
16
+ };
17
+ }, I, S>;
18
+ export declare function checkBlockHasDefaultProp<Prop extends keyof typeof defaultProps, I extends InlineContentSchema, S extends StyleSchema>(prop: Prop, block: Block<any, I, S>, editor: BlockNoteEditor<any, I, S>): block is BlockFromConfig<{
19
+ type: string;
20
+ propSchema: {
21
+ [P in Prop]: (typeof defaultProps)[P];
22
+ };
23
+ content: "table" | "inline" | "none";
24
+ }, I, S>;