@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,563 +0,0 @@
|
|
|
1
|
-
import * as pmView from "prosemirror-view";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { BlockNoteEditor } from "../../../index.js";
|
|
4
|
-
import { nestedListsToBlockNoteStructure } from "./util/nestedLists.js";
|
|
5
|
-
|
|
6
|
-
async function parseHTMLAndCompareSnapshots(
|
|
7
|
-
html: string,
|
|
8
|
-
snapshotName: string
|
|
9
|
-
) {
|
|
10
|
-
const editor = BlockNoteEditor.create();
|
|
11
|
-
const div = document.createElement("div");
|
|
12
|
-
editor.mount(div);
|
|
13
|
-
const blocks = await editor.tryParseHTMLToBlocks(html);
|
|
14
|
-
|
|
15
|
-
const snapshotPath = "./__snapshots__/" + snapshotName + ".json";
|
|
16
|
-
await expect(JSON.stringify(blocks, undefined, 2)).toMatchFileSnapshot(
|
|
17
|
-
snapshotPath
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
// Now, we also want to test actually pasting in the editor, and not just calling
|
|
21
|
-
// tryParseHTMLToBlocks directly.
|
|
22
|
-
// The reason is that the prosemirror logic for pasting can be a bit different, because
|
|
23
|
-
// it's related to the context of where the user is pasting exactly (selection)
|
|
24
|
-
//
|
|
25
|
-
// The internal difference come that in tryParseHTMLToBlocks, we use DOMParser.parse,
|
|
26
|
-
// while when pasting, Prosemirror uses DOMParser.parseSlice, and then tries to fit the
|
|
27
|
-
// slice in the document. This fitting might change the structure / interpretation of the pasted blocks
|
|
28
|
-
|
|
29
|
-
// Simulate a paste event (this uses DOMParser.parseSlice internally)
|
|
30
|
-
|
|
31
|
-
(window as any).__TEST_OPTIONS.mockID = 0; // reset id counter
|
|
32
|
-
const htmlNode = nestedListsToBlockNoteStructure(html);
|
|
33
|
-
|
|
34
|
-
const slice = (pmView as any).__parseFromClipboard(
|
|
35
|
-
editor.prosemirrorView,
|
|
36
|
-
"",
|
|
37
|
-
htmlNode.innerHTML,
|
|
38
|
-
false,
|
|
39
|
-
editor._tiptapEditor.state.selection.$from
|
|
40
|
-
);
|
|
41
|
-
editor.dispatch(editor._tiptapEditor.state.tr.replaceSelection(slice));
|
|
42
|
-
|
|
43
|
-
// alternative paste simulation doesn't work in a non-browser vitest env
|
|
44
|
-
// editor._tiptapEditor.view.pasteHTML(html, {
|
|
45
|
-
// preventDefault: () => {
|
|
46
|
-
// // noop
|
|
47
|
-
// },
|
|
48
|
-
// clipboardData: {
|
|
49
|
-
// types: ["text/html"],
|
|
50
|
-
// getData: () => html,
|
|
51
|
-
// },
|
|
52
|
-
// } as any);
|
|
53
|
-
|
|
54
|
-
const pastedBlocks = editor.document;
|
|
55
|
-
pastedBlocks.pop(); // trailing paragraph
|
|
56
|
-
expect(pastedBlocks).toStrictEqual(blocks);
|
|
57
|
-
|
|
58
|
-
editor.mount(undefined);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
describe("Parse HTML", () => {
|
|
62
|
-
it("Parse basic block types", async () => {
|
|
63
|
-
const html = `<h1>Heading 1</h1>
|
|
64
|
-
<h2>Heading 2</h2>
|
|
65
|
-
<h3>Heading 3</h3>
|
|
66
|
-
<p>Paragraph</p>
|
|
67
|
-
<figure><img src="exampleURL" /><figcaption>Image Caption</figcaption></figure>
|
|
68
|
-
<p>None <strong>Bold </strong><em>Italic </em><u>Underline </u><s>Strikethrough </s><strong><em><s><u>All</u></s></em></strong></p>`;
|
|
69
|
-
|
|
70
|
-
await parseHTMLAndCompareSnapshots(html, "parse-basic-block-types");
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it("list test", async () => {
|
|
74
|
-
const html = `<ul>
|
|
75
|
-
<li>First</li>
|
|
76
|
-
<li>Second</li>
|
|
77
|
-
<li>Third</li>
|
|
78
|
-
<li>
|
|
79
|
-
<input type="checkbox">
|
|
80
|
-
Fourth
|
|
81
|
-
</li>
|
|
82
|
-
<li>
|
|
83
|
-
<input type="checkbox">
|
|
84
|
-
Fifth
|
|
85
|
-
</li>
|
|
86
|
-
<li>Five Parent
|
|
87
|
-
<ul>
|
|
88
|
-
<li>Child 1</li>
|
|
89
|
-
<li>Child 2</li>
|
|
90
|
-
<li>
|
|
91
|
-
<input type="checkbox">
|
|
92
|
-
Child 3
|
|
93
|
-
</li>
|
|
94
|
-
<li>
|
|
95
|
-
<input type="checkbox">
|
|
96
|
-
Child 4
|
|
97
|
-
</li>
|
|
98
|
-
</ul>
|
|
99
|
-
</li>
|
|
100
|
-
</ul>`;
|
|
101
|
-
await parseHTMLAndCompareSnapshots(html, "list-test");
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it("Parse nested lists", async () => {
|
|
105
|
-
const html = `<ul>
|
|
106
|
-
<li>Bullet List Item</li>
|
|
107
|
-
<li>Bullet List Item
|
|
108
|
-
<ul>
|
|
109
|
-
<li>Nested Bullet List Item</li>
|
|
110
|
-
<li>Nested Bullet List Item</li>
|
|
111
|
-
</ul>
|
|
112
|
-
</li>
|
|
113
|
-
<li>Bullet List Item</li>
|
|
114
|
-
</ul>
|
|
115
|
-
<ol>
|
|
116
|
-
<li>Numbered List Item</li>
|
|
117
|
-
<li>Numbered List Item
|
|
118
|
-
<ol>
|
|
119
|
-
<li>Nested Numbered List Item</li>
|
|
120
|
-
<li>Nested Numbered List Item</li>
|
|
121
|
-
</ol>
|
|
122
|
-
</li>
|
|
123
|
-
<li>Numbered List Item</li>
|
|
124
|
-
</ol>
|
|
125
|
-
<ul>
|
|
126
|
-
<li>
|
|
127
|
-
<input type="checkbox">
|
|
128
|
-
Check List Item
|
|
129
|
-
</li>
|
|
130
|
-
<li>
|
|
131
|
-
<input type="checkbox">
|
|
132
|
-
Check List Item
|
|
133
|
-
<ul>
|
|
134
|
-
<li>
|
|
135
|
-
<input type="checkbox">
|
|
136
|
-
Nested Check List Item
|
|
137
|
-
</li>
|
|
138
|
-
<li>
|
|
139
|
-
<input type="checkbox">
|
|
140
|
-
Nested Check List Item
|
|
141
|
-
</li>
|
|
142
|
-
</ul>
|
|
143
|
-
</li>
|
|
144
|
-
<li>
|
|
145
|
-
<input type="checkbox">
|
|
146
|
-
Nested Check List Item
|
|
147
|
-
</li>
|
|
148
|
-
</ul>`;
|
|
149
|
-
|
|
150
|
-
await parseHTMLAndCompareSnapshots(html, "parse-nested-lists");
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it("Parse nested lists with paragraphs", async () => {
|
|
154
|
-
const html = `<ul>
|
|
155
|
-
<li>
|
|
156
|
-
<p>Bullet List Item</p>
|
|
157
|
-
</li>
|
|
158
|
-
<li>
|
|
159
|
-
<p>Bullet List Item</p>
|
|
160
|
-
<ul>
|
|
161
|
-
<li>
|
|
162
|
-
<p>Nested Bullet List Item</p>
|
|
163
|
-
</li>
|
|
164
|
-
<li>
|
|
165
|
-
<p>Nested Bullet List Item</p>
|
|
166
|
-
</li>
|
|
167
|
-
</ul>
|
|
168
|
-
</li>
|
|
169
|
-
<li>
|
|
170
|
-
<p>Bullet List Item</p>
|
|
171
|
-
</li>
|
|
172
|
-
</ul>
|
|
173
|
-
<ol>
|
|
174
|
-
<li>
|
|
175
|
-
<p>Numbered List Item</p>
|
|
176
|
-
</li>
|
|
177
|
-
<li>
|
|
178
|
-
<p>Numbered List Item</p>
|
|
179
|
-
<ol>
|
|
180
|
-
<li>
|
|
181
|
-
<p>Nested Numbered List Item</p>
|
|
182
|
-
</li>
|
|
183
|
-
<li>
|
|
184
|
-
<p>Nested Numbered List Item</p>
|
|
185
|
-
</li>
|
|
186
|
-
</ol>
|
|
187
|
-
</li>
|
|
188
|
-
<li>
|
|
189
|
-
<p>Numbered List Item</p>
|
|
190
|
-
</li>
|
|
191
|
-
</ol>
|
|
192
|
-
<ul>
|
|
193
|
-
<li>
|
|
194
|
-
<input type="checkbox">
|
|
195
|
-
<p>Checked List Item</p>
|
|
196
|
-
</li>
|
|
197
|
-
<li>
|
|
198
|
-
<input type="checkbox">
|
|
199
|
-
<p>Checked List Item</p>
|
|
200
|
-
<ul>
|
|
201
|
-
<li>
|
|
202
|
-
<input type="checkbox">
|
|
203
|
-
<p>Nested Checked List Item</p>
|
|
204
|
-
</li>
|
|
205
|
-
<li>
|
|
206
|
-
<label><input type="checkbox"></label>
|
|
207
|
-
<p>Nested Checked List Item</p>
|
|
208
|
-
</li>
|
|
209
|
-
</ul>
|
|
210
|
-
</li>
|
|
211
|
-
<li>
|
|
212
|
-
<input type="checkbox">
|
|
213
|
-
<p>Checked List Item</p>
|
|
214
|
-
</li>
|
|
215
|
-
</ul>`;
|
|
216
|
-
|
|
217
|
-
await parseHTMLAndCompareSnapshots(
|
|
218
|
-
html,
|
|
219
|
-
"parse-nested-lists-with-paragraphs"
|
|
220
|
-
);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it("Parse mixed nested lists", async () => {
|
|
224
|
-
const html = `<ul>
|
|
225
|
-
<li>Bullet List Item</li>
|
|
226
|
-
<li>Bullet List Item
|
|
227
|
-
<ol>
|
|
228
|
-
<li>Nested Numbered List Item</li>
|
|
229
|
-
<li>Nested Numbered List Item</li>
|
|
230
|
-
</ol>
|
|
231
|
-
</li>
|
|
232
|
-
<li>Bullet List Item</li>
|
|
233
|
-
</ul>
|
|
234
|
-
<ol>
|
|
235
|
-
<li>Numbered List Item</li>
|
|
236
|
-
<li>Numbered List Item
|
|
237
|
-
<ul>
|
|
238
|
-
<li>
|
|
239
|
-
<input type="checkbox" checked>
|
|
240
|
-
Nested Check List Item
|
|
241
|
-
</li>
|
|
242
|
-
<li>
|
|
243
|
-
<input type="checkbox">
|
|
244
|
-
Nested Check List Item
|
|
245
|
-
</li>
|
|
246
|
-
</ul>
|
|
247
|
-
</li>
|
|
248
|
-
<li>Numbered List Item</li>
|
|
249
|
-
</ol>
|
|
250
|
-
<ul>
|
|
251
|
-
<li>
|
|
252
|
-
<input type="checkbox" checked>
|
|
253
|
-
Check List Item
|
|
254
|
-
</li>
|
|
255
|
-
<li>
|
|
256
|
-
<input type="checkbox">
|
|
257
|
-
Check List Item
|
|
258
|
-
<ul>
|
|
259
|
-
<li>Nested Bullet List Item</li>
|
|
260
|
-
<li>Nested Bullet List Item</li>
|
|
261
|
-
</ul>
|
|
262
|
-
</li>
|
|
263
|
-
<li>
|
|
264
|
-
<input type="checkbox" checked>
|
|
265
|
-
Nested Check List Item
|
|
266
|
-
</li>
|
|
267
|
-
</ul>`;
|
|
268
|
-
|
|
269
|
-
await parseHTMLAndCompareSnapshots(html, "parse-mixed-nested-lists");
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
it("Parse divs", async () => {
|
|
273
|
-
const html = `<div>Single Div</div>
|
|
274
|
-
<div>
|
|
275
|
-
Div
|
|
276
|
-
<div>Nested Div</div>
|
|
277
|
-
<div>Nested Div</div>
|
|
278
|
-
</div>
|
|
279
|
-
<div>Single Div 2</div>
|
|
280
|
-
<div>
|
|
281
|
-
<div>Nested Div</div>
|
|
282
|
-
<div>Nested Div</div>
|
|
283
|
-
</div>`;
|
|
284
|
-
|
|
285
|
-
await parseHTMLAndCompareSnapshots(html, "parse-divs");
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
it("Parse two divs", async () => {
|
|
289
|
-
const html = `<div>Single Div</div><div>second Div</div>`;
|
|
290
|
-
|
|
291
|
-
await parseHTMLAndCompareSnapshots(html, "parse-two-divs");
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
it("Parse image in paragraph", async () => {
|
|
295
|
-
const html = `<p>
|
|
296
|
-
<img src="exampleURL">
|
|
297
|
-
</p>`;
|
|
298
|
-
|
|
299
|
-
await parseHTMLAndCompareSnapshots(html, "parse-image-in-paragraph");
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
it("Parse fake image caption", async () => {
|
|
303
|
-
const html = `<div>
|
|
304
|
-
<img src="exampleURL">
|
|
305
|
-
<p>Image Caption</p>
|
|
306
|
-
</div>`;
|
|
307
|
-
|
|
308
|
-
await parseHTMLAndCompareSnapshots(html, "parse-fake-image-caption");
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
// TODO: this one fails
|
|
312
|
-
it.skip("Parse deep nested content", async () => {
|
|
313
|
-
const html = `<div>
|
|
314
|
-
Outer 1 Div Before
|
|
315
|
-
<div>
|
|
316
|
-
Outer 2 Div Before
|
|
317
|
-
<div>
|
|
318
|
-
Outer 3 Div Before
|
|
319
|
-
<div>
|
|
320
|
-
Outer 4 Div Before
|
|
321
|
-
<h1>Heading 1</h1>
|
|
322
|
-
<h2>Heading 2</h2>
|
|
323
|
-
<h3>Heading 3</h3>
|
|
324
|
-
<p>Paragraph</p>
|
|
325
|
-
<figure><img src="exampleURL"><figcaption>Image Caption</figcaption></figure>
|
|
326
|
-
<p><strong>Bold</strong> <em>Italic</em> <u>Underline</u> <s>Strikethrough</s> <strong><em><s><u>All</u></s></em></strong></p>
|
|
327
|
-
Outer 4 Div After
|
|
328
|
-
</div>
|
|
329
|
-
Outer 3 Div After
|
|
330
|
-
</div>
|
|
331
|
-
Outer 2 Div After
|
|
332
|
-
</div>
|
|
333
|
-
Outer 1 Div After
|
|
334
|
-
</div>`;
|
|
335
|
-
|
|
336
|
-
await parseHTMLAndCompareSnapshots(html, "parse-deep-nested-content");
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
it("Parse div with inline content and nested blocks", async () => {
|
|
340
|
-
const html = `<div>
|
|
341
|
-
None <strong>Bold </strong><em>Italic </em><u>Underline </u><s>Strikethrough </s><strong><em><s><u>All</u></s></em></strong>
|
|
342
|
-
<div>Nested Div</div>
|
|
343
|
-
<p>Nested Paragraph</p>
|
|
344
|
-
</div>`;
|
|
345
|
-
|
|
346
|
-
await parseHTMLAndCompareSnapshots(html, "parse-div-with-inline-content");
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
it("Parses 2 tables", async () => {
|
|
350
|
-
const html = `
|
|
351
|
-
<table style="border-collapse:collapse;margin-left:255.478pt" cellspacing="0">
|
|
352
|
-
<tr style="height:22pt">
|
|
353
|
-
<td style="width:203pt">
|
|
354
|
-
<p data-text-alignment="left" data-text-indent="0pt"><u>Company</u></p>
|
|
355
|
-
</td>
|
|
356
|
-
</tr>
|
|
357
|
-
<tr style="height:86pt">
|
|
358
|
-
<td style="width:203pt">
|
|
359
|
-
<p data-text-alignment="left" data-text-indent="0pt"><b>Example Company Inc.</b></p>
|
|
360
|
-
<p data-text-alignment="left" data-text-indent="0pt">
|
|
361
|
-
<p>Name: [Company Representative]</p>
|
|
362
|
-
</p>
|
|
363
|
-
<p data-text-alignment="left" data-text-indent="0pt">Title: Chief Executive Officer</p>
|
|
364
|
-
</td>
|
|
365
|
-
</tr>
|
|
366
|
-
</table>
|
|
367
|
-
|
|
368
|
-
<table style="border-collapse:collapse;margin-left:256.5pt" cellspacing="0">
|
|
369
|
-
<tr style="height:58pt">
|
|
370
|
-
<td style="width:209pt;border-bottom-style:solid;border-bottom-width:2pt">
|
|
371
|
-
<p data-text-alignment="left" data-text-indent="0pt"><u>Advisor</u></p>
|
|
372
|
-
</td>
|
|
373
|
-
</tr>
|
|
374
|
-
<tr style="height:13pt">
|
|
375
|
-
<td style="width:209pt;border-top-style:solid;border-top-width:2pt">
|
|
376
|
-
<p data-text-alignment="left" data-text-indent="0pt">[Advisor Name]</p>
|
|
377
|
-
</td>
|
|
378
|
-
</tr>
|
|
379
|
-
</table>`;
|
|
380
|
-
|
|
381
|
-
await parseHTMLAndCompareSnapshots(html, "parse-2-tables");
|
|
382
|
-
});
|
|
383
|
-
|
|
384
|
-
it("Parse Notion HTML", async () => {
|
|
385
|
-
// A few notes on Notion output HTML:
|
|
386
|
-
// - Does not preserve text/background colors
|
|
387
|
-
// - Does not preserve non-list-item block nesting
|
|
388
|
-
// - Hard breaks are represented using white space, not `<br>` elements
|
|
389
|
-
// - Images are converted to links with a "!" at the start
|
|
390
|
-
// - Cells in first row of a table are converted to `th` elements, regardless
|
|
391
|
-
// of if the row is set as a header row
|
|
392
|
-
|
|
393
|
-
const html = `<meta charset='utf-8'><h1>Heading 1</h1>
|
|
394
|
-
<h2>Heading 2</h2>
|
|
395
|
-
<h3>Heading 3</h3>
|
|
396
|
-
<p>Paragraph 1</p>
|
|
397
|
-
<p>Nested Paragraph 1</p>
|
|
398
|
-
<p>Nested Paragraph 2</p>
|
|
399
|
-
<p>Paragraph
|
|
400
|
-
With Hard Break</p>
|
|
401
|
-
<p><strong>Bold</strong> <em>Italic</em> Underline <s>Strikethrough</s> <em><strong><s>All</s></strong></em></p>
|
|
402
|
-
<ul>
|
|
403
|
-
<li>Bullet List Item 1
|
|
404
|
-
<ul>
|
|
405
|
-
<li>Nested Bullet List Item 1
|
|
406
|
-
<ol>
|
|
407
|
-
<li>Nested Numbered List Item 1</li>
|
|
408
|
-
<li>Nested Numbered List Item 2</li>
|
|
409
|
-
</ol>
|
|
410
|
-
</li>
|
|
411
|
-
<li>Nested Bullet List Item 2</li>
|
|
412
|
-
</ul>
|
|
413
|
-
</li>
|
|
414
|
-
<li>Bullet List Item 2</li>
|
|
415
|
-
</ul>
|
|
416
|
-
<ol>
|
|
417
|
-
<li>Numbered List Item 1</li>
|
|
418
|
-
<li>Numbered List Item 2</li>
|
|
419
|
-
</ol>
|
|
420
|
-
<p>Background Color Paragraph</p>
|
|
421
|
-
<p>!<a href="https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg">https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg</a></p>
|
|
422
|
-
<table>
|
|
423
|
-
<thead>
|
|
424
|
-
<tr>
|
|
425
|
-
<th>Cell 1</th>
|
|
426
|
-
<th>Cell 2</th>
|
|
427
|
-
<th>Cell 3</th>
|
|
428
|
-
</tr>
|
|
429
|
-
</thead>
|
|
430
|
-
<tbody>
|
|
431
|
-
<tr>
|
|
432
|
-
<td>Cell 4</td>
|
|
433
|
-
<td>Cell 5</td>
|
|
434
|
-
<td>Cell 6</td>
|
|
435
|
-
</tr>
|
|
436
|
-
<tr>
|
|
437
|
-
<td>Cell 7</td>
|
|
438
|
-
<td>Cell 8</td>
|
|
439
|
-
<td>Cell 9</td>
|
|
440
|
-
</tr>
|
|
441
|
-
</tbody>
|
|
442
|
-
</table>
|
|
443
|
-
<p>Paragraph</p>
|
|
444
|
-
<!-- notionvc: 7cb7968f-b969-4795-af7a-d41b5481c675 -->`;
|
|
445
|
-
|
|
446
|
-
await parseHTMLAndCompareSnapshots(html, "parse-notion-html");
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
// Currently breaking, seems related to parsing `</br>` elements
|
|
450
|
-
it.skip("Parse Google Docs HTML", async () => {
|
|
451
|
-
// A few notes on Google Docs output HTML:
|
|
452
|
-
// - All inline markup is represented as `<span>` elements with inline
|
|
453
|
-
// styles (bold, italic, etc.)
|
|
454
|
-
// - The nested list structure is not valid, i.e. `<ul/ol>` elements are not
|
|
455
|
-
// placed within `<li>` elements
|
|
456
|
-
// - Images are wrapped in two spans and a paragraph
|
|
457
|
-
// - Everything is nested within a `<b>` element
|
|
458
|
-
|
|
459
|
-
const html = `<meta charset='utf-8'>
|
|
460
|
-
<meta charset="utf-8">
|
|
461
|
-
<b style="font-weight:normal;" id="docs-internal-guid-fdf86189-7fff-f50a-2bef-c048469db8a9">
|
|
462
|
-
<h1 dir="ltr" style="line-height:1.38;margin-left: 18pt;text-indent: -18pt;margin-top:24pt;margin-bottom:6pt;padding:0pt 0pt 0pt 18pt;"><span style="font-size:23pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Heading 1</span></h1>
|
|
463
|
-
<h2 dir="ltr" style="line-height:1.38;margin-left: 18pt;text-indent: -18pt;margin-top:18pt;margin-bottom:4pt;padding:0pt 0pt 0pt 18pt;"><span style="font-size:17pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Heading 2</span></h2>
|
|
464
|
-
<h3 dir="ltr" style="line-height:1.38;margin-left: 18pt;text-indent: -18pt;margin-top:14pt;margin-bottom:4pt;padding:0pt 0pt 0pt 18pt;"><span style="font-size:13pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Heading 3</span></h3>
|
|
465
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Paragraph 1</span></p>
|
|
466
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Paragraph 2</span></p>
|
|
467
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Paragraph 3</span></p>
|
|
468
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Paragraph With </span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"><br /></span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Hard Break</span></p>
|
|
469
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Bold</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"> </span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:italic;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Italic</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"> Underline </span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:line-through;-webkit-text-decoration-skip:none;text-decoration-skip-ink:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Strikethrough</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"> </span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#ff0000;background-color:transparent;font-weight:700;font-style:italic;font-variant:normal;text-decoration:line-through;-webkit-text-decoration-skip:none;text-decoration-skip-ink:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">All</span></p>
|
|
470
|
-
<ul style="margin-top:0;margin-bottom:0;padding-inline-start:48px;">
|
|
471
|
-
<li dir="ltr" style="list-style-type:disc;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="1">
|
|
472
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Bullet List Item 1</span></p>
|
|
473
|
-
</li>
|
|
474
|
-
<ul style="margin-top:0;margin-bottom:0;padding-inline-start:48px;">
|
|
475
|
-
<li dir="ltr" style="list-style-type:circle;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="2">
|
|
476
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Nested Bullet List Item 1</span></p>
|
|
477
|
-
</li>
|
|
478
|
-
<ol style="margin-top:0;margin-bottom:0;padding-inline-start:48px;">
|
|
479
|
-
<li dir="ltr" style="list-style-type:decimal;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="3">
|
|
480
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Nested Numbered List Item 1</span></p>
|
|
481
|
-
</li>
|
|
482
|
-
<li dir="ltr" style="list-style-type:decimal;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="3">
|
|
483
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Nested Numbered List Item 2</span></p>
|
|
484
|
-
</li>
|
|
485
|
-
</ol>
|
|
486
|
-
<li dir="ltr" style="list-style-type:circle;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="2">
|
|
487
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Nested Bullet List Item 2</span></p>
|
|
488
|
-
</li>
|
|
489
|
-
</ul>
|
|
490
|
-
<li dir="ltr" style="list-style-type:disc;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="1">
|
|
491
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Bullet List Item 2</span></p>
|
|
492
|
-
</li>
|
|
493
|
-
</ul>
|
|
494
|
-
<ol style="margin-top:0;margin-bottom:0;padding-inline-start:48px;">
|
|
495
|
-
<li dir="ltr" style="list-style-type:decimal;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="1">
|
|
496
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Numbered List Item 1</span></p>
|
|
497
|
-
</li>
|
|
498
|
-
<li dir="ltr" style="list-style-type:decimal;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="1">
|
|
499
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:12pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Numbered List Item 2</span></p>
|
|
500
|
-
</li>
|
|
501
|
-
</ol>
|
|
502
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"><span style="border:none;display:inline-block;overflow:hidden;width:447px;height:301px;"><img src="https://lh7-us.googleusercontent.com/SGyYp6hfLvNkli62NKFJB6NQz-fNa2Sjy8QxfUuqipW--qCCXmCz-dJmeZUGaDXIF9TEZHzbhNJsw4_w-B09eaFOn0oUChKsrSt3cwAIFu6d4SoSjHTR_DRTPr415_P7an7Lue-EwlUcVBk1WCzcoVQ" width="447" height="301" style="margin-left:0px;margin-top:0px;" /></span></span></p>
|
|
503
|
-
<br />
|
|
504
|
-
<div dir="ltr" style="margin-left:0pt;" align="left">
|
|
505
|
-
<table style="border:none;border-collapse:collapse;table-layout:fixed;width:468pt">
|
|
506
|
-
<colgroup>
|
|
507
|
-
<col />
|
|
508
|
-
<col />
|
|
509
|
-
<col />
|
|
510
|
-
</colgroup>
|
|
511
|
-
<tbody>
|
|
512
|
-
<tr style="height:0pt">
|
|
513
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
514
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 1</span></p>
|
|
515
|
-
</td>
|
|
516
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
517
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 2</span></p>
|
|
518
|
-
</td>
|
|
519
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
520
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 3</span></p>
|
|
521
|
-
</td>
|
|
522
|
-
</tr>
|
|
523
|
-
<tr style="height:0pt">
|
|
524
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
525
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 4</span></p>
|
|
526
|
-
</td>
|
|
527
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
528
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 5</span></p>
|
|
529
|
-
</td>
|
|
530
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
531
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 6</span></p>
|
|
532
|
-
</td>
|
|
533
|
-
</tr>
|
|
534
|
-
<tr style="height:0pt">
|
|
535
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
536
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 7</span></p>
|
|
537
|
-
</td>
|
|
538
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
539
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 8</span></p>
|
|
540
|
-
</td>
|
|
541
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
542
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 9</span></p>
|
|
543
|
-
</td>
|
|
544
|
-
</tr>
|
|
545
|
-
</tbody>
|
|
546
|
-
</table>
|
|
547
|
-
</div>
|
|
548
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Paragraph</span></p>
|
|
549
|
-
</b>
|
|
550
|
-
<br class="Apple-interchange-newline">`;
|
|
551
|
-
|
|
552
|
-
await parseHTMLAndCompareSnapshots(html, "parse-google-docs-html");
|
|
553
|
-
});
|
|
554
|
-
|
|
555
|
-
it("Parse codeblocks", async () => {
|
|
556
|
-
const html = `<pre><code>console.log("Should default to JS")</code></pre>
|
|
557
|
-
<pre><code data-language="typescript">console.log("Should parse TS from data-language")</code></pre>
|
|
558
|
-
<pre><code class="language-python">print("Should parse Python from language- class")</code></pre>
|
|
559
|
-
<pre><code class="language-ruby" data-language="typescript">console.log("Should prioritize TS from data-language over language- class")</code></pre>`;
|
|
560
|
-
|
|
561
|
-
await parseHTMLAndCompareSnapshots(html, "parse-codeblocks");
|
|
562
|
-
});
|
|
563
|
-
});
|