@blocknote/core 0.15.6 → 0.15.9
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 +1486 -1350
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +5 -5
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +23 -23
- package/src/api/exporters/copyExtension.ts +48 -33
- package/src/api/exporters/html/__snapshots__/complex/misc/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/customParagraph/styled/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/noCaption/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/noName/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/fontSize/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/between-links/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/end/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/link/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/multiple/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/only/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/start/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/styles/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noCaption/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noName/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noPreview/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/link/adjacent/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/link/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/link/styled/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/mention/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/paragraph/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/paragraph/empty/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/paragraph/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/paragraph/styled/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/button/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/small/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/tag/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionLeavesBlockChildren.html +1 -1
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionSpansBlocksChildren.html +1 -1
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionWithinBlockChildren.html +1 -1
- package/src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts +51 -2
- package/src/api/parsers/handleFileInsertion.ts +81 -17
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +24 -48
- package/src/blocks/FileBlockContent/FileBlockContent.ts +4 -22
- package/src/blocks/FileBlockContent/fileBlockHelpers.ts +72 -1
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +36 -62
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +34 -59
- package/src/editor/BlockNoteEditor.test.ts +13 -0
- package/src/editor/BlockNoteEditor.ts +89 -13
- package/src/editor/BlockNoteExtensions.ts +4 -2
- package/src/editor/BlockNoteTipTapEditor.ts +4 -1
- package/src/extensions/FilePanel/FilePanelPlugin.ts +10 -6
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +0 -1
- package/src/extensions/SideMenu/SideMenuPlugin.ts +23 -12
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +22 -10
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +6 -1
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +5 -1
- package/src/extensions/UniqueID/UniqueID.ts +15 -4
- package/src/pm-nodes/BlockContainer.ts +1 -2
- package/src/schema/blocks/types.ts +1 -1
- package/src/schema/inlineContent/createSpec.ts +54 -5
- package/types/src/api/testUtil/cases/customBlocks.d.ts +6 -6
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +6 -6
- package/types/src/api/testUtil/cases/customStyles.d.ts +6 -6
- package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +5 -5
- package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +2 -2
- package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +11 -1
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +5 -5
- package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +5 -5
- package/types/src/blocks/defaultBlocks.d.ts +12 -12
- package/types/src/editor/BlockNoteEditor.d.ts +27 -5
- package/types/src/editor/BlockNoteExtensions.d.ts +1 -0
- package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +1 -1
- package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +1 -0
- package/types/src/schema/blocks/types.d.ts +1 -1
- package/types/src/schema/inlineContent/createSpec.d.ts +3 -3
|
@@ -415,7 +415,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
|
|
|
415
415
|
};
|
|
416
416
|
content: "none";
|
|
417
417
|
isFileBlock: true;
|
|
418
|
-
|
|
418
|
+
fileBlockAccept: string[];
|
|
419
419
|
};
|
|
420
420
|
implementation: import("../../../schema").TiptapBlockImplementation<{
|
|
421
421
|
type: "image";
|
|
@@ -445,7 +445,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
|
|
|
445
445
|
};
|
|
446
446
|
content: "none";
|
|
447
447
|
isFileBlock: true;
|
|
448
|
-
|
|
448
|
+
fileBlockAccept: string[];
|
|
449
449
|
}, any, import("../../../schema").InlineContentSchema, import("../../../schema").StyleSchema>;
|
|
450
450
|
};
|
|
451
451
|
video: {
|
|
@@ -477,7 +477,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
|
|
|
477
477
|
};
|
|
478
478
|
content: "none";
|
|
479
479
|
isFileBlock: true;
|
|
480
|
-
|
|
480
|
+
fileBlockAccept: string[];
|
|
481
481
|
};
|
|
482
482
|
implementation: import("../../../schema").TiptapBlockImplementation<{
|
|
483
483
|
type: "video";
|
|
@@ -507,7 +507,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
|
|
|
507
507
|
};
|
|
508
508
|
content: "none";
|
|
509
509
|
isFileBlock: true;
|
|
510
|
-
|
|
510
|
+
fileBlockAccept: string[];
|
|
511
511
|
}, any, import("../../../schema").InlineContentSchema, import("../../../schema").StyleSchema>;
|
|
512
512
|
};
|
|
513
513
|
audio: {
|
|
@@ -532,7 +532,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
|
|
|
532
532
|
};
|
|
533
533
|
content: "none";
|
|
534
534
|
isFileBlock: true;
|
|
535
|
-
|
|
535
|
+
fileBlockAccept: string[];
|
|
536
536
|
};
|
|
537
537
|
implementation: import("../../../schema").TiptapBlockImplementation<{
|
|
538
538
|
type: "audio";
|
|
@@ -555,7 +555,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
|
|
|
555
555
|
};
|
|
556
556
|
content: "none";
|
|
557
557
|
isFileBlock: true;
|
|
558
|
-
|
|
558
|
+
fileBlockAccept: string[];
|
|
559
559
|
}, any, import("../../../schema").InlineContentSchema, import("../../../schema").StyleSchema>;
|
|
560
560
|
};
|
|
561
561
|
}>, import("../../../schema").InlineContentSchemaFromSpecs<{
|
|
@@ -289,7 +289,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
289
289
|
};
|
|
290
290
|
content: "none";
|
|
291
291
|
isFileBlock: true;
|
|
292
|
-
|
|
292
|
+
fileBlockAccept: string[];
|
|
293
293
|
};
|
|
294
294
|
implementation: import("../../..").TiptapBlockImplementation<{
|
|
295
295
|
type: "image";
|
|
@@ -319,7 +319,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
319
319
|
};
|
|
320
320
|
content: "none";
|
|
321
321
|
isFileBlock: true;
|
|
322
|
-
|
|
322
|
+
fileBlockAccept: string[];
|
|
323
323
|
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
324
324
|
};
|
|
325
325
|
video: {
|
|
@@ -351,7 +351,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
351
351
|
};
|
|
352
352
|
content: "none";
|
|
353
353
|
isFileBlock: true;
|
|
354
|
-
|
|
354
|
+
fileBlockAccept: string[];
|
|
355
355
|
};
|
|
356
356
|
implementation: import("../../..").TiptapBlockImplementation<{
|
|
357
357
|
type: "video";
|
|
@@ -381,7 +381,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
381
381
|
};
|
|
382
382
|
content: "none";
|
|
383
383
|
isFileBlock: true;
|
|
384
|
-
|
|
384
|
+
fileBlockAccept: string[];
|
|
385
385
|
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
386
386
|
};
|
|
387
387
|
audio: {
|
|
@@ -406,7 +406,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
406
406
|
};
|
|
407
407
|
content: "none";
|
|
408
408
|
isFileBlock: true;
|
|
409
|
-
|
|
409
|
+
fileBlockAccept: string[];
|
|
410
410
|
};
|
|
411
411
|
implementation: import("../../..").TiptapBlockImplementation<{
|
|
412
412
|
type: "audio";
|
|
@@ -429,7 +429,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
429
429
|
};
|
|
430
430
|
content: "none";
|
|
431
431
|
isFileBlock: true;
|
|
432
|
-
|
|
432
|
+
fileBlockAccept: string[];
|
|
433
433
|
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
434
434
|
};
|
|
435
435
|
}>, import("../../..").InlineContentSchemaFromSpecs<{
|
|
@@ -289,7 +289,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
289
289
|
};
|
|
290
290
|
content: "none";
|
|
291
291
|
isFileBlock: true;
|
|
292
|
-
|
|
292
|
+
fileBlockAccept: string[];
|
|
293
293
|
};
|
|
294
294
|
implementation: import("../../..").TiptapBlockImplementation<{
|
|
295
295
|
type: "image";
|
|
@@ -319,7 +319,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
319
319
|
};
|
|
320
320
|
content: "none";
|
|
321
321
|
isFileBlock: true;
|
|
322
|
-
|
|
322
|
+
fileBlockAccept: string[];
|
|
323
323
|
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
324
324
|
};
|
|
325
325
|
video: {
|
|
@@ -351,7 +351,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
351
351
|
};
|
|
352
352
|
content: "none";
|
|
353
353
|
isFileBlock: true;
|
|
354
|
-
|
|
354
|
+
fileBlockAccept: string[];
|
|
355
355
|
};
|
|
356
356
|
implementation: import("../../..").TiptapBlockImplementation<{
|
|
357
357
|
type: "video";
|
|
@@ -381,7 +381,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
381
381
|
};
|
|
382
382
|
content: "none";
|
|
383
383
|
isFileBlock: true;
|
|
384
|
-
|
|
384
|
+
fileBlockAccept: string[];
|
|
385
385
|
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
386
386
|
};
|
|
387
387
|
audio: {
|
|
@@ -406,7 +406,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
406
406
|
};
|
|
407
407
|
content: "none";
|
|
408
408
|
isFileBlock: true;
|
|
409
|
-
|
|
409
|
+
fileBlockAccept: string[];
|
|
410
410
|
};
|
|
411
411
|
implementation: import("../../..").TiptapBlockImplementation<{
|
|
412
412
|
type: "audio";
|
|
@@ -429,7 +429,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
|
429
429
|
};
|
|
430
430
|
content: "none";
|
|
431
431
|
isFileBlock: true;
|
|
432
|
-
|
|
432
|
+
fileBlockAccept: string[];
|
|
433
433
|
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
434
434
|
};
|
|
435
435
|
}>, import("../../..").InlineContentSchemaFromSpecs<{
|
|
@@ -38,14 +38,14 @@ export declare const audioBlockConfig: {
|
|
|
38
38
|
};
|
|
39
39
|
content: "none";
|
|
40
40
|
isFileBlock: true;
|
|
41
|
-
|
|
41
|
+
fileBlockAccept: string[];
|
|
42
42
|
};
|
|
43
43
|
export declare const audioRender: (block: BlockFromConfig<typeof audioBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>) => {
|
|
44
44
|
dom: HTMLDivElement;
|
|
45
|
-
destroy
|
|
45
|
+
destroy?: undefined;
|
|
46
46
|
} | {
|
|
47
47
|
dom: HTMLDivElement;
|
|
48
|
-
destroy
|
|
48
|
+
destroy: (() => void) | undefined;
|
|
49
49
|
};
|
|
50
50
|
export declare const audioParse: (element: HTMLElement) => Partial<Props<typeof audioBlockConfig.propSchema>> | undefined;
|
|
51
51
|
export declare const audioToExternalHTML: (block: BlockFromConfig<typeof audioBlockConfig, any, any>) => {
|
|
@@ -73,7 +73,7 @@ export declare const AudioBlock: {
|
|
|
73
73
|
};
|
|
74
74
|
content: "none";
|
|
75
75
|
isFileBlock: true;
|
|
76
|
-
|
|
76
|
+
fileBlockAccept: string[];
|
|
77
77
|
};
|
|
78
78
|
implementation: import("../../schema").TiptapBlockImplementation<{
|
|
79
79
|
type: "audio";
|
|
@@ -96,6 +96,6 @@ export declare const AudioBlock: {
|
|
|
96
96
|
};
|
|
97
97
|
content: "none";
|
|
98
98
|
isFileBlock: true;
|
|
99
|
-
|
|
99
|
+
fileBlockAccept: string[];
|
|
100
100
|
}, any, import("../../schema").InlineContentSchema, import("../../schema").StyleSchema>;
|
|
101
101
|
};
|
|
@@ -35,10 +35,10 @@ export declare const fileBlockConfig: {
|
|
|
35
35
|
};
|
|
36
36
|
export declare const fileRender: (block: BlockFromConfig<typeof fileBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>) => {
|
|
37
37
|
dom: HTMLDivElement;
|
|
38
|
-
destroy
|
|
38
|
+
destroy?: undefined;
|
|
39
39
|
} | {
|
|
40
40
|
dom: HTMLDivElement;
|
|
41
|
-
destroy
|
|
41
|
+
destroy: (() => void) | undefined;
|
|
42
42
|
};
|
|
43
43
|
export declare const fileParse: (element: HTMLElement) => {
|
|
44
44
|
url: string | undefined;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
2
|
-
import { BlockFromConfig, FileBlockConfig } from "../../schema";
|
|
2
|
+
import { BlockFromConfig, BlockSchemaWithBlock, FileBlockConfig } from "../../schema";
|
|
3
|
+
export declare const createFileBlockWrapper: (block: BlockFromConfig<FileBlockConfig, any, any>, editor: BlockNoteEditor<BlockSchemaWithBlock<FileBlockConfig["type"], FileBlockConfig>, any, any>, element: {
|
|
4
|
+
dom: HTMLElement;
|
|
5
|
+
destroy?: () => void;
|
|
6
|
+
}, buttonText?: string, buttonIcon?: HTMLElement) => {
|
|
7
|
+
dom: HTMLDivElement;
|
|
8
|
+
destroy?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
dom: HTMLDivElement;
|
|
11
|
+
destroy: (() => void) | undefined;
|
|
12
|
+
};
|
|
3
13
|
export declare const createDefaultFilePreview: (block: BlockFromConfig<FileBlockConfig, any, any>) => {
|
|
4
14
|
dom: HTMLElement;
|
|
5
15
|
destroy?: () => void;
|
|
@@ -52,14 +52,14 @@ export declare const imageBlockConfig: {
|
|
|
52
52
|
};
|
|
53
53
|
content: "none";
|
|
54
54
|
isFileBlock: true;
|
|
55
|
-
|
|
55
|
+
fileBlockAccept: string[];
|
|
56
56
|
};
|
|
57
57
|
export declare const imageRender: (block: BlockFromConfig<typeof imageBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>) => {
|
|
58
58
|
dom: HTMLDivElement;
|
|
59
|
-
destroy
|
|
59
|
+
destroy?: undefined;
|
|
60
60
|
} | {
|
|
61
61
|
dom: HTMLDivElement;
|
|
62
|
-
destroy
|
|
62
|
+
destroy: (() => void) | undefined;
|
|
63
63
|
};
|
|
64
64
|
export declare const imageParse: (element: HTMLElement) => Partial<Props<typeof imageBlockConfig.propSchema>> | undefined;
|
|
65
65
|
export declare const imageToExternalHTML: (block: BlockFromConfig<typeof imageBlockConfig, any, any>) => {
|
|
@@ -94,7 +94,7 @@ export declare const ImageBlock: {
|
|
|
94
94
|
};
|
|
95
95
|
content: "none";
|
|
96
96
|
isFileBlock: true;
|
|
97
|
-
|
|
97
|
+
fileBlockAccept: string[];
|
|
98
98
|
};
|
|
99
99
|
implementation: import("../../schema").TiptapBlockImplementation<{
|
|
100
100
|
type: "image";
|
|
@@ -124,6 +124,6 @@ export declare const ImageBlock: {
|
|
|
124
124
|
};
|
|
125
125
|
content: "none";
|
|
126
126
|
isFileBlock: true;
|
|
127
|
-
|
|
127
|
+
fileBlockAccept: string[];
|
|
128
128
|
}, any, import("../../schema").InlineContentSchema, import("../../schema").StyleSchema>;
|
|
129
129
|
};
|
|
@@ -52,14 +52,14 @@ export declare const videoBlockConfig: {
|
|
|
52
52
|
};
|
|
53
53
|
content: "none";
|
|
54
54
|
isFileBlock: true;
|
|
55
|
-
|
|
55
|
+
fileBlockAccept: string[];
|
|
56
56
|
};
|
|
57
57
|
export declare const videoRender: (block: BlockFromConfig<typeof videoBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>) => {
|
|
58
58
|
dom: HTMLDivElement;
|
|
59
|
-
destroy
|
|
59
|
+
destroy?: undefined;
|
|
60
60
|
} | {
|
|
61
61
|
dom: HTMLDivElement;
|
|
62
|
-
destroy
|
|
62
|
+
destroy: (() => void) | undefined;
|
|
63
63
|
};
|
|
64
64
|
export declare const videoParse: (element: HTMLElement) => Partial<Props<typeof videoBlockConfig.propSchema>> | undefined;
|
|
65
65
|
export declare const videoToExternalHTML: (block: BlockFromConfig<typeof videoBlockConfig, any, any>) => {
|
|
@@ -94,7 +94,7 @@ export declare const VideoBlock: {
|
|
|
94
94
|
};
|
|
95
95
|
content: "none";
|
|
96
96
|
isFileBlock: true;
|
|
97
|
-
|
|
97
|
+
fileBlockAccept: string[];
|
|
98
98
|
};
|
|
99
99
|
implementation: import("../../schema").TiptapBlockImplementation<{
|
|
100
100
|
type: "video";
|
|
@@ -124,6 +124,6 @@ export declare const VideoBlock: {
|
|
|
124
124
|
};
|
|
125
125
|
content: "none";
|
|
126
126
|
isFileBlock: true;
|
|
127
|
-
|
|
127
|
+
fileBlockAccept: string[];
|
|
128
128
|
}, any, import("../../schema").InlineContentSchema, import("../../schema").StyleSchema>;
|
|
129
129
|
};
|
|
@@ -287,7 +287,7 @@ export declare const defaultBlockSpecs: {
|
|
|
287
287
|
};
|
|
288
288
|
content: "none";
|
|
289
289
|
isFileBlock: true;
|
|
290
|
-
|
|
290
|
+
fileBlockAccept: string[];
|
|
291
291
|
};
|
|
292
292
|
implementation: import("../schema").TiptapBlockImplementation<{
|
|
293
293
|
type: "image";
|
|
@@ -317,7 +317,7 @@ export declare const defaultBlockSpecs: {
|
|
|
317
317
|
};
|
|
318
318
|
content: "none";
|
|
319
319
|
isFileBlock: true;
|
|
320
|
-
|
|
320
|
+
fileBlockAccept: string[];
|
|
321
321
|
}, any, InlineContentSchema, StyleSchema>;
|
|
322
322
|
};
|
|
323
323
|
video: {
|
|
@@ -349,7 +349,7 @@ export declare const defaultBlockSpecs: {
|
|
|
349
349
|
};
|
|
350
350
|
content: "none";
|
|
351
351
|
isFileBlock: true;
|
|
352
|
-
|
|
352
|
+
fileBlockAccept: string[];
|
|
353
353
|
};
|
|
354
354
|
implementation: import("../schema").TiptapBlockImplementation<{
|
|
355
355
|
type: "video";
|
|
@@ -379,7 +379,7 @@ export declare const defaultBlockSpecs: {
|
|
|
379
379
|
};
|
|
380
380
|
content: "none";
|
|
381
381
|
isFileBlock: true;
|
|
382
|
-
|
|
382
|
+
fileBlockAccept: string[];
|
|
383
383
|
}, any, InlineContentSchema, StyleSchema>;
|
|
384
384
|
};
|
|
385
385
|
audio: {
|
|
@@ -404,7 +404,7 @@ export declare const defaultBlockSpecs: {
|
|
|
404
404
|
};
|
|
405
405
|
content: "none";
|
|
406
406
|
isFileBlock: true;
|
|
407
|
-
|
|
407
|
+
fileBlockAccept: string[];
|
|
408
408
|
};
|
|
409
409
|
implementation: import("../schema").TiptapBlockImplementation<{
|
|
410
410
|
type: "audio";
|
|
@@ -427,7 +427,7 @@ export declare const defaultBlockSpecs: {
|
|
|
427
427
|
};
|
|
428
428
|
content: "none";
|
|
429
429
|
isFileBlock: true;
|
|
430
|
-
|
|
430
|
+
fileBlockAccept: string[];
|
|
431
431
|
}, any, InlineContentSchema, StyleSchema>;
|
|
432
432
|
};
|
|
433
433
|
};
|
|
@@ -719,7 +719,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
719
719
|
};
|
|
720
720
|
content: "none";
|
|
721
721
|
isFileBlock: true;
|
|
722
|
-
|
|
722
|
+
fileBlockAccept: string[];
|
|
723
723
|
};
|
|
724
724
|
implementation: import("../schema").TiptapBlockImplementation<{
|
|
725
725
|
type: "image";
|
|
@@ -749,7 +749,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
749
749
|
};
|
|
750
750
|
content: "none";
|
|
751
751
|
isFileBlock: true;
|
|
752
|
-
|
|
752
|
+
fileBlockAccept: string[];
|
|
753
753
|
}, any, InlineContentSchema, StyleSchema>;
|
|
754
754
|
};
|
|
755
755
|
video: {
|
|
@@ -781,7 +781,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
781
781
|
};
|
|
782
782
|
content: "none";
|
|
783
783
|
isFileBlock: true;
|
|
784
|
-
|
|
784
|
+
fileBlockAccept: string[];
|
|
785
785
|
};
|
|
786
786
|
implementation: import("../schema").TiptapBlockImplementation<{
|
|
787
787
|
type: "video";
|
|
@@ -811,7 +811,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
811
811
|
};
|
|
812
812
|
content: "none";
|
|
813
813
|
isFileBlock: true;
|
|
814
|
-
|
|
814
|
+
fileBlockAccept: string[];
|
|
815
815
|
}, any, InlineContentSchema, StyleSchema>;
|
|
816
816
|
};
|
|
817
817
|
audio: {
|
|
@@ -836,7 +836,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
836
836
|
};
|
|
837
837
|
content: "none";
|
|
838
838
|
isFileBlock: true;
|
|
839
|
-
|
|
839
|
+
fileBlockAccept: string[];
|
|
840
840
|
};
|
|
841
841
|
implementation: import("../schema").TiptapBlockImplementation<{
|
|
842
842
|
type: "audio";
|
|
@@ -859,7 +859,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
859
859
|
};
|
|
860
860
|
content: "none";
|
|
861
861
|
isFileBlock: true;
|
|
862
|
-
|
|
862
|
+
fileBlockAccept: string[];
|
|
863
863
|
}, any, InlineContentSchema, StyleSchema>;
|
|
864
864
|
};
|
|
865
865
|
}>;
|
|
@@ -8,7 +8,7 @@ import { LinkToolbarProsemirrorPlugin } from "../extensions/LinkToolbar/LinkTool
|
|
|
8
8
|
import { SideMenuProsemirrorPlugin } from "../extensions/SideMenu/SideMenuPlugin";
|
|
9
9
|
import { SuggestionMenuProseMirrorPlugin } from "../extensions/SuggestionMenu/SuggestionPlugin";
|
|
10
10
|
import { TableHandlesProsemirrorPlugin } from "../extensions/TableHandles/TableHandlesPlugin";
|
|
11
|
-
import { BlockIdentifier, BlockNoteDOMAttributes, BlockSchema, BlockSpecs, InlineContentSchema, InlineContentSpecs, PartialInlineContent, StyleSchema, StyleSpecs
|
|
11
|
+
import { BlockIdentifier, BlockNoteDOMAttributes, BlockSchema, BlockSpecs, InlineContentSchema, InlineContentSpecs, PartialInlineContent, Styles, StyleSchema, StyleSpecs } from "../schema";
|
|
12
12
|
import { NoInfer } from "../util/typescript";
|
|
13
13
|
import { TextCursorPosition } from "./cursorPositionTypes";
|
|
14
14
|
import { Selection } from "./selectionTypes";
|
|
@@ -18,6 +18,12 @@ import { Dictionary } from "../i18n/dictionary";
|
|
|
18
18
|
import { Transaction } from "@tiptap/pm/state";
|
|
19
19
|
import "../style.css";
|
|
20
20
|
export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema> = {
|
|
21
|
+
/**
|
|
22
|
+
* Whether changes to blocks (like indentation, creating lists, changing headings) should be animated or not. Defaults to `true`.
|
|
23
|
+
*
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
animations?: boolean;
|
|
21
27
|
disableExtensions: string[];
|
|
22
28
|
/**
|
|
23
29
|
* A dictionary object containing translations for the editor.
|
|
@@ -53,7 +59,7 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
|
|
|
53
59
|
* @param file The file that should be uploaded.
|
|
54
60
|
* @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)
|
|
55
61
|
*/
|
|
56
|
-
uploadFile: (file: File) => Promise<string | Record<string, any>>;
|
|
62
|
+
uploadFile: (file: File, blockId?: string) => Promise<string | Record<string, any>>;
|
|
57
63
|
/**
|
|
58
64
|
* Resolve a URL of a file block to one that can be displayed or downloaded. This can be used for creating authenticated URL or
|
|
59
65
|
* implementing custom protocols / schemes
|
|
@@ -94,9 +100,18 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
|
|
|
94
100
|
* You probably don't need to set this manually, but use the `server-util` package instead that uses this option internally
|
|
95
101
|
*/
|
|
96
102
|
_headless: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* A flag indicating whether to set an HTML ID for every block
|
|
105
|
+
*
|
|
106
|
+
* When set to `true`, on each block an id attribute will be set with the block id
|
|
107
|
+
* Otherwise, the HTML ID attribute will not be set.
|
|
108
|
+
*
|
|
109
|
+
* (note that the id is always set on the `data-id` attribute)
|
|
110
|
+
*/
|
|
111
|
+
setIdAttribute?: boolean;
|
|
97
112
|
};
|
|
98
113
|
export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema> {
|
|
99
|
-
|
|
114
|
+
protected readonly options: Partial<BlockNoteEditorOptions<any, any, any>>;
|
|
100
115
|
private readonly _pmSchema;
|
|
101
116
|
/**
|
|
102
117
|
* Boolean indicating whether the editor is in headless mode.
|
|
@@ -146,7 +161,9 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
146
161
|
* @param file The file that should be uploaded.
|
|
147
162
|
* @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)
|
|
148
163
|
*/
|
|
149
|
-
readonly uploadFile: ((file: File) => Promise<string | Record<string, any>>) | undefined;
|
|
164
|
+
readonly uploadFile: ((file: File, blockId?: string) => Promise<string | Record<string, any>>) | undefined;
|
|
165
|
+
private onUploadStartCallbacks;
|
|
166
|
+
private onUploadEndCallbacks;
|
|
150
167
|
readonly resolveFileUrl: (url: string) => Promise<string>;
|
|
151
168
|
get pmSchema(): Schema<any, any>;
|
|
152
169
|
static create<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema>(options?: Partial<BlockNoteEditorOptions<BSchema, ISchema, SSchema>>): BlockNoteEditor<BSchema, ISchema, SSchema>;
|
|
@@ -162,6 +179,8 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
162
179
|
get domElement(): HTMLDivElement;
|
|
163
180
|
isFocused(): boolean;
|
|
164
181
|
focus(): void;
|
|
182
|
+
onUploadStart(callback: (blockId?: string) => void): () => void;
|
|
183
|
+
onUploadEnd(callback: (blockId?: string) => void): () => void;
|
|
165
184
|
/**
|
|
166
185
|
* @deprecated, use `editor.document` instead
|
|
167
186
|
*/
|
|
@@ -369,5 +388,8 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
369
388
|
* @returns A function to remove the callback.
|
|
370
389
|
*/
|
|
371
390
|
onSelectionChange(callback: (editor: BlockNoteEditor<BSchema, ISchema, SSchema>) => void): (() => void) | undefined;
|
|
372
|
-
|
|
391
|
+
openSuggestionMenu(triggerCharacter: string, pluginState?: {
|
|
392
|
+
deleteTriggerCharacter?: boolean;
|
|
393
|
+
ignoreQueryLength?: boolean;
|
|
394
|
+
}): void;
|
|
373
395
|
}
|
|
@@ -27,5 +27,5 @@ export declare class FilePanelProsemirrorPlugin<I extends InlineContentSchema, S
|
|
|
27
27
|
constructor(editor: BlockNoteEditor<Record<string, FileBlockConfig>, I, S>);
|
|
28
28
|
get shown(): boolean;
|
|
29
29
|
onUpdate(callback: (state: FilePanelState<I, S>) => void): () => void;
|
|
30
|
-
closeMenu: () => void;
|
|
30
|
+
closeMenu: () => void | undefined;
|
|
31
31
|
}
|
|
@@ -5,6 +5,7 @@ import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
|
5
5
|
import { EventEmitter } from "../../util/EventEmitter";
|
|
6
6
|
export type SuggestionMenuState = UiElementPosition & {
|
|
7
7
|
query: string;
|
|
8
|
+
ignoreQueryLength?: boolean;
|
|
8
9
|
};
|
|
9
10
|
/**
|
|
10
11
|
* A ProseMirror plugin for suggestions, designed to make '/'-commands possible as well as mentions.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TagParseRule } from "@tiptap/pm/model";
|
|
2
2
|
import { StyleSchema } from "../styles/types";
|
|
3
|
-
import { CustomInlineContentConfig,
|
|
4
|
-
export type CustomInlineContentImplementation<T extends
|
|
3
|
+
import { CustomInlineContentConfig, InlineContentFromConfig, InlineContentSpec, PartialCustomInlineContentFromConfig } from "./types";
|
|
4
|
+
export type CustomInlineContentImplementation<T extends CustomInlineContentConfig, S extends StyleSchema> = {
|
|
5
5
|
render: (
|
|
6
6
|
/**
|
|
7
7
|
* The custom inline content to render
|
|
8
8
|
*/
|
|
9
|
-
inlineContent: InlineContentFromConfig<T, S>
|
|
9
|
+
inlineContent: InlineContentFromConfig<T, S>, updateInlineContent: (update: PartialCustomInlineContentFromConfig<T, S>) => void
|
|
10
10
|
/**
|
|
11
11
|
* The BlockNote editor instance
|
|
12
12
|
* This is typed generically. If you want an editor with your custom schema, you need to
|