@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
|
@@ -53,274 +53,367 @@ describe("Test updateBlock typing", () => {
|
|
|
53
53
|
|
|
54
54
|
describe("Test updateBlock", () => {
|
|
55
55
|
it.skip("Update ID", () => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
expect(
|
|
57
|
+
getEditor().transact((tr) =>
|
|
58
|
+
updateBlock(tr, "heading-with-everything", {
|
|
59
|
+
id: "new-id",
|
|
60
|
+
})
|
|
61
|
+
)
|
|
62
|
+
).toMatchSnapshot();
|
|
60
63
|
expect(getEditor().document).toMatchSnapshot();
|
|
61
64
|
});
|
|
62
65
|
|
|
63
66
|
it("Update type", () => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
expect(
|
|
68
|
+
getEditor().transact((tr) =>
|
|
69
|
+
updateBlock(tr, "heading-with-everything", {
|
|
70
|
+
type: "paragraph",
|
|
71
|
+
})
|
|
72
|
+
)
|
|
73
|
+
).toMatchSnapshot();
|
|
67
74
|
|
|
68
75
|
expect(getEditor().document).toMatchSnapshot();
|
|
69
76
|
});
|
|
70
77
|
|
|
71
78
|
it("Update single prop", () => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
expect(
|
|
80
|
+
getEditor().transact((tr) =>
|
|
81
|
+
updateBlock(tr, "heading-with-everything", {
|
|
82
|
+
props: {
|
|
83
|
+
level: 3,
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
)
|
|
87
|
+
).toMatchSnapshot();
|
|
77
88
|
|
|
78
89
|
expect(getEditor().document).toMatchSnapshot();
|
|
79
90
|
});
|
|
80
91
|
|
|
81
92
|
it("Update all props", () => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
expect(
|
|
94
|
+
getEditor().transact((tr) =>
|
|
95
|
+
updateBlock(tr, "heading-with-everything", {
|
|
96
|
+
props: {
|
|
97
|
+
backgroundColor: "blue",
|
|
98
|
+
level: 3,
|
|
99
|
+
textAlignment: "right",
|
|
100
|
+
textColor: "blue",
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
|
+
)
|
|
104
|
+
).toMatchSnapshot();
|
|
90
105
|
|
|
91
106
|
expect(getEditor().document).toMatchSnapshot();
|
|
92
107
|
});
|
|
93
108
|
|
|
94
109
|
it("Revert single prop", () => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
expect(
|
|
111
|
+
getEditor().transact((tr) =>
|
|
112
|
+
updateBlock(tr, "heading-with-everything", {
|
|
113
|
+
props: {
|
|
114
|
+
level: undefined,
|
|
115
|
+
},
|
|
116
|
+
})
|
|
117
|
+
)
|
|
118
|
+
).toMatchSnapshot();
|
|
100
119
|
|
|
101
120
|
expect(getEditor().document).toMatchSnapshot();
|
|
102
121
|
});
|
|
103
122
|
|
|
104
123
|
it("Revert all props", () => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
124
|
+
expect(
|
|
125
|
+
getEditor().transact((tr) =>
|
|
126
|
+
updateBlock(tr, "heading-with-everything", {
|
|
127
|
+
props: {
|
|
128
|
+
backgroundColor: undefined,
|
|
129
|
+
level: undefined,
|
|
130
|
+
textAlignment: undefined,
|
|
131
|
+
textColor: undefined,
|
|
132
|
+
},
|
|
133
|
+
})
|
|
134
|
+
)
|
|
135
|
+
).toMatchSnapshot();
|
|
113
136
|
|
|
114
137
|
expect(getEditor().document).toMatchSnapshot();
|
|
115
138
|
});
|
|
116
139
|
|
|
117
140
|
it("Update with plain content", () => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
141
|
+
expect(
|
|
142
|
+
getEditor().transact((tr) =>
|
|
143
|
+
updateBlock(tr, "heading-with-everything", {
|
|
144
|
+
content: "New content",
|
|
145
|
+
})
|
|
146
|
+
)
|
|
147
|
+
).toMatchSnapshot();
|
|
121
148
|
|
|
122
149
|
expect(getEditor().document).toMatchSnapshot();
|
|
123
150
|
});
|
|
124
151
|
|
|
125
152
|
it("Update with styled content", () => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
153
|
+
expect(
|
|
154
|
+
getEditor().transact((tr) =>
|
|
155
|
+
updateBlock(tr, "heading-with-everything", {
|
|
156
|
+
content: [
|
|
157
|
+
{
|
|
158
|
+
type: "text",
|
|
159
|
+
text: "New",
|
|
160
|
+
styles: { backgroundColor: "blue" },
|
|
161
|
+
},
|
|
162
|
+
{ type: "text", text: " ", styles: {} },
|
|
163
|
+
{
|
|
164
|
+
type: "text",
|
|
165
|
+
text: "content",
|
|
166
|
+
styles: { backgroundColor: "blue" },
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
})
|
|
170
|
+
)
|
|
171
|
+
).toMatchSnapshot();
|
|
133
172
|
|
|
134
173
|
expect(getEditor().document).toMatchSnapshot();
|
|
135
174
|
});
|
|
136
175
|
|
|
137
176
|
it("Update children", () => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
{
|
|
141
|
-
id: "new-nested-paragraph",
|
|
142
|
-
type: "paragraph",
|
|
143
|
-
content: "New nested Paragraph 2",
|
|
177
|
+
expect(
|
|
178
|
+
getEditor().transact((tr) =>
|
|
179
|
+
updateBlock(tr, "heading-with-everything", {
|
|
144
180
|
children: [
|
|
145
181
|
{
|
|
146
|
-
id: "new-
|
|
182
|
+
id: "new-nested-paragraph",
|
|
147
183
|
type: "paragraph",
|
|
148
|
-
content: "New
|
|
184
|
+
content: "New nested Paragraph 2",
|
|
185
|
+
children: [
|
|
186
|
+
{
|
|
187
|
+
id: "new-double-nested-paragraph",
|
|
188
|
+
type: "paragraph",
|
|
189
|
+
content: "New double Nested Paragraph 2",
|
|
190
|
+
},
|
|
191
|
+
],
|
|
149
192
|
},
|
|
150
193
|
],
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
194
|
+
})
|
|
195
|
+
)
|
|
196
|
+
).toMatchSnapshot();
|
|
154
197
|
|
|
155
198
|
expect(getEditor().document).toMatchSnapshot();
|
|
156
199
|
});
|
|
157
200
|
|
|
158
201
|
it.skip("Update everything", () => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
backgroundColor: "blue",
|
|
164
|
-
textAlignment: "right",
|
|
165
|
-
textColor: "blue",
|
|
166
|
-
},
|
|
167
|
-
content: [
|
|
168
|
-
{ type: "text", text: "New", styles: { backgroundColor: "blue" } },
|
|
169
|
-
{ type: "text", text: " ", styles: {} },
|
|
170
|
-
{ type: "text", text: "content", styles: { backgroundColor: "blue" } },
|
|
171
|
-
],
|
|
172
|
-
children: [
|
|
173
|
-
{
|
|
174
|
-
id: "new-nested-paragraph",
|
|
202
|
+
expect(
|
|
203
|
+
getEditor().transact((tr) =>
|
|
204
|
+
updateBlock(tr, "heading-with-everything", {
|
|
205
|
+
id: "new-id",
|
|
175
206
|
type: "paragraph",
|
|
176
|
-
|
|
207
|
+
props: {
|
|
208
|
+
backgroundColor: "blue",
|
|
209
|
+
textAlignment: "right",
|
|
210
|
+
textColor: "blue",
|
|
211
|
+
},
|
|
212
|
+
content: [
|
|
213
|
+
{
|
|
214
|
+
type: "text",
|
|
215
|
+
text: "New",
|
|
216
|
+
styles: { backgroundColor: "blue" },
|
|
217
|
+
},
|
|
218
|
+
{ type: "text", text: " ", styles: {} },
|
|
219
|
+
{
|
|
220
|
+
type: "text",
|
|
221
|
+
text: "content",
|
|
222
|
+
styles: { backgroundColor: "blue" },
|
|
223
|
+
},
|
|
224
|
+
],
|
|
177
225
|
children: [
|
|
178
226
|
{
|
|
179
|
-
id: "new-
|
|
227
|
+
id: "new-nested-paragraph",
|
|
180
228
|
type: "paragraph",
|
|
181
|
-
content: "New
|
|
229
|
+
content: "New nested Paragraph 2",
|
|
230
|
+
children: [
|
|
231
|
+
{
|
|
232
|
+
id: "new-double-nested-paragraph",
|
|
233
|
+
type: "paragraph",
|
|
234
|
+
content: "New double Nested Paragraph 2",
|
|
235
|
+
},
|
|
236
|
+
],
|
|
182
237
|
},
|
|
183
238
|
],
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
239
|
+
})
|
|
240
|
+
)
|
|
241
|
+
).toMatchSnapshot();
|
|
187
242
|
|
|
188
243
|
expect(getEditor().document).toMatchSnapshot();
|
|
189
244
|
});
|
|
190
245
|
|
|
191
246
|
it("Update inline content to empty table content", () => {
|
|
192
247
|
expect(() => {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
248
|
+
getEditor().transact((tr) =>
|
|
249
|
+
updateBlock(tr, "paragraph-0", {
|
|
250
|
+
type: "table",
|
|
251
|
+
})
|
|
252
|
+
);
|
|
196
253
|
}).toThrow();
|
|
197
254
|
});
|
|
198
255
|
|
|
199
256
|
it("Update table content to empty inline content", () => {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
257
|
+
expect(
|
|
258
|
+
getEditor().transact((tr) =>
|
|
259
|
+
updateBlock(tr, "table-0", {
|
|
260
|
+
type: "paragraph",
|
|
261
|
+
})
|
|
262
|
+
)
|
|
263
|
+
).toMatchSnapshot();
|
|
203
264
|
|
|
204
265
|
expect(getEditor().document).toMatchSnapshot();
|
|
205
266
|
});
|
|
206
267
|
|
|
207
268
|
it("Update inline content to table content", () => {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
269
|
+
expect(
|
|
270
|
+
getEditor().transact((tr) =>
|
|
271
|
+
updateBlock(tr, "paragraph-0", {
|
|
272
|
+
type: "table",
|
|
273
|
+
content: {
|
|
274
|
+
type: "tableContent",
|
|
275
|
+
rows: [
|
|
276
|
+
{
|
|
277
|
+
cells: ["Cell 1", "Cell 2", "Cell 3"],
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
cells: ["Cell 4", "Cell 5", "Cell 6"],
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
cells: ["Cell 7", "Cell 8", "Cell 9"],
|
|
284
|
+
},
|
|
285
|
+
],
|
|
221
286
|
},
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
287
|
+
})
|
|
288
|
+
)
|
|
289
|
+
).toMatchSnapshot();
|
|
225
290
|
|
|
226
291
|
expect(getEditor().document).toMatchSnapshot();
|
|
227
292
|
});
|
|
228
293
|
|
|
229
294
|
it("Update table content to inline content", () => {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
295
|
+
expect(
|
|
296
|
+
getEditor().transact((tr) =>
|
|
297
|
+
updateBlock(tr, "table-0", {
|
|
298
|
+
type: "paragraph",
|
|
299
|
+
content: "Paragraph",
|
|
300
|
+
})
|
|
301
|
+
)
|
|
302
|
+
).toMatchSnapshot();
|
|
234
303
|
|
|
235
304
|
expect(getEditor().document).toMatchSnapshot();
|
|
236
305
|
});
|
|
237
306
|
|
|
238
307
|
it("Update inline content to no content", () => {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
308
|
+
expect(
|
|
309
|
+
getEditor().transact((tr) =>
|
|
310
|
+
updateBlock(tr, "paragraph-0", {
|
|
311
|
+
type: "image",
|
|
312
|
+
})
|
|
313
|
+
)
|
|
314
|
+
).toMatchSnapshot();
|
|
242
315
|
|
|
243
316
|
expect(getEditor().document).toMatchSnapshot();
|
|
244
317
|
});
|
|
245
318
|
|
|
246
319
|
it("Update no content to empty inline content", () => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
320
|
+
expect(
|
|
321
|
+
getEditor().transact((tr) =>
|
|
322
|
+
updateBlock(tr, "image-0", {
|
|
323
|
+
type: "paragraph",
|
|
324
|
+
})
|
|
325
|
+
)
|
|
326
|
+
).toMatchSnapshot();
|
|
250
327
|
|
|
251
328
|
expect(getEditor().document).toMatchSnapshot();
|
|
252
329
|
});
|
|
253
330
|
|
|
254
331
|
it("Update no content to inline content", () => {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
332
|
+
expect(
|
|
333
|
+
getEditor().transact((tr) =>
|
|
334
|
+
updateBlock(tr, "image-0", {
|
|
335
|
+
type: "paragraph",
|
|
336
|
+
content: "Paragraph",
|
|
337
|
+
})
|
|
338
|
+
)
|
|
339
|
+
).toMatchSnapshot();
|
|
259
340
|
|
|
260
341
|
expect(getEditor().document).toMatchSnapshot();
|
|
261
342
|
});
|
|
262
343
|
|
|
263
344
|
it("Update no content to empty table content", () => {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
345
|
+
expect(
|
|
346
|
+
getEditor().transact((tr) =>
|
|
347
|
+
updateBlock(tr, "image-0", {
|
|
348
|
+
type: "table",
|
|
349
|
+
})
|
|
350
|
+
)
|
|
351
|
+
).toMatchSnapshot();
|
|
267
352
|
|
|
268
353
|
expect(getEditor().document).toMatchSnapshot();
|
|
269
354
|
});
|
|
270
355
|
|
|
271
356
|
it("Update no content to table content", () => {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
357
|
+
expect(
|
|
358
|
+
getEditor().transact((tr) =>
|
|
359
|
+
updateBlock(tr, "image-0", {
|
|
360
|
+
type: "table",
|
|
361
|
+
content: {
|
|
362
|
+
type: "tableContent",
|
|
363
|
+
rows: [
|
|
279
364
|
{
|
|
280
|
-
|
|
281
|
-
|
|
365
|
+
cells: [
|
|
366
|
+
{
|
|
367
|
+
type: "tableCell",
|
|
368
|
+
content: ["Cell 1"],
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
type: "tableCell",
|
|
372
|
+
content: ["Cell 2"],
|
|
373
|
+
props: {
|
|
374
|
+
backgroundColor: "red",
|
|
375
|
+
colspan: 1,
|
|
376
|
+
rowspan: 1,
|
|
377
|
+
textAlignment: "right",
|
|
378
|
+
textColor: "red",
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
type: "tableCell",
|
|
383
|
+
content: ["Cell 3"],
|
|
384
|
+
props: {
|
|
385
|
+
backgroundColor: "default",
|
|
386
|
+
colspan: 1,
|
|
387
|
+
rowspan: 1,
|
|
388
|
+
textAlignment: "left",
|
|
389
|
+
textColor: "default",
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
],
|
|
282
393
|
},
|
|
283
394
|
{
|
|
284
|
-
|
|
285
|
-
content: ["Cell 2"],
|
|
286
|
-
props: {
|
|
287
|
-
backgroundColor: "red",
|
|
288
|
-
colspan: 1,
|
|
289
|
-
rowspan: 1,
|
|
290
|
-
textAlignment: "right",
|
|
291
|
-
textColor: "red",
|
|
292
|
-
},
|
|
395
|
+
cells: ["Cell 4", "Cell 5", "Cell 6"],
|
|
293
396
|
},
|
|
294
397
|
{
|
|
295
|
-
|
|
296
|
-
content: ["Cell 3"],
|
|
297
|
-
props: {
|
|
298
|
-
backgroundColor: "default",
|
|
299
|
-
colspan: 1,
|
|
300
|
-
rowspan: 1,
|
|
301
|
-
textAlignment: "left",
|
|
302
|
-
textColor: "default",
|
|
303
|
-
},
|
|
398
|
+
cells: ["Cell 7", "Cell 8", "Cell 9"],
|
|
304
399
|
},
|
|
305
400
|
],
|
|
306
401
|
},
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
{
|
|
311
|
-
cells: ["Cell 7", "Cell 8", "Cell 9"],
|
|
312
|
-
},
|
|
313
|
-
],
|
|
314
|
-
},
|
|
315
|
-
});
|
|
402
|
+
})
|
|
403
|
+
)
|
|
404
|
+
).toMatchSnapshot();
|
|
316
405
|
|
|
317
406
|
expect(getEditor().document).toMatchSnapshot();
|
|
318
407
|
});
|
|
319
408
|
|
|
320
409
|
it("Update table content to no content", () => {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
410
|
+
expect(
|
|
411
|
+
getEditor().transact((tr) =>
|
|
412
|
+
updateBlock(tr, "table-0", {
|
|
413
|
+
type: "image",
|
|
414
|
+
})
|
|
415
|
+
)
|
|
416
|
+
).toMatchSnapshot();
|
|
324
417
|
|
|
325
418
|
expect(getEditor().document).toMatchSnapshot();
|
|
326
419
|
});
|