@blocknote/core 0.11.2 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -17
- package/dist/blocknote.js +1662 -1447
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +7 -3
- package/src/api/blockManipulation/blockManipulation.test.ts +19 -15
- package/src/api/blockManipulation/blockManipulation.ts +107 -17
- package/src/api/exporters/html/externalHTMLExporter.ts +3 -7
- package/src/api/exporters/html/htmlConversion.test.ts +6 -3
- package/src/api/exporters/html/internalHTMLSerializer.ts +3 -7
- package/src/api/exporters/html/util/sharedHTMLConversion.ts +3 -3
- package/src/api/exporters/markdown/markdownExporter.test.ts +7 -3
- package/src/api/exporters/markdown/markdownExporter.ts +2 -6
- package/src/api/getCurrentBlockContentType.ts +14 -0
- package/src/api/nodeConversions/nodeConversions.test.ts +14 -7
- package/src/api/nodeConversions/nodeConversions.ts +1 -2
- package/src/api/parsers/html/parseHTML.test.ts +5 -1
- package/src/api/parsers/html/parseHTML.ts +2 -6
- package/src/api/parsers/html/util/nestedLists.ts +11 -1
- package/src/api/parsers/markdown/parseMarkdown.test.ts +3 -0
- package/src/api/parsers/markdown/parseMarkdown.ts +2 -6
- package/src/api/testUtil/cases/customBlocks.ts +18 -16
- package/src/api/testUtil/cases/customInlineContent.ts +12 -13
- package/src/api/testUtil/cases/customStyles.ts +12 -10
- package/src/api/testUtil/index.ts +4 -2
- package/src/api/testUtil/partialBlockTestUtil.ts +2 -6
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +50 -21
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +1 -2
- package/src/blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +8 -1
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +18 -5
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +7 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +18 -5
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +14 -5
- package/src/blocks/defaultBlockHelpers.ts +3 -3
- package/src/blocks/defaultBlockTypeGuards.ts +84 -0
- package/src/blocks/defaultBlocks.ts +29 -3
- package/src/editor/Block.css +2 -31
- package/src/editor/BlockNoteEditor.ts +223 -267
- package/src/editor/BlockNoteExtensions.ts +5 -2
- package/src/editor/BlockNoteSchema.ts +98 -0
- package/src/editor/BlockNoteTipTapEditor.ts +162 -0
- package/src/editor/cursorPositionTypes.ts +2 -6
- package/src/editor/editor.css +0 -1
- package/src/editor/selectionTypes.ts +2 -6
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +22 -29
- package/src/extensions/{ImageToolbar → ImagePanel}/ImageToolbarPlugin.ts +54 -60
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +330 -0
- package/src/extensions/Placeholder/PlaceholderExtension.ts +81 -88
- package/src/extensions/SideMenu/SideMenuPlugin.ts +55 -56
- package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +8 -0
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +353 -0
- package/src/extensions/{SlashMenu/defaultSlashMenuItems.ts → SuggestionMenu/getDefaultSlashMenuItems.ts} +119 -89
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +62 -45
- package/src/extensions-shared/UiElementPosition.ts +4 -0
- package/src/index.ts +8 -8
- package/src/pm-nodes/BlockContainer.ts +5 -5
- package/src/schema/blocks/types.ts +15 -15
- package/src/schema/inlineContent/createSpec.ts +2 -2
- package/src/schema/inlineContent/types.ts +1 -1
- package/src/util/browser.ts +6 -4
- package/src/util/typescript.ts +7 -4
- package/types/src/api/blockManipulation/blockManipulation.d.ts +6 -1
- package/types/src/api/exporters/html/externalHTMLExporter.d.ts +2 -1
- package/types/src/api/exporters/html/internalHTMLSerializer.d.ts +2 -1
- package/types/src/api/exporters/markdown/markdownExporter.d.ts +2 -1
- package/types/src/api/getCurrentBlockContentType.d.ts +2 -0
- package/types/src/api/nodeConversions/nodeConversions.d.ts +2 -1
- package/types/src/api/parsers/html/parseHTML.d.ts +2 -1
- package/types/src/api/parsers/markdown/parseMarkdown.d.ts +2 -1
- package/types/src/api/testUtil/cases/customBlocks.d.ts +72 -13
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +281 -6
- package/types/src/api/testUtil/cases/customStyles.d.ts +247 -13
- package/types/src/api/testUtil/index.d.ts +4 -2
- package/types/src/api/testUtil/partialBlockTestUtil.d.ts +2 -1
- package/types/src/blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +6 -1
- package/types/src/blocks/defaultBlockHelpers.d.ts +2 -2
- package/types/src/blocks/defaultBlockTypeGuards.d.ts +24 -0
- package/types/src/blocks/defaultBlocks.d.ts +21 -15
- package/types/src/editor/BlockNoteEditor.d.ts +51 -56
- package/types/src/editor/BlockNoteExtensions.d.ts +1 -0
- package/types/src/editor/BlockNoteSchema.d.ts +34 -0
- package/types/src/editor/BlockNoteTipTapEditor.d.ts +28 -0
- package/types/src/editor/cursorPositionTypes.d.ts +2 -1
- package/types/src/editor/selectionTypes.d.ts +2 -1
- package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +5 -6
- package/types/src/extensions/ImagePanel/ImageToolbarPlugin.d.ts +32 -0
- package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +40 -0
- package/types/src/extensions/Placeholder/PlaceholderExtension.d.ts +2 -15
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +8 -7
- package/types/src/extensions/SuggestionMenu/DefaultSuggestionItem.d.ts +8 -0
- package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +31 -0
- package/types/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.d.ts +10 -0
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +7 -7
- package/types/src/extensions-shared/UiElementPosition.d.ts +4 -0
- package/types/src/index.d.ts +8 -8
- package/types/src/pm-nodes/BlockContainer.d.ts +3 -2
- package/types/src/pm-nodes/BlockGroup.d.ts +1 -1
- package/types/src/schema/blocks/types.d.ts +15 -15
- package/types/src/schema/inlineContent/types.d.ts +1 -1
- package/types/src/util/browser.d.ts +1 -0
- package/types/src/util/typescript.d.ts +1 -0
- package/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.ts +0 -335
- package/src/extensions/SlashMenu/BaseSlashMenuItem.ts +0 -12
- package/src/extensions/SlashMenu/SlashMenuPlugin.ts +0 -53
- package/src/extensions-shared/BaseUiElementTypes.ts +0 -8
- package/src/extensions-shared/README.md +0 -3
- package/src/extensions-shared/suggestion/SuggestionItem.ts +0 -3
- package/src/extensions-shared/suggestion/SuggestionPlugin.ts +0 -448
- package/types/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.d.ts +0 -38
- package/types/src/extensions/ImageToolbar/ImageToolbarPlugin.d.ts +0 -31
- package/types/src/extensions/SlashMenu/BaseSlashMenuItem.d.ts +0 -7
- package/types/src/extensions/SlashMenu/SlashMenuPlugin.d.ts +0 -13
- package/types/src/extensions/SlashMenu/defaultSlashMenuItems.d.ts +0 -3
- package/types/src/extensions-shared/BaseUiElementTypes.d.ts +0 -7
- package/types/src/extensions-shared/suggestion/SuggestionItem.d.ts +0 -3
- package/types/src/extensions-shared/suggestion/SuggestionPlugin.d.ts +0 -36
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-100.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-100.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-200.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-200.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-300.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-300.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-500.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-500.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-600.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-600.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-700.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-700.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-800.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-800.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-900.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-900.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-regular.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-regular.woff2 +0 -0
- /package/src/{assets/fonts-inter.css → fonts/inter.css} +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/** Define the main block types **/
|
|
2
|
-
import { Extension, Node } from "@tiptap/core";
|
|
2
|
+
import type { Extension, Node } from "@tiptap/core";
|
|
3
3
|
|
|
4
4
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
5
|
-
import {
|
|
5
|
+
import type {
|
|
6
6
|
InlineContent,
|
|
7
7
|
InlineContentSchema,
|
|
8
8
|
PartialInlineContent,
|
|
9
9
|
} from "../inlineContent/types";
|
|
10
|
-
import { PropSchema, Props } from "../propTypes";
|
|
11
|
-
import { StyleSchema } from "../styles/types";
|
|
10
|
+
import type { PropSchema, Props } from "../propTypes";
|
|
11
|
+
import type { StyleSchema } from "../styles/types";
|
|
12
12
|
|
|
13
13
|
export type BlockNoteDOMElement =
|
|
14
14
|
| "editor"
|
|
15
|
-
| "
|
|
15
|
+
| "block"
|
|
16
16
|
| "blockGroup"
|
|
17
17
|
| "blockContent"
|
|
18
18
|
| "inlineContent";
|
|
@@ -41,7 +41,7 @@ export type TiptapBlockImplementation<
|
|
|
41
41
|
node: Node;
|
|
42
42
|
toInternalHTML: (
|
|
43
43
|
block: BlockFromConfigNoChildren<T, I, S> & {
|
|
44
|
-
children:
|
|
44
|
+
children: BlockNoDefaults<B, I, S>[];
|
|
45
45
|
},
|
|
46
46
|
editor: BlockNoteEditor<B, I, S>
|
|
47
47
|
) => {
|
|
@@ -50,7 +50,7 @@ export type TiptapBlockImplementation<
|
|
|
50
50
|
};
|
|
51
51
|
toExternalHTML: (
|
|
52
52
|
block: BlockFromConfigNoChildren<T, I, S> & {
|
|
53
|
-
children:
|
|
53
|
+
children: BlockNoDefaults<B, I, S>[];
|
|
54
54
|
},
|
|
55
55
|
editor: BlockNoteEditor<B, I, S>
|
|
56
56
|
) => {
|
|
@@ -142,7 +142,7 @@ export type BlockFromConfig<
|
|
|
142
142
|
I extends InlineContentSchema,
|
|
143
143
|
S extends StyleSchema
|
|
144
144
|
> = BlockFromConfigNoChildren<B, I, S> & {
|
|
145
|
-
children:
|
|
145
|
+
children: BlockNoDefaults<BlockSchema, I, S>[];
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
// Converts each block spec into a Block object without children. We later merge
|
|
@@ -158,12 +158,12 @@ type BlocksWithoutChildren<
|
|
|
158
158
|
|
|
159
159
|
// Converts each block spec into a Block object without children, merges them
|
|
160
160
|
// into a union type, and adds a children property
|
|
161
|
-
export type
|
|
161
|
+
export type BlockNoDefaults<
|
|
162
162
|
BSchema extends BlockSchema,
|
|
163
163
|
I extends InlineContentSchema,
|
|
164
164
|
S extends StyleSchema
|
|
165
165
|
> = BlocksWithoutChildren<BSchema, I, S>[keyof BSchema] & {
|
|
166
|
-
children:
|
|
166
|
+
children: BlockNoDefaults<BSchema, I, S>[];
|
|
167
167
|
};
|
|
168
168
|
|
|
169
169
|
export type SpecificBlock<
|
|
@@ -172,7 +172,7 @@ export type SpecificBlock<
|
|
|
172
172
|
I extends InlineContentSchema,
|
|
173
173
|
S extends StyleSchema
|
|
174
174
|
> = BlocksWithoutChildren<BSchema, I, S>[BType] & {
|
|
175
|
-
children:
|
|
175
|
+
children: BlockNoDefaults<BSchema, I, S>[];
|
|
176
176
|
};
|
|
177
177
|
|
|
178
178
|
/** CODE FOR PARTIAL BLOCKS, analogous to above
|
|
@@ -219,7 +219,7 @@ type PartialBlocksWithoutChildren<
|
|
|
219
219
|
>;
|
|
220
220
|
};
|
|
221
221
|
|
|
222
|
-
export type
|
|
222
|
+
export type PartialBlockNoDefaults<
|
|
223
223
|
BSchema extends BlockSchema,
|
|
224
224
|
I extends InlineContentSchema,
|
|
225
225
|
S extends StyleSchema
|
|
@@ -229,7 +229,7 @@ export type PartialBlock<
|
|
|
229
229
|
S
|
|
230
230
|
>[keyof PartialBlocksWithoutChildren<BSchema, I, S>] &
|
|
231
231
|
Partial<{
|
|
232
|
-
children:
|
|
232
|
+
children: PartialBlockNoDefaults<BSchema, I, S>[];
|
|
233
233
|
}>;
|
|
234
234
|
|
|
235
235
|
export type SpecificPartialBlock<
|
|
@@ -238,7 +238,7 @@ export type SpecificPartialBlock<
|
|
|
238
238
|
BType extends keyof BSchema,
|
|
239
239
|
S extends StyleSchema
|
|
240
240
|
> = PartialBlocksWithoutChildren<BSchema, I, S>[BType] & {
|
|
241
|
-
children?:
|
|
241
|
+
children?: BlockNoDefaults<BSchema, I, S>[];
|
|
242
242
|
};
|
|
243
243
|
|
|
244
244
|
export type PartialBlockFromConfig<
|
|
@@ -246,7 +246,7 @@ export type PartialBlockFromConfig<
|
|
|
246
246
|
I extends InlineContentSchema,
|
|
247
247
|
S extends StyleSchema
|
|
248
248
|
> = PartialBlockFromConfigNoChildren<B, I, S> & {
|
|
249
|
-
children?:
|
|
249
|
+
children?: BlockNoDefaults<BlockSchema, I, S>[];
|
|
250
250
|
};
|
|
251
251
|
|
|
252
252
|
export type BlockIdentifier = { id: string } | string;
|
|
@@ -98,8 +98,8 @@ export function createInlineContentSpec<
|
|
|
98
98
|
const output = inlineContentImplementation.render(
|
|
99
99
|
nodeToCustomInlineContent(
|
|
100
100
|
node,
|
|
101
|
-
editor.inlineContentSchema,
|
|
102
|
-
editor.styleSchema
|
|
101
|
+
editor.schema.inlineContentSchema,
|
|
102
|
+
editor.schema.styleSchema
|
|
103
103
|
) as any as InlineContentFromConfig<T, S> // TODO: fix cast
|
|
104
104
|
);
|
|
105
105
|
|
|
@@ -74,7 +74,7 @@ export type PartialCustomInlineContentFromConfig<
|
|
|
74
74
|
> = {
|
|
75
75
|
type: I["type"];
|
|
76
76
|
props?: Props<I["propSchema"]>;
|
|
77
|
-
content
|
|
77
|
+
content?: I["content"] extends "styled"
|
|
78
78
|
? StyledText<S>[] | string
|
|
79
79
|
: I["content"] extends "plain"
|
|
80
80
|
? string
|
package/src/util/browser.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export const isAppleOS = () =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
typeof navigator !== "undefined" &&
|
|
3
|
+
(/Mac/.test(navigator.platform) ||
|
|
4
|
+
(/AppleWebKit/.test(navigator.userAgent) &&
|
|
5
|
+
/Mobile\/\w+/.test(navigator.userAgent)));
|
|
6
6
|
|
|
7
7
|
export function formatKeyboardShortcut(shortcut: string) {
|
|
8
8
|
if (isAppleOS()) {
|
|
@@ -16,3 +16,5 @@ export function mergeCSSClasses(...classes: string[]) {
|
|
|
16
16
|
return classes.filter((c) => c).join(" ");
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export const isSafari = () =>
|
|
20
|
+
/^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
package/src/util/typescript.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export class UnreachableCaseError extends Error {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
2
|
+
constructor(val: never) {
|
|
3
|
+
super(`Unreachable case: ${val}`);
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// TODO: change for built-in version of typescript 5.4 after upgrade
|
|
8
|
+
export type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Node } from "prosemirror-model";
|
|
2
|
+
import { Block, PartialBlock } from "../../blocks/defaultBlocks";
|
|
1
3
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
2
|
-
import {
|
|
4
|
+
import { BlockIdentifier, BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
3
5
|
export declare function insertBlocks<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blocksToInsert: PartialBlock<BSchema, I, S>[], referenceBlock: BlockIdentifier, placement: "before" | "after" | "nested" | undefined, editor: BlockNoteEditor<BSchema, I, S>): Block<BSchema, I, S>[];
|
|
4
6
|
export declare function updateBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blockToUpdate: BlockIdentifier, update: PartialBlock<BSchema, I, S>, editor: BlockNoteEditor<BSchema, I, S>): Block<BSchema, I, S>;
|
|
5
7
|
export declare function removeBlocks<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blocksToRemove: BlockIdentifier[], editor: BlockNoteEditor<BSchema, I, S>): Block<BSchema, I, S>[];
|
|
@@ -7,3 +9,6 @@ export declare function replaceBlocks<BSchema extends BlockSchema, I extends Inl
|
|
|
7
9
|
insertedBlocks: Block<BSchema, I, S>[];
|
|
8
10
|
removedBlocks: Block<BSchema, I, S>[];
|
|
9
11
|
};
|
|
12
|
+
export declare function insertContentAt<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(position: any, nodes: Node[], editor: BlockNoteEditor<BSchema, I, S>, options?: {
|
|
13
|
+
updateSelection: boolean;
|
|
14
|
+
}): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, Schema } from "prosemirror-model";
|
|
2
|
+
import { PartialBlock } from "../../../blocks/defaultBlocks";
|
|
2
3
|
import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
|
|
3
|
-
import { BlockSchema, InlineContentSchema,
|
|
4
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema";
|
|
4
5
|
export interface ExternalHTMLExporter<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> {
|
|
5
6
|
exportBlocks: (blocks: PartialBlock<BSchema, I, S>[]) => string;
|
|
6
7
|
exportProseMirrorFragment: (fragment: Fragment) => string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, Schema } from "prosemirror-model";
|
|
2
|
+
import { PartialBlock } from "../../../blocks/defaultBlocks";
|
|
2
3
|
import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
|
|
3
|
-
import { BlockSchema, InlineContentSchema,
|
|
4
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema";
|
|
4
5
|
export interface InternalHTMLSerializer<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> {
|
|
5
6
|
serializeProseMirrorFragment: (fragment: Fragment) => string;
|
|
6
7
|
serializeBlocks: (blocks: PartialBlock<BSchema, I, S>[]) => string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Schema } from "prosemirror-model";
|
|
2
|
+
import { Block } from "../../../blocks/defaultBlocks";
|
|
2
3
|
import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
|
|
3
|
-
import {
|
|
4
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema";
|
|
4
5
|
export declare function cleanHTMLToMarkdown(cleanHTMLString: string): string;
|
|
5
6
|
export declare function blocksToMarkdown<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blocks: Block<BSchema, I, S>[], schema: Schema, editor: BlockNoteEditor<BSchema, I, S>): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Node, Schema } from "@tiptap/pm/model";
|
|
2
|
-
import type {
|
|
2
|
+
import type { BlockSchema, InlineContent, InlineContentSchema, PartialInlineContent, PartialTableContent, StyleSchema } from "../../schema";
|
|
3
|
+
import type { Block, PartialBlock } from "../../blocks/defaultBlocks";
|
|
3
4
|
/**
|
|
4
5
|
* converts an array of inline content elements to prosemirror nodes
|
|
5
6
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Schema } from "prosemirror-model";
|
|
2
|
-
import {
|
|
2
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema";
|
|
3
|
+
import { Block } from "../../../blocks/defaultBlocks";
|
|
3
4
|
export declare function HTMLToBlocks<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(html: string, blockSchema: BSchema, icSchema: I, styleSchema: S, pmSchema: Schema): Promise<Block<BSchema, I, S>[]>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Schema } from "prosemirror-model";
|
|
2
|
-
import { Block
|
|
2
|
+
import { Block } from "../../../blocks/defaultBlocks";
|
|
3
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema";
|
|
3
4
|
export declare function markdownToBlocks<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(markdown: string, blockSchema: BSchema, icSchema: I, styleSchema: S, pmSchema: Schema): Promise<Block<BSchema, I, S>[]>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EditorTestCases } from "../index";
|
|
2
2
|
import { DefaultInlineContentSchema, DefaultStyleSchema } from "../../../blocks/defaultBlocks";
|
|
3
|
-
import {
|
|
4
|
-
declare const
|
|
3
|
+
import { BlockNoteSchema } from "../../../editor/BlockNoteSchema";
|
|
4
|
+
declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
5
5
|
simpleImage: {
|
|
6
6
|
config: {
|
|
7
7
|
type: "simpleImage";
|
|
@@ -25,7 +25,7 @@ declare const customSpecs: {
|
|
|
25
25
|
};
|
|
26
26
|
content: "none";
|
|
27
27
|
};
|
|
28
|
-
implementation: import("
|
|
28
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
29
29
|
type: "simpleImage";
|
|
30
30
|
propSchema: {
|
|
31
31
|
textAlignment: {
|
|
@@ -65,7 +65,7 @@ declare const customSpecs: {
|
|
|
65
65
|
};
|
|
66
66
|
content: "inline";
|
|
67
67
|
};
|
|
68
|
-
implementation: import("
|
|
68
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
69
69
|
type: "customParagraph";
|
|
70
70
|
propSchema: {
|
|
71
71
|
backgroundColor: {
|
|
@@ -99,7 +99,7 @@ declare const customSpecs: {
|
|
|
99
99
|
};
|
|
100
100
|
content: "inline";
|
|
101
101
|
};
|
|
102
|
-
implementation: import("
|
|
102
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
103
103
|
type: "simpleCustomParagraph";
|
|
104
104
|
propSchema: {
|
|
105
105
|
backgroundColor: {
|
|
@@ -133,7 +133,7 @@ declare const customSpecs: {
|
|
|
133
133
|
};
|
|
134
134
|
};
|
|
135
135
|
};
|
|
136
|
-
implementation: import("
|
|
136
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
137
137
|
type: "paragraph";
|
|
138
138
|
content: "inline";
|
|
139
139
|
propSchema: {
|
|
@@ -171,7 +171,7 @@ declare const customSpecs: {
|
|
|
171
171
|
};
|
|
172
172
|
};
|
|
173
173
|
};
|
|
174
|
-
implementation: import("
|
|
174
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
175
175
|
type: "heading";
|
|
176
176
|
content: "inline";
|
|
177
177
|
propSchema: {
|
|
@@ -209,7 +209,7 @@ declare const customSpecs: {
|
|
|
209
209
|
};
|
|
210
210
|
};
|
|
211
211
|
};
|
|
212
|
-
implementation: import("
|
|
212
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
213
213
|
type: "bulletListItem";
|
|
214
214
|
content: "inline";
|
|
215
215
|
propSchema: {
|
|
@@ -243,7 +243,7 @@ declare const customSpecs: {
|
|
|
243
243
|
};
|
|
244
244
|
};
|
|
245
245
|
};
|
|
246
|
-
implementation: import("
|
|
246
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
247
247
|
type: "numberedListItem";
|
|
248
248
|
content: "inline";
|
|
249
249
|
propSchema: {
|
|
@@ -283,7 +283,7 @@ declare const customSpecs: {
|
|
|
283
283
|
};
|
|
284
284
|
content: "none";
|
|
285
285
|
};
|
|
286
|
-
implementation: import("
|
|
286
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
287
287
|
type: "image";
|
|
288
288
|
propSchema: {
|
|
289
289
|
textAlignment: {
|
|
@@ -323,7 +323,7 @@ declare const customSpecs: {
|
|
|
323
323
|
};
|
|
324
324
|
};
|
|
325
325
|
};
|
|
326
|
-
implementation: import("
|
|
326
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
327
327
|
type: "table";
|
|
328
328
|
content: "table";
|
|
329
329
|
propSchema: {
|
|
@@ -340,6 +340,65 @@ declare const customSpecs: {
|
|
|
340
340
|
};
|
|
341
341
|
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
342
342
|
};
|
|
343
|
-
}
|
|
344
|
-
|
|
343
|
+
}>, import("../../..").InlineContentSchemaFromSpecs<{
|
|
344
|
+
text: {
|
|
345
|
+
config: "text";
|
|
346
|
+
implementation: any;
|
|
347
|
+
};
|
|
348
|
+
link: {
|
|
349
|
+
config: "link";
|
|
350
|
+
implementation: any;
|
|
351
|
+
};
|
|
352
|
+
}>, import("../../..").StyleSchemaFromSpecs<{
|
|
353
|
+
bold: {
|
|
354
|
+
config: {
|
|
355
|
+
type: string;
|
|
356
|
+
propSchema: "boolean";
|
|
357
|
+
};
|
|
358
|
+
implementation: import("../../..").StyleImplementation;
|
|
359
|
+
};
|
|
360
|
+
italic: {
|
|
361
|
+
config: {
|
|
362
|
+
type: string;
|
|
363
|
+
propSchema: "boolean";
|
|
364
|
+
};
|
|
365
|
+
implementation: import("../../..").StyleImplementation;
|
|
366
|
+
};
|
|
367
|
+
underline: {
|
|
368
|
+
config: {
|
|
369
|
+
type: string;
|
|
370
|
+
propSchema: "boolean";
|
|
371
|
+
};
|
|
372
|
+
implementation: import("../../..").StyleImplementation;
|
|
373
|
+
};
|
|
374
|
+
strike: {
|
|
375
|
+
config: {
|
|
376
|
+
type: string;
|
|
377
|
+
propSchema: "boolean";
|
|
378
|
+
};
|
|
379
|
+
implementation: import("../../..").StyleImplementation;
|
|
380
|
+
};
|
|
381
|
+
code: {
|
|
382
|
+
config: {
|
|
383
|
+
type: string;
|
|
384
|
+
propSchema: "boolean";
|
|
385
|
+
};
|
|
386
|
+
implementation: import("../../..").StyleImplementation;
|
|
387
|
+
};
|
|
388
|
+
textColor: {
|
|
389
|
+
config: {
|
|
390
|
+
type: string;
|
|
391
|
+
propSchema: "string";
|
|
392
|
+
};
|
|
393
|
+
implementation: import("../../..").StyleImplementation;
|
|
394
|
+
};
|
|
395
|
+
backgroundColor: {
|
|
396
|
+
config: {
|
|
397
|
+
type: string;
|
|
398
|
+
propSchema: "string";
|
|
399
|
+
};
|
|
400
|
+
implementation: import("../../..").StyleImplementation;
|
|
401
|
+
};
|
|
402
|
+
}>>;
|
|
403
|
+
export declare const customBlocksTestCases: EditorTestCases<typeof schema.blockSchema, DefaultInlineContentSchema, DefaultStyleSchema>;
|
|
345
404
|
export {};
|