@blocknote/core 0.9.6 → 0.10.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/dist/blocknote.js +3696 -2609
- 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 -0
- package/package.json +11 -5
- package/src/api/README.md +8 -0
- package/src/api/blockManipulation/blockManipulation.test.ts +72 -10
- package/src/api/blockManipulation/blockManipulation.ts +38 -18
- package/src/api/exporters/copyExtension.ts +68 -0
- package/src/api/exporters/html/__snapshots__/complex/misc/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/complex/misc/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/customParagraph/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/customParagraph/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/customParagraph/nested/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/customParagraph/nested/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/customParagraph/styled/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/customParagraph/styled/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/fontSize/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/fontSize/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/between-links/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/between-links/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/end/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/end/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/link/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/link/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/multiple/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/multiple/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/only/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/only/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/start/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/start/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/styles/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/hardbreak/styles/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/button/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/button/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/nested/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/nested/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/link/adjacent/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/link/adjacent/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/link/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/link/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/link/styled/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/link/styled/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/mention/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/mention/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/paragraph/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/paragraph/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/paragraph/empty/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/paragraph/empty/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/paragraph/nested/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/paragraph/nested/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/paragraph/styled/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/paragraph/styled/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/paste/parse-basic-block-types.json +140 -0
- package/src/api/exporters/html/__snapshots__/paste/parse-deep-nested-content.json +240 -0
- package/src/api/exporters/html/__snapshots__/paste/parse-div-with-inline-content.json +91 -0
- package/src/api/exporters/html/__snapshots__/paste/parse-divs.json +19 -0
- package/src/api/exporters/html/__snapshots__/paste/parse-fake-image-caption.json +31 -0
- package/src/api/exporters/html/__snapshots__/paste/parse-mixed-nested-lists.json +70 -0
- package/src/api/exporters/html/__snapshots__/paste/parse-nested-lists-with-paragraphs.json +70 -0
- package/src/api/exporters/html/__snapshots__/paste/parse-nested-lists.json +70 -0
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/button/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/button/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/small/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/small/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/tag/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/tag/basic/internal.html +1 -0
- package/src/api/exporters/html/externalHTMLExporter.ts +98 -0
- package/src/api/exporters/html/htmlConversion.test.ts +100 -0
- package/src/api/exporters/html/internalHTMLSerializer.ts +80 -0
- package/src/api/exporters/html/util/sharedHTMLConversion.ts +128 -0
- package/src/api/{formatConversions → exporters/html/util}/simplifyBlocksRehypePlugin.ts +13 -0
- package/src/api/exporters/markdown/__snapshots__/complex/misc/markdown.md +5 -0
- package/src/api/exporters/markdown/__snapshots__/customParagraph/basic/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/customParagraph/nested/markdown.md +5 -0
- package/src/api/exporters/markdown/__snapshots__/customParagraph/styled/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/fontSize/basic/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/hardbreak/basic/markdown.md +2 -0
- package/src/api/exporters/markdown/__snapshots__/hardbreak/between-links/markdown.md +2 -0
- package/src/api/exporters/markdown/__snapshots__/hardbreak/end/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/hardbreak/link/markdown.md +2 -0
- package/src/api/exporters/markdown/__snapshots__/hardbreak/multiple/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/hardbreak/start/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/hardbreak/styles/markdown.md +2 -0
- package/src/api/exporters/markdown/__snapshots__/image/basic/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/image/button/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/image/nested/markdown.md +7 -0
- package/src/api/exporters/markdown/__snapshots__/link/adjacent/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/link/basic/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/link/styled/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/mention/basic/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/paragraph/basic/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/paragraph/nested/markdown.md +5 -0
- package/src/api/exporters/markdown/__snapshots__/paragraph/styled/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/basic/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/nested/markdown.md +5 -0
- package/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/styled/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/button/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/small/basic/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/tag/basic/markdown.md +1 -0
- package/src/api/exporters/markdown/markdownExporter.test.ts +85 -0
- package/src/api/exporters/markdown/markdownExporter.ts +42 -0
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +486 -125
- package/src/api/nodeConversions/nodeConversions.test.ts +67 -498
- package/src/api/nodeConversions/nodeConversions.ts +311 -85
- package/src/api/parsers/html/__snapshots__/paste/list-test.json +105 -0
- package/src/api/parsers/html/__snapshots__/paste/parse-basic-block-types.json +140 -0
- package/src/api/parsers/html/__snapshots__/paste/parse-deep-nested-content.json +240 -0
- package/src/api/parsers/html/__snapshots__/paste/parse-div-with-inline-content.json +91 -0
- package/src/api/parsers/html/__snapshots__/paste/parse-divs.json +121 -0
- package/src/api/parsers/html/__snapshots__/paste/parse-fake-image-caption.json +31 -0
- package/src/api/parsers/html/__snapshots__/paste/parse-google-docs-html.json +476 -0
- package/src/api/parsers/html/__snapshots__/paste/parse-mixed-nested-lists.json +140 -0
- package/src/api/parsers/html/__snapshots__/paste/parse-nested-lists-with-paragraphs.json +140 -0
- package/src/api/parsers/html/__snapshots__/paste/parse-nested-lists.json +157 -0
- package/src/api/parsers/html/__snapshots__/paste/parse-notion-html.json +470 -0
- package/src/api/parsers/html/__snapshots__/paste/parse-two-divs.json +36 -0
- package/src/api/parsers/html/parseHTML.test.ts +440 -0
- package/src/api/parsers/html/parseHTML.ts +42 -0
- package/src/api/parsers/html/util/__snapshots__/nestedLists.test.ts.snap +129 -0
- package/src/api/parsers/html/util/nestedLists.test.ts +176 -0
- package/src/api/parsers/html/util/nestedLists.ts +113 -0
- package/src/api/parsers/markdown/__snapshots__/complex.json +353 -0
- package/src/api/parsers/markdown/__snapshots__/issue-226-1.json +71 -0
- package/src/api/parsers/markdown/__snapshots__/issue-226-2.json +144 -0
- package/src/api/parsers/markdown/__snapshots__/nested.json +72 -0
- package/src/api/parsers/markdown/__snapshots__/non-nested.json +71 -0
- package/src/api/parsers/markdown/__snapshots__/styled.json +58 -0
- package/src/api/parsers/markdown/parseMarkdown.test.ts +114 -0
- package/src/api/parsers/markdown/parseMarkdown.ts +84 -0
- package/src/api/parsers/pasteExtension.ts +59 -0
- package/src/api/testUtil/cases/customBlocks.ts +282 -0
- package/src/api/testUtil/cases/customInlineContent.ts +114 -0
- package/src/api/testUtil/cases/customStyles.ts +100 -0
- package/src/api/testUtil/cases/defaultSchema.ts +399 -0
- package/src/api/testUtil/index.ts +17 -0
- package/src/api/testUtil/partialBlockTestUtil.ts +127 -0
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +136 -0
- package/src/{extensions/Blocks/nodes/BlockContent → blocks}/ImageBlockContent/ImageBlockContent.ts +87 -31
- package/src/{extensions/Blocks/nodes/BlockContent → blocks}/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +34 -47
- package/src/{extensions/Blocks/nodes/BlockContent → blocks}/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -1
- package/src/{extensions/Blocks/nodes/BlockContent → blocks}/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +1 -1
- package/src/{extensions/Blocks/nodes/BlockContent → blocks}/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +34 -56
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +43 -0
- package/src/blocks/README.md +3 -0
- package/src/blocks/TableBlockContent/TableBlockContent.ts +74 -0
- package/src/blocks/TableBlockContent/TableExtension.ts +63 -0
- package/src/blocks/defaultBlockHelpers.ts +95 -0
- package/src/blocks/defaultBlocks.ts +60 -0
- package/src/blocks/defaultProps.ts +24 -0
- package/src/{extensions/Blocks/nodes/Block.module.css → editor/Block.css} +69 -62
- package/src/{BlockNoteEditor.test.ts → editor/BlockNoteEditor.test.ts} +2 -2
- package/src/{BlockNoteEditor.ts → editor/BlockNoteEditor.ts} +363 -153
- package/src/{BlockNoteExtensions.ts → editor/BlockNoteExtensions.ts} +59 -40
- package/src/editor/README.md +3 -0
- package/src/editor/cursorPositionTypes.ts +16 -0
- package/src/{editor.module.css → editor/editor.css} +43 -15
- package/src/editor/selectionTypes.ts +14 -0
- package/src/editor/transformPasted.ts +58 -0
- package/src/extensions/BackgroundColor/BackgroundColorExtension.ts +1 -36
- package/src/extensions/BackgroundColor/BackgroundColorMark.ts +12 -27
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +16 -24
- package/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.ts +12 -10
- package/src/extensions/ImageToolbar/ImageToolbarPlugin.ts +35 -73
- package/src/extensions/Placeholder/PlaceholderExtension.ts +4 -4
- package/src/extensions/README.md +3 -0
- package/src/extensions/SideMenu/SideMenuPlugin.ts +66 -37
- package/src/extensions/SlashMenu/BaseSlashMenuItem.ts +7 -6
- package/src/extensions/SlashMenu/SlashMenuPlugin.ts +9 -7
- package/src/extensions/SlashMenu/defaultSlashMenuItems.ts +98 -35
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +617 -0
- package/src/extensions/TextAlignment/TextAlignmentExtension.ts +3 -51
- package/src/extensions/TextColor/TextColorExtension.ts +1 -29
- package/src/extensions/TextColor/TextColorMark.ts +7 -27
- package/src/extensions/UniqueID/UniqueID.ts +28 -2
- package/src/extensions-shared/README.md +3 -0
- package/src/{shared/plugins → extensions-shared}/suggestion/SuggestionPlugin.ts +19 -13
- package/src/index.ts +21 -15
- package/src/{extensions/Blocks/nodes → pm-nodes}/BlockContainer.ts +161 -96
- package/src/pm-nodes/BlockGroup.ts +54 -0
- package/src/pm-nodes/Doc.ts +7 -0
- package/src/pm-nodes/README.md +42 -0
- package/src/pm-nodes/index.ts +3 -0
- package/src/schema/README.md +3 -0
- package/src/schema/blocks/createSpec.ts +220 -0
- package/src/schema/blocks/internal.ts +253 -0
- package/src/schema/blocks/types.ts +252 -0
- package/src/schema/index.ts +10 -0
- package/src/schema/inlineContent/createSpec.ts +119 -0
- package/src/schema/inlineContent/internal.ts +105 -0
- package/src/schema/inlineContent/types.ts +144 -0
- package/src/schema/propTypes.ts +32 -0
- package/src/schema/styles/createSpec.ts +85 -0
- package/src/schema/styles/internal.ts +96 -0
- package/src/schema/styles/types.ts +42 -0
- package/src/util/README.md +3 -0
- package/src/{shared/utils.ts → util/browser.ts} +4 -8
- package/src/util/string.ts +3 -0
- package/src/util/typescript.ts +5 -0
- package/types/src/api/blockManipulation/blockManipulation.d.ts +5 -4
- package/types/src/api/exporters/copyExtension.d.ts +6 -0
- package/types/src/api/exporters/html/externalHTMLExporter.d.ts +8 -0
- package/types/src/api/exporters/html/internalHTMLSerializer.d.ts +8 -0
- package/types/src/api/exporters/html/util/sharedHTMLConversion.d.ts +7 -0
- package/types/src/api/exporters/markdown/markdownExporter.d.ts +5 -0
- package/types/src/api/nodeConversions/nodeConversions.d.ts +14 -6
- package/types/src/api/parsers/html/parseHTML.d.ts +3 -0
- package/types/src/api/parsers/html/parseHTML.test.d.ts +1 -0
- package/types/src/api/parsers/html/util/nestedLists.d.ts +1 -0
- package/types/src/api/parsers/html/util/nestedLists.test.d.ts +1 -0
- package/types/src/api/parsers/markdown/parseMarkdown.d.ts +3 -0
- package/types/src/api/parsers/markdown/parseMarkdown.test.d.ts +1 -0
- package/types/src/api/parsers/pasteExtension.d.ts +6 -0
- package/types/src/api/testUtil/cases/customBlocks.d.ts +345 -0
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +29 -0
- package/types/src/api/testUtil/cases/customStyles.d.ts +64 -0
- package/types/src/api/testUtil/cases/defaultSchema.d.ts +3 -0
- package/types/src/api/testUtil/index.d.ts +12 -0
- package/types/src/api/testUtil/partialBlockTestUtil.d.ts +7 -0
- package/types/src/blocks/HeadingBlockContent/HeadingBlockContent.d.ts +58 -0
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +93 -0
- package/types/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.d.ts +46 -0
- package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +46 -0
- package/types/src/blocks/ParagraphBlockContent/ParagraphBlockContent.d.ts +52 -0
- package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +53 -0
- package/types/src/blocks/TableBlockContent/TableExtension.d.ts +2 -0
- package/types/src/blocks/defaultBlockHelpers.d.ts +10 -0
- package/types/src/blocks/defaultBlocks.d.ts +577 -0
- package/types/src/{extensions/Blocks/api → blocks}/defaultProps.d.ts +2 -1
- package/types/src/{BlockNoteEditor.d.ts → editor/BlockNoteEditor.d.ts} +54 -43
- package/types/src/editor/BlockNoteEditor.test.d.ts +1 -0
- package/types/src/{BlockNoteExtensions.d.ts → editor/BlockNoteExtensions.d.ts} +7 -4
- package/types/src/editor/cursorPositionTypes.d.ts +6 -0
- package/types/src/editor/selectionTypes.d.ts +4 -0
- package/types/src/editor/transformPasted.d.ts +12 -0
- package/types/src/extensions/BackgroundColor/BackgroundColorExtension.d.ts +0 -7
- package/types/src/extensions/BackgroundColor/BackgroundColorMark.d.ts +7 -9
- package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +8 -6
- package/types/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.d.ts +6 -6
- package/types/src/extensions/ImageToolbar/ImageToolbarPlugin.d.ts +11 -16
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +18 -11
- package/types/src/extensions/SlashMenu/BaseSlashMenuItem.d.ts +5 -6
- package/types/src/extensions/SlashMenu/SlashMenuPlugin.d.ts +6 -6
- package/types/src/extensions/SlashMenu/defaultSlashMenuItems.d.ts +2 -1
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +74 -0
- package/types/src/extensions/TextAlignment/TextAlignmentExtension.d.ts +0 -7
- package/types/src/extensions/TextColor/TextColorExtension.d.ts +0 -7
- package/types/src/extensions/TextColor/TextColorMark.d.ts +7 -9
- package/types/src/extensions/UniqueID/UniqueID.d.ts +1 -1
- package/types/src/{shared/plugins → extensions-shared}/suggestion/SuggestionPlugin.d.ts +5 -4
- package/types/src/index.d.ts +20 -15
- package/types/src/{extensions/Blocks/nodes → pm-nodes}/BlockContainer.d.ts +5 -3
- package/types/src/pm-nodes/Doc.d.ts +2 -0
- package/types/src/pm-nodes/index.d.ts +3 -0
- package/types/src/schema/blocks/createSpec.d.ts +35 -0
- package/types/src/schema/blocks/internal.d.ts +45 -0
- package/types/src/schema/blocks/types.d.ts +107 -0
- package/types/src/schema/index.d.ts +10 -0
- package/types/src/schema/inlineContent/createSpec.d.ts +21 -0
- package/types/src/schema/inlineContent/internal.d.ts +28 -0
- package/types/src/schema/inlineContent/types.d.ts +62 -0
- package/types/src/schema/propTypes.d.ts +8 -0
- package/types/src/schema/styles/createSpec.d.ts +13 -0
- package/types/src/schema/styles/internal.d.ts +22 -0
- package/types/src/schema/styles/types.d.ts +21 -0
- package/types/src/{shared/utils.d.ts → util/browser.d.ts} +0 -3
- package/types/src/util/string.d.ts +1 -0
- package/types/src/util/typescript.d.ts +3 -0
- package/src/api/formatConversions/__snapshots__/formatConversions.test.ts.snap +0 -346
- package/src/api/formatConversions/formatConversions.test.ts +0 -753
- package/src/api/formatConversions/formatConversions.ts +0 -133
- package/src/api/nodeConversions/testUtil.ts +0 -65
- package/src/extensions/Blocks/api/block.ts +0 -307
- package/src/extensions/Blocks/api/blockTypes.ts +0 -249
- package/src/extensions/Blocks/api/cursorPositionTypes.ts +0 -7
- package/src/extensions/Blocks/api/defaultBlocks.ts +0 -16
- package/src/extensions/Blocks/api/defaultProps.ts +0 -16
- package/src/extensions/Blocks/api/inlineContentTypes.ts +0 -36
- package/src/extensions/Blocks/api/selectionTypes.ts +0 -5
- package/src/extensions/Blocks/api/serialization.ts +0 -29
- package/src/extensions/Blocks/helpers/findBlock.ts +0 -5
- package/src/extensions/Blocks/index.ts +0 -8
- package/src/extensions/Blocks/nodes/BlockAttributes.ts +0 -10
- package/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.ts +0 -142
- package/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.ts +0 -62
- package/src/extensions/Blocks/nodes/BlockGroup.ts +0 -53
- package/types/src/api/formatConversions/formatConversions.d.ts +0 -6
- package/types/src/api/nodeConversions/testUtil.d.ts +0 -2
- package/types/src/extensions/Blocks/api/block.d.ts +0 -20
- package/types/src/extensions/Blocks/api/blockTypes.d.ts +0 -103
- package/types/src/extensions/Blocks/api/cursorPositionTypes.d.ts +0 -6
- package/types/src/extensions/Blocks/api/defaultBlocks.d.ts +0 -117
- package/types/src/extensions/Blocks/api/inlineContentTypes.d.ts +0 -30
- package/types/src/extensions/Blocks/api/selectionTypes.d.ts +0 -4
- package/types/src/extensions/Blocks/api/serialization.d.ts +0 -2
- package/types/src/extensions/Blocks/helpers/findBlock.d.ts +0 -6
- package/types/src/extensions/Blocks/index.d.ts +0 -4
- package/types/src/extensions/Blocks/nodes/BlockAttributes.d.ts +0 -2
- package/types/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.d.ts +0 -43
- package/types/src/extensions/Blocks/nodes/BlockContent/ImageBlockContent/ImageBlockContent.d.ts +0 -37
- package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.d.ts +0 -35
- package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +0 -35
- package/types/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.d.ts +0 -44
- /package/src/{shared/EditorElement.ts → api/exporters/markdown/__snapshots__/hardbreak/only/markdown.md} +0 -0
- /package/{types/src/shared/EditorElement.d.ts → src/api/exporters/markdown/__snapshots__/paragraph/empty/markdown.md} +0 -0
- /package/src/api/{formatConversions → exporters/markdown}/removeUnderlinesRehypePlugin.ts +0 -0
- /package/src/{extensions/Blocks/helpers → api}/getBlockInfoFromPos.ts +0 -0
- /package/src/api/{util/nodeUtil.ts → nodeUtil.ts} +0 -0
- /package/src/{extensions/Blocks/nodes/BlockContent → blocks}/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +0 -0
- /package/src/extensions/{Blocks → NonEditableBlocks}/NonEditableBlockPlugin.ts +0 -0
- /package/src/extensions/{Blocks → PreviousBlockType}/PreviousBlockTypePlugin.ts +0 -0
- /package/src/{shared → extensions-shared}/BaseUiElementTypes.ts +0 -0
- /package/src/{shared/plugins → extensions-shared}/suggestion/SuggestionItem.ts +0 -0
- /package/src/{shared → util}/EventEmitter.ts +0 -0
- /package/types/src/{BlockNoteEditor.test.d.ts → api/exporters/html/htmlConversion.test.d.ts} +0 -0
- /package/types/src/api/{formatConversions → exporters/html/util}/simplifyBlocksRehypePlugin.d.ts +0 -0
- /package/types/src/api/{formatConversions/formatConversions.test.d.ts → exporters/markdown/markdownExporter.test.d.ts} +0 -0
- /package/types/src/api/{formatConversions → exporters/markdown}/removeUnderlinesRehypePlugin.d.ts +0 -0
- /package/types/src/{extensions/Blocks/helpers → api}/getBlockInfoFromPos.d.ts +0 -0
- /package/types/src/api/{util/nodeUtil.d.ts → nodeUtil.d.ts} +0 -0
- /package/types/src/{extensions/Blocks/nodes/BlockContent → blocks}/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +0 -0
- /package/types/src/{extensions/Blocks/nodes/BlockContent → blocks}/ListItemBlockContent/ListItemKeyboardShortcuts.d.ts +0 -0
- /package/types/src/{extensions/Blocks/nodes/BlockContent → blocks}/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.d.ts +0 -0
- /package/types/src/extensions/{Blocks → NonEditableBlocks}/NonEditableBlockPlugin.d.ts +0 -0
- /package/types/src/extensions/{Blocks → PreviousBlockType}/PreviousBlockTypePlugin.d.ts +0 -0
- /package/types/src/{shared → extensions-shared}/BaseUiElementTypes.d.ts +0 -0
- /package/types/src/{shared/plugins → extensions-shared}/suggestion/SuggestionItem.d.ts +0 -0
- /package/types/src/{extensions/Blocks/nodes → pm-nodes}/BlockGroup.d.ts +0 -0
- /package/types/src/{shared → util}/EventEmitter.d.ts +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Mark } from "@tiptap/core";
|
|
2
|
+
import { ParseRule } from "@tiptap/pm/model";
|
|
3
|
+
import {
|
|
4
|
+
addStyleAttributes,
|
|
5
|
+
createInternalStyleSpec,
|
|
6
|
+
stylePropsToAttributes,
|
|
7
|
+
} from "./internal";
|
|
8
|
+
import { StyleConfig, StyleSpec } from "./types";
|
|
9
|
+
import {UnreachableCaseError} from "../../util/typescript";
|
|
10
|
+
|
|
11
|
+
export type CustomStyleImplementation<T extends StyleConfig> = {
|
|
12
|
+
render: T["propSchema"] extends "boolean"
|
|
13
|
+
? () => {
|
|
14
|
+
dom: HTMLElement;
|
|
15
|
+
contentDOM?: HTMLElement;
|
|
16
|
+
}
|
|
17
|
+
: (value: string) => {
|
|
18
|
+
dom: HTMLElement;
|
|
19
|
+
contentDOM?: HTMLElement;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// TODO: support serialization
|
|
24
|
+
|
|
25
|
+
export function getStyleParseRules(config: StyleConfig): ParseRule[] {
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
tag: `[data-style-type="${config.type}"]`,
|
|
29
|
+
contentElement: (element) => {
|
|
30
|
+
const htmlElement = element as HTMLElement;
|
|
31
|
+
|
|
32
|
+
if (htmlElement.matches("[data-editable]")) {
|
|
33
|
+
return htmlElement;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return htmlElement.querySelector("[data-editable]") || htmlElement;
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function createStyleSpec<T extends StyleConfig>(
|
|
43
|
+
styleConfig: T,
|
|
44
|
+
styleImplementation: CustomStyleImplementation<T>
|
|
45
|
+
): StyleSpec<T> {
|
|
46
|
+
const mark = Mark.create({
|
|
47
|
+
name: styleConfig.type,
|
|
48
|
+
|
|
49
|
+
addAttributes() {
|
|
50
|
+
return stylePropsToAttributes(styleConfig.propSchema);
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
parseHTML() {
|
|
54
|
+
return getStyleParseRules(styleConfig);
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
renderHTML({ mark }) {
|
|
58
|
+
let renderResult: {
|
|
59
|
+
dom: HTMLElement;
|
|
60
|
+
contentDOM?: HTMLElement;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
if (styleConfig.propSchema === "boolean") {
|
|
64
|
+
// @ts-ignore not sure why this is complaining
|
|
65
|
+
renderResult = styleImplementation.render();
|
|
66
|
+
} else if (styleConfig.propSchema === "string") {
|
|
67
|
+
renderResult = styleImplementation.render(mark.attrs.stringValue);
|
|
68
|
+
} else {
|
|
69
|
+
throw new UnreachableCaseError(styleConfig.propSchema);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// const renderResult = styleImplementation.render();
|
|
73
|
+
return addStyleAttributes(
|
|
74
|
+
renderResult,
|
|
75
|
+
styleConfig.type,
|
|
76
|
+
mark.attrs.stringValue,
|
|
77
|
+
styleConfig.propSchema
|
|
78
|
+
);
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
return createInternalStyleSpec(styleConfig, {
|
|
83
|
+
mark,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Attributes, Mark } from "@tiptap/core";
|
|
2
|
+
import {
|
|
3
|
+
StyleConfig,
|
|
4
|
+
StyleImplementation,
|
|
5
|
+
StylePropSchema,
|
|
6
|
+
StyleSchemaFromSpecs,
|
|
7
|
+
StyleSpec,
|
|
8
|
+
StyleSpecs,
|
|
9
|
+
} from "./types";
|
|
10
|
+
|
|
11
|
+
export function stylePropsToAttributes(
|
|
12
|
+
propSchema: StylePropSchema
|
|
13
|
+
): Attributes {
|
|
14
|
+
if (propSchema === "boolean") {
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
stringValue: {
|
|
19
|
+
default: undefined,
|
|
20
|
+
keepOnSplit: true,
|
|
21
|
+
parseHTML: (element) => element.getAttribute("data-value"),
|
|
22
|
+
renderHTML: (attributes) =>
|
|
23
|
+
attributes.stringValue !== undefined
|
|
24
|
+
? {
|
|
25
|
+
"data-value": attributes.stringValue,
|
|
26
|
+
}
|
|
27
|
+
: {},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Function that adds necessary classes and attributes to the `dom` element
|
|
33
|
+
// returned from a custom style's 'render' function, to ensure no data is lost
|
|
34
|
+
// on internal copy & paste.
|
|
35
|
+
export function addStyleAttributes<
|
|
36
|
+
SType extends string,
|
|
37
|
+
PSchema extends StylePropSchema
|
|
38
|
+
>(
|
|
39
|
+
element: {
|
|
40
|
+
dom: HTMLElement;
|
|
41
|
+
contentDOM?: HTMLElement;
|
|
42
|
+
},
|
|
43
|
+
styleType: SType,
|
|
44
|
+
styleValue: PSchema extends "boolean" ? undefined : string,
|
|
45
|
+
propSchema: PSchema
|
|
46
|
+
): {
|
|
47
|
+
dom: HTMLElement;
|
|
48
|
+
contentDOM?: HTMLElement;
|
|
49
|
+
} {
|
|
50
|
+
// Sets content type attribute
|
|
51
|
+
element.dom.setAttribute("data-style-type", styleType);
|
|
52
|
+
// Adds style value as an HTML attribute in kebab-case with "data-" prefix, if
|
|
53
|
+
// the style takes a string value.
|
|
54
|
+
if (propSchema === "string") {
|
|
55
|
+
element.dom.setAttribute("data-value", styleValue as string);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (element.contentDOM !== undefined) {
|
|
59
|
+
element.contentDOM.setAttribute("data-editable", "");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return element;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// This helper function helps to instantiate a stylespec with a
|
|
66
|
+
// config and implementation that conform to the type of Config
|
|
67
|
+
export function createInternalStyleSpec<T extends StyleConfig>(
|
|
68
|
+
config: T,
|
|
69
|
+
implementation: StyleImplementation
|
|
70
|
+
) {
|
|
71
|
+
return {
|
|
72
|
+
config,
|
|
73
|
+
implementation,
|
|
74
|
+
} satisfies StyleSpec<T>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function createStyleSpecFromTipTapMark<
|
|
78
|
+
T extends Mark,
|
|
79
|
+
P extends StylePropSchema
|
|
80
|
+
>(mark: T, propSchema: P) {
|
|
81
|
+
return createInternalStyleSpec(
|
|
82
|
+
{
|
|
83
|
+
type: mark.name as T["name"],
|
|
84
|
+
propSchema,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
mark,
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function getStyleSchemaFromSpecs<T extends StyleSpecs>(specs: T) {
|
|
93
|
+
return Object.fromEntries(
|
|
94
|
+
Object.entries(specs).map(([key, value]) => [key, value.config])
|
|
95
|
+
) as StyleSchemaFromSpecs<T>;
|
|
96
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Mark } from "@tiptap/core";
|
|
2
|
+
|
|
3
|
+
export type StylePropSchema = "boolean" | "string"; // TODO: use PropSchema as name? Use objects as type similar to blocks?
|
|
4
|
+
|
|
5
|
+
// StyleConfig contains the "schema" info about a Style type
|
|
6
|
+
// i.e. what props it supports, what content it supports, etc.
|
|
7
|
+
export type StyleConfig = {
|
|
8
|
+
type: string;
|
|
9
|
+
readonly propSchema: StylePropSchema;
|
|
10
|
+
// content: "inline" | "none" | "table";
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// StyleImplementation contains the "implementation" info about a Style element.
|
|
14
|
+
// Currently, the implementation is always a TipTap Mark
|
|
15
|
+
export type StyleImplementation = {
|
|
16
|
+
mark: Mark;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// Container for both the config and implementation of a Style,
|
|
20
|
+
// and the type of `implementation` is based on that of the config
|
|
21
|
+
export type StyleSpec<T extends StyleConfig> = {
|
|
22
|
+
config: T;
|
|
23
|
+
implementation: StyleImplementation;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// A Schema contains all the types (Configs) supported in an editor
|
|
27
|
+
// The keys are the "type" of Styles supported
|
|
28
|
+
export type StyleSchema = Record<string, StyleConfig>;
|
|
29
|
+
|
|
30
|
+
export type StyleSpecs = Record<string, StyleSpec<StyleConfig>>;
|
|
31
|
+
|
|
32
|
+
export type StyleSchemaFromSpecs<T extends StyleSpecs> = {
|
|
33
|
+
[K in keyof T]: T[K]["config"];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type Styles<T extends StyleSchema> = {
|
|
37
|
+
[K in keyof T]?: T[K]["propSchema"] extends "boolean"
|
|
38
|
+
? boolean
|
|
39
|
+
: T[K]["propSchema"] extends "string"
|
|
40
|
+
? string
|
|
41
|
+
: never;
|
|
42
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export const isAppleOS = () =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
typeof navigator !== "undefined" &&
|
|
3
|
+
(/Mac/.test(navigator.platform) ||
|
|
4
|
+
(/AppleWebKit/.test(navigator.userAgent) &&
|
|
5
|
+
/Mobile\/\w+/.test(navigator.userAgent)));
|
|
5
6
|
|
|
6
7
|
export function formatKeyboardShortcut(shortcut: string) {
|
|
7
8
|
if (isAppleOS()) {
|
|
@@ -15,8 +16,3 @@ export function mergeCSSClasses(...classes: string[]) {
|
|
|
15
16
|
return classes.filter((c) => c).join(" ");
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export class UnreachableCaseError extends Error {
|
|
19
|
-
constructor(val: never) {
|
|
20
|
-
super(`Unreachable case: ${val}`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Editor } from "@tiptap/core";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
2
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
3
|
+
import { BlockIdentifier, BlockSchema, InlineContentSchema, PartialBlock, StyleSchema } from "../../schema";
|
|
4
|
+
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>): void;
|
|
5
|
+
export declare function updateBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blockToUpdate: BlockIdentifier, update: PartialBlock<BSchema, I, S>, editor: Editor): void;
|
|
5
6
|
export declare function removeBlocks(blocksToRemove: BlockIdentifier[], editor: Editor): void;
|
|
6
|
-
export declare function replaceBlocks<BSchema extends BlockSchema>(blocksToRemove: BlockIdentifier[], blocksToInsert: PartialBlock<BSchema>[], editor:
|
|
7
|
+
export declare function replaceBlocks<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blocksToRemove: BlockIdentifier[], blocksToInsert: PartialBlock<BSchema, I, S>[], editor: BlockNoteEditor<BSchema, I, S>): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
3
|
+
import { InlineContentSchema, StyleSchema } from "../../schema";
|
|
4
|
+
export declare const createCopyToClipboardExtension: <BSchema extends Record<string, import("../../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>) => Extension<{
|
|
5
|
+
editor: BlockNoteEditor<BSchema, I, S>;
|
|
6
|
+
}, undefined>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Fragment, Schema } from "prosemirror-model";
|
|
2
|
+
import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
|
|
3
|
+
import { BlockSchema, InlineContentSchema, PartialBlock, StyleSchema } from "../../../schema";
|
|
4
|
+
export interface ExternalHTMLExporter<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> {
|
|
5
|
+
exportBlocks: (blocks: PartialBlock<BSchema, I, S>[]) => string;
|
|
6
|
+
exportProseMirrorFragment: (fragment: Fragment) => string;
|
|
7
|
+
}
|
|
8
|
+
export declare const createExternalHTMLExporter: <BSchema extends Record<string, import("../../../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(schema: Schema, editor: BlockNoteEditor<BSchema, I, S>) => ExternalHTMLExporter<BSchema, I, S>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Fragment, Schema } from "prosemirror-model";
|
|
2
|
+
import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
|
|
3
|
+
import { BlockSchema, InlineContentSchema, PartialBlock, StyleSchema } from "../../../schema";
|
|
4
|
+
export interface InternalHTMLSerializer<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> {
|
|
5
|
+
serializeProseMirrorFragment: (fragment: Fragment) => string;
|
|
6
|
+
serializeBlocks: (blocks: PartialBlock<BSchema, I, S>[]) => string;
|
|
7
|
+
}
|
|
8
|
+
export declare const createInternalHTMLSerializer: <BSchema extends Record<string, import("../../../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(schema: Schema, editor: BlockNoteEditor<BSchema, I, S>) => InternalHTMLSerializer<BSchema, I, S>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DOMSerializer, Fragment, Node } from "prosemirror-model";
|
|
2
|
+
import type { BlockNoteEditor } from "../../../../editor/BlockNoteEditor";
|
|
3
|
+
import { InlineContentSchema, StyleSchema } from "../../../../schema";
|
|
4
|
+
export declare const serializeNodeInner: <BSchema extends Record<string, import("../../../../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(node: Node, options: {
|
|
5
|
+
document?: Document;
|
|
6
|
+
}, serializer: DOMSerializer, editor: BlockNoteEditor<BSchema, I, S>, toExternalHTML: boolean) => HTMLElement;
|
|
7
|
+
export declare const serializeProseMirrorFragment: (fragment: Fragment, serializer: DOMSerializer) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Schema } from "prosemirror-model";
|
|
2
|
+
import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
|
|
3
|
+
import { Block, BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema";
|
|
4
|
+
export declare function cleanHTMLToMarkdown(cleanHTMLString: string): string;
|
|
5
|
+
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,15 +1,23 @@
|
|
|
1
|
-
import { Node, Schema } from "
|
|
2
|
-
import { Block, BlockSchema, PartialBlock } from "../../
|
|
3
|
-
import { PartialInlineContent } from "../../extensions/Blocks/api/inlineContentTypes";
|
|
1
|
+
import { Node, Schema } from "@tiptap/pm/model";
|
|
2
|
+
import type { Block, BlockSchema, InlineContent, InlineContentSchema, PartialBlock, PartialInlineContent, PartialTableContent, StyleSchema } from "../../schema";
|
|
4
3
|
/**
|
|
5
4
|
* converts an array of inline content elements to prosemirror nodes
|
|
6
5
|
*/
|
|
7
|
-
export declare function inlineContentToNodes(blockContent: PartialInlineContent
|
|
6
|
+
export declare function inlineContentToNodes<I extends InlineContentSchema, S extends StyleSchema>(blockContent: PartialInlineContent<I, S>, schema: Schema, styleSchema: S): Node[];
|
|
7
|
+
/**
|
|
8
|
+
* converts an array of inline content elements to prosemirror nodes
|
|
9
|
+
*/
|
|
10
|
+
export declare function tableContentToNodes<I extends InlineContentSchema, S extends StyleSchema>(tableContent: PartialTableContent<I, S>, schema: Schema, styleSchema: StyleSchema): Node[];
|
|
8
11
|
/**
|
|
9
12
|
* Converts a BlockNote block to a TipTap node.
|
|
10
13
|
*/
|
|
11
|
-
export declare function blockToNode
|
|
14
|
+
export declare function blockToNode(block: PartialBlock<any, any, any>, schema: Schema, styleSchema: StyleSchema): Node;
|
|
15
|
+
/**
|
|
16
|
+
* Converts an internal (prosemirror) content node to a BlockNote InlineContent array.
|
|
17
|
+
*/
|
|
18
|
+
export declare function contentNodeToInlineContent<I extends InlineContentSchema, S extends StyleSchema>(contentNode: Node, inlineContentSchema: I, styleSchema: S): InlineContent<I, S>[];
|
|
19
|
+
export declare function nodeToCustomInlineContent<I extends InlineContentSchema, S extends StyleSchema>(node: Node, inlineContentSchema: I, styleSchema: S): InlineContent<I, S>;
|
|
12
20
|
/**
|
|
13
21
|
* Convert a TipTap node to a BlockNote block.
|
|
14
22
|
*/
|
|
15
|
-
export declare function nodeToBlock<BSchema extends BlockSchema>(node: Node, blockSchema: BSchema, blockCache?: WeakMap<Node, Block<BSchema>>): Block<BSchema>;
|
|
23
|
+
export declare function nodeToBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(node: Node, blockSchema: BSchema, inlineContentSchema: I, styleSchema: S, blockCache?: WeakMap<Node, Block<BSchema, I, S>>): Block<BSchema, I, S>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Schema } from "prosemirror-model";
|
|
2
|
+
import { Block, BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema";
|
|
3
|
+
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>[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function nestedListsToBlockNoteStructure(elementOrHTML: HTMLElement | string): HTMLElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Schema } from "prosemirror-model";
|
|
2
|
+
import { Block, BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema";
|
|
3
|
+
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>[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
3
|
+
import { InlineContentSchema, StyleSchema } from "../../schema";
|
|
4
|
+
export declare const createPasteFromClipboardExtension: <BSchema extends Record<string, import("../../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>) => Extension<{
|
|
5
|
+
editor: BlockNoteEditor<BSchema, I, S>;
|
|
6
|
+
}, undefined>;
|