@blocknote/core 0.9.5 → 0.10.0
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 +3699 -2600
- 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 +8 -4
- 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/empty/markdown.md +0 -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 -98
- 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 +117 -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} +70 -66
- package/src/{BlockNoteEditor.test.ts → editor/BlockNoteEditor.test.ts} +2 -2
- package/src/{BlockNoteEditor.ts → editor/BlockNoteEditor.ts} +382 -159
- 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} +42 -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 +77 -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/BlockNoteEditor.d.ts +51 -37
- package/types/src/BlockNoteExtensions.d.ts +8 -3
- 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/exporters/markdown/markdownExporter.test.d.ts +1 -0
- package/types/src/api/getBlockInfoFromPos.d.ts +27 -0
- package/types/src/api/nodeConversions/nodeConversions.d.ts +14 -6
- package/types/src/api/nodeConversions/testUtil.d.ts +7 -2
- package/types/src/api/nodeUtil.d.ts +8 -0
- 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/testCases/cases/customBlocks.d.ts +345 -0
- package/types/src/api/testCases/cases/customInlineContent.d.ts +29 -0
- package/types/src/api/testCases/cases/customStyles.d.ts +64 -0
- package/types/src/api/testCases/cases/defaultSchema.d.ts +3 -0
- package/types/src/api/testCases/index.d.ts +12 -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/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +1 -0
- package/types/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.d.ts +46 -0
- package/types/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.d.ts +2 -0
- package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.d.ts +2 -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/blocks/defaultProps.d.ts +15 -0
- package/types/src/editor/BlockNoteEditor.d.ts +299 -0
- package/types/src/editor/BlockNoteEditor.test.d.ts +1 -0
- package/types/src/editor/BlockNoteExtensions.d.ts +24 -0
- 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/Blocks/api/blocks/createSpec.d.ts +35 -0
- package/types/src/extensions/Blocks/api/blocks/internal.d.ts +45 -0
- package/types/src/extensions/Blocks/api/blocks/types.d.ts +114 -0
- package/types/src/extensions/Blocks/api/cursorPositionTypes.d.ts +7 -5
- package/types/src/extensions/Blocks/api/defaultBlocks.d.ts +573 -113
- package/types/src/extensions/Blocks/api/defaultProps.d.ts +2 -1
- package/types/src/extensions/Blocks/api/inlineContent/createSpec.d.ts +21 -0
- package/types/src/extensions/Blocks/api/inlineContent/internal.d.ts +25 -0
- package/types/src/extensions/Blocks/api/inlineContent/types.d.ts +62 -0
- package/types/src/extensions/Blocks/api/selectionTypes.d.ts +5 -3
- package/types/src/extensions/Blocks/api/styles/createSpec.d.ts +13 -0
- package/types/src/extensions/Blocks/api/styles/internal.d.ts +22 -0
- package/types/src/extensions/Blocks/api/styles/types.d.ts +21 -0
- package/types/src/extensions/Blocks/nodes/BlockContainer.d.ts +8 -4
- package/types/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.d.ts +38 -23
- package/types/src/extensions/Blocks/nodes/BlockContent/ImageBlockContent/ImageBlockContent.d.ts +75 -17
- package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.d.ts +30 -19
- package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +30 -19
- package/types/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.d.ts +36 -28
- package/types/src/extensions/Blocks/nodes/BlockContent/TableBlockContent/TableBlockContent.d.ts +53 -0
- package/types/src/extensions/Blocks/nodes/BlockContent/TableBlockContent/TableExtension.d.ts +2 -0
- package/types/src/extensions/Blocks/nodes/BlockContent/defaultBlockHelpers.d.ts +12 -0
- package/types/src/extensions/Blocks/nodes/BlockGroup.d.ts +1 -1
- 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/NonEditableBlocks/NonEditableBlockPlugin.d.ts +2 -0
- package/types/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.d.ts +14 -0
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +19 -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/extensions-shared/BaseUiElementTypes.d.ts +7 -0
- package/types/src/extensions-shared/suggestion/SuggestionItem.d.ts +3 -0
- package/types/src/extensions-shared/suggestion/SuggestionPlugin.d.ts +36 -0
- package/types/src/index.d.ts +20 -15
- package/types/src/pm-nodes/BlockContainer.d.ts +28 -0
- package/types/src/pm-nodes/BlockGroup.d.ts +10 -0
- 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/plugins/suggestion/SuggestionPlugin.d.ts +4 -2
- package/types/src/util/EventEmitter.d.ts +11 -0
- package/types/src/util/browser.d.ts +3 -0
- 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/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/inlineContentTypes.d.ts +0 -30
- package/types/src/extensions/Blocks/api/serialization.d.ts +0 -2
- /package/src/{shared/EditorElement.ts → api/exporters/markdown/__snapshots__/hardbreak/only/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/api/{formatConversions/formatConversions.test.d.ts → 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 → exporters/markdown}/removeUnderlinesRehypePlugin.d.ts +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Node } from "@tiptap/core";
|
|
2
2
|
export declare const BlockGroup: Node<{
|
|
3
3
|
domAttributes?: Partial<{
|
|
4
|
+
editor: Record<string, string>;
|
|
4
5
|
blockContainer: Record<string, string>;
|
|
5
6
|
blockGroup: Record<string, string>;
|
|
6
|
-
editor: Record<string, string>;
|
|
7
7
|
blockContent: Record<string, string>;
|
|
8
8
|
inlineContent: Record<string, string>;
|
|
9
9
|
}> | undefined;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { EditorState, Plugin, PluginKey } from "prosemirror-state";
|
|
2
2
|
import { EditorView } from "prosemirror-view";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
4
|
+
import { BaseUiElementCallbacks, BaseUiElementState } from "../../extensions-shared/BaseUiElementTypes";
|
|
5
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
6
|
+
import { EventEmitter } from "../../util/EventEmitter";
|
|
5
7
|
export type FormattingToolbarCallbacks = BaseUiElementCallbacks;
|
|
6
8
|
export type FormattingToolbarState = BaseUiElementState;
|
|
7
|
-
export declare class FormattingToolbarView
|
|
9
|
+
export declare class FormattingToolbarView {
|
|
8
10
|
private readonly editor;
|
|
9
11
|
private readonly pmView;
|
|
10
12
|
private formattingToolbarState?;
|
|
@@ -18,7 +20,7 @@ export declare class FormattingToolbarView<BSchema extends BlockSchema> {
|
|
|
18
20
|
from: number;
|
|
19
21
|
to: number;
|
|
20
22
|
}) => boolean;
|
|
21
|
-
constructor(editor: BlockNoteEditor<
|
|
23
|
+
constructor(editor: BlockNoteEditor<BlockSchema, InlineContentSchema, StyleSchema>, pmView: EditorView, updateFormattingToolbar: (formattingToolbarState: FormattingToolbarState) => void);
|
|
22
24
|
viewMousedownHandler: () => void;
|
|
23
25
|
viewMouseupHandler: () => void;
|
|
24
26
|
dragstartHandler: () => void;
|
|
@@ -30,9 +32,9 @@ export declare class FormattingToolbarView<BSchema extends BlockSchema> {
|
|
|
30
32
|
getSelectionBoundingBox(): DOMRect;
|
|
31
33
|
}
|
|
32
34
|
export declare const formattingToolbarPluginKey: PluginKey<any>;
|
|
33
|
-
export declare class FormattingToolbarProsemirrorPlugin
|
|
35
|
+
export declare class FormattingToolbarProsemirrorPlugin extends EventEmitter<any> {
|
|
34
36
|
private view;
|
|
35
37
|
readonly plugin: Plugin;
|
|
36
|
-
constructor(editor: BlockNoteEditor<
|
|
38
|
+
constructor(editor: BlockNoteEditor<any, any, any>);
|
|
37
39
|
onUpdate(callback: (state: FormattingToolbarState) => void): () => void;
|
|
38
40
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Plugin, PluginKey } from "prosemirror-state";
|
|
2
|
-
import { BlockNoteEditor } from "../../BlockNoteEditor";
|
|
3
|
-
import { BaseUiElementState } from "../../shared/BaseUiElementTypes";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
3
|
+
import { BaseUiElementState } from "../../extensions-shared/BaseUiElementTypes";
|
|
4
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
5
|
+
import { EventEmitter } from "../../util/EventEmitter";
|
|
6
6
|
export type HyperlinkToolbarState = BaseUiElementState & {
|
|
7
7
|
url: string;
|
|
8
8
|
text: string;
|
|
9
9
|
};
|
|
10
10
|
export declare const hyperlinkToolbarPluginKey: PluginKey<any>;
|
|
11
|
-
export declare class HyperlinkToolbarProsemirrorPlugin<BSchema extends BlockSchema> extends EventEmitter<any> {
|
|
11
|
+
export declare class HyperlinkToolbarProsemirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends EventEmitter<any> {
|
|
12
12
|
private view;
|
|
13
13
|
readonly plugin: Plugin;
|
|
14
|
-
constructor(editor: BlockNoteEditor<BSchema>);
|
|
14
|
+
constructor(editor: BlockNoteEditor<BSchema, I, S>);
|
|
15
15
|
onUpdate(callback: (state: HyperlinkToolbarState) => void): () => void;
|
|
16
16
|
/**
|
|
17
17
|
* Edit the currently hovered hyperlink.
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
import { EditorState, Plugin, PluginKey } from "prosemirror-state";
|
|
2
2
|
import { EditorView } from "prosemirror-view";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { EventEmitter } from "../../util/EventEmitter";
|
|
4
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
5
|
+
import { BlockSchema, InlineContentSchema, SpecificBlock, StyleSchema } from "../../schema";
|
|
6
|
+
import { BaseUiElementCallbacks, BaseUiElementState } from "../../extensions-shared/BaseUiElementTypes";
|
|
5
7
|
export type ImageToolbarCallbacks = BaseUiElementCallbacks;
|
|
6
|
-
export type ImageToolbarState = BaseUiElementState & {
|
|
7
|
-
block: SpecificBlock<
|
|
8
|
-
image: BlockSpec<"image", {
|
|
9
|
-
src: {
|
|
10
|
-
default: string;
|
|
11
|
-
};
|
|
12
|
-
}, false>;
|
|
13
|
-
}, "image">;
|
|
8
|
+
export type ImageToolbarState<B extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema = StyleSchema> = BaseUiElementState & {
|
|
9
|
+
block: SpecificBlock<B, "image", I, S>;
|
|
14
10
|
};
|
|
15
|
-
export declare class ImageToolbarView {
|
|
11
|
+
export declare class ImageToolbarView<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> {
|
|
16
12
|
private readonly pluginKey;
|
|
17
13
|
private readonly pmView;
|
|
18
14
|
private imageToolbarState?;
|
|
19
15
|
updateImageToolbar: () => void;
|
|
20
16
|
prevWasEditable: boolean | null;
|
|
21
|
-
|
|
22
|
-
constructor(pluginKey: PluginKey, pmView: EditorView, updateImageToolbar: (imageToolbarState: ImageToolbarState) => void);
|
|
17
|
+
constructor(pluginKey: PluginKey, pmView: EditorView, updateImageToolbar: (imageToolbarState: ImageToolbarState<BSchema, I, S>) => void);
|
|
23
18
|
mouseDownHandler: () => void;
|
|
24
19
|
dragstartHandler: () => void;
|
|
25
20
|
blurHandler: (event: FocusEvent) => void;
|
|
@@ -28,9 +23,9 @@ export declare class ImageToolbarView {
|
|
|
28
23
|
destroy(): void;
|
|
29
24
|
}
|
|
30
25
|
export declare const imageToolbarPluginKey: PluginKey<any>;
|
|
31
|
-
export declare class ImageToolbarProsemirrorPlugin<BSchema extends BlockSchema> extends EventEmitter<any> {
|
|
26
|
+
export declare class ImageToolbarProsemirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends EventEmitter<any> {
|
|
32
27
|
private view;
|
|
33
28
|
readonly plugin: Plugin;
|
|
34
|
-
constructor(_editor: BlockNoteEditor<BSchema>);
|
|
35
|
-
onUpdate(callback: (state: ImageToolbarState) => void): () => void;
|
|
29
|
+
constructor(_editor: BlockNoteEditor<BSchema, I, S>);
|
|
30
|
+
onUpdate(callback: (state: ImageToolbarState<BSchema, I, S>) => void): () => void;
|
|
36
31
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Plugin } from "prosemirror-state";
|
|
2
|
+
/**
|
|
3
|
+
* This plugin tracks transformation of Block node attributes, so we can support CSS transitions.
|
|
4
|
+
*
|
|
5
|
+
* Problem it solves: ProseMirror recreates the DOM when transactions happen. So when a transaction changes a Node attribute,
|
|
6
|
+
* it results in a completely new DOM element. This means CSS transitions don't work.
|
|
7
|
+
*
|
|
8
|
+
* Solution: When attributes change on a node, this plugin sets a data-* attribute with the "previous" value. This way we can still use CSS transitions. (See block.module.css)
|
|
9
|
+
*/
|
|
10
|
+
export declare const PreviousBlockTypePlugin: () => Plugin<{
|
|
11
|
+
prevTransactionOldBlockAttrs: any;
|
|
12
|
+
currentTransactionOldBlockAttrs: any;
|
|
13
|
+
updatedBlocks: Set<string>;
|
|
14
|
+
}>;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { PluginView } from "@tiptap/pm/state";
|
|
2
2
|
import { Plugin, PluginKey } from "prosemirror-state";
|
|
3
3
|
import { EditorView } from "prosemirror-view";
|
|
4
|
-
import { BlockNoteEditor } from "../../BlockNoteEditor";
|
|
5
|
-
import { BaseUiElementState } from "../../shared/BaseUiElementTypes";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
export type SideMenuState<BSchema extends BlockSchema> = BaseUiElementState & {
|
|
9
|
-
block: Block<BSchema>;
|
|
4
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
5
|
+
import { BaseUiElementState } from "../../extensions-shared/BaseUiElementTypes";
|
|
6
|
+
import { Block, BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
7
|
+
import { EventEmitter } from "../../util/EventEmitter";
|
|
8
|
+
export type SideMenuState<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = BaseUiElementState & {
|
|
9
|
+
block: Block<BSchema, I, S>;
|
|
10
10
|
};
|
|
11
|
-
export declare
|
|
11
|
+
export declare function getDraggableBlockFromCoords(coords: {
|
|
12
|
+
left: number;
|
|
13
|
+
top: number;
|
|
14
|
+
}, view: EditorView): {
|
|
15
|
+
node: HTMLElement;
|
|
16
|
+
id: string;
|
|
17
|
+
} | undefined;
|
|
18
|
+
export declare class SideMenuView<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> implements PluginView {
|
|
12
19
|
private readonly editor;
|
|
13
20
|
private readonly pmView;
|
|
14
21
|
private readonly updateSideMenu;
|
|
@@ -18,7 +25,7 @@ export declare class SideMenuView<BSchema extends BlockSchema> implements Plugin
|
|
|
18
25
|
private hoveredBlock;
|
|
19
26
|
isDragging: boolean;
|
|
20
27
|
menuFrozen: boolean;
|
|
21
|
-
constructor(editor: BlockNoteEditor<BSchema>, pmView: EditorView, updateSideMenu: (sideMenuState: SideMenuState<BSchema>) => void);
|
|
28
|
+
constructor(editor: BlockNoteEditor<BSchema, I, S>, pmView: EditorView, updateSideMenu: (sideMenuState: SideMenuState<BSchema, I, S>) => void);
|
|
22
29
|
/**
|
|
23
30
|
* Sets isDragging when dragging text.
|
|
24
31
|
*/
|
|
@@ -36,18 +43,19 @@ export declare class SideMenuView<BSchema extends BlockSchema> implements Plugin
|
|
|
36
43
|
*/
|
|
37
44
|
onDragOver: (event: DragEvent) => void;
|
|
38
45
|
onKeyDown: (_event: KeyboardEvent) => void;
|
|
46
|
+
onMouseDown: (_event: MouseEvent) => void;
|
|
39
47
|
onMouseMove: (event: MouseEvent) => void;
|
|
40
48
|
onScroll: () => void;
|
|
41
49
|
destroy(): void;
|
|
42
50
|
addBlock(): void;
|
|
43
51
|
}
|
|
44
52
|
export declare const sideMenuPluginKey: PluginKey<any>;
|
|
45
|
-
export declare class SideMenuProsemirrorPlugin<BSchema extends BlockSchema> extends EventEmitter<any> {
|
|
53
|
+
export declare class SideMenuProsemirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends EventEmitter<any> {
|
|
46
54
|
private readonly editor;
|
|
47
55
|
private sideMenuView;
|
|
48
56
|
readonly plugin: Plugin;
|
|
49
|
-
constructor(editor: BlockNoteEditor<BSchema>);
|
|
50
|
-
onUpdate(callback: (state: SideMenuState<BSchema>) => void): () => void;
|
|
57
|
+
constructor(editor: BlockNoteEditor<BSchema, I, S>);
|
|
58
|
+
onUpdate(callback: (state: SideMenuState<BSchema, I, S>) => void): () => void;
|
|
51
59
|
/**
|
|
52
60
|
* If the block is empty, opens the slash menu. If the block has content,
|
|
53
61
|
* creates a new block below and opens the slash menu in it.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { BlockSchema } from "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
execute: (editor: BlockNoteEditor<BSchema>) => void;
|
|
1
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
2
|
+
import { SuggestionItem } from "../../extensions-shared/suggestion/SuggestionItem";
|
|
3
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
4
|
+
export type BaseSlashMenuItem<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = SuggestionItem & {
|
|
5
|
+
execute: (editor: BlockNoteEditor<BSchema, I, S>) => void;
|
|
7
6
|
aliases?: string[];
|
|
8
7
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Plugin, PluginKey } from "prosemirror-state";
|
|
2
|
-
import { BlockNoteEditor } from "../../BlockNoteEditor";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
3
|
+
import { SuggestionsMenuState } from "../../extensions-shared/suggestion/SuggestionPlugin";
|
|
4
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
5
|
+
import { EventEmitter } from "../../util/EventEmitter";
|
|
6
6
|
import { BaseSlashMenuItem } from "./BaseSlashMenuItem";
|
|
7
7
|
export declare const slashMenuPluginKey: PluginKey<any>;
|
|
8
|
-
export declare class SlashMenuProsemirrorPlugin<BSchema extends BlockSchema, SlashMenuItem extends BaseSlashMenuItem<BSchema>> extends EventEmitter<any> {
|
|
8
|
+
export declare class SlashMenuProsemirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema, SlashMenuItem extends BaseSlashMenuItem<BSchema, I, S>> extends EventEmitter<any> {
|
|
9
9
|
readonly plugin: Plugin;
|
|
10
10
|
readonly itemCallback: (item: SlashMenuItem) => void;
|
|
11
|
-
constructor(editor: BlockNoteEditor<BSchema>, items: SlashMenuItem[]);
|
|
11
|
+
constructor(editor: BlockNoteEditor<BSchema, I, S>, items: SlashMenuItem[]);
|
|
12
12
|
onUpdate(callback: (state: SuggestionsMenuState<SlashMenuItem>) => void): () => void;
|
|
13
13
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { InlineContentSchema, StyleSchema } from "../../schema";
|
|
1
2
|
import { BaseSlashMenuItem } from "./BaseSlashMenuItem";
|
|
2
|
-
export declare const getDefaultSlashMenuItems: <BSchema extends Record<string, import("
|
|
3
|
+
export declare const getDefaultSlashMenuItems: <BSchema extends Record<string, import("../../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(schema?: BSchema) => BaseSlashMenuItem<BSchema, I, S>[];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Plugin, PluginKey, PluginView } from "prosemirror-state";
|
|
2
|
+
import { EditorView } from "prosemirror-view";
|
|
3
|
+
import { EventEmitter } from "../../util/EventEmitter";
|
|
4
|
+
import { DefaultBlockSchema } from "../../blocks/defaultBlocks";
|
|
5
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
6
|
+
import { BlockFromConfigNoChildren, BlockSchemaWithBlock, InlineContentSchema, StyleSchema } from "../../schema";
|
|
7
|
+
export type TableHandlesState<I extends InlineContentSchema, S extends StyleSchema> = {
|
|
8
|
+
show: boolean;
|
|
9
|
+
referencePosCell: DOMRect;
|
|
10
|
+
referencePosTable: DOMRect;
|
|
11
|
+
block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], I, S>;
|
|
12
|
+
colIndex: number;
|
|
13
|
+
rowIndex: number;
|
|
14
|
+
draggingState: {
|
|
15
|
+
draggedCellOrientation: "row" | "col";
|
|
16
|
+
originalIndex: number;
|
|
17
|
+
mousePos: number;
|
|
18
|
+
} | undefined;
|
|
19
|
+
};
|
|
20
|
+
export declare class TableHandlesView<BSchema extends BlockSchemaWithBlock<"table", DefaultBlockSchema["table"]>, I extends InlineContentSchema, S extends StyleSchema> implements PluginView {
|
|
21
|
+
private readonly editor;
|
|
22
|
+
private readonly pmView;
|
|
23
|
+
state?: TableHandlesState<I, S>;
|
|
24
|
+
updateState: () => void;
|
|
25
|
+
tableId: string | undefined;
|
|
26
|
+
tablePos: number | undefined;
|
|
27
|
+
menuFrozen: boolean;
|
|
28
|
+
prevWasEditable: boolean | null;
|
|
29
|
+
constructor(editor: BlockNoteEditor<BSchema, I, S>, pmView: EditorView, updateState: (state: TableHandlesState<I, S>) => void);
|
|
30
|
+
mouseMoveHandler: (event: MouseEvent) => false | undefined;
|
|
31
|
+
dragOverHandler: (event: DragEvent) => void;
|
|
32
|
+
dropHandler: (event: DragEvent) => void;
|
|
33
|
+
scrollHandler: () => void;
|
|
34
|
+
destroy(): void;
|
|
35
|
+
}
|
|
36
|
+
export declare const tableHandlesPluginKey: PluginKey<any>;
|
|
37
|
+
export declare class TableHandlesProsemirrorPlugin<BSchema extends BlockSchemaWithBlock<"table", DefaultBlockSchema["table"]>, I extends InlineContentSchema, S extends StyleSchema> extends EventEmitter<any> {
|
|
38
|
+
private readonly editor;
|
|
39
|
+
private view;
|
|
40
|
+
readonly plugin: Plugin;
|
|
41
|
+
constructor(editor: BlockNoteEditor<BSchema, I, S>);
|
|
42
|
+
onUpdate(callback: (state: TableHandlesState<I, S>) => void): () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Callback that should be set on the `dragStart` event for whichever element
|
|
45
|
+
* is used as the column drag handle.
|
|
46
|
+
*/
|
|
47
|
+
colDragStart: (event: {
|
|
48
|
+
dataTransfer: DataTransfer | null;
|
|
49
|
+
clientX: number;
|
|
50
|
+
}) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Callback that should be set on the `dragStart` event for whichever element
|
|
53
|
+
* is used as the row drag handle.
|
|
54
|
+
*/
|
|
55
|
+
rowDragStart: (event: {
|
|
56
|
+
dataTransfer: DataTransfer | null;
|
|
57
|
+
clientY: number;
|
|
58
|
+
}) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Callback that should be set on the `dragEnd` event for both the element
|
|
61
|
+
* used as the row drag handle, and the one used as the column drag handle.
|
|
62
|
+
*/
|
|
63
|
+
dragEnd: () => void;
|
|
64
|
+
/**
|
|
65
|
+
* Freezes the drag handles. When frozen, they will stay attached to the same
|
|
66
|
+
* cell regardless of which cell is hovered by the mouse cursor.
|
|
67
|
+
*/
|
|
68
|
+
freezeHandles: () => boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Unfreezes the drag handles. When frozen, they will stay attached to the
|
|
71
|
+
* same cell regardless of which cell is hovered by the mouse cursor.
|
|
72
|
+
*/
|
|
73
|
+
unfreezeHandles: () => boolean;
|
|
74
|
+
}
|
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
import { Extension } from "@tiptap/core";
|
|
2
|
-
declare module "@tiptap/core" {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
textAlignment: {
|
|
5
|
-
setTextAlignment: (textAlignment: "left" | "center" | "right" | "justify") => ReturnType;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
2
|
export declare const TextAlignmentExtension: Extension<any, any>;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
import { Extension } from "@tiptap/core";
|
|
2
|
-
declare module "@tiptap/core" {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
blockTextColor: {
|
|
5
|
-
setBlockTextColor: (posInBlock: number, color: string) => ReturnType;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
2
|
export declare const TextColorExtension: Extension<any, any>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export declare const TextColorMark: Mark<any, any>;
|
|
1
|
+
export declare const TextColor: {
|
|
2
|
+
config: {
|
|
3
|
+
type: string;
|
|
4
|
+
propSchema: "string";
|
|
5
|
+
};
|
|
6
|
+
implementation: import("../../schema").StyleImplementation;
|
|
7
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Plugin, PluginKey } from "prosemirror-state";
|
|
2
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
3
|
+
import { InlineContentSchema, StyleSchema } from "../../schema";
|
|
4
|
+
import { BaseUiElementState } from "../BaseUiElementTypes";
|
|
5
|
+
import { SuggestionItem } from "./SuggestionItem";
|
|
6
|
+
export type SuggestionsMenuState<T extends SuggestionItem> = BaseUiElementState & {
|
|
7
|
+
filteredItems: T[];
|
|
8
|
+
keyboardHoveredItemIndex: number;
|
|
9
|
+
};
|
|
10
|
+
type SuggestionPluginState<T extends SuggestionItem> = {
|
|
11
|
+
active: boolean;
|
|
12
|
+
triggerCharacter: string | undefined;
|
|
13
|
+
queryStartPos: number | undefined;
|
|
14
|
+
items: T[];
|
|
15
|
+
keyboardHoveredItemIndex: number | undefined;
|
|
16
|
+
notFoundCount: number | undefined;
|
|
17
|
+
decorationId: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A ProseMirror plugin for suggestions, designed to make '/'-commands possible as well as mentions.
|
|
21
|
+
*
|
|
22
|
+
* This is basically a simplified version of TipTap's [Suggestions](https://github.com/ueberdosis/tiptap/tree/db92a9b313c5993b723c85cd30256f1d4a0b65e1/packages/suggestion) plugin.
|
|
23
|
+
*
|
|
24
|
+
* This version is adapted from the aforementioned version in the following ways:
|
|
25
|
+
* - This version supports generic items instead of only strings (to allow for more advanced filtering for example)
|
|
26
|
+
* - This version hides some unnecessary complexity from the user of the plugin.
|
|
27
|
+
* - This version handles key events differently
|
|
28
|
+
*/
|
|
29
|
+
export declare const setupSuggestionsMenu: <T extends SuggestionItem, BSchema extends Record<string, import("../../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, updateSuggestionsMenu: (suggestionsMenuState: SuggestionsMenuState<T>) => void, pluginKey: PluginKey, defaultTriggerCharacter: string, items?: (query: string) => T[], onSelectItem?: (props: {
|
|
30
|
+
item: T;
|
|
31
|
+
editor: BlockNoteEditor<BSchema, I, S>;
|
|
32
|
+
}) => void) => {
|
|
33
|
+
plugin: Plugin<SuggestionPluginState<T>>;
|
|
34
|
+
itemCallback: (item: T) => void;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export *
|
|
11
|
-
export
|
|
1
|
+
export * from "./api/exporters/html/externalHTMLExporter";
|
|
2
|
+
export * from "./api/exporters/html/internalHTMLSerializer";
|
|
3
|
+
export * from "./api/testUtil";
|
|
4
|
+
export * from "./blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY";
|
|
5
|
+
export * from "./blocks/defaultBlocks";
|
|
6
|
+
export * from "./blocks/defaultProps";
|
|
7
|
+
export * from "./editor/BlockNoteEditor";
|
|
8
|
+
export * from "./editor/BlockNoteExtensions";
|
|
9
|
+
export * from "./editor/selectionTypes";
|
|
10
|
+
export * from "./extensions-shared/BaseUiElementTypes";
|
|
11
|
+
export type { SuggestionItem } from "./extensions-shared/suggestion/SuggestionItem";
|
|
12
|
+
export * from "./extensions-shared/suggestion/SuggestionPlugin";
|
|
12
13
|
export * from "./extensions/FormattingToolbar/FormattingToolbarPlugin";
|
|
13
14
|
export * from "./extensions/HyperlinkToolbar/HyperlinkToolbarPlugin";
|
|
14
15
|
export * from "./extensions/ImageToolbar/ImageToolbarPlugin";
|
|
@@ -16,7 +17,11 @@ export * from "./extensions/SideMenu/SideMenuPlugin";
|
|
|
16
17
|
export * from "./extensions/SlashMenu/BaseSlashMenuItem";
|
|
17
18
|
export * from "./extensions/SlashMenu/SlashMenuPlugin";
|
|
18
19
|
export { getDefaultSlashMenuItems } from "./extensions/SlashMenu/defaultSlashMenuItems";
|
|
19
|
-
export * from "./
|
|
20
|
-
export
|
|
21
|
-
export * from "./
|
|
22
|
-
export * from "./
|
|
20
|
+
export * from "./extensions/TableHandles/TableHandlesPlugin";
|
|
21
|
+
export * from "./schema";
|
|
22
|
+
export * from "./util/browser";
|
|
23
|
+
export * from "./util/string";
|
|
24
|
+
export * from "./api/nodeConversions/nodeConversions";
|
|
25
|
+
export * from "./api/testUtil/partialBlockTestUtil";
|
|
26
|
+
export * from "./extensions/UniqueID/UniqueID";
|
|
27
|
+
export { UnreachableCaseError } from "./util/typescript";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
|
+
import type { BlockNoteEditor } from "../editor/BlockNoteEditor";
|
|
3
|
+
import { BlockSchema, InlineContentSchema, PartialBlock, StyleSchema } from "../schema";
|
|
4
|
+
declare module "@tiptap/core" {
|
|
5
|
+
interface Commands<ReturnType> {
|
|
6
|
+
block: {
|
|
7
|
+
BNCreateBlock: (pos: number) => ReturnType;
|
|
8
|
+
BNDeleteBlock: (posInBlock: number) => ReturnType;
|
|
9
|
+
BNMergeBlocks: (posBetweenBlocks: number) => ReturnType;
|
|
10
|
+
BNSplitBlock: (posInBlock: number, keepType: boolean) => ReturnType;
|
|
11
|
+
BNUpdateBlock: <BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(posInBlock: number, block: PartialBlock<BSchema, I, S>) => ReturnType;
|
|
12
|
+
BNCreateOrUpdateBlock: <BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(posInBlock: number, block: PartialBlock<BSchema, I, S>) => ReturnType;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The main "Block node" documents consist of
|
|
18
|
+
*/
|
|
19
|
+
export declare const BlockContainer: Node<{
|
|
20
|
+
domAttributes?: Partial<{
|
|
21
|
+
blockContainer: Record<string, string>;
|
|
22
|
+
blockGroup: Record<string, string>;
|
|
23
|
+
editor: Record<string, string>;
|
|
24
|
+
blockContent: Record<string, string>;
|
|
25
|
+
inlineContent: Record<string, string>;
|
|
26
|
+
}> | undefined;
|
|
27
|
+
editor: BlockNoteEditor<BlockSchema, InlineContentSchema, StyleSchema>;
|
|
28
|
+
}, any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
|
+
export declare const BlockGroup: Node<{
|
|
3
|
+
domAttributes?: Partial<{
|
|
4
|
+
blockContainer: Record<string, string>;
|
|
5
|
+
blockGroup: Record<string, string>;
|
|
6
|
+
editor: Record<string, string>;
|
|
7
|
+
blockContent: Record<string, string>;
|
|
8
|
+
inlineContent: Record<string, string>;
|
|
9
|
+
}> | undefined;
|
|
10
|
+
}, any>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ParseRule } from "@tiptap/pm/model";
|
|
2
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
3
|
+
import { InlineContentSchema } from "../inlineContent/types";
|
|
4
|
+
import { StyleSchema } from "../styles/types";
|
|
5
|
+
import { BlockConfig, BlockFromConfig, BlockSchemaWithBlock, PartialBlockFromConfig } from "./types";
|
|
6
|
+
export type CustomBlockConfig = BlockConfig & {
|
|
7
|
+
content: "inline" | "none";
|
|
8
|
+
};
|
|
9
|
+
export type CustomBlockImplementation<T extends CustomBlockConfig, I extends InlineContentSchema, S extends StyleSchema> = {
|
|
10
|
+
render: (
|
|
11
|
+
/**
|
|
12
|
+
* The custom block to render
|
|
13
|
+
*/
|
|
14
|
+
block: BlockFromConfig<T, I, S>,
|
|
15
|
+
/**
|
|
16
|
+
* The BlockNote editor instance
|
|
17
|
+
* This is typed generically. If you want an editor with your custom schema, you need to
|
|
18
|
+
* cast it manually, e.g.: `const e = editor as BlockNoteEditor<typeof mySchema>;`
|
|
19
|
+
*/
|
|
20
|
+
editor: BlockNoteEditor<BlockSchemaWithBlock<T["type"], T>, I, S>) => {
|
|
21
|
+
dom: HTMLElement;
|
|
22
|
+
contentDOM?: HTMLElement;
|
|
23
|
+
destroy?: () => void;
|
|
24
|
+
};
|
|
25
|
+
toExternalHTML?: (block: BlockFromConfig<T, I, S>, editor: BlockNoteEditor<BlockSchemaWithBlock<T["type"], T>, I, S>) => {
|
|
26
|
+
dom: HTMLElement;
|
|
27
|
+
contentDOM?: HTMLElement;
|
|
28
|
+
};
|
|
29
|
+
parse?: (el: HTMLElement) => PartialBlockFromConfig<T, I, S>["props"] | undefined;
|
|
30
|
+
};
|
|
31
|
+
export declare function getParseRules(config: BlockConfig, customParseFunction: CustomBlockImplementation<any, any, any>["parse"]): ParseRule[];
|
|
32
|
+
export declare function createBlockSpec<T extends CustomBlockConfig, I extends InlineContentSchema, S extends StyleSchema>(blockConfig: T, blockImplementation: CustomBlockImplementation<T, I, S>): {
|
|
33
|
+
config: T;
|
|
34
|
+
implementation: import("./types").TiptapBlockImplementation<T, any, InlineContentSchema, StyleSchema>;
|
|
35
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Attributes, Editor, Extension, Node, NodeConfig } from "@tiptap/core";
|
|
2
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
3
|
+
import { InlineContentSchema } from "../inlineContent/types";
|
|
4
|
+
import { PropSchema, Props } from "../propTypes";
|
|
5
|
+
import { StyleSchema } from "../styles/types";
|
|
6
|
+
import { BlockConfig, BlockSchemaFromSpecs, BlockSchemaWithBlock, BlockSpecs, SpecificBlock, TiptapBlockImplementation } from "./types";
|
|
7
|
+
export declare function propsToAttributes(propSchema: PropSchema): Attributes;
|
|
8
|
+
export declare function getBlockFromPos<BType extends string, Config extends BlockConfig, BSchema extends BlockSchemaWithBlock<BType, Config>, I extends InlineContentSchema, S extends StyleSchema>(getPos: (() => number) | boolean, editor: BlockNoteEditor<BSchema, I, S>, tipTapEditor: Editor, type: BType): SpecificBlock<BSchema, BType, I, S>;
|
|
9
|
+
export declare function wrapInBlockStructure<BType extends string, PSchema extends PropSchema>(element: {
|
|
10
|
+
dom: HTMLElement;
|
|
11
|
+
contentDOM?: HTMLElement;
|
|
12
|
+
destroy?: () => void;
|
|
13
|
+
}, blockType: BType, blockProps: Props<PSchema>, propSchema: PSchema, domAttributes?: Record<string, string>): {
|
|
14
|
+
dom: HTMLElement;
|
|
15
|
+
contentDOM?: HTMLElement;
|
|
16
|
+
destroy?: () => void;
|
|
17
|
+
};
|
|
18
|
+
type StronglyTypedTipTapNode<Name extends string, Content extends "inline*" | "tableRow+" | ""> = Node & {
|
|
19
|
+
name: Name;
|
|
20
|
+
config: {
|
|
21
|
+
content: Content;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare function createStronglyTypedTiptapNode<Name extends string, Content extends "inline*" | "tableRow+" | "">(config: NodeConfig & {
|
|
25
|
+
name: Name;
|
|
26
|
+
content: Content;
|
|
27
|
+
}): StronglyTypedTipTapNode<Name, Content>;
|
|
28
|
+
export declare function createInternalBlockSpec<T extends BlockConfig>(config: T, implementation: TiptapBlockImplementation<T, any, InlineContentSchema, StyleSchema>): {
|
|
29
|
+
config: T;
|
|
30
|
+
implementation: TiptapBlockImplementation<T, any, InlineContentSchema, StyleSchema>;
|
|
31
|
+
};
|
|
32
|
+
export declare function createBlockSpecFromStronglyTypedTiptapNode<T extends Node, P extends PropSchema>(node: T, propSchema: P, requiredExtensions?: Array<Extension | Node>): {
|
|
33
|
+
config: {
|
|
34
|
+
type: T["name"];
|
|
35
|
+
content: T["config"]["content"] extends "inline*" ? "inline" : T["config"]["content"] extends "tableRow+" ? "table" : "none";
|
|
36
|
+
propSchema: P;
|
|
37
|
+
};
|
|
38
|
+
implementation: TiptapBlockImplementation<{
|
|
39
|
+
type: T["name"];
|
|
40
|
+
content: T["config"]["content"] extends "inline*" ? "inline" : T["config"]["content"] extends "tableRow+" ? "table" : "none";
|
|
41
|
+
propSchema: P;
|
|
42
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
43
|
+
};
|
|
44
|
+
export declare function getBlockSchemaFromSpecs<T extends BlockSpecs>(specs: T): BlockSchemaFromSpecs<T>;
|
|
45
|
+
export {};
|