@blocknote/core 0.13.2 → 0.13.3
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.
- package/dist/blocknote.js +5282 -2785
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +7 -7
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/exporters/html/__snapshots__/file/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/button/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/button/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/nested/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/nested/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/noCaption/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/noCaption/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/noName/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/noName/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/button/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/button/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noCaption/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/noCaption/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/noName/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/noName/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/noPreview/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/button/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/button/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/nested/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/nested/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/button/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/button/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html +1 -0
- package/src/api/exporters/markdown/__snapshots__/file/basic/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/file/button/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/file/nested/markdown.md +7 -0
- package/src/api/exporters/markdown/__snapshots__/file/noCaption/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/file/noName/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/image/basic/markdown.md +1 -1
- package/src/api/exporters/markdown/__snapshots__/image/button/markdown.md +1 -1
- package/src/api/exporters/markdown/__snapshots__/image/nested/markdown.md +2 -2
- package/src/api/exporters/markdown/__snapshots__/image/noCaption/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/image/noName/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/image/noPreview/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/simpleFile/basic/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/simpleFile/button/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/simpleFile/nested/markdown.md +7 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +3 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/button/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +6 -2
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noPreview/markdown.md +3 -0
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +212 -4
- package/src/api/parsers/html/__snapshots__/paste/parse-basic-block-types.json +3 -1
- package/src/api/parsers/html/__snapshots__/paste/parse-fake-image-caption.json +3 -1
- package/src/api/testUtil/cases/customBlocks.ts +79 -33
- package/src/api/testUtil/cases/customInlineContent.ts +1 -1
- package/src/api/testUtil/cases/customStyles.ts +1 -1
- package/src/api/testUtil/cases/defaultSchema.ts +114 -4
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +162 -0
- package/src/blocks/AudioBlockContent/audioBlockHelpers.ts +5 -0
- package/src/blocks/FileBlockContent/FileBlockContent.ts +121 -0
- package/src/blocks/FileBlockContent/fileBlockHelpers.ts +377 -0
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +135 -356
- package/src/blocks/ImageBlockContent/imageBlockHelpers.ts +6 -0
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +182 -0
- package/src/blocks/VideoBlockContent/videoBlockHelpers.ts +6 -0
- package/src/blocks/defaultBlockTypeGuards.ts +53 -1
- package/src/blocks/defaultBlocks.ts +8 -2
- package/src/editor/Block.css +67 -27
- package/src/editor/BlockNoteEditor.ts +14 -10
- package/src/editor/BlockNoteSchema.ts +12 -3
- package/src/extensions/{ImagePanel/ImageToolbarPlugin.ts → FilePanel/FilePanelPlugin.ts} +22 -25
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +14 -2
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +59 -2
- package/src/i18n/locales/en.ts +102 -11
- package/src/i18n/locales/fr.ts +104 -11
- package/src/i18n/locales/index.ts +8 -2
- package/src/i18n/locales/is.ts +288 -0
- package/src/i18n/locales/ja.ts +300 -0
- package/src/i18n/locales/ko.ts +292 -0
- package/src/i18n/locales/nl.ts +101 -8
- package/src/i18n/locales/pl.ts +280 -0
- package/src/i18n/locales/pt.ts +281 -0
- package/src/i18n/locales/vi.ts +281 -0
- package/src/i18n/locales/zh.ts +107 -8
- package/src/index.ts +9 -2
- package/src/pm-nodes/BlockContainer.ts +2 -2
- package/src/schema/blocks/createSpec.ts +1 -0
- package/src/schema/blocks/internal.ts +10 -0
- package/src/schema/blocks/types.ts +41 -5
- package/src/util/string.ts +12 -0
- package/types/src/api/testUtil/cases/customBlocks.d.ts +228 -42
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +178 -4
- package/types/src/api/testUtil/cases/customStyles.d.ts +178 -4
- package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +104 -0
- package/types/src/blocks/AudioBlockContent/audioBlockHelpers.d.ts +3 -0
- package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +96 -0
- package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +30 -0
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +53 -14
- package/types/src/blocks/ImageBlockContent/imageBlockHelpers.d.ts +4 -0
- package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +132 -0
- package/types/src/blocks/VideoBlockContent/videoBlockHelpers.d.ts +4 -0
- package/types/src/blocks/defaultBlockTypeGuards.d.ts +6 -1
- package/types/src/blocks/defaultBlocks.d.ts +356 -8
- package/types/src/editor/BlockNoteEditor.d.ts +5 -5
- package/types/src/extensions/{ImagePanel/ImageToolbarPlugin.d.ts → FilePanel/FilePanelPlugin.d.ts} +9 -12
- package/types/src/i18n/locales/en.d.ts +49 -7
- package/types/src/i18n/locales/fr.d.ts +2 -184
- package/types/src/i18n/locales/index.d.ts +7 -1
- package/types/src/i18n/locales/is.d.ts +2 -0
- package/types/src/i18n/locales/ja.d.ts +2 -0
- package/types/src/i18n/locales/ko.d.ts +2 -0
- package/types/src/i18n/locales/pl.d.ts +2 -0
- package/types/src/i18n/locales/pt.d.ts +2 -0
- package/types/src/i18n/locales/vi.d.ts +2 -0
- package/types/src/index.d.ts +8 -2
- package/types/src/schema/blocks/internal.d.ts +1 -1
- package/types/src/schema/blocks/types.d.ts +26 -1
- package/types/src/util/string.d.ts +1 -0
- /package/src/blocks/{ImageBlockContent → FileBlockContent}/uploadToTmpFilesDotOrg_DEV_ONLY.ts +0 -0
- /package/types/src/blocks/{ImageBlockContent → FileBlockContent}/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +0 -0
|
@@ -144,6 +144,48 @@ export declare const defaultBlockSpecs: {
|
|
|
144
144
|
};
|
|
145
145
|
}, any, InlineContentSchema, StyleSchema>;
|
|
146
146
|
};
|
|
147
|
+
file: {
|
|
148
|
+
config: {
|
|
149
|
+
type: "file";
|
|
150
|
+
propSchema: {
|
|
151
|
+
backgroundColor: {
|
|
152
|
+
default: "default";
|
|
153
|
+
};
|
|
154
|
+
name: {
|
|
155
|
+
default: "";
|
|
156
|
+
};
|
|
157
|
+
url: {
|
|
158
|
+
default: "";
|
|
159
|
+
};
|
|
160
|
+
caption: {
|
|
161
|
+
default: "";
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
content: "none";
|
|
165
|
+
isFileBlock: true;
|
|
166
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
167
|
+
};
|
|
168
|
+
implementation: import("../schema").TiptapBlockImplementation<{
|
|
169
|
+
type: "file";
|
|
170
|
+
propSchema: {
|
|
171
|
+
backgroundColor: {
|
|
172
|
+
default: "default";
|
|
173
|
+
};
|
|
174
|
+
name: {
|
|
175
|
+
default: "";
|
|
176
|
+
};
|
|
177
|
+
url: {
|
|
178
|
+
default: "";
|
|
179
|
+
};
|
|
180
|
+
caption: {
|
|
181
|
+
default: "";
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
content: "none";
|
|
185
|
+
isFileBlock: true;
|
|
186
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
187
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
188
|
+
};
|
|
147
189
|
image: {
|
|
148
190
|
config: {
|
|
149
191
|
type: "image";
|
|
@@ -155,17 +197,26 @@ export declare const defaultBlockSpecs: {
|
|
|
155
197
|
backgroundColor: {
|
|
156
198
|
default: "default";
|
|
157
199
|
};
|
|
200
|
+
name: {
|
|
201
|
+
default: "";
|
|
202
|
+
};
|
|
158
203
|
url: {
|
|
159
204
|
default: "";
|
|
160
205
|
};
|
|
161
206
|
caption: {
|
|
162
207
|
default: "";
|
|
163
208
|
};
|
|
164
|
-
|
|
165
|
-
default:
|
|
209
|
+
showPreview: {
|
|
210
|
+
default: true;
|
|
211
|
+
};
|
|
212
|
+
previewWidth: {
|
|
213
|
+
default: number;
|
|
166
214
|
};
|
|
167
215
|
};
|
|
168
216
|
content: "none";
|
|
217
|
+
isFileBlock: true;
|
|
218
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
219
|
+
fileBlockAcceptMimeTypes: string[];
|
|
169
220
|
};
|
|
170
221
|
implementation: import("../schema").TiptapBlockImplementation<{
|
|
171
222
|
type: "image";
|
|
@@ -177,17 +228,140 @@ export declare const defaultBlockSpecs: {
|
|
|
177
228
|
backgroundColor: {
|
|
178
229
|
default: "default";
|
|
179
230
|
};
|
|
231
|
+
name: {
|
|
232
|
+
default: "";
|
|
233
|
+
};
|
|
234
|
+
url: {
|
|
235
|
+
default: "";
|
|
236
|
+
};
|
|
237
|
+
caption: {
|
|
238
|
+
default: "";
|
|
239
|
+
};
|
|
240
|
+
showPreview: {
|
|
241
|
+
default: true;
|
|
242
|
+
};
|
|
243
|
+
previewWidth: {
|
|
244
|
+
default: number;
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
content: "none";
|
|
248
|
+
isFileBlock: true;
|
|
249
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
250
|
+
fileBlockAcceptMimeTypes: string[];
|
|
251
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
252
|
+
};
|
|
253
|
+
video: {
|
|
254
|
+
config: {
|
|
255
|
+
type: "video";
|
|
256
|
+
propSchema: {
|
|
257
|
+
textAlignment: {
|
|
258
|
+
default: "left";
|
|
259
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
260
|
+
};
|
|
261
|
+
backgroundColor: {
|
|
262
|
+
default: "default";
|
|
263
|
+
};
|
|
264
|
+
name: {
|
|
265
|
+
default: "";
|
|
266
|
+
};
|
|
267
|
+
url: {
|
|
268
|
+
default: "";
|
|
269
|
+
};
|
|
270
|
+
caption: {
|
|
271
|
+
default: "";
|
|
272
|
+
};
|
|
273
|
+
showPreview: {
|
|
274
|
+
default: true;
|
|
275
|
+
};
|
|
276
|
+
previewWidth: {
|
|
277
|
+
default: number;
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
content: "none";
|
|
281
|
+
isFileBlock: true;
|
|
282
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
283
|
+
fileBlockAcceptMimeTypes: string[];
|
|
284
|
+
};
|
|
285
|
+
implementation: import("../schema").TiptapBlockImplementation<{
|
|
286
|
+
type: "video";
|
|
287
|
+
propSchema: {
|
|
288
|
+
textAlignment: {
|
|
289
|
+
default: "left";
|
|
290
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
291
|
+
};
|
|
292
|
+
backgroundColor: {
|
|
293
|
+
default: "default";
|
|
294
|
+
};
|
|
295
|
+
name: {
|
|
296
|
+
default: "";
|
|
297
|
+
};
|
|
298
|
+
url: {
|
|
299
|
+
default: "";
|
|
300
|
+
};
|
|
301
|
+
caption: {
|
|
302
|
+
default: "";
|
|
303
|
+
};
|
|
304
|
+
showPreview: {
|
|
305
|
+
default: true;
|
|
306
|
+
};
|
|
307
|
+
previewWidth: {
|
|
308
|
+
default: number;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
content: "none";
|
|
312
|
+
isFileBlock: true;
|
|
313
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
314
|
+
fileBlockAcceptMimeTypes: string[];
|
|
315
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
316
|
+
};
|
|
317
|
+
audio: {
|
|
318
|
+
config: {
|
|
319
|
+
type: "audio";
|
|
320
|
+
propSchema: {
|
|
321
|
+
backgroundColor: {
|
|
322
|
+
default: "default";
|
|
323
|
+
};
|
|
324
|
+
name: {
|
|
325
|
+
default: "";
|
|
326
|
+
};
|
|
327
|
+
url: {
|
|
328
|
+
default: "";
|
|
329
|
+
};
|
|
330
|
+
caption: {
|
|
331
|
+
default: "";
|
|
332
|
+
};
|
|
333
|
+
showPreview: {
|
|
334
|
+
default: true;
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
content: "none";
|
|
338
|
+
isFileBlock: true;
|
|
339
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
340
|
+
fileBlockAcceptMimeTypes: string[];
|
|
341
|
+
};
|
|
342
|
+
implementation: import("../schema").TiptapBlockImplementation<{
|
|
343
|
+
type: "audio";
|
|
344
|
+
propSchema: {
|
|
345
|
+
backgroundColor: {
|
|
346
|
+
default: "default";
|
|
347
|
+
};
|
|
348
|
+
name: {
|
|
349
|
+
default: "";
|
|
350
|
+
};
|
|
180
351
|
url: {
|
|
181
352
|
default: "";
|
|
182
353
|
};
|
|
183
354
|
caption: {
|
|
184
355
|
default: "";
|
|
185
356
|
};
|
|
186
|
-
|
|
187
|
-
default:
|
|
357
|
+
showPreview: {
|
|
358
|
+
default: true;
|
|
188
359
|
};
|
|
189
360
|
};
|
|
190
361
|
content: "none";
|
|
362
|
+
isFileBlock: true;
|
|
363
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
364
|
+
fileBlockAcceptMimeTypes: string[];
|
|
191
365
|
}, any, InlineContentSchema, StyleSchema>;
|
|
192
366
|
};
|
|
193
367
|
table: {
|
|
@@ -370,6 +544,48 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
370
544
|
};
|
|
371
545
|
}, any, InlineContentSchema, StyleSchema>;
|
|
372
546
|
};
|
|
547
|
+
file: {
|
|
548
|
+
config: {
|
|
549
|
+
type: "file";
|
|
550
|
+
propSchema: {
|
|
551
|
+
backgroundColor: {
|
|
552
|
+
default: "default";
|
|
553
|
+
};
|
|
554
|
+
name: {
|
|
555
|
+
default: "";
|
|
556
|
+
};
|
|
557
|
+
url: {
|
|
558
|
+
default: "";
|
|
559
|
+
};
|
|
560
|
+
caption: {
|
|
561
|
+
default: "";
|
|
562
|
+
};
|
|
563
|
+
};
|
|
564
|
+
content: "none";
|
|
565
|
+
isFileBlock: true;
|
|
566
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
567
|
+
};
|
|
568
|
+
implementation: import("../schema").TiptapBlockImplementation<{
|
|
569
|
+
type: "file";
|
|
570
|
+
propSchema: {
|
|
571
|
+
backgroundColor: {
|
|
572
|
+
default: "default";
|
|
573
|
+
};
|
|
574
|
+
name: {
|
|
575
|
+
default: "";
|
|
576
|
+
};
|
|
577
|
+
url: {
|
|
578
|
+
default: "";
|
|
579
|
+
};
|
|
580
|
+
caption: {
|
|
581
|
+
default: "";
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
content: "none";
|
|
585
|
+
isFileBlock: true;
|
|
586
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
587
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
588
|
+
};
|
|
373
589
|
image: {
|
|
374
590
|
config: {
|
|
375
591
|
type: "image";
|
|
@@ -381,17 +597,26 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
381
597
|
backgroundColor: {
|
|
382
598
|
default: "default";
|
|
383
599
|
};
|
|
600
|
+
name: {
|
|
601
|
+
default: "";
|
|
602
|
+
};
|
|
384
603
|
url: {
|
|
385
604
|
default: "";
|
|
386
605
|
};
|
|
387
606
|
caption: {
|
|
388
607
|
default: "";
|
|
389
608
|
};
|
|
390
|
-
|
|
391
|
-
default:
|
|
609
|
+
showPreview: {
|
|
610
|
+
default: true;
|
|
611
|
+
};
|
|
612
|
+
previewWidth: {
|
|
613
|
+
default: number;
|
|
392
614
|
};
|
|
393
615
|
};
|
|
394
616
|
content: "none";
|
|
617
|
+
isFileBlock: true;
|
|
618
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
619
|
+
fileBlockAcceptMimeTypes: string[];
|
|
395
620
|
};
|
|
396
621
|
implementation: import("../schema").TiptapBlockImplementation<{
|
|
397
622
|
type: "image";
|
|
@@ -403,17 +628,140 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
403
628
|
backgroundColor: {
|
|
404
629
|
default: "default";
|
|
405
630
|
};
|
|
631
|
+
name: {
|
|
632
|
+
default: "";
|
|
633
|
+
};
|
|
634
|
+
url: {
|
|
635
|
+
default: "";
|
|
636
|
+
};
|
|
637
|
+
caption: {
|
|
638
|
+
default: "";
|
|
639
|
+
};
|
|
640
|
+
showPreview: {
|
|
641
|
+
default: true;
|
|
642
|
+
};
|
|
643
|
+
previewWidth: {
|
|
644
|
+
default: number;
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
content: "none";
|
|
648
|
+
isFileBlock: true;
|
|
649
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
650
|
+
fileBlockAcceptMimeTypes: string[];
|
|
651
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
652
|
+
};
|
|
653
|
+
video: {
|
|
654
|
+
config: {
|
|
655
|
+
type: "video";
|
|
656
|
+
propSchema: {
|
|
657
|
+
textAlignment: {
|
|
658
|
+
default: "left";
|
|
659
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
660
|
+
};
|
|
661
|
+
backgroundColor: {
|
|
662
|
+
default: "default";
|
|
663
|
+
};
|
|
664
|
+
name: {
|
|
665
|
+
default: "";
|
|
666
|
+
};
|
|
667
|
+
url: {
|
|
668
|
+
default: "";
|
|
669
|
+
};
|
|
670
|
+
caption: {
|
|
671
|
+
default: "";
|
|
672
|
+
};
|
|
673
|
+
showPreview: {
|
|
674
|
+
default: true;
|
|
675
|
+
};
|
|
676
|
+
previewWidth: {
|
|
677
|
+
default: number;
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
content: "none";
|
|
681
|
+
isFileBlock: true;
|
|
682
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
683
|
+
fileBlockAcceptMimeTypes: string[];
|
|
684
|
+
};
|
|
685
|
+
implementation: import("../schema").TiptapBlockImplementation<{
|
|
686
|
+
type: "video";
|
|
687
|
+
propSchema: {
|
|
688
|
+
textAlignment: {
|
|
689
|
+
default: "left";
|
|
690
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
691
|
+
};
|
|
692
|
+
backgroundColor: {
|
|
693
|
+
default: "default";
|
|
694
|
+
};
|
|
695
|
+
name: {
|
|
696
|
+
default: "";
|
|
697
|
+
};
|
|
698
|
+
url: {
|
|
699
|
+
default: "";
|
|
700
|
+
};
|
|
701
|
+
caption: {
|
|
702
|
+
default: "";
|
|
703
|
+
};
|
|
704
|
+
showPreview: {
|
|
705
|
+
default: true;
|
|
706
|
+
};
|
|
707
|
+
previewWidth: {
|
|
708
|
+
default: number;
|
|
709
|
+
};
|
|
710
|
+
};
|
|
711
|
+
content: "none";
|
|
712
|
+
isFileBlock: true;
|
|
713
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
714
|
+
fileBlockAcceptMimeTypes: string[];
|
|
715
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
716
|
+
};
|
|
717
|
+
audio: {
|
|
718
|
+
config: {
|
|
719
|
+
type: "audio";
|
|
720
|
+
propSchema: {
|
|
721
|
+
backgroundColor: {
|
|
722
|
+
default: "default";
|
|
723
|
+
};
|
|
724
|
+
name: {
|
|
725
|
+
default: "";
|
|
726
|
+
};
|
|
727
|
+
url: {
|
|
728
|
+
default: "";
|
|
729
|
+
};
|
|
730
|
+
caption: {
|
|
731
|
+
default: "";
|
|
732
|
+
};
|
|
733
|
+
showPreview: {
|
|
734
|
+
default: true;
|
|
735
|
+
};
|
|
736
|
+
};
|
|
737
|
+
content: "none";
|
|
738
|
+
isFileBlock: true;
|
|
739
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
740
|
+
fileBlockAcceptMimeTypes: string[];
|
|
741
|
+
};
|
|
742
|
+
implementation: import("../schema").TiptapBlockImplementation<{
|
|
743
|
+
type: "audio";
|
|
744
|
+
propSchema: {
|
|
745
|
+
backgroundColor: {
|
|
746
|
+
default: "default";
|
|
747
|
+
};
|
|
748
|
+
name: {
|
|
749
|
+
default: "";
|
|
750
|
+
};
|
|
406
751
|
url: {
|
|
407
752
|
default: "";
|
|
408
753
|
};
|
|
409
754
|
caption: {
|
|
410
755
|
default: "";
|
|
411
756
|
};
|
|
412
|
-
|
|
413
|
-
default:
|
|
757
|
+
showPreview: {
|
|
758
|
+
default: true;
|
|
414
759
|
};
|
|
415
760
|
};
|
|
416
761
|
content: "none";
|
|
762
|
+
isFileBlock: true;
|
|
763
|
+
isFileBlockPlaceholder: (block: any) => boolean;
|
|
764
|
+
fileBlockAcceptMimeTypes: string[];
|
|
417
765
|
}, any, InlineContentSchema, StyleSchema>;
|
|
418
766
|
};
|
|
419
767
|
table: {
|
|
@@ -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,9 @@ 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
53
|
/**
|
|
54
54
|
* When enabled, allows for collaboration between multiple users.
|
|
55
55
|
*/
|
|
@@ -92,9 +92,9 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
92
92
|
readonly linkToolbar: LinkToolbarProsemirrorPlugin<BSchema, ISchema, SSchema>;
|
|
93
93
|
readonly sideMenu: SideMenuProsemirrorPlugin<BSchema, ISchema, SSchema>;
|
|
94
94
|
readonly suggestionMenus: SuggestionMenuProseMirrorPlugin<BSchema, ISchema, SSchema>;
|
|
95
|
-
readonly
|
|
95
|
+
readonly filePanel?: FilePanelProsemirrorPlugin<BSchema, ISchema, SSchema>;
|
|
96
96
|
readonly tableHandles?: TableHandlesProsemirrorPlugin<ISchema, SSchema>;
|
|
97
|
-
readonly uploadFile: ((file: File) => Promise<string
|
|
97
|
+
readonly uploadFile: ((file: File) => Promise<string | Record<string, any>>) | undefined;
|
|
98
98
|
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
99
|
private constructor();
|
|
100
100
|
/**
|
package/types/src/extensions/{ImagePanel/ImageToolbarPlugin.d.ts → FilePanel/FilePanelPlugin.d.ts}
RENAMED
|
@@ -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
|
|
9
|
-
block: BlockFromConfig<
|
|
7
|
+
export type FilePanelState<I extends InlineContentSchema, S extends StyleSchema> = UiElementPosition & {
|
|
8
|
+
block: BlockFromConfig<FileBlockConfig, I, S>;
|
|
10
9
|
};
|
|
11
|
-
export declare class
|
|
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?:
|
|
13
|
+
state?: FilePanelState<I, S>;
|
|
15
14
|
emitUpdate: () => void;
|
|
16
15
|
prevWasEditable: boolean | null;
|
|
17
|
-
constructor(pluginKey: PluginKey, pmView: EditorView, emitUpdate: (state:
|
|
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
|
|
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:
|
|
29
|
+
onUpdate(callback: (state: FilePanelState<I, S>) => void): () => void;
|
|
33
30
|
closeMenu: () => void;
|
|
34
31
|
}
|
|
@@ -48,6 +48,24 @@ export declare const en: {
|
|
|
48
48
|
aliases: string[];
|
|
49
49
|
group: string;
|
|
50
50
|
};
|
|
51
|
+
video: {
|
|
52
|
+
title: string;
|
|
53
|
+
subtext: string;
|
|
54
|
+
aliases: string[];
|
|
55
|
+
group: string;
|
|
56
|
+
};
|
|
57
|
+
audio: {
|
|
58
|
+
title: string;
|
|
59
|
+
subtext: string;
|
|
60
|
+
aliases: string[];
|
|
61
|
+
group: string;
|
|
62
|
+
};
|
|
63
|
+
file: {
|
|
64
|
+
title: string;
|
|
65
|
+
subtext: string;
|
|
66
|
+
aliases: string[];
|
|
67
|
+
group: string;
|
|
68
|
+
};
|
|
51
69
|
};
|
|
52
70
|
placeholders: {
|
|
53
71
|
default: string;
|
|
@@ -55,8 +73,19 @@ export declare const en: {
|
|
|
55
73
|
bulletListItem: string;
|
|
56
74
|
numberedListItem: string;
|
|
57
75
|
};
|
|
58
|
-
|
|
59
|
-
|
|
76
|
+
file_blocks: {
|
|
77
|
+
image: {
|
|
78
|
+
add_button_text: string;
|
|
79
|
+
};
|
|
80
|
+
video: {
|
|
81
|
+
add_button_text: string;
|
|
82
|
+
};
|
|
83
|
+
audio: {
|
|
84
|
+
add_button_text: string;
|
|
85
|
+
};
|
|
86
|
+
file: {
|
|
87
|
+
add_button_text: string;
|
|
88
|
+
};
|
|
60
89
|
};
|
|
61
90
|
side_menu: {
|
|
62
91
|
add_block_label: string;
|
|
@@ -122,11 +151,24 @@ export declare const en: {
|
|
|
122
151
|
tooltip: string;
|
|
123
152
|
secondary_tooltip: string;
|
|
124
153
|
};
|
|
125
|
-
|
|
154
|
+
file_caption: {
|
|
126
155
|
tooltip: string;
|
|
127
156
|
input_placeholder: string;
|
|
128
157
|
};
|
|
129
|
-
|
|
158
|
+
file_replace: {
|
|
159
|
+
tooltip: Record<string, string>;
|
|
160
|
+
};
|
|
161
|
+
file_rename: {
|
|
162
|
+
tooltip: Record<string, string>;
|
|
163
|
+
input_placeholder: Record<string, string>;
|
|
164
|
+
};
|
|
165
|
+
file_download: {
|
|
166
|
+
tooltip: Record<string, string>;
|
|
167
|
+
};
|
|
168
|
+
file_delete: {
|
|
169
|
+
tooltip: Record<string, string>;
|
|
170
|
+
};
|
|
171
|
+
file_preview_toggle: {
|
|
130
172
|
tooltip: string;
|
|
131
173
|
};
|
|
132
174
|
nest: {
|
|
@@ -150,15 +192,15 @@ export declare const en: {
|
|
|
150
192
|
tooltip: string;
|
|
151
193
|
};
|
|
152
194
|
};
|
|
153
|
-
|
|
195
|
+
file_panel: {
|
|
154
196
|
upload: {
|
|
155
197
|
title: string;
|
|
156
|
-
file_placeholder: string
|
|
198
|
+
file_placeholder: Record<string, string>;
|
|
157
199
|
upload_error: string;
|
|
158
200
|
};
|
|
159
201
|
embed: {
|
|
160
202
|
title: string;
|
|
161
|
-
embed_button: string
|
|
203
|
+
embed_button: Record<string, string>;
|
|
162
204
|
url_placeholder: string;
|
|
163
205
|
};
|
|
164
206
|
};
|