@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
|
@@ -1,753 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
2
|
-
import { Block, BlockNoteEditor } from "../..";
|
|
3
|
-
import UniqueID from "../../extensions/UniqueID/UniqueID";
|
|
4
|
-
|
|
5
|
-
let editor: BlockNoteEditor;
|
|
6
|
-
|
|
7
|
-
const getNonNestedBlocks = (): Block[] => [
|
|
8
|
-
{
|
|
9
|
-
id: UniqueID.options.generateID(),
|
|
10
|
-
type: "heading",
|
|
11
|
-
props: {
|
|
12
|
-
backgroundColor: "default",
|
|
13
|
-
textColor: "default",
|
|
14
|
-
textAlignment: "left",
|
|
15
|
-
level: 1,
|
|
16
|
-
},
|
|
17
|
-
content: [
|
|
18
|
-
{
|
|
19
|
-
type: "text",
|
|
20
|
-
text: "Heading",
|
|
21
|
-
styles: {},
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
children: [],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: UniqueID.options.generateID(),
|
|
28
|
-
type: "paragraph",
|
|
29
|
-
props: {
|
|
30
|
-
backgroundColor: "default",
|
|
31
|
-
textColor: "default",
|
|
32
|
-
textAlignment: "left",
|
|
33
|
-
},
|
|
34
|
-
content: [
|
|
35
|
-
{
|
|
36
|
-
type: "text",
|
|
37
|
-
text: "Paragraph",
|
|
38
|
-
styles: {},
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
children: [],
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: UniqueID.options.generateID(),
|
|
45
|
-
type: "bulletListItem",
|
|
46
|
-
props: {
|
|
47
|
-
backgroundColor: "default",
|
|
48
|
-
textColor: "default",
|
|
49
|
-
textAlignment: "left",
|
|
50
|
-
},
|
|
51
|
-
content: [
|
|
52
|
-
{
|
|
53
|
-
type: "text",
|
|
54
|
-
text: "Bullet List Item",
|
|
55
|
-
styles: {},
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
children: [],
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
id: UniqueID.options.generateID(),
|
|
62
|
-
type: "numberedListItem",
|
|
63
|
-
props: {
|
|
64
|
-
backgroundColor: "default",
|
|
65
|
-
textColor: "default",
|
|
66
|
-
textAlignment: "left",
|
|
67
|
-
},
|
|
68
|
-
content: [
|
|
69
|
-
{
|
|
70
|
-
type: "text",
|
|
71
|
-
text: "Numbered List Item",
|
|
72
|
-
styles: {},
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
children: [],
|
|
76
|
-
},
|
|
77
|
-
];
|
|
78
|
-
|
|
79
|
-
const getNestedBlocks = (): Block[] => [
|
|
80
|
-
{
|
|
81
|
-
id: UniqueID.options.generateID(),
|
|
82
|
-
type: "heading",
|
|
83
|
-
props: {
|
|
84
|
-
backgroundColor: "default",
|
|
85
|
-
textColor: "default",
|
|
86
|
-
textAlignment: "left",
|
|
87
|
-
level: 1,
|
|
88
|
-
},
|
|
89
|
-
content: [
|
|
90
|
-
{
|
|
91
|
-
type: "text",
|
|
92
|
-
text: "Heading",
|
|
93
|
-
styles: {},
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
children: [
|
|
97
|
-
{
|
|
98
|
-
id: UniqueID.options.generateID(),
|
|
99
|
-
type: "paragraph",
|
|
100
|
-
props: {
|
|
101
|
-
backgroundColor: "default",
|
|
102
|
-
textColor: "default",
|
|
103
|
-
textAlignment: "left",
|
|
104
|
-
},
|
|
105
|
-
content: [
|
|
106
|
-
{
|
|
107
|
-
type: "text",
|
|
108
|
-
text: "Paragraph",
|
|
109
|
-
styles: {},
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
children: [
|
|
113
|
-
{
|
|
114
|
-
id: UniqueID.options.generateID(),
|
|
115
|
-
type: "bulletListItem",
|
|
116
|
-
props: {
|
|
117
|
-
backgroundColor: "default",
|
|
118
|
-
textColor: "default",
|
|
119
|
-
textAlignment: "left",
|
|
120
|
-
},
|
|
121
|
-
content: [
|
|
122
|
-
{
|
|
123
|
-
type: "text",
|
|
124
|
-
text: "Bullet List Item",
|
|
125
|
-
styles: {},
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
children: [
|
|
129
|
-
{
|
|
130
|
-
id: UniqueID.options.generateID(),
|
|
131
|
-
type: "numberedListItem",
|
|
132
|
-
props: {
|
|
133
|
-
backgroundColor: "default",
|
|
134
|
-
textColor: "default",
|
|
135
|
-
textAlignment: "left",
|
|
136
|
-
},
|
|
137
|
-
content: [
|
|
138
|
-
{
|
|
139
|
-
type: "text",
|
|
140
|
-
text: "Numbered List Item",
|
|
141
|
-
styles: {},
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
children: [],
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
},
|
|
152
|
-
];
|
|
153
|
-
|
|
154
|
-
const getStyledBlocks = (): Block[] => [
|
|
155
|
-
{
|
|
156
|
-
id: UniqueID.options.generateID(),
|
|
157
|
-
type: "paragraph",
|
|
158
|
-
props: {
|
|
159
|
-
backgroundColor: "default",
|
|
160
|
-
textColor: "default",
|
|
161
|
-
textAlignment: "left",
|
|
162
|
-
},
|
|
163
|
-
content: [
|
|
164
|
-
{
|
|
165
|
-
type: "text",
|
|
166
|
-
text: "Bold",
|
|
167
|
-
styles: {
|
|
168
|
-
bold: true,
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
type: "text",
|
|
173
|
-
text: "Italic",
|
|
174
|
-
styles: {
|
|
175
|
-
italic: true,
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
type: "text",
|
|
180
|
-
text: "Underline",
|
|
181
|
-
styles: {
|
|
182
|
-
underline: true,
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
type: "text",
|
|
187
|
-
text: "Strikethrough",
|
|
188
|
-
styles: {
|
|
189
|
-
strike: true,
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
type: "text",
|
|
194
|
-
text: "TextColor",
|
|
195
|
-
styles: {
|
|
196
|
-
textColor: "red",
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
type: "text",
|
|
201
|
-
text: "BackgroundColor",
|
|
202
|
-
styles: {
|
|
203
|
-
backgroundColor: "red",
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
type: "text",
|
|
208
|
-
text: "Multiple",
|
|
209
|
-
styles: {
|
|
210
|
-
bold: true,
|
|
211
|
-
italic: true,
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
],
|
|
215
|
-
children: [],
|
|
216
|
-
},
|
|
217
|
-
];
|
|
218
|
-
|
|
219
|
-
const getComplexBlocks = (): Block[] => [
|
|
220
|
-
{
|
|
221
|
-
id: UniqueID.options.generateID(),
|
|
222
|
-
type: "heading",
|
|
223
|
-
props: {
|
|
224
|
-
backgroundColor: "red",
|
|
225
|
-
textColor: "yellow",
|
|
226
|
-
textAlignment: "right",
|
|
227
|
-
level: 1,
|
|
228
|
-
},
|
|
229
|
-
content: [
|
|
230
|
-
{
|
|
231
|
-
type: "text",
|
|
232
|
-
text: "Heading 1",
|
|
233
|
-
styles: {},
|
|
234
|
-
},
|
|
235
|
-
],
|
|
236
|
-
children: [
|
|
237
|
-
{
|
|
238
|
-
id: UniqueID.options.generateID(),
|
|
239
|
-
type: "heading",
|
|
240
|
-
props: {
|
|
241
|
-
backgroundColor: "orange",
|
|
242
|
-
textColor: "orange",
|
|
243
|
-
textAlignment: "center",
|
|
244
|
-
level: 2,
|
|
245
|
-
},
|
|
246
|
-
content: [
|
|
247
|
-
{
|
|
248
|
-
type: "text",
|
|
249
|
-
text: "Heading 2",
|
|
250
|
-
styles: {},
|
|
251
|
-
},
|
|
252
|
-
],
|
|
253
|
-
children: [
|
|
254
|
-
{
|
|
255
|
-
id: UniqueID.options.generateID(),
|
|
256
|
-
type: "heading",
|
|
257
|
-
props: {
|
|
258
|
-
backgroundColor: "yellow",
|
|
259
|
-
textColor: "red",
|
|
260
|
-
textAlignment: "left",
|
|
261
|
-
level: 3,
|
|
262
|
-
},
|
|
263
|
-
content: [
|
|
264
|
-
{
|
|
265
|
-
type: "text",
|
|
266
|
-
text: "Heading 3",
|
|
267
|
-
styles: {},
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
children: [],
|
|
271
|
-
},
|
|
272
|
-
],
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
id: UniqueID.options.generateID(),
|
|
278
|
-
type: "paragraph",
|
|
279
|
-
props: {
|
|
280
|
-
backgroundColor: "default",
|
|
281
|
-
textColor: "default",
|
|
282
|
-
textAlignment: "left",
|
|
283
|
-
},
|
|
284
|
-
content: [
|
|
285
|
-
{
|
|
286
|
-
type: "text",
|
|
287
|
-
text: "Paragraph",
|
|
288
|
-
styles: {
|
|
289
|
-
textColor: "purple",
|
|
290
|
-
backgroundColor: "green",
|
|
291
|
-
},
|
|
292
|
-
},
|
|
293
|
-
],
|
|
294
|
-
children: [],
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
id: UniqueID.options.generateID(),
|
|
298
|
-
type: "paragraph",
|
|
299
|
-
props: {
|
|
300
|
-
backgroundColor: "default",
|
|
301
|
-
textColor: "default",
|
|
302
|
-
textAlignment: "left",
|
|
303
|
-
},
|
|
304
|
-
content: [
|
|
305
|
-
{
|
|
306
|
-
type: "text",
|
|
307
|
-
text: "P",
|
|
308
|
-
styles: {},
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
type: "text",
|
|
312
|
-
text: "ara",
|
|
313
|
-
styles: {
|
|
314
|
-
bold: true,
|
|
315
|
-
},
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
type: "text",
|
|
319
|
-
text: "grap",
|
|
320
|
-
styles: {
|
|
321
|
-
italic: true,
|
|
322
|
-
},
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
type: "text",
|
|
326
|
-
text: "h",
|
|
327
|
-
styles: {},
|
|
328
|
-
},
|
|
329
|
-
],
|
|
330
|
-
children: [],
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
id: UniqueID.options.generateID(),
|
|
334
|
-
type: "paragraph",
|
|
335
|
-
props: {
|
|
336
|
-
backgroundColor: "default",
|
|
337
|
-
textColor: "default",
|
|
338
|
-
textAlignment: "left",
|
|
339
|
-
},
|
|
340
|
-
content: [
|
|
341
|
-
{
|
|
342
|
-
type: "text",
|
|
343
|
-
text: "P",
|
|
344
|
-
styles: {},
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
type: "text",
|
|
348
|
-
text: "ara",
|
|
349
|
-
styles: {
|
|
350
|
-
underline: true,
|
|
351
|
-
},
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
type: "text",
|
|
355
|
-
text: "grap",
|
|
356
|
-
styles: {
|
|
357
|
-
strike: true,
|
|
358
|
-
},
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
type: "text",
|
|
362
|
-
text: "h",
|
|
363
|
-
styles: {},
|
|
364
|
-
},
|
|
365
|
-
],
|
|
366
|
-
children: [],
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
id: UniqueID.options.generateID(),
|
|
370
|
-
type: "bulletListItem",
|
|
371
|
-
props: {
|
|
372
|
-
backgroundColor: "default",
|
|
373
|
-
textColor: "default",
|
|
374
|
-
textAlignment: "left",
|
|
375
|
-
},
|
|
376
|
-
content: [
|
|
377
|
-
{
|
|
378
|
-
type: "text",
|
|
379
|
-
text: "Bullet List Item",
|
|
380
|
-
styles: {},
|
|
381
|
-
},
|
|
382
|
-
],
|
|
383
|
-
children: [],
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
id: UniqueID.options.generateID(),
|
|
387
|
-
type: "bulletListItem",
|
|
388
|
-
props: {
|
|
389
|
-
backgroundColor: "default",
|
|
390
|
-
textColor: "default",
|
|
391
|
-
textAlignment: "left",
|
|
392
|
-
},
|
|
393
|
-
content: [
|
|
394
|
-
{
|
|
395
|
-
type: "text",
|
|
396
|
-
text: "Bullet List Item",
|
|
397
|
-
styles: {},
|
|
398
|
-
},
|
|
399
|
-
],
|
|
400
|
-
children: [
|
|
401
|
-
{
|
|
402
|
-
id: UniqueID.options.generateID(),
|
|
403
|
-
type: "bulletListItem",
|
|
404
|
-
props: {
|
|
405
|
-
backgroundColor: "default",
|
|
406
|
-
textColor: "default",
|
|
407
|
-
textAlignment: "left",
|
|
408
|
-
},
|
|
409
|
-
content: [
|
|
410
|
-
{
|
|
411
|
-
type: "text",
|
|
412
|
-
text: "Bullet List Item",
|
|
413
|
-
styles: {},
|
|
414
|
-
},
|
|
415
|
-
],
|
|
416
|
-
children: [
|
|
417
|
-
{
|
|
418
|
-
id: UniqueID.options.generateID(),
|
|
419
|
-
type: "bulletListItem",
|
|
420
|
-
props: {
|
|
421
|
-
backgroundColor: "default",
|
|
422
|
-
textColor: "default",
|
|
423
|
-
textAlignment: "left",
|
|
424
|
-
},
|
|
425
|
-
content: [
|
|
426
|
-
{
|
|
427
|
-
type: "text",
|
|
428
|
-
text: "Bullet List Item",
|
|
429
|
-
styles: {},
|
|
430
|
-
},
|
|
431
|
-
],
|
|
432
|
-
children: [],
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
id: UniqueID.options.generateID(),
|
|
436
|
-
type: "paragraph",
|
|
437
|
-
props: {
|
|
438
|
-
backgroundColor: "default",
|
|
439
|
-
textColor: "default",
|
|
440
|
-
textAlignment: "left",
|
|
441
|
-
},
|
|
442
|
-
content: [
|
|
443
|
-
{
|
|
444
|
-
type: "text",
|
|
445
|
-
text: "Paragraph",
|
|
446
|
-
styles: {},
|
|
447
|
-
},
|
|
448
|
-
],
|
|
449
|
-
children: [],
|
|
450
|
-
},
|
|
451
|
-
{
|
|
452
|
-
id: UniqueID.options.generateID(),
|
|
453
|
-
type: "numberedListItem",
|
|
454
|
-
props: {
|
|
455
|
-
backgroundColor: "default",
|
|
456
|
-
textColor: "default",
|
|
457
|
-
textAlignment: "left",
|
|
458
|
-
},
|
|
459
|
-
content: [
|
|
460
|
-
{
|
|
461
|
-
type: "text",
|
|
462
|
-
text: "Numbered List Item",
|
|
463
|
-
styles: {},
|
|
464
|
-
},
|
|
465
|
-
],
|
|
466
|
-
children: [],
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
id: UniqueID.options.generateID(),
|
|
470
|
-
type: "numberedListItem",
|
|
471
|
-
props: {
|
|
472
|
-
backgroundColor: "default",
|
|
473
|
-
textColor: "default",
|
|
474
|
-
textAlignment: "left",
|
|
475
|
-
},
|
|
476
|
-
content: [
|
|
477
|
-
{
|
|
478
|
-
type: "text",
|
|
479
|
-
text: "Numbered List Item",
|
|
480
|
-
styles: {},
|
|
481
|
-
},
|
|
482
|
-
],
|
|
483
|
-
children: [],
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
id: UniqueID.options.generateID(),
|
|
487
|
-
type: "numberedListItem",
|
|
488
|
-
props: {
|
|
489
|
-
backgroundColor: "default",
|
|
490
|
-
textColor: "default",
|
|
491
|
-
textAlignment: "left",
|
|
492
|
-
},
|
|
493
|
-
content: [
|
|
494
|
-
{
|
|
495
|
-
type: "text",
|
|
496
|
-
text: "Numbered List Item",
|
|
497
|
-
styles: {},
|
|
498
|
-
},
|
|
499
|
-
],
|
|
500
|
-
children: [
|
|
501
|
-
{
|
|
502
|
-
id: UniqueID.options.generateID(),
|
|
503
|
-
type: "numberedListItem",
|
|
504
|
-
props: {
|
|
505
|
-
backgroundColor: "default",
|
|
506
|
-
textColor: "default",
|
|
507
|
-
textAlignment: "left",
|
|
508
|
-
},
|
|
509
|
-
content: [
|
|
510
|
-
{
|
|
511
|
-
type: "text",
|
|
512
|
-
text: "Numbered List Item",
|
|
513
|
-
styles: {},
|
|
514
|
-
},
|
|
515
|
-
],
|
|
516
|
-
children: [],
|
|
517
|
-
},
|
|
518
|
-
],
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
id: UniqueID.options.generateID(),
|
|
522
|
-
type: "bulletListItem",
|
|
523
|
-
props: {
|
|
524
|
-
backgroundColor: "default",
|
|
525
|
-
textColor: "default",
|
|
526
|
-
textAlignment: "left",
|
|
527
|
-
},
|
|
528
|
-
content: [
|
|
529
|
-
{
|
|
530
|
-
type: "text",
|
|
531
|
-
text: "Bullet List Item",
|
|
532
|
-
styles: {},
|
|
533
|
-
},
|
|
534
|
-
],
|
|
535
|
-
children: [],
|
|
536
|
-
},
|
|
537
|
-
],
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
id: UniqueID.options.generateID(),
|
|
541
|
-
type: "bulletListItem",
|
|
542
|
-
props: {
|
|
543
|
-
backgroundColor: "default",
|
|
544
|
-
textColor: "default",
|
|
545
|
-
textAlignment: "left",
|
|
546
|
-
},
|
|
547
|
-
content: [
|
|
548
|
-
{
|
|
549
|
-
type: "text",
|
|
550
|
-
text: "Bullet List Item",
|
|
551
|
-
styles: {},
|
|
552
|
-
},
|
|
553
|
-
],
|
|
554
|
-
children: [],
|
|
555
|
-
},
|
|
556
|
-
],
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
id: UniqueID.options.generateID(),
|
|
560
|
-
type: "bulletListItem",
|
|
561
|
-
props: {
|
|
562
|
-
backgroundColor: "default",
|
|
563
|
-
textColor: "default",
|
|
564
|
-
textAlignment: "left",
|
|
565
|
-
},
|
|
566
|
-
content: [
|
|
567
|
-
{
|
|
568
|
-
type: "text",
|
|
569
|
-
text: "Bullet List Item",
|
|
570
|
-
styles: {},
|
|
571
|
-
},
|
|
572
|
-
],
|
|
573
|
-
children: [],
|
|
574
|
-
},
|
|
575
|
-
];
|
|
576
|
-
|
|
577
|
-
function removeInlineContentClass(html: string) {
|
|
578
|
-
return html.replace(/ class="_inlineContent_([a-zA-Z0-9_-])+"/g, "");
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
beforeEach(() => {
|
|
582
|
-
(window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS = {};
|
|
583
|
-
|
|
584
|
-
editor = new BlockNoteEditor();
|
|
585
|
-
});
|
|
586
|
-
|
|
587
|
-
afterEach(() => {
|
|
588
|
-
editor._tiptapEditor.destroy();
|
|
589
|
-
editor = undefined as any;
|
|
590
|
-
|
|
591
|
-
delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS;
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
describe("Non-Nested Block/HTML/Markdown Conversions", () => {
|
|
595
|
-
it("Convert non-nested blocks to HTML", async () => {
|
|
596
|
-
const output = await editor.blocksToHTML(getNonNestedBlocks());
|
|
597
|
-
|
|
598
|
-
expect(removeInlineContentClass(output)).toMatchSnapshot();
|
|
599
|
-
});
|
|
600
|
-
|
|
601
|
-
it("Convert non-nested blocks to Markdown", async () => {
|
|
602
|
-
const output = await editor.blocksToMarkdown(getNonNestedBlocks());
|
|
603
|
-
|
|
604
|
-
expect(output).toMatchSnapshot();
|
|
605
|
-
});
|
|
606
|
-
|
|
607
|
-
it("Convert non-nested HTML to blocks", async () => {
|
|
608
|
-
const html = `<h1>Heading</h1><p>Paragraph</p><ul><li><p>Bullet List Item</p></li></ul><ol><li><p>Numbered List Item</p></li></ol>`;
|
|
609
|
-
const output = await editor.HTMLToBlocks(html);
|
|
610
|
-
|
|
611
|
-
expect(output).toMatchSnapshot();
|
|
612
|
-
});
|
|
613
|
-
|
|
614
|
-
it("Convert non-nested Markdown to blocks", async () => {
|
|
615
|
-
const markdown = `# Heading
|
|
616
|
-
|
|
617
|
-
Paragraph
|
|
618
|
-
|
|
619
|
-
* Bullet List Item
|
|
620
|
-
|
|
621
|
-
1. Numbered List Item
|
|
622
|
-
`;
|
|
623
|
-
const output = await editor.markdownToBlocks(markdown);
|
|
624
|
-
|
|
625
|
-
expect(output).toMatchSnapshot();
|
|
626
|
-
});
|
|
627
|
-
});
|
|
628
|
-
|
|
629
|
-
describe("Nested Block/HTML/Markdown Conversions", () => {
|
|
630
|
-
it("Convert nested blocks to HTML", async () => {
|
|
631
|
-
const output = await editor.blocksToHTML(getNestedBlocks());
|
|
632
|
-
|
|
633
|
-
expect(removeInlineContentClass(output)).toMatchSnapshot();
|
|
634
|
-
});
|
|
635
|
-
|
|
636
|
-
it("Convert nested blocks to Markdown", async () => {
|
|
637
|
-
const output = await editor.blocksToMarkdown(getNestedBlocks());
|
|
638
|
-
|
|
639
|
-
expect(output).toMatchSnapshot();
|
|
640
|
-
});
|
|
641
|
-
// // Failing due to nested block parsing bug.
|
|
642
|
-
// it("Convert nested HTML to blocks", async () => {
|
|
643
|
-
// const html = `<h1>Heading</h1><p>Paragraph</p><ul><li><p>Bullet List Item</p><ol><li><p>Numbered List Item</p></li></ol></li></ul>`;
|
|
644
|
-
// const output = await editor.HTMLToBlocks(html);
|
|
645
|
-
//
|
|
646
|
-
// expect(output).toMatchSnapshot();
|
|
647
|
-
// });
|
|
648
|
-
// // Failing due to nested block parsing bug.
|
|
649
|
-
// it("Convert nested Markdown to blocks", async () => {
|
|
650
|
-
// const markdown = `# Heading
|
|
651
|
-
//
|
|
652
|
-
// Paragraph
|
|
653
|
-
//
|
|
654
|
-
// * Bullet List Item
|
|
655
|
-
//
|
|
656
|
-
// 1. Numbered List Item
|
|
657
|
-
// `;
|
|
658
|
-
// const output = await editor.markdownToBlocks(markdown);
|
|
659
|
-
//
|
|
660
|
-
// expect(output).toMatchSnapshot();
|
|
661
|
-
// });
|
|
662
|
-
});
|
|
663
|
-
|
|
664
|
-
describe("Styled Block/HTML/Markdown Conversions", () => {
|
|
665
|
-
it("Convert styled blocks to HTML", async () => {
|
|
666
|
-
const output = await editor.blocksToHTML(getStyledBlocks());
|
|
667
|
-
|
|
668
|
-
expect(removeInlineContentClass(output)).toMatchSnapshot();
|
|
669
|
-
});
|
|
670
|
-
|
|
671
|
-
it("Convert styled blocks to Markdown", async () => {
|
|
672
|
-
const output = await editor.blocksToMarkdown(getStyledBlocks());
|
|
673
|
-
|
|
674
|
-
expect(output).toMatchSnapshot();
|
|
675
|
-
});
|
|
676
|
-
|
|
677
|
-
it("Convert styled HTML to blocks", async () => {
|
|
678
|
-
const html = `<p><strong>Bold</strong><em>Italic</em><u>Underline</u><s>Strikethrough</s><span data-text-color="red">TextColor</span><span data-background-color="red">BackgroundColor</span><strong><em>Multiple</em></strong></p>`;
|
|
679
|
-
const output = await editor.HTMLToBlocks(html);
|
|
680
|
-
|
|
681
|
-
expect(output).toMatchSnapshot();
|
|
682
|
-
});
|
|
683
|
-
|
|
684
|
-
it("Convert styled Markdown to blocks", async () => {
|
|
685
|
-
const markdown = `**Bold***Italic*Underline~~Strikethrough~~TextColorBackgroundColor***Multiple***`;
|
|
686
|
-
const output = await editor.markdownToBlocks(markdown);
|
|
687
|
-
|
|
688
|
-
expect(output).toMatchSnapshot();
|
|
689
|
-
});
|
|
690
|
-
});
|
|
691
|
-
|
|
692
|
-
describe("Complex Block/HTML/Markdown Conversions", () => {
|
|
693
|
-
it("Convert complex blocks to HTML", async () => {
|
|
694
|
-
const output = await editor.blocksToHTML(getComplexBlocks());
|
|
695
|
-
|
|
696
|
-
expect(removeInlineContentClass(output)).toMatchSnapshot();
|
|
697
|
-
});
|
|
698
|
-
|
|
699
|
-
it("Convert complex blocks to Markdown", async () => {
|
|
700
|
-
const output = await editor.blocksToMarkdown(getComplexBlocks());
|
|
701
|
-
|
|
702
|
-
expect(output).toMatchSnapshot();
|
|
703
|
-
});
|
|
704
|
-
// // Failing due to nested block parsing bug.
|
|
705
|
-
// it("Convert complex HTML to blocks", async () => {
|
|
706
|
-
// const html = `<h1>Heading 1</h1><h2>Heading 2</h2><h3>Heading 3</h3><p><span data-text-color="purple"><span data-background-color="green">Paragraph</span></span></p><p>P<strong>ara</strong><em>grap</em>h</p><p>P<u>ara</u><s>grap</s>h</p><ul><li><p>Bullet List Item</p></li><li><p>Bullet List Item</p><ul><li><p>Bullet List Item</p><ul><li><p>Bullet List Item</p></li></ul><p>Paragraph</p><ol><li><p>Numbered List Item</p></li><li><p>Numbered List Item</p></li><li><p>Numbered List Item</p><ol><li><p>Numbered List Item</p></li></ol></li></ol><ul><li><p>Bullet List Item</p></li></ul></li><li><p>Bullet List Item</p></li></ul></li><li><p>Bullet List Item</p></li></ul>`;
|
|
707
|
-
// const output = await editor.HTMLToBlocks(html);
|
|
708
|
-
//
|
|
709
|
-
// expect(output).toMatchSnapshot();
|
|
710
|
-
// });
|
|
711
|
-
// // Failing due to nested block parsing bug.
|
|
712
|
-
// it("Convert complex Markdown to blocks", async () => {
|
|
713
|
-
// const markdown = `# Heading 1
|
|
714
|
-
//
|
|
715
|
-
// ## Heading 2
|
|
716
|
-
//
|
|
717
|
-
// ### Heading 3
|
|
718
|
-
//
|
|
719
|
-
// Paragraph
|
|
720
|
-
//
|
|
721
|
-
// P**ara***grap*h
|
|
722
|
-
//
|
|
723
|
-
// P*ara*~~grap~~h
|
|
724
|
-
//
|
|
725
|
-
// * Bullet List Item
|
|
726
|
-
//
|
|
727
|
-
// * Bullet List Item
|
|
728
|
-
//
|
|
729
|
-
// * Bullet List Item
|
|
730
|
-
//
|
|
731
|
-
// * Bullet List Item
|
|
732
|
-
//
|
|
733
|
-
// Paragraph
|
|
734
|
-
//
|
|
735
|
-
// 1. Numbered List Item
|
|
736
|
-
//
|
|
737
|
-
// 2. Numbered List Item
|
|
738
|
-
//
|
|
739
|
-
// 3. Numbered List Item
|
|
740
|
-
//
|
|
741
|
-
// 1. Numbered List Item
|
|
742
|
-
//
|
|
743
|
-
// * Bullet List Item
|
|
744
|
-
//
|
|
745
|
-
// * Bullet List Item
|
|
746
|
-
//
|
|
747
|
-
// * Bullet List Item
|
|
748
|
-
// `;
|
|
749
|
-
// const output = await editor.markdownToBlocks(markdown);
|
|
750
|
-
//
|
|
751
|
-
// expect(output).toMatchSnapshot();
|
|
752
|
-
// });
|
|
753
|
-
});
|