@blocknote/core 0.15.4 → 0.15.6

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/src/index.ts CHANGED
@@ -1,15 +1,16 @@
1
1
  import * as locales from "./i18n/locales";
2
2
  export * from "./api/exporters/html/externalHTMLExporter";
3
3
  export * from "./api/exporters/html/internalHTMLSerializer";
4
+ export * from "./api/getCurrentBlockContentType";
4
5
  export * from "./api/testUtil";
5
6
  export * from "./blocks/AudioBlockContent/AudioBlockContent";
6
7
  export * from "./blocks/FileBlockContent/FileBlockContent";
7
- export * from "./blocks/ImageBlockContent/ImageBlockContent";
8
- export * from "./blocks/VideoBlockContent/VideoBlockContent";
9
-
10
8
  export * from "./blocks/FileBlockContent/fileBlockHelpers";
11
9
  export * from "./blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY";
10
+ export * from "./blocks/ImageBlockContent/ImageBlockContent";
12
11
  export { parseImageElement } from "./blocks/ImageBlockContent/imageBlockHelpers";
12
+ export * from "./blocks/VideoBlockContent/VideoBlockContent";
13
+ export * from "./blocks/defaultBlockHelpers";
13
14
  export * from "./blocks/defaultBlockTypeGuards";
14
15
  export * from "./blocks/defaultBlocks";
15
16
  export * from "./blocks/defaultProps";
@@ -22,15 +23,16 @@ export * from "./extensions/FilePanel/FilePanelPlugin";
22
23
  export * from "./extensions/FormattingToolbar/FormattingToolbarPlugin";
23
24
  export * from "./extensions/LinkToolbar/LinkToolbarPlugin";
24
25
  export * from "./extensions/SideMenu/SideMenuPlugin";
25
- export * from "./extensions/SuggestionMenu/DefaultSuggestionItem";
26
26
  export * from "./extensions/SuggestionMenu/DefaultGridSuggestionItem";
27
+ export * from "./extensions/SuggestionMenu/DefaultSuggestionItem";
27
28
  export * from "./extensions/SuggestionMenu/SuggestionPlugin";
28
- export * from "./extensions/SuggestionMenu/getDefaultSlashMenuItems";
29
29
  export * from "./extensions/SuggestionMenu/getDefaultEmojiPickerItems";
30
+ export * from "./extensions/SuggestionMenu/getDefaultSlashMenuItems";
30
31
  export * from "./extensions/TableHandles/TableHandlesPlugin";
31
32
  export * from "./i18n/dictionary";
32
33
  export * from "./schema";
33
34
  export * from "./util/browser";
35
+ export * from "./util/esmDependencies";
34
36
  export * from "./util/string";
35
37
  export * from "./util/typescript";
36
38
  export { UnreachableCaseError, assertEmpty } from "./util/typescript";
@@ -0,0 +1,51 @@
1
+ // some dependencies only export as ESM modules. This makes them incompatible with Node CJS.
2
+ // To work around this, we load these dependencies as dynamic imports in a function that initializes them.
3
+
4
+ // (to reproduce this issue, run ts-node on a file that users server-util)
5
+ export let esmDependencies:
6
+ | undefined
7
+ | {
8
+ rehypeParse: typeof import("rehype-parse");
9
+ rehypeStringify: typeof import("rehype-stringify");
10
+ unified: typeof import("unified");
11
+ hastUtilFromDom: typeof import("hast-util-from-dom");
12
+ rehypeRemark: typeof import("rehype-remark");
13
+ remarkGfm: typeof import("remark-gfm");
14
+ remarkStringify: typeof import("remark-stringify");
15
+ remarkParse: typeof import("remark-parse");
16
+ remarkRehype: typeof import("remark-rehype");
17
+ rehypeFormat: typeof import("rehype-format");
18
+ };
19
+
20
+ export async function initializeESMDependencies() {
21
+ if (esmDependencies) {
22
+ return esmDependencies;
23
+ }
24
+ const vals = await Promise.all([
25
+ import("rehype-parse"),
26
+ import("rehype-stringify"),
27
+ import("unified"),
28
+ import("hast-util-from-dom"),
29
+ import("rehype-remark"),
30
+ import("remark-gfm"),
31
+ import("remark-stringify"),
32
+ import("remark-parse"),
33
+ import("remark-rehype"),
34
+ import("rehype-format"),
35
+ ]);
36
+
37
+ esmDependencies = {
38
+ rehypeParse: vals[0],
39
+ rehypeStringify: vals[1],
40
+ unified: vals[2],
41
+ hastUtilFromDom: vals[3],
42
+ rehypeRemark: vals[4],
43
+ remarkGfm: vals[5],
44
+ remarkStringify: vals[6],
45
+ remarkParse: vals[7],
46
+ remarkRehype: vals[8],
47
+ rehypeFormat: vals[9],
48
+ };
49
+
50
+ return esmDependencies;
51
+ }
@@ -5,4 +5,4 @@ import { BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema";
5
5
  export declare function cleanHTMLToMarkdown(cleanHTMLString: string): string;
6
6
  export declare function blocksToMarkdown<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blocks: PartialBlock<BSchema, I, S>[], schema: Schema, editor: BlockNoteEditor<BSchema, I, S>, options: {
7
7
  document?: Document;
8
- }): string;
8
+ }): Promise<string>;
@@ -150,7 +150,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
150
150
  readonly resolveFileUrl: (url: string) => Promise<string>;
151
151
  get pmSchema(): Schema<any, any>;
152
152
  static create<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema>(options?: Partial<BlockNoteEditorOptions<BSchema, ISchema, SSchema>>): BlockNoteEditor<BSchema, ISchema, SSchema>;
153
- private constructor();
153
+ protected constructor(options: Partial<BlockNoteEditorOptions<any, any, any>>);
154
154
  dispatch(tr: Transaction): void;
155
155
  /**
156
156
  * Mount the editor to a parent DOM element. Call mount(undefined) to clean up
@@ -1,5 +1,7 @@
1
1
  export * from "./ar";
2
+ export * from "./de";
2
3
  export * from "./en";
4
+ export * from "./es";
3
5
  export * from "./fr";
4
6
  export * from "./is";
5
7
  export * from "./ja";
@@ -7,7 +9,6 @@ export * from "./ko";
7
9
  export * from "./nl";
8
10
  export * from "./pl";
9
11
  export * from "./pt";
12
+ export * from "./ru";
10
13
  export * from "./vi";
11
14
  export * from "./zh";
12
- export * from "./ru";
13
- export * from "./de";
@@ -1,14 +1,16 @@
1
1
  import * as locales from "./i18n/locales";
2
2
  export * from "./api/exporters/html/externalHTMLExporter";
3
3
  export * from "./api/exporters/html/internalHTMLSerializer";
4
+ export * from "./api/getCurrentBlockContentType";
4
5
  export * from "./api/testUtil";
5
6
  export * from "./blocks/AudioBlockContent/AudioBlockContent";
6
7
  export * from "./blocks/FileBlockContent/FileBlockContent";
7
- export * from "./blocks/ImageBlockContent/ImageBlockContent";
8
- export * from "./blocks/VideoBlockContent/VideoBlockContent";
9
8
  export * from "./blocks/FileBlockContent/fileBlockHelpers";
10
9
  export * from "./blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY";
10
+ export * from "./blocks/ImageBlockContent/ImageBlockContent";
11
11
  export { parseImageElement } from "./blocks/ImageBlockContent/imageBlockHelpers";
12
+ export * from "./blocks/VideoBlockContent/VideoBlockContent";
13
+ export * from "./blocks/defaultBlockHelpers";
12
14
  export * from "./blocks/defaultBlockTypeGuards";
13
15
  export * from "./blocks/defaultBlocks";
14
16
  export * from "./blocks/defaultProps";
@@ -21,15 +23,16 @@ export * from "./extensions/FilePanel/FilePanelPlugin";
21
23
  export * from "./extensions/FormattingToolbar/FormattingToolbarPlugin";
22
24
  export * from "./extensions/LinkToolbar/LinkToolbarPlugin";
23
25
  export * from "./extensions/SideMenu/SideMenuPlugin";
24
- export * from "./extensions/SuggestionMenu/DefaultSuggestionItem";
25
26
  export * from "./extensions/SuggestionMenu/DefaultGridSuggestionItem";
27
+ export * from "./extensions/SuggestionMenu/DefaultSuggestionItem";
26
28
  export * from "./extensions/SuggestionMenu/SuggestionPlugin";
27
- export * from "./extensions/SuggestionMenu/getDefaultSlashMenuItems";
28
29
  export * from "./extensions/SuggestionMenu/getDefaultEmojiPickerItems";
30
+ export * from "./extensions/SuggestionMenu/getDefaultSlashMenuItems";
29
31
  export * from "./extensions/TableHandles/TableHandlesPlugin";
30
32
  export * from "./i18n/dictionary";
31
33
  export * from "./schema";
32
34
  export * from "./util/browser";
35
+ export * from "./util/esmDependencies";
33
36
  export * from "./util/string";
34
37
  export * from "./util/typescript";
35
38
  export { UnreachableCaseError, assertEmpty } from "./util/typescript";
@@ -0,0 +1,24 @@
1
+ export declare let esmDependencies: undefined | {
2
+ rehypeParse: typeof import("rehype-parse");
3
+ rehypeStringify: typeof import("rehype-stringify");
4
+ unified: typeof import("unified");
5
+ hastUtilFromDom: typeof import("hast-util-from-dom");
6
+ rehypeRemark: typeof import("rehype-remark");
7
+ remarkGfm: typeof import("remark-gfm");
8
+ remarkStringify: typeof import("remark-stringify");
9
+ remarkParse: typeof import("remark-parse");
10
+ remarkRehype: typeof import("remark-rehype");
11
+ rehypeFormat: typeof import("rehype-format");
12
+ };
13
+ export declare function initializeESMDependencies(): Promise<{
14
+ rehypeParse: typeof import("rehype-parse");
15
+ rehypeStringify: typeof import("rehype-stringify");
16
+ unified: typeof import("unified");
17
+ hastUtilFromDom: typeof import("hast-util-from-dom");
18
+ rehypeRemark: typeof import("rehype-remark");
19
+ remarkGfm: typeof import("remark-gfm");
20
+ remarkStringify: typeof import("remark-stringify");
21
+ remarkParse: typeof import("remark-parse");
22
+ remarkRehype: typeof import("remark-rehype");
23
+ rehypeFormat: typeof import("rehype-format");
24
+ }>;