@blocknote/core 0.28.0 → 0.29.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.cjs +9 -9
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +3221 -3351
- package/dist/blocknote.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/__snapshots__/blocks-deleted-nested-deep.json +26 -0
- package/src/api/__snapshots__/blocks-deleted-nested.json +68 -0
- package/src/api/__snapshots__/blocks-deleted.json +26 -0
- package/src/api/__snapshots__/blocks-inserted-nested.json +62 -0
- package/src/api/__snapshots__/blocks-inserted.json +20 -0
- package/src/api/__snapshots__/blocks-updated-content-inserted.json +42 -0
- package/src/api/__snapshots__/blocks-updated-multiple-insert.json +50 -0
- package/src/api/__snapshots__/blocks-updated-multiple.json +82 -0
- package/src/api/__snapshots__/blocks-updated-nested-deep.json +42 -0
- package/src/api/__snapshots__/blocks-updated-nested-multiple.json +118 -0
- package/src/api/__snapshots__/blocks-updated-nested.json +78 -0
- package/src/api/__snapshots__/blocks-updated-single.json +42 -0
- package/src/api/__snapshots__/blocks-updated.json +42 -0
- package/src/api/blockManipulation/__snapshots__/transactions.test.ts.snap +34 -0
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +312 -0
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +127 -94
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +19 -37
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +8 -6
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +25 -31
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +93 -91
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +16 -20
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +14 -1
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +18 -56
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +52 -46
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +1051 -0
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +247 -154
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +109 -142
- package/src/api/blockManipulation/getBlock/getBlock.ts +23 -48
- package/src/api/blockManipulation/insertContentAt.ts +4 -17
- package/src/api/blockManipulation/selections/selection.test.ts +32 -16
- package/src/api/blockManipulation/selections/selection.ts +25 -51
- package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.ts +35 -14
- package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts +34 -65
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +8 -10
- package/src/api/clipboard/toClipboard/copyExtension.ts +7 -7
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -16
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +3 -17
- package/src/api/getBlockInfoFromPos.ts +13 -1
- package/src/api/nodeConversions/blockToNode.ts +21 -10
- package/src/api/nodeConversions/fragmentToBlocks.ts +5 -18
- package/src/api/nodeConversions/nodeToBlock.ts +11 -8
- package/src/api/nodeUtil.test.ts +228 -0
- package/src/api/nodeUtil.ts +235 -2
- package/src/api/parsers/html/parseHTML.ts +2 -10
- package/src/api/parsers/markdown/parseMarkdown.ts +2 -8
- package/src/api/pmUtil.ts +54 -0
- package/src/api/positionMapping.ts +4 -2
- package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +2 -2
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +9 -13
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +5 -9
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +19 -31
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +10 -8
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +9 -13
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +1 -1
- package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +5 -9
- package/src/blocks/defaultBlockHelpers.ts +1 -1
- package/src/editor/BlockNoteEditor.test.ts +1 -1
- package/src/editor/BlockNoteEditor.ts +259 -131
- package/src/editor/BlockNoteTipTapEditor.ts +91 -8
- package/src/extensions/Comments/CommentsPlugin.ts +32 -34
- package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +4 -8
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +12 -13
- package/src/extensions/ShowSelection/ShowSelectionPlugin.ts +1 -3
- package/src/extensions/SideMenu/MultipleNodeSelection.ts +3 -1
- package/src/extensions/SideMenu/dragging.ts +1 -1
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +22 -19
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +8 -8
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +150 -136
- package/src/index.ts +4 -3
- package/src/schema/inlineContent/createSpec.ts +1 -5
- package/types/src/api/blockManipulation/commands/insertBlocks/insertBlocks.d.ts +2 -2
- package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.d.ts +4 -8
- package/types/src/api/blockManipulation/commands/updateBlock/updateBlock.d.ts +9 -10
- package/types/src/api/blockManipulation/getBlock/getBlock.d.ts +7 -7
- package/types/src/api/blockManipulation/insertContentAt.d.ts +5 -3
- package/types/src/api/blockManipulation/selections/selection.d.ts +3 -3
- package/types/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.d.ts +5 -5
- package/types/src/api/getBlockInfoFromPos.d.ts +8 -1
- package/types/src/api/nodeConversions/blockToNode.d.ts +3 -3
- package/types/src/api/nodeConversions/fragmentToBlocks.d.ts +1 -2
- package/types/src/api/nodeConversions/nodeToBlock.d.ts +2 -2
- package/types/src/api/nodeUtil.d.ts +67 -1
- package/types/src/api/parsers/html/parseHTML.d.ts +1 -1
- package/types/src/api/parsers/markdown/parseMarkdown.d.ts +1 -1
- package/types/src/api/pmUtil.d.ts +12 -0
- package/types/src/editor/BlockNoteEditor.d.ts +72 -10
- package/types/src/editor/BlockNoteTipTapEditor.d.ts +15 -2
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +1 -1
- package/types/src/index.d.ts +1 -2
- package/src/api/blockManipulation/commands/removeBlocks/__snapshots__/removeBlocks.test.ts.snap +0 -1859
- package/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.ts +0 -40
- package/src/api/blockManipulation/commands/removeBlocks/removeBlocks.ts +0 -20
- package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraph.html +0 -138
- package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html +0 -138
- package/src/api/clipboard/__snapshots__/external/pasteImage.html +0 -153
- package/src/api/clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html +0 -138
- package/src/api/clipboard/__snapshots__/external/pasteTable.html +0 -233
- package/src/api/clipboard/__snapshots__/external/pasteTableInExistingTable.html +0 -216
- package/src/api/clipboard/__snapshots__/internal/basicBlocks.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/basicBlocksWithProps.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/childToParent.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/childrenToNextParent.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/childrenToNextParentsChildren.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/image.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/multipleChildren.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/multipleStyledText.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/nestedImage.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/partialChildToParent.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/styledText.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/tableAllCells.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/tableCell.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/tableCellText.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/tableRow.html +0 -1
- package/src/api/clipboard/__snapshots__/internal/unstyledText.html +0 -1
- package/src/api/clipboard/clipboardExternal.test.ts +0 -161
- package/src/api/clipboard/clipboardInternal.test.ts +0 -435
- package/src/api/clipboard/testUtil.ts +0 -27
- package/src/api/exporters/html/__snapshots__/codeBlock/contains-newlines/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/codeBlock/contains-newlines/internal.html +0 -3
- package/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/codeBlock/empty/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/codeBlock/empty/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/codeBlock/python/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/codeBlock/python/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/complex/misc/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/complex/misc/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/customBlock/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/customBlock/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/customParagraph/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/customParagraph/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/customParagraph/nested/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/customParagraph/nested/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/customParagraph/styled/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/customParagraph/styled/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/file/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/file/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/file/button/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/file/button/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/file/nested/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/file/nested/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/file/noCaption/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/file/noCaption/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/file/noName/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/file/noName/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/fontSize/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/fontSize/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/between-links/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/between-links/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/end/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/end/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/link/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/link/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/multiple/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/multiple/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/only/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/only/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/start/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/start/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/styles/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/styles/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/button/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/button/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/nested/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/nested/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/noCaption/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/noCaption/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/noName/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/noName/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/noPreview/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/link/adjacent/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/link/adjacent/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/link/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/link/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/link/styled/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/link/styled/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/lists/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/lists/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/lists/nested/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/lists/nested/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/mention/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/mention/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/pageBreak/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/pageBreak/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/paragraph/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/paragraph/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/paragraph/empty/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/paragraph/empty/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/paragraph/nested/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/paragraph/nested/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/paragraph/styled/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/paragraph/styled/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/paste/parse-basic-block-types.json +0 -140
- package/src/api/exporters/html/__snapshots__/paste/parse-deep-nested-content.json +0 -240
- package/src/api/exporters/html/__snapshots__/paste/parse-div-with-inline-content.json +0 -91
- package/src/api/exporters/html/__snapshots__/paste/parse-divs.json +0 -19
- package/src/api/exporters/html/__snapshots__/paste/parse-fake-image-caption.json +0 -31
- package/src/api/exporters/html/__snapshots__/paste/parse-mixed-nested-lists.json +0 -70
- package/src/api/exporters/html/__snapshots__/paste/parse-nested-lists-with-paragraphs.json +0 -70
- package/src/api/exporters/html/__snapshots__/paste/parse-nested-lists.json +0 -70
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleFile/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleFile/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleFile/button/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleFile/button/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleFile/nested/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleFile/nested/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/button/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/button/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/small/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/small/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/allColWidths/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/allColWidths/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/basic/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/headerCols/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/headerCols/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/headerRows/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/headerRows/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/headersRows/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/headersRows/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/mixedCellColors/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/mixedCellColors/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/mixedColWidths/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/mixedColWidths/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/mixedRowspansAndColspans/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/table/mixedRowspansAndColspans/internal.html +0 -1
- package/src/api/exporters/html/__snapshots__/tag/basic/external.html +0 -1
- package/src/api/exporters/html/__snapshots__/tag/basic/internal.html +0 -1
- package/src/api/exporters/html/htmlConversion.test.ts +0 -110
- package/src/api/exporters/markdown/__snapshots__/codeBlock/contains-newlines/markdown.md +0 -4
- package/src/api/exporters/markdown/__snapshots__/codeBlock/defaultLanguage/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/codeBlock/empty/markdown.md +0 -2
- package/src/api/exporters/markdown/__snapshots__/codeBlock/python/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/complex/misc/markdown.md +0 -5
- package/src/api/exporters/markdown/__snapshots__/customBlock/basic/markdown.md +0 -5
- package/src/api/exporters/markdown/__snapshots__/customParagraph/basic/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/customParagraph/lineBreaks/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/customParagraph/nested/markdown.md +0 -5
- package/src/api/exporters/markdown/__snapshots__/customParagraph/styled/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/file/basic/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/file/button/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/file/nested/markdown.md +0 -7
- package/src/api/exporters/markdown/__snapshots__/file/noCaption/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/file/noName/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/fontSize/basic/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/hardbreak/basic/markdown.md +0 -2
- package/src/api/exporters/markdown/__snapshots__/hardbreak/between-links/markdown.md +0 -2
- package/src/api/exporters/markdown/__snapshots__/hardbreak/end/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/hardbreak/link/markdown.md +0 -2
- package/src/api/exporters/markdown/__snapshots__/hardbreak/multiple/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/hardbreak/only/markdown.md +0 -0
- package/src/api/exporters/markdown/__snapshots__/hardbreak/start/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/hardbreak/styles/markdown.md +0 -2
- package/src/api/exporters/markdown/__snapshots__/image/basic/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/image/button/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/image/nested/markdown.md +0 -7
- package/src/api/exporters/markdown/__snapshots__/image/noCaption/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/image/noName/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/image/noPreview/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/link/adjacent/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/link/basic/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/link/styled/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/lists/basic/markdown.md +0 -10
- package/src/api/exporters/markdown/__snapshots__/lists/nested/markdown.md +0 -10
- package/src/api/exporters/markdown/__snapshots__/mention/basic/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/pageBreak/basic/markdown.md +0 -0
- package/src/api/exporters/markdown/__snapshots__/paragraph/basic/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/paragraph/empty/markdown.md +0 -0
- package/src/api/exporters/markdown/__snapshots__/paragraph/lineBreaks/markdown.md +0 -2
- package/src/api/exporters/markdown/__snapshots__/paragraph/nested/markdown.md +0 -5
- package/src/api/exporters/markdown/__snapshots__/paragraph/styled/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/basic/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/nested/markdown.md +0 -5
- package/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/styled/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/simpleFile/basic/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/simpleFile/button/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/simpleFile/nested/markdown.md +0 -7
- package/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/simpleImage/button/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +0 -7
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noPreview/markdown.md +0 -3
- package/src/api/exporters/markdown/__snapshots__/small/basic/markdown.md +0 -1
- package/src/api/exporters/markdown/__snapshots__/table/allColWidths/markdown.md +0 -5
- package/src/api/exporters/markdown/__snapshots__/table/basic/markdown.md +0 -5
- package/src/api/exporters/markdown/__snapshots__/table/headerCols/markdown.md +0 -4
- package/src/api/exporters/markdown/__snapshots__/table/headerRows/markdown.md +0 -4
- package/src/api/exporters/markdown/__snapshots__/table/mixedCellColors/markdown.md +0 -5
- package/src/api/exporters/markdown/__snapshots__/table/mixedColWidths/markdown.md +0 -5
- package/src/api/exporters/markdown/__snapshots__/table/mixedRowspansAndColspans/markdown.md +0 -5
- package/src/api/exporters/markdown/__snapshots__/tag/basic/markdown.md +0 -1
- package/src/api/exporters/markdown/markdownExporter.test.ts +0 -86
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +0 -3473
- package/src/api/nodeConversions/nodeConversions.test.ts +0 -83
- package/src/api/parsers/html/__snapshots__/list-test.json +0 -177
- package/src/api/parsers/html/__snapshots__/parse-2-tables.json +0 -129
- package/src/api/parsers/html/__snapshots__/parse-basic-block-types.json +0 -142
- package/src/api/parsers/html/__snapshots__/parse-codeblocks.json +0 -62
- package/src/api/parsers/html/__snapshots__/parse-div-with-inline-content.json +0 -91
- package/src/api/parsers/html/__snapshots__/parse-divs.json +0 -121
- package/src/api/parsers/html/__snapshots__/parse-fake-image-caption.json +0 -33
- package/src/api/parsers/html/__snapshots__/parse-image-in-paragraph.json +0 -16
- package/src/api/parsers/html/__snapshots__/parse-mixed-nested-lists.json +0 -265
- package/src/api/parsers/html/__snapshots__/parse-nested-lists-with-paragraphs.json +0 -265
- package/src/api/parsers/html/__snapshots__/parse-nested-lists.json +0 -265
- package/src/api/parsers/html/__snapshots__/parse-notion-html.json +0 -565
- package/src/api/parsers/html/__snapshots__/parse-two-divs.json +0 -36
- package/src/api/parsers/html/parseHTML.test.ts +0 -563
- package/src/api/parsers/markdown/__snapshots__/complex.json +0 -353
- package/src/api/parsers/markdown/__snapshots__/issue-226-1.json +0 -71
- package/src/api/parsers/markdown/__snapshots__/issue-226-2.json +0 -144
- package/src/api/parsers/markdown/__snapshots__/nested.json +0 -72
- package/src/api/parsers/markdown/__snapshots__/non-nested.json +0 -71
- package/src/api/parsers/markdown/__snapshots__/pasted/complex.json +0 -319
- package/src/api/parsers/markdown/__snapshots__/pasted/issue-226-1.json +0 -81
- package/src/api/parsers/markdown/__snapshots__/pasted/issue-226-2.json +0 -165
- package/src/api/parsers/markdown/__snapshots__/pasted/nested.json +0 -81
- package/src/api/parsers/markdown/__snapshots__/pasted/non-nested.json +0 -81
- package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +0 -61
- package/src/api/parsers/markdown/__snapshots__/pasted/whitespace bold.json +0 -42
- package/src/api/parsers/markdown/__snapshots__/styled.json +0 -58
- package/src/api/parsers/markdown/__snapshots__/whitespace bold.json +0 -19
- package/src/api/parsers/markdown/parseMarkdown.test.ts +0 -135
- package/src/api/testUtil/cases/customBlocks.ts +0 -342
- package/src/api/testUtil/cases/customInlineContent.ts +0 -113
- package/src/api/testUtil/cases/customStyles.ts +0 -102
- package/src/api/testUtil/cases/defaultSchema.ts +0 -1493
- package/src/api/testUtil/index.ts +0 -19
- package/src/api/testUtil/partialBlockTestUtil.ts +0 -198
- package/src/api/testUtil/paste.ts +0 -46
- package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.d.ts +0 -4
- package/types/src/api/clipboard/clipboardExternal.test.d.ts +0 -1
- package/types/src/api/clipboard/clipboardInternal.test.d.ts +0 -1
- package/types/src/api/clipboard/testUtil.d.ts +0 -541
- package/types/src/api/exporters/html/htmlConversion.test.d.ts +0 -1
- package/types/src/api/exporters/markdown/markdownExporter.test.d.ts +0 -1
- package/types/src/api/nodeConversions/nodeConversions.test.d.ts +0 -1
- package/types/src/api/parsers/html/parseHTML.test.d.ts +0 -1
- package/types/src/api/parsers/markdown/parseMarkdown.test.d.ts +0 -1
- package/types/src/api/testUtil/cases/customBlocks.d.ts +0 -670
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +0 -558
- package/types/src/api/testUtil/cases/customStyles.d.ts +0 -552
- package/types/src/api/testUtil/cases/defaultSchema.d.ts +0 -4
- package/types/src/api/testUtil/index.d.ts +0 -14
- package/types/src/api/testUtil/partialBlockTestUtil.d.ts +0 -9
- package/types/src/api/testUtil/paste.d.ts +0 -2
- /package/types/src/api/{blockManipulation/commands/removeBlocks/removeBlocks.test.d.ts → nodeUtil.test.d.ts} +0 -0
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
import { EditorTestCases } from "../index.js";
|
|
2
|
-
|
|
3
|
-
import { uploadToTmpFilesDotOrg_DEV_ONLY } from "../../../blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js";
|
|
4
|
-
import {
|
|
5
|
-
imagePropSchema,
|
|
6
|
-
imageRender,
|
|
7
|
-
} from "../../../blocks/ImageBlockContent/ImageBlockContent.js";
|
|
8
|
-
import {
|
|
9
|
-
DefaultInlineContentSchema,
|
|
10
|
-
DefaultStyleSchema,
|
|
11
|
-
defaultBlockSpecs,
|
|
12
|
-
} from "../../../blocks/defaultBlocks.js";
|
|
13
|
-
import { defaultProps } from "../../../blocks/defaultProps.js";
|
|
14
|
-
import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js";
|
|
15
|
-
import { BlockNoteSchema } from "../../../editor/BlockNoteSchema.js";
|
|
16
|
-
import { createBlockSpec } from "../../../schema/index.js";
|
|
17
|
-
|
|
18
|
-
// This is a modified version of the default image block that does not implement
|
|
19
|
-
// a `toExternalHTML` function. It's used to test if the custom serializer by
|
|
20
|
-
// default serializes custom blocks using their `render` function.
|
|
21
|
-
const SimpleImage = createBlockSpec(
|
|
22
|
-
{
|
|
23
|
-
type: "simpleImage",
|
|
24
|
-
propSchema: imagePropSchema,
|
|
25
|
-
content: "none",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
render: (block, editor) => imageRender(block as any, editor as any),
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const CustomParagraph = createBlockSpec(
|
|
33
|
-
{
|
|
34
|
-
type: "customParagraph",
|
|
35
|
-
propSchema: defaultProps,
|
|
36
|
-
content: "inline",
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
render: () => {
|
|
40
|
-
const paragraph = document.createElement("p");
|
|
41
|
-
paragraph.className = "custom-paragraph";
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
dom: paragraph,
|
|
45
|
-
contentDOM: paragraph,
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
toExternalHTML: () => {
|
|
49
|
-
const paragraph = document.createElement("p");
|
|
50
|
-
paragraph.className = "custom-paragraph";
|
|
51
|
-
paragraph.innerHTML = "Hello World";
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
dom: paragraph,
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
const SimpleCustomParagraph = createBlockSpec(
|
|
61
|
-
{
|
|
62
|
-
type: "simpleCustomParagraph",
|
|
63
|
-
propSchema: defaultProps,
|
|
64
|
-
content: "inline",
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
render: () => {
|
|
68
|
-
const paragraph = document.createElement("p");
|
|
69
|
-
paragraph.className = "simple-custom-paragraph";
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
dom: paragraph,
|
|
73
|
-
contentDOM: paragraph,
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
const schema = BlockNoteSchema.create({
|
|
80
|
-
blockSpecs: {
|
|
81
|
-
...defaultBlockSpecs,
|
|
82
|
-
simpleImage: SimpleImage,
|
|
83
|
-
customParagraph: CustomParagraph,
|
|
84
|
-
simpleCustomParagraph: SimpleCustomParagraph,
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
export const customBlocksTestCases: EditorTestCases<
|
|
89
|
-
typeof schema.blockSchema,
|
|
90
|
-
DefaultInlineContentSchema,
|
|
91
|
-
DefaultStyleSchema
|
|
92
|
-
> = {
|
|
93
|
-
name: "custom blocks schema",
|
|
94
|
-
createEditor: () => {
|
|
95
|
-
return BlockNoteEditor.create({
|
|
96
|
-
schema,
|
|
97
|
-
uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
98
|
-
});
|
|
99
|
-
},
|
|
100
|
-
documents: [
|
|
101
|
-
// Because images need to fetch the download URL async, their output HTML is
|
|
102
|
-
// initially rendered without a `src` attribute, which is reflected in the
|
|
103
|
-
// tests.
|
|
104
|
-
{
|
|
105
|
-
name: "simpleImage/button",
|
|
106
|
-
blocks: [
|
|
107
|
-
{
|
|
108
|
-
type: "simpleImage",
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: "simpleImage/basic",
|
|
114
|
-
blocks: [
|
|
115
|
-
{
|
|
116
|
-
type: "simpleImage",
|
|
117
|
-
props: {
|
|
118
|
-
name: "example",
|
|
119
|
-
url: "exampleURL",
|
|
120
|
-
caption: "Caption",
|
|
121
|
-
previewWidth: 256,
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: "simpleImage/noName",
|
|
128
|
-
blocks: [
|
|
129
|
-
{
|
|
130
|
-
type: "simpleImage",
|
|
131
|
-
props: {
|
|
132
|
-
url: "exampleURL",
|
|
133
|
-
caption: "Caption",
|
|
134
|
-
previewWidth: 256,
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: "simpleImage/noCaption",
|
|
141
|
-
blocks: [
|
|
142
|
-
{
|
|
143
|
-
type: "simpleImage",
|
|
144
|
-
props: {
|
|
145
|
-
name: "example",
|
|
146
|
-
url: "exampleURL",
|
|
147
|
-
previewWidth: 256,
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
name: "simpleImage/noPreview",
|
|
154
|
-
blocks: [
|
|
155
|
-
{
|
|
156
|
-
type: "simpleImage",
|
|
157
|
-
props: {
|
|
158
|
-
name: "example",
|
|
159
|
-
url: "exampleURL",
|
|
160
|
-
caption: "Caption",
|
|
161
|
-
showPreview: false,
|
|
162
|
-
previewWidth: 256,
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: "simpleImage/nested",
|
|
169
|
-
blocks: [
|
|
170
|
-
{
|
|
171
|
-
type: "simpleImage",
|
|
172
|
-
props: {
|
|
173
|
-
name: "example",
|
|
174
|
-
url: "exampleURL",
|
|
175
|
-
caption: "Caption",
|
|
176
|
-
previewWidth: 256,
|
|
177
|
-
},
|
|
178
|
-
children: [
|
|
179
|
-
{
|
|
180
|
-
type: "simpleImage",
|
|
181
|
-
props: {
|
|
182
|
-
name: "example",
|
|
183
|
-
url: "exampleURL",
|
|
184
|
-
caption: "Caption",
|
|
185
|
-
previewWidth: 256,
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
},
|
|
190
|
-
],
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
name: "customParagraph/basic",
|
|
194
|
-
blocks: [
|
|
195
|
-
{
|
|
196
|
-
type: "customParagraph",
|
|
197
|
-
content: "Custom Paragraph",
|
|
198
|
-
},
|
|
199
|
-
],
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
name: "customParagraph/styled",
|
|
203
|
-
blocks: [
|
|
204
|
-
{
|
|
205
|
-
type: "customParagraph",
|
|
206
|
-
props: {
|
|
207
|
-
textAlignment: "center",
|
|
208
|
-
textColor: "orange",
|
|
209
|
-
backgroundColor: "pink",
|
|
210
|
-
},
|
|
211
|
-
content: [
|
|
212
|
-
{
|
|
213
|
-
type: "text",
|
|
214
|
-
styles: {},
|
|
215
|
-
text: "Plain ",
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
type: "text",
|
|
219
|
-
styles: {
|
|
220
|
-
textColor: "red",
|
|
221
|
-
},
|
|
222
|
-
text: "Red Text ",
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
type: "text",
|
|
226
|
-
styles: {
|
|
227
|
-
backgroundColor: "blue",
|
|
228
|
-
},
|
|
229
|
-
text: "Blue Background ",
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
type: "text",
|
|
233
|
-
styles: {
|
|
234
|
-
textColor: "red",
|
|
235
|
-
backgroundColor: "blue",
|
|
236
|
-
},
|
|
237
|
-
text: "Mixed Colors",
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
},
|
|
241
|
-
],
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
name: "customParagraph/nested",
|
|
245
|
-
blocks: [
|
|
246
|
-
{
|
|
247
|
-
type: "customParagraph",
|
|
248
|
-
content: "Custom Paragraph",
|
|
249
|
-
children: [
|
|
250
|
-
{
|
|
251
|
-
type: "customParagraph",
|
|
252
|
-
content: "Nested Custom Paragraph 1",
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
type: "customParagraph",
|
|
256
|
-
content: "Nested Custom Paragraph 2",
|
|
257
|
-
},
|
|
258
|
-
],
|
|
259
|
-
},
|
|
260
|
-
],
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: "customParagraph/lineBreaks",
|
|
264
|
-
blocks: [
|
|
265
|
-
{
|
|
266
|
-
type: "customParagraph",
|
|
267
|
-
content: "Line 1\nLine 2",
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
name: "simpleCustomParagraph/basic",
|
|
273
|
-
blocks: [
|
|
274
|
-
{
|
|
275
|
-
type: "simpleCustomParagraph",
|
|
276
|
-
content: "Custom Paragraph",
|
|
277
|
-
},
|
|
278
|
-
],
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
name: "simpleCustomParagraph/styled",
|
|
282
|
-
blocks: [
|
|
283
|
-
{
|
|
284
|
-
type: "simpleCustomParagraph",
|
|
285
|
-
props: {
|
|
286
|
-
textAlignment: "center",
|
|
287
|
-
textColor: "orange",
|
|
288
|
-
backgroundColor: "pink",
|
|
289
|
-
},
|
|
290
|
-
content: [
|
|
291
|
-
{
|
|
292
|
-
type: "text",
|
|
293
|
-
styles: {},
|
|
294
|
-
text: "Plain ",
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
type: "text",
|
|
298
|
-
styles: {
|
|
299
|
-
textColor: "red",
|
|
300
|
-
},
|
|
301
|
-
text: "Red Text ",
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
type: "text",
|
|
305
|
-
styles: {
|
|
306
|
-
backgroundColor: "blue",
|
|
307
|
-
},
|
|
308
|
-
text: "Blue Background ",
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
type: "text",
|
|
312
|
-
styles: {
|
|
313
|
-
textColor: "red",
|
|
314
|
-
backgroundColor: "blue",
|
|
315
|
-
},
|
|
316
|
-
text: "Mixed Colors",
|
|
317
|
-
},
|
|
318
|
-
],
|
|
319
|
-
},
|
|
320
|
-
],
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
name: "simpleCustomParagraph/nested",
|
|
324
|
-
blocks: [
|
|
325
|
-
{
|
|
326
|
-
type: "simpleCustomParagraph",
|
|
327
|
-
content: "Custom Paragraph",
|
|
328
|
-
children: [
|
|
329
|
-
{
|
|
330
|
-
type: "simpleCustomParagraph",
|
|
331
|
-
content: "Nested Custom Paragraph 1",
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
type: "simpleCustomParagraph",
|
|
335
|
-
content: "Nested Custom Paragraph 2",
|
|
336
|
-
},
|
|
337
|
-
],
|
|
338
|
-
},
|
|
339
|
-
],
|
|
340
|
-
},
|
|
341
|
-
],
|
|
342
|
-
};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { EditorTestCases } from "../index.js";
|
|
2
|
-
|
|
3
|
-
import { uploadToTmpFilesDotOrg_DEV_ONLY } from "../../../blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js";
|
|
4
|
-
import {
|
|
5
|
-
DefaultBlockSchema,
|
|
6
|
-
DefaultStyleSchema,
|
|
7
|
-
defaultInlineContentSpecs,
|
|
8
|
-
} from "../../../blocks/defaultBlocks.js";
|
|
9
|
-
import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js";
|
|
10
|
-
import { BlockNoteSchema } from "../../../editor/BlockNoteSchema.js";
|
|
11
|
-
import { createInlineContentSpec } from "../../../schema/inlineContent/createSpec.js";
|
|
12
|
-
|
|
13
|
-
const mention = createInlineContentSpec(
|
|
14
|
-
{
|
|
15
|
-
type: "mention" as const,
|
|
16
|
-
propSchema: {
|
|
17
|
-
user: {
|
|
18
|
-
default: "",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
content: "none",
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
render: (ic) => {
|
|
25
|
-
const dom = document.createElement("span");
|
|
26
|
-
dom.appendChild(document.createTextNode("@" + ic.props.user));
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
dom,
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const tag = createInlineContentSpec(
|
|
36
|
-
{
|
|
37
|
-
type: "tag" as const,
|
|
38
|
-
propSchema: {},
|
|
39
|
-
content: "styled",
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
render: () => {
|
|
43
|
-
const dom = document.createElement("span");
|
|
44
|
-
dom.textContent = "#";
|
|
45
|
-
|
|
46
|
-
const contentDOM = document.createElement("span");
|
|
47
|
-
dom.appendChild(contentDOM);
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
dom,
|
|
51
|
-
contentDOM,
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const schema = BlockNoteSchema.create({
|
|
58
|
-
inlineContentSpecs: {
|
|
59
|
-
...defaultInlineContentSpecs,
|
|
60
|
-
mention,
|
|
61
|
-
tag,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
export const customInlineContentTestCases: EditorTestCases<
|
|
66
|
-
DefaultBlockSchema,
|
|
67
|
-
typeof schema.inlineContentSchema,
|
|
68
|
-
DefaultStyleSchema
|
|
69
|
-
> = {
|
|
70
|
-
name: "custom inline content schema",
|
|
71
|
-
createEditor: () => {
|
|
72
|
-
return BlockNoteEditor.create({
|
|
73
|
-
uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
74
|
-
schema,
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
documents: [
|
|
78
|
-
{
|
|
79
|
-
name: "mention/basic",
|
|
80
|
-
blocks: [
|
|
81
|
-
{
|
|
82
|
-
type: "paragraph",
|
|
83
|
-
content: [
|
|
84
|
-
"I enjoy working with ",
|
|
85
|
-
{
|
|
86
|
-
type: "mention",
|
|
87
|
-
props: {
|
|
88
|
-
user: "Matthew",
|
|
89
|
-
},
|
|
90
|
-
content: undefined,
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: "tag/basic",
|
|
98
|
-
blocks: [
|
|
99
|
-
{
|
|
100
|
-
type: "paragraph",
|
|
101
|
-
content: [
|
|
102
|
-
"I love ",
|
|
103
|
-
{
|
|
104
|
-
type: "tag",
|
|
105
|
-
// props: {},
|
|
106
|
-
content: "BlockNote",
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { EditorTestCases } from "../index.js";
|
|
2
|
-
|
|
3
|
-
import { uploadToTmpFilesDotOrg_DEV_ONLY } from "../../../blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js";
|
|
4
|
-
import {
|
|
5
|
-
DefaultBlockSchema,
|
|
6
|
-
DefaultInlineContentSchema,
|
|
7
|
-
defaultStyleSpecs,
|
|
8
|
-
} from "../../../blocks/defaultBlocks.js";
|
|
9
|
-
import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js";
|
|
10
|
-
import { BlockNoteSchema } from "../../../editor/BlockNoteSchema.js";
|
|
11
|
-
import { createStyleSpec } from "../../../schema/styles/createSpec.js";
|
|
12
|
-
|
|
13
|
-
const small = createStyleSpec(
|
|
14
|
-
{
|
|
15
|
-
type: "small",
|
|
16
|
-
propSchema: "boolean",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
render: () => {
|
|
20
|
-
const dom = document.createElement("small");
|
|
21
|
-
return {
|
|
22
|
-
dom,
|
|
23
|
-
contentDOM: dom,
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const fontSize = createStyleSpec(
|
|
30
|
-
{
|
|
31
|
-
type: "fontSize",
|
|
32
|
-
propSchema: "string",
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
render: (value) => {
|
|
36
|
-
const dom = document.createElement("span");
|
|
37
|
-
dom.setAttribute("style", "font-size: " + value);
|
|
38
|
-
return {
|
|
39
|
-
dom,
|
|
40
|
-
contentDOM: dom,
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const schema = BlockNoteSchema.create({
|
|
47
|
-
styleSpecs: {
|
|
48
|
-
...defaultStyleSpecs,
|
|
49
|
-
small,
|
|
50
|
-
fontSize,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export const customStylesTestCases: EditorTestCases<
|
|
55
|
-
DefaultBlockSchema,
|
|
56
|
-
DefaultInlineContentSchema,
|
|
57
|
-
typeof schema.styleSchema
|
|
58
|
-
> = {
|
|
59
|
-
name: "custom style schema",
|
|
60
|
-
createEditor: () => {
|
|
61
|
-
return BlockNoteEditor.create({
|
|
62
|
-
uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
63
|
-
schema,
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
documents: [
|
|
67
|
-
{
|
|
68
|
-
name: "small/basic",
|
|
69
|
-
blocks: [
|
|
70
|
-
{
|
|
71
|
-
type: "paragraph",
|
|
72
|
-
content: [
|
|
73
|
-
{
|
|
74
|
-
type: "text",
|
|
75
|
-
text: "This is a small text",
|
|
76
|
-
styles: {
|
|
77
|
-
small: true,
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "fontSize/basic",
|
|
86
|
-
blocks: [
|
|
87
|
-
{
|
|
88
|
-
type: "paragraph",
|
|
89
|
-
content: [
|
|
90
|
-
{
|
|
91
|
-
type: "text",
|
|
92
|
-
text: "This is text with a custom fontSize",
|
|
93
|
-
styles: {
|
|
94
|
-
fontSize: "18px",
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
};
|