@blocknote/core 0.13.2 → 0.13.4

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 (163) hide show
  1. package/dist/blocknote.js +5730 -2891
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +7 -7
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/dist/webpack-stats.json +1 -1
  7. package/package.json +2 -2
  8. package/src/api/exporters/html/__snapshots__/file/basic/external.html +1 -0
  9. package/src/api/exporters/html/__snapshots__/file/basic/internal.html +1 -0
  10. package/src/api/exporters/html/__snapshots__/file/button/external.html +1 -0
  11. package/src/api/exporters/html/__snapshots__/file/button/internal.html +1 -0
  12. package/src/api/exporters/html/__snapshots__/file/nested/external.html +1 -0
  13. package/src/api/exporters/html/__snapshots__/file/nested/internal.html +1 -0
  14. package/src/api/exporters/html/__snapshots__/file/noCaption/external.html +1 -0
  15. package/src/api/exporters/html/__snapshots__/file/noCaption/internal.html +1 -0
  16. package/src/api/exporters/html/__snapshots__/file/noName/external.html +1 -0
  17. package/src/api/exporters/html/__snapshots__/file/noName/internal.html +1 -0
  18. package/src/api/exporters/html/__snapshots__/image/basic/external.html +1 -1
  19. package/src/api/exporters/html/__snapshots__/image/basic/internal.html +1 -1
  20. package/src/api/exporters/html/__snapshots__/image/button/external.html +1 -1
  21. package/src/api/exporters/html/__snapshots__/image/button/internal.html +1 -1
  22. package/src/api/exporters/html/__snapshots__/image/nested/external.html +1 -1
  23. package/src/api/exporters/html/__snapshots__/image/nested/internal.html +1 -1
  24. package/src/api/exporters/html/__snapshots__/image/noCaption/external.html +1 -0
  25. package/src/api/exporters/html/__snapshots__/image/noCaption/internal.html +1 -0
  26. package/src/api/exporters/html/__snapshots__/image/noName/external.html +1 -0
  27. package/src/api/exporters/html/__snapshots__/image/noName/internal.html +1 -0
  28. package/src/api/exporters/html/__snapshots__/image/noPreview/external.html +1 -0
  29. package/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +1 -0
  30. package/src/api/exporters/html/__snapshots__/lists/basic/external.html +1 -0
  31. package/src/api/exporters/html/__snapshots__/lists/basic/internal.html +1 -0
  32. package/src/api/exporters/html/__snapshots__/lists/nested/external.html +1 -0
  33. package/src/api/exporters/html/__snapshots__/lists/nested/internal.html +1 -0
  34. package/src/api/exporters/html/__snapshots__/simpleFile/basic/external.html +1 -0
  35. package/src/api/exporters/html/__snapshots__/simpleFile/basic/internal.html +1 -0
  36. package/src/api/exporters/html/__snapshots__/simpleFile/button/external.html +1 -0
  37. package/src/api/exporters/html/__snapshots__/simpleFile/button/internal.html +1 -0
  38. package/src/api/exporters/html/__snapshots__/simpleFile/nested/external.html +1 -0
  39. package/src/api/exporters/html/__snapshots__/simpleFile/nested/internal.html +1 -0
  40. package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
  41. package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +1 -1
  42. package/src/api/exporters/html/__snapshots__/simpleImage/button/external.html +1 -1
  43. package/src/api/exporters/html/__snapshots__/simpleImage/button/internal.html +1 -1
  44. package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
  45. package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +1 -1
  46. package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -0
  47. package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html +1 -0
  48. package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -0
  49. package/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +1 -0
  50. package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +1 -0
  51. package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html +1 -0
  52. package/src/api/exporters/html/externalHTMLExporter.ts +4 -3
  53. package/src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts +1 -1
  54. package/src/api/exporters/markdown/__snapshots__/file/basic/markdown.md +3 -0
  55. package/src/api/exporters/markdown/__snapshots__/file/button/markdown.md +1 -0
  56. package/src/api/exporters/markdown/__snapshots__/file/nested/markdown.md +7 -0
  57. package/src/api/exporters/markdown/__snapshots__/file/noCaption/markdown.md +1 -0
  58. package/src/api/exporters/markdown/__snapshots__/file/noName/markdown.md +3 -0
  59. package/src/api/exporters/markdown/__snapshots__/image/basic/markdown.md +1 -1
  60. package/src/api/exporters/markdown/__snapshots__/image/button/markdown.md +1 -1
  61. package/src/api/exporters/markdown/__snapshots__/image/nested/markdown.md +2 -2
  62. package/src/api/exporters/markdown/__snapshots__/image/noCaption/markdown.md +1 -0
  63. package/src/api/exporters/markdown/__snapshots__/image/noName/markdown.md +3 -0
  64. package/src/api/exporters/markdown/__snapshots__/image/noPreview/markdown.md +3 -0
  65. package/src/api/exporters/markdown/__snapshots__/lists/basic/markdown.md +8 -0
  66. package/src/api/exporters/markdown/__snapshots__/lists/nested/markdown.md +10 -0
  67. package/src/api/exporters/markdown/__snapshots__/simpleFile/basic/markdown.md +3 -0
  68. package/src/api/exporters/markdown/__snapshots__/simpleFile/button/markdown.md +1 -0
  69. package/src/api/exporters/markdown/__snapshots__/simpleFile/nested/markdown.md +7 -0
  70. package/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +3 -1
  71. package/src/api/exporters/markdown/__snapshots__/simpleImage/button/markdown.md +1 -0
  72. package/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +6 -2
  73. package/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md +1 -0
  74. package/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md +3 -0
  75. package/src/api/exporters/markdown/__snapshots__/simpleImage/noPreview/markdown.md +3 -0
  76. package/src/api/exporters/markdown/markdownExporter.ts +2 -0
  77. package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +42 -0
  78. package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +262 -4
  79. package/src/api/parsers/html/__snapshots__/paste/list-test.json +74 -2
  80. package/src/api/parsers/html/__snapshots__/paste/parse-basic-block-types.json +3 -1
  81. package/src/api/parsers/html/__snapshots__/paste/parse-fake-image-caption.json +3 -1
  82. package/src/api/parsers/html/__snapshots__/paste/parse-mixed-nested-lists.json +135 -10
  83. package/src/api/parsers/html/__snapshots__/paste/parse-nested-lists-with-paragraphs.json +132 -7
  84. package/src/api/parsers/html/__snapshots__/paste/parse-nested-lists.json +111 -3
  85. package/src/api/parsers/html/parseHTML.test.ts +166 -95
  86. package/src/api/testUtil/cases/customBlocks.ts +82 -33
  87. package/src/api/testUtil/cases/customInlineContent.ts +1 -1
  88. package/src/api/testUtil/cases/customStyles.ts +1 -1
  89. package/src/api/testUtil/cases/defaultSchema.ts +185 -4
  90. package/src/blocks/AudioBlockContent/AudioBlockContent.ts +163 -0
  91. package/src/blocks/AudioBlockContent/audioBlockHelpers.ts +5 -0
  92. package/src/blocks/FileBlockContent/FileBlockContent.ts +120 -0
  93. package/src/blocks/FileBlockContent/fileBlockHelpers.ts +377 -0
  94. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +134 -354
  95. package/src/blocks/ImageBlockContent/imageBlockHelpers.ts +6 -0
  96. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +3 -0
  97. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +266 -0
  98. package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +2 -1
  99. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +1 -0
  100. package/src/blocks/VideoBlockContent/VideoBlockContent.ts +181 -0
  101. package/src/blocks/VideoBlockContent/videoBlockHelpers.ts +6 -0
  102. package/src/blocks/defaultBlockTypeGuards.ts +53 -1
  103. package/src/blocks/defaultBlocks.ts +11 -2
  104. package/src/editor/Block.css +89 -27
  105. package/src/editor/BlockNoteEditor.ts +24 -10
  106. package/src/editor/BlockNoteSchema.ts +12 -3
  107. package/src/editor/transformPasted.ts +2 -1
  108. package/src/extensions/{ImagePanel/ImageToolbarPlugin.ts → FilePanel/FilePanelPlugin.ts} +22 -25
  109. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +14 -2
  110. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +72 -2
  111. package/src/extensions/TableHandles/TableHandlesPlugin.ts +27 -27
  112. package/src/extensions/TextAlignment/TextAlignmentExtension.ts +7 -1
  113. package/src/i18n/locales/en.ts +117 -11
  114. package/src/i18n/locales/fr.ts +118 -11
  115. package/src/i18n/locales/index.ts +8 -2
  116. package/src/i18n/locales/is.ts +295 -0
  117. package/src/i18n/locales/ja.ts +323 -0
  118. package/src/i18n/locales/ko.ts +307 -0
  119. package/src/i18n/locales/nl.ts +108 -8
  120. package/src/i18n/locales/pl.ts +287 -0
  121. package/src/i18n/locales/pt.ts +295 -0
  122. package/src/i18n/locales/vi.ts +295 -0
  123. package/src/i18n/locales/zh.ts +123 -8
  124. package/src/index.ts +9 -2
  125. package/src/pm-nodes/BlockContainer.ts +18 -6
  126. package/src/schema/blocks/createSpec.ts +1 -0
  127. package/src/schema/blocks/internal.ts +10 -0
  128. package/src/schema/blocks/types.ts +40 -5
  129. package/src/util/string.ts +12 -0
  130. package/types/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.d.ts +7 -0
  131. package/types/src/api/testUtil/cases/customBlocks.d.ts +272 -54
  132. package/types/src/api/testUtil/cases/customInlineContent.d.ts +222 -16
  133. package/types/src/api/testUtil/cases/customStyles.d.ts +222 -16
  134. package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +101 -0
  135. package/types/src/blocks/AudioBlockContent/audioBlockHelpers.d.ts +3 -0
  136. package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +93 -0
  137. package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +30 -0
  138. package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +50 -14
  139. package/types/src/blocks/ImageBlockContent/imageBlockHelpers.d.ts +4 -0
  140. package/types/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.d.ts +55 -0
  141. package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +129 -0
  142. package/types/src/blocks/VideoBlockContent/videoBlockHelpers.d.ts +4 -0
  143. package/types/src/blocks/defaultBlockTypeGuards.d.ts +6 -1
  144. package/types/src/blocks/defaultBlocks.d.ts +444 -32
  145. package/types/src/editor/BlockNoteEditor.d.ts +12 -5
  146. package/types/src/extensions/{ImagePanel/ImageToolbarPlugin.d.ts → FilePanel/FilePanelPlugin.d.ts} +9 -12
  147. package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +1 -1
  148. package/types/src/i18n/locales/en.d.ts +56 -7
  149. package/types/src/i18n/locales/fr.d.ts +2 -184
  150. package/types/src/i18n/locales/index.d.ts +7 -1
  151. package/types/src/i18n/locales/is.d.ts +2 -0
  152. package/types/src/i18n/locales/ja.d.ts +2 -0
  153. package/types/src/i18n/locales/ko.d.ts +2 -0
  154. package/types/src/i18n/locales/pl.d.ts +2 -0
  155. package/types/src/i18n/locales/pt.d.ts +2 -0
  156. package/types/src/i18n/locales/vi.d.ts +2 -0
  157. package/types/src/index.d.ts +8 -2
  158. package/types/src/pm-nodes/BlockContainer.d.ts +1 -1
  159. package/types/src/schema/blocks/internal.d.ts +1 -1
  160. package/types/src/schema/blocks/types.d.ts +25 -1
  161. package/types/src/util/string.d.ts +1 -0
  162. /package/src/blocks/{ImageBlockContent → FileBlockContent}/uploadToTmpFilesDotOrg_DEV_ONLY.ts +0 -0
  163. /package/types/src/blocks/{ImageBlockContent → FileBlockContent}/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +0 -0
@@ -144,6 +144,120 @@ export declare const defaultBlockSpecs: {
144
144
  };
145
145
  }, any, InlineContentSchema, StyleSchema>;
146
146
  };
147
+ checkListItem: {
148
+ config: {
149
+ type: "checkListItem";
150
+ content: "inline";
151
+ propSchema: {
152
+ checked: {
153
+ default: false;
154
+ };
155
+ backgroundColor: {
156
+ default: "default";
157
+ };
158
+ textColor: {
159
+ default: "default";
160
+ };
161
+ textAlignment: {
162
+ default: "left";
163
+ values: readonly ["left", "center", "right", "justify"];
164
+ };
165
+ };
166
+ };
167
+ implementation: import("../schema").TiptapBlockImplementation<{
168
+ type: "checkListItem";
169
+ content: "inline";
170
+ propSchema: {
171
+ checked: {
172
+ default: false;
173
+ };
174
+ backgroundColor: {
175
+ default: "default";
176
+ };
177
+ textColor: {
178
+ default: "default";
179
+ };
180
+ textAlignment: {
181
+ default: "left";
182
+ values: readonly ["left", "center", "right", "justify"];
183
+ };
184
+ };
185
+ }, any, InlineContentSchema, StyleSchema>;
186
+ };
187
+ table: {
188
+ config: {
189
+ type: "table";
190
+ content: "table";
191
+ propSchema: {
192
+ backgroundColor: {
193
+ default: "default";
194
+ };
195
+ textColor: {
196
+ default: "default";
197
+ };
198
+ textAlignment: {
199
+ default: "left";
200
+ values: readonly ["left", "center", "right", "justify"];
201
+ };
202
+ };
203
+ };
204
+ implementation: import("../schema").TiptapBlockImplementation<{
205
+ type: "table";
206
+ content: "table";
207
+ propSchema: {
208
+ backgroundColor: {
209
+ default: "default";
210
+ };
211
+ textColor: {
212
+ default: "default";
213
+ };
214
+ textAlignment: {
215
+ default: "left";
216
+ values: readonly ["left", "center", "right", "justify"];
217
+ };
218
+ };
219
+ }, any, InlineContentSchema, StyleSchema>;
220
+ };
221
+ file: {
222
+ config: {
223
+ type: "file";
224
+ propSchema: {
225
+ backgroundColor: {
226
+ default: "default";
227
+ };
228
+ name: {
229
+ default: "";
230
+ };
231
+ url: {
232
+ default: "";
233
+ };
234
+ caption: {
235
+ default: "";
236
+ };
237
+ };
238
+ content: "none";
239
+ isFileBlock: true;
240
+ };
241
+ implementation: import("../schema").TiptapBlockImplementation<{
242
+ type: "file";
243
+ propSchema: {
244
+ backgroundColor: {
245
+ default: "default";
246
+ };
247
+ name: {
248
+ default: "";
249
+ };
250
+ url: {
251
+ default: "";
252
+ };
253
+ caption: {
254
+ default: "";
255
+ };
256
+ };
257
+ content: "none";
258
+ isFileBlock: true;
259
+ }, any, InlineContentSchema, StyleSchema>;
260
+ };
147
261
  image: {
148
262
  config: {
149
263
  type: "image";
@@ -155,17 +269,25 @@ export declare const defaultBlockSpecs: {
155
269
  backgroundColor: {
156
270
  default: "default";
157
271
  };
272
+ name: {
273
+ default: "";
274
+ };
158
275
  url: {
159
276
  default: "";
160
277
  };
161
278
  caption: {
162
279
  default: "";
163
280
  };
164
- width: {
165
- default: 512;
281
+ showPreview: {
282
+ default: true;
283
+ };
284
+ previewWidth: {
285
+ default: number;
166
286
  };
167
287
  };
168
288
  content: "none";
289
+ isFileBlock: true;
290
+ fileBlockAcceptMimeTypes: string[];
169
291
  };
170
292
  implementation: import("../schema").TiptapBlockImplementation<{
171
293
  type: "image";
@@ -177,51 +299,135 @@ export declare const defaultBlockSpecs: {
177
299
  backgroundColor: {
178
300
  default: "default";
179
301
  };
302
+ name: {
303
+ default: "";
304
+ };
180
305
  url: {
181
306
  default: "";
182
307
  };
183
308
  caption: {
184
309
  default: "";
185
310
  };
186
- width: {
187
- default: 512;
311
+ showPreview: {
312
+ default: true;
313
+ };
314
+ previewWidth: {
315
+ default: number;
188
316
  };
189
317
  };
190
318
  content: "none";
319
+ isFileBlock: true;
320
+ fileBlockAcceptMimeTypes: string[];
191
321
  }, any, InlineContentSchema, StyleSchema>;
192
322
  };
193
- table: {
323
+ video: {
194
324
  config: {
195
- type: "table";
196
- content: "table";
325
+ type: "video";
197
326
  propSchema: {
327
+ textAlignment: {
328
+ default: "left";
329
+ values: readonly ["left", "center", "right", "justify"];
330
+ };
198
331
  backgroundColor: {
199
332
  default: "default";
200
333
  };
201
- textColor: {
202
- default: "default";
334
+ name: {
335
+ default: "";
336
+ };
337
+ url: {
338
+ default: "";
339
+ };
340
+ caption: {
341
+ default: "";
203
342
  };
343
+ showPreview: {
344
+ default: true;
345
+ };
346
+ previewWidth: {
347
+ default: number;
348
+ };
349
+ };
350
+ content: "none";
351
+ isFileBlock: true;
352
+ fileBlockAcceptMimeTypes: string[];
353
+ };
354
+ implementation: import("../schema").TiptapBlockImplementation<{
355
+ type: "video";
356
+ propSchema: {
204
357
  textAlignment: {
205
358
  default: "left";
206
359
  values: readonly ["left", "center", "right", "justify"];
207
360
  };
361
+ backgroundColor: {
362
+ default: "default";
363
+ };
364
+ name: {
365
+ default: "";
366
+ };
367
+ url: {
368
+ default: "";
369
+ };
370
+ caption: {
371
+ default: "";
372
+ };
373
+ showPreview: {
374
+ default: true;
375
+ };
376
+ previewWidth: {
377
+ default: number;
378
+ };
208
379
  };
380
+ content: "none";
381
+ isFileBlock: true;
382
+ fileBlockAcceptMimeTypes: string[];
383
+ }, any, InlineContentSchema, StyleSchema>;
384
+ };
385
+ audio: {
386
+ config: {
387
+ type: "audio";
388
+ propSchema: {
389
+ backgroundColor: {
390
+ default: "default";
391
+ };
392
+ name: {
393
+ default: "";
394
+ };
395
+ url: {
396
+ default: "";
397
+ };
398
+ caption: {
399
+ default: "";
400
+ };
401
+ showPreview: {
402
+ default: true;
403
+ };
404
+ };
405
+ content: "none";
406
+ isFileBlock: true;
407
+ fileBlockAcceptMimeTypes: string[];
209
408
  };
210
409
  implementation: import("../schema").TiptapBlockImplementation<{
211
- type: "table";
212
- content: "table";
410
+ type: "audio";
213
411
  propSchema: {
214
412
  backgroundColor: {
215
413
  default: "default";
216
414
  };
217
- textColor: {
218
- default: "default";
415
+ name: {
416
+ default: "";
219
417
  };
220
- textAlignment: {
221
- default: "left";
222
- values: readonly ["left", "center", "right", "justify"];
418
+ url: {
419
+ default: "";
420
+ };
421
+ caption: {
422
+ default: "";
423
+ };
424
+ showPreview: {
425
+ default: true;
223
426
  };
224
427
  };
428
+ content: "none";
429
+ isFileBlock: true;
430
+ fileBlockAcceptMimeTypes: string[];
225
431
  }, any, InlineContentSchema, StyleSchema>;
226
432
  };
227
433
  };
@@ -370,6 +576,120 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
370
576
  };
371
577
  }, any, InlineContentSchema, StyleSchema>;
372
578
  };
579
+ checkListItem: {
580
+ config: {
581
+ type: "checkListItem";
582
+ content: "inline";
583
+ propSchema: {
584
+ checked: {
585
+ default: false;
586
+ };
587
+ backgroundColor: {
588
+ default: "default";
589
+ };
590
+ textColor: {
591
+ default: "default";
592
+ };
593
+ textAlignment: {
594
+ default: "left";
595
+ values: readonly ["left", "center", "right", "justify"];
596
+ };
597
+ };
598
+ };
599
+ implementation: import("../schema").TiptapBlockImplementation<{
600
+ type: "checkListItem";
601
+ content: "inline";
602
+ propSchema: {
603
+ checked: {
604
+ default: false;
605
+ };
606
+ backgroundColor: {
607
+ default: "default";
608
+ };
609
+ textColor: {
610
+ default: "default";
611
+ };
612
+ textAlignment: {
613
+ default: "left";
614
+ values: readonly ["left", "center", "right", "justify"];
615
+ };
616
+ };
617
+ }, any, InlineContentSchema, StyleSchema>;
618
+ };
619
+ table: {
620
+ config: {
621
+ type: "table";
622
+ content: "table";
623
+ propSchema: {
624
+ backgroundColor: {
625
+ default: "default";
626
+ };
627
+ textColor: {
628
+ default: "default";
629
+ };
630
+ textAlignment: {
631
+ default: "left";
632
+ values: readonly ["left", "center", "right", "justify"];
633
+ };
634
+ };
635
+ };
636
+ implementation: import("../schema").TiptapBlockImplementation<{
637
+ type: "table";
638
+ content: "table";
639
+ propSchema: {
640
+ backgroundColor: {
641
+ default: "default";
642
+ };
643
+ textColor: {
644
+ default: "default";
645
+ };
646
+ textAlignment: {
647
+ default: "left";
648
+ values: readonly ["left", "center", "right", "justify"];
649
+ };
650
+ };
651
+ }, any, InlineContentSchema, StyleSchema>;
652
+ };
653
+ file: {
654
+ config: {
655
+ type: "file";
656
+ propSchema: {
657
+ backgroundColor: {
658
+ default: "default";
659
+ };
660
+ name: {
661
+ default: "";
662
+ };
663
+ url: {
664
+ default: "";
665
+ };
666
+ caption: {
667
+ default: "";
668
+ };
669
+ };
670
+ content: "none";
671
+ isFileBlock: true;
672
+ };
673
+ implementation: import("../schema").TiptapBlockImplementation<{
674
+ type: "file";
675
+ propSchema: {
676
+ backgroundColor: {
677
+ default: "default";
678
+ };
679
+ name: {
680
+ default: "";
681
+ };
682
+ url: {
683
+ default: "";
684
+ };
685
+ caption: {
686
+ default: "";
687
+ };
688
+ };
689
+ content: "none";
690
+ isFileBlock: true;
691
+ }, any, InlineContentSchema, StyleSchema>;
692
+ };
373
693
  image: {
374
694
  config: {
375
695
  type: "image";
@@ -381,17 +701,25 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
381
701
  backgroundColor: {
382
702
  default: "default";
383
703
  };
704
+ name: {
705
+ default: "";
706
+ };
384
707
  url: {
385
708
  default: "";
386
709
  };
387
710
  caption: {
388
711
  default: "";
389
712
  };
390
- width: {
391
- default: 512;
713
+ showPreview: {
714
+ default: true;
715
+ };
716
+ previewWidth: {
717
+ default: number;
392
718
  };
393
719
  };
394
720
  content: "none";
721
+ isFileBlock: true;
722
+ fileBlockAcceptMimeTypes: string[];
395
723
  };
396
724
  implementation: import("../schema").TiptapBlockImplementation<{
397
725
  type: "image";
@@ -403,51 +731,135 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
403
731
  backgroundColor: {
404
732
  default: "default";
405
733
  };
734
+ name: {
735
+ default: "";
736
+ };
406
737
  url: {
407
738
  default: "";
408
739
  };
409
740
  caption: {
410
741
  default: "";
411
742
  };
412
- width: {
413
- default: 512;
743
+ showPreview: {
744
+ default: true;
745
+ };
746
+ previewWidth: {
747
+ default: number;
414
748
  };
415
749
  };
416
750
  content: "none";
751
+ isFileBlock: true;
752
+ fileBlockAcceptMimeTypes: string[];
417
753
  }, any, InlineContentSchema, StyleSchema>;
418
754
  };
419
- table: {
755
+ video: {
420
756
  config: {
421
- type: "table";
422
- content: "table";
757
+ type: "video";
423
758
  propSchema: {
759
+ textAlignment: {
760
+ default: "left";
761
+ values: readonly ["left", "center", "right", "justify"];
762
+ };
424
763
  backgroundColor: {
425
764
  default: "default";
426
765
  };
427
- textColor: {
428
- default: "default";
766
+ name: {
767
+ default: "";
768
+ };
769
+ url: {
770
+ default: "";
771
+ };
772
+ caption: {
773
+ default: "";
429
774
  };
775
+ showPreview: {
776
+ default: true;
777
+ };
778
+ previewWidth: {
779
+ default: number;
780
+ };
781
+ };
782
+ content: "none";
783
+ isFileBlock: true;
784
+ fileBlockAcceptMimeTypes: string[];
785
+ };
786
+ implementation: import("../schema").TiptapBlockImplementation<{
787
+ type: "video";
788
+ propSchema: {
430
789
  textAlignment: {
431
790
  default: "left";
432
791
  values: readonly ["left", "center", "right", "justify"];
433
792
  };
793
+ backgroundColor: {
794
+ default: "default";
795
+ };
796
+ name: {
797
+ default: "";
798
+ };
799
+ url: {
800
+ default: "";
801
+ };
802
+ caption: {
803
+ default: "";
804
+ };
805
+ showPreview: {
806
+ default: true;
807
+ };
808
+ previewWidth: {
809
+ default: number;
810
+ };
434
811
  };
812
+ content: "none";
813
+ isFileBlock: true;
814
+ fileBlockAcceptMimeTypes: string[];
815
+ }, any, InlineContentSchema, StyleSchema>;
816
+ };
817
+ audio: {
818
+ config: {
819
+ type: "audio";
820
+ propSchema: {
821
+ backgroundColor: {
822
+ default: "default";
823
+ };
824
+ name: {
825
+ default: "";
826
+ };
827
+ url: {
828
+ default: "";
829
+ };
830
+ caption: {
831
+ default: "";
832
+ };
833
+ showPreview: {
834
+ default: true;
835
+ };
836
+ };
837
+ content: "none";
838
+ isFileBlock: true;
839
+ fileBlockAcceptMimeTypes: string[];
435
840
  };
436
841
  implementation: import("../schema").TiptapBlockImplementation<{
437
- type: "table";
438
- content: "table";
842
+ type: "audio";
439
843
  propSchema: {
440
844
  backgroundColor: {
441
845
  default: "default";
442
846
  };
443
- textColor: {
444
- default: "default";
847
+ name: {
848
+ default: "";
445
849
  };
446
- textAlignment: {
447
- default: "left";
448
- values: readonly ["left", "center", "right", "justify"];
850
+ url: {
851
+ default: "";
852
+ };
853
+ caption: {
854
+ default: "";
855
+ };
856
+ showPreview: {
857
+ default: true;
449
858
  };
450
859
  };
860
+ content: "none";
861
+ isFileBlock: true;
862
+ fileBlockAcceptMimeTypes: string[];
451
863
  }, any, InlineContentSchema, StyleSchema>;
452
864
  };
453
865
  }>;
@@ -2,8 +2,8 @@ import { EditorOptions } from "@tiptap/core";
2
2
  import { Node } from "prosemirror-model";
3
3
  import * as Y from "yjs";
4
4
  import { Block, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, PartialBlock } from "../blocks/defaultBlocks";
5
+ import { FilePanelProsemirrorPlugin } from "../extensions/FilePanel/FilePanelPlugin";
5
6
  import { FormattingToolbarProsemirrorPlugin } from "../extensions/FormattingToolbar/FormattingToolbarPlugin";
6
- import { ImagePanelProsemirrorPlugin } from "../extensions/ImagePanel/ImageToolbarPlugin";
7
7
  import { LinkToolbarProsemirrorPlugin } from "../extensions/LinkToolbar/LinkToolbarPlugin";
8
8
  import { SideMenuProsemirrorPlugin } from "../extensions/SideMenu/SideMenuPlugin";
9
9
  import { SuggestionMenuProseMirrorPlugin } from "../extensions/SuggestionMenu/SuggestionPlugin";
@@ -47,9 +47,15 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
47
47
  /**
48
48
  * A custom function to handle file uploads.
49
49
  * @param file The file that should be uploaded.
50
- * @returns The URL of the uploaded file.
50
+ * @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)
51
51
  */
52
- uploadFile: (file: File) => Promise<string>;
52
+ uploadFile: (file: File) => Promise<string | Record<string, any>>;
53
+ /**
54
+ * Resolve a URL of a file block to one that can be displayed or downloaded. This can be used for creating authenticated URL or
55
+ * implementing custom protocols / schemes
56
+ * @returns The URL that's
57
+ */
58
+ resolveFileUrl: (url: string) => Promise<string>;
53
59
  /**
54
60
  * When enabled, allows for collaboration between multiple users.
55
61
  */
@@ -92,9 +98,10 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
92
98
  readonly linkToolbar: LinkToolbarProsemirrorPlugin<BSchema, ISchema, SSchema>;
93
99
  readonly sideMenu: SideMenuProsemirrorPlugin<BSchema, ISchema, SSchema>;
94
100
  readonly suggestionMenus: SuggestionMenuProseMirrorPlugin<BSchema, ISchema, SSchema>;
95
- readonly imagePanel?: ImagePanelProsemirrorPlugin<ISchema, SSchema>;
101
+ readonly filePanel?: FilePanelProsemirrorPlugin<BSchema, ISchema, SSchema>;
96
102
  readonly tableHandles?: TableHandlesProsemirrorPlugin<ISchema, SSchema>;
97
- readonly uploadFile: ((file: File) => Promise<string>) | undefined;
103
+ readonly uploadFile: ((file: File) => Promise<string | Record<string, any>>) | undefined;
104
+ readonly resolveFileUrl: (url: string) => Promise<string>;
98
105
  static create<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema>(options?: Partial<BlockNoteEditorOptions<BSchema, ISchema, SSchema>>): BlockNoteEditor<BSchema, ISchema, SSchema>;
99
106
  private constructor();
100
107
  /**
@@ -1,20 +1,19 @@
1
1
  import { EditorState, Plugin, PluginKey, PluginView } from "prosemirror-state";
2
2
  import { EditorView } from "prosemirror-view";
3
- import { DefaultBlockSchema } from "../../blocks/defaultBlocks";
4
3
  import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
5
4
  import { UiElementPosition } from "../../extensions-shared/UiElementPosition";
6
- import type { BlockFromConfig, InlineContentSchema, StyleSchema } from "../../schema";
5
+ import type { BlockFromConfig, BlockSchema, FileBlockConfig, InlineContentSchema, StyleSchema } from "../../schema";
7
6
  import { EventEmitter } from "../../util/EventEmitter";
8
- export type ImagePanelState<I extends InlineContentSchema, S extends StyleSchema> = UiElementPosition & {
9
- block: BlockFromConfig<DefaultBlockSchema["image"], I, S>;
7
+ export type FilePanelState<I extends InlineContentSchema, S extends StyleSchema> = UiElementPosition & {
8
+ block: BlockFromConfig<FileBlockConfig, I, S>;
10
9
  };
11
- export declare class ImagePanelView<I extends InlineContentSchema, S extends StyleSchema> implements PluginView {
10
+ export declare class FilePanelView<I extends InlineContentSchema, S extends StyleSchema> implements PluginView {
12
11
  private readonly pluginKey;
13
12
  private readonly pmView;
14
- state?: ImagePanelState<I, S>;
13
+ state?: FilePanelState<I, S>;
15
14
  emitUpdate: () => void;
16
15
  prevWasEditable: boolean | null;
17
- constructor(pluginKey: PluginKey, pmView: EditorView, emitUpdate: (state: ImagePanelState<I, S>) => void);
16
+ constructor(pluginKey: PluginKey, pmView: EditorView, emitUpdate: (state: FilePanelState<I, S>) => void);
18
17
  mouseDownHandler: () => void;
19
18
  dragstartHandler: () => void;
20
19
  scrollHandler: () => void;
@@ -22,13 +21,11 @@ export declare class ImagePanelView<I extends InlineContentSchema, S extends Sty
22
21
  closeMenu: () => void;
23
22
  destroy(): void;
24
23
  }
25
- export declare class ImagePanelProsemirrorPlugin<I extends InlineContentSchema, S extends StyleSchema> extends EventEmitter<any> {
24
+ export declare class FilePanelProsemirrorPlugin<B extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends EventEmitter<any> {
26
25
  private view;
27
26
  readonly plugin: Plugin;
28
- constructor(_editor: BlockNoteEditor<{
29
- image: DefaultBlockSchema["image"];
30
- }, I, S>);
27
+ constructor(_editor: BlockNoteEditor<B, I, S>);
31
28
  get shown(): boolean;
32
- onUpdate(callback: (state: ImagePanelState<I, S>) => void): () => void;
29
+ onUpdate(callback: (state: FilePanelState<I, S>) => void): () => void;
33
30
  closeMenu: () => void;
34
31
  }
@@ -17,7 +17,7 @@ export type TableHandlesState<I extends InlineContentSchema, S extends StyleSche
17
17
  mousePos: number;
18
18
  } | undefined;
19
19
  };
20
- export declare class TableHandlesView<BSchema extends BlockSchemaWithBlock<"table", DefaultBlockSchema["table"]>, I extends InlineContentSchema, S extends StyleSchema> implements PluginView {
20
+ export declare class TableHandlesView<I extends InlineContentSchema, S extends StyleSchema> implements PluginView {
21
21
  private readonly editor;
22
22
  private readonly pmView;
23
23
  state?: TableHandlesState<I, S>;