From 83ac5a9d26dadb1ad21ee1ad4a2a8c6ace4a9257 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Mon, 7 Apr 2025 19:04:08 +0200 Subject: [PATCH 01/12] Restructured unit testing setup --- .../external/pasteEndOfParagraphText.html | 138 - .../__snapshots__/external/pasteImage.html | 153 - .../__snapshots__/external/pasteTable.html | 233 -- .../__snapshots__/internal/basicBlocks.html | 1 - .../internal/basicBlocksWithProps.html | 1 - .../__snapshots__/internal/childToParent.html | 1 - .../internal/childrenToNextParent.html | 1 - .../childrenToNextParentsChildren.html | 1 - .../internal/multipleStyledText.html | 1 - .../__snapshots__/internal/nestedImage.html | 1 - .../internal/paragraphInCustomBlock.html | 1 - .../internal/partialChildToParent.html | 1 - .../__snapshots__/internal/styledText.html | 1 - .../__snapshots__/internal/tableAllCells.html | 1 - .../__snapshots__/internal/tableCell.html | 1 - .../__snapshots__/internal/tableCellText.html | 1 - .../__snapshots__/internal/tableRow.html | 1 - .../__snapshots__/internal/unstyledText.html | 1 - .../api/clipboard/clipboardExternal.test.ts | 161 - .../api/clipboard/clipboardInternal.test.ts | 435 --- packages/core/src/api/clipboard/testUtil.ts | 27 - .../codeBlock/contains-newlines/internal.html | 3 - .../codeBlock/defaultLanguage/internal.html | 1 - .../codeBlock/empty/internal.html | 1 - .../codeBlock/python/internal.html | 1 - .../__snapshots__/complex/misc/internal.html | 1 - .../customBlock/basic/external.html | 1 - .../customBlock/basic/internal.html | 1 - .../customParagraph/basic/external.html | 1 - .../customParagraph/basic/internal.html | 1 - .../customParagraph/lineBreaks/external.html | 1 - .../customParagraph/lineBreaks/internal.html | 1 - .../customParagraph/nested/external.html | 1 - .../customParagraph/nested/internal.html | 1 - .../customParagraph/styled/external.html | 1 - .../customParagraph/styled/internal.html | 1 - .../__snapshots__/file/basic/internal.html | 1 - .../__snapshots__/file/button/internal.html | 1 - .../__snapshots__/file/nested/internal.html | 1 - .../file/noCaption/internal.html | 1 - .../__snapshots__/file/noName/internal.html | 1 - .../fontSize/basic/external.html | 1 - .../fontSize/basic/internal.html | 1 - .../hardbreak/basic/internal.html | 1 - .../hardbreak/between-links/internal.html | 1 - .../__snapshots__/hardbreak/end/internal.html | 1 - .../hardbreak/link/internal.html | 1 - .../hardbreak/multiple/internal.html | 1 - .../hardbreak/only/internal.html | 1 - .../hardbreak/start/internal.html | 1 - .../hardbreak/styles/internal.html | 1 - .../__snapshots__/image/basic/external.html | 1 - .../__snapshots__/image/basic/internal.html | 1 - .../__snapshots__/image/button/internal.html | 1 - .../__snapshots__/image/nested/external.html | 1 - .../__snapshots__/image/nested/internal.html | 1 - .../image/noCaption/external.html | 1 - .../image/noCaption/internal.html | 1 - .../__snapshots__/image/noName/external.html | 1 - .../__snapshots__/image/noName/internal.html | 1 - .../image/noPreview/internal.html | 1 - .../__snapshots__/link/adjacent/internal.html | 1 - .../__snapshots__/link/basic/internal.html | 1 - .../__snapshots__/link/styled/internal.html | 1 - .../__snapshots__/lists/basic/internal.html | 1 - .../__snapshots__/lists/nested/internal.html | 1 - .../__snapshots__/mention/basic/external.html | 1 - .../__snapshots__/mention/basic/internal.html | 1 - .../pageBreak/basic/external.html | 1 - .../pageBreak/basic/internal.html | 1 - .../paragraph/basic/internal.html | 1 - .../paragraph/empty/internal.html | 1 - .../paragraph/lineBreaks/internal.html | 1 - .../paragraph/nested/internal.html | 1 - .../paragraph/styled/internal.html | 1 - .../paste/parse-basic-block-types.json | 140 - .../paste/parse-mixed-nested-lists.json | 70 - .../parse-nested-lists-with-paragraphs.json | 70 - .../paste/parse-nested-lists.json | 70 - .../simpleCustomParagraph/basic/external.html | 1 - .../simpleCustomParagraph/basic/internal.html | 1 - .../nested/external.html | 1 - .../nested/internal.html | 1 - .../styled/external.html | 1 - .../styled/internal.html | 1 - .../simpleFile/basic/external.html | 1 - .../simpleFile/basic/internal.html | 1 - .../simpleFile/button/external.html | 1 - .../simpleFile/button/internal.html | 1 - .../simpleFile/nested/external.html | 1 - .../simpleFile/nested/internal.html | 1 - .../simpleImage/basic/external.html | 1 - .../simpleImage/basic/internal.html | 1 - .../simpleImage/button/external.html | 1 - .../simpleImage/button/internal.html | 1 - .../simpleImage/nested/external.html | 1 - .../simpleImage/nested/internal.html | 1 - .../simpleImage/noCaption/external.html | 1 - .../simpleImage/noCaption/internal.html | 1 - .../simpleImage/noName/external.html | 1 - .../simpleImage/noName/internal.html | 1 - .../simpleImage/noPreview/external.html | 1 - .../simpleImage/noPreview/internal.html | 1 - .../__snapshots__/small/basic/external.html | 1 - .../__snapshots__/small/basic/internal.html | 1 - .../table/allColWidths/internal.html | 1 - .../__snapshots__/table/basic/internal.html | 1 - .../table/headerCols/internal.html | 1 - .../table/headerRows/internal.html | 1 - .../table/headersRows/external.html | 1 - .../table/headersRows/internal.html | 1 - .../table/mixedCellColors/internal.html | 1 - .../table/mixedColWidths/internal.html | 1 - .../mixedRowspansAndColspans/internal.html | 1 - .../__snapshots__/tag/basic/external.html | 1 - .../__snapshots__/tag/basic/internal.html | 1 - .../api/exporters/html/htmlConversion.test.ts | 110 - .../customBlock/basic/markdown.md | 5 - .../customParagraph/basic/markdown.md | 1 - .../customParagraph/lineBreaks/markdown.md | 1 - .../customParagraph/nested/markdown.md | 5 - .../customParagraph/styled/markdown.md | 1 - .../__snapshots__/fontSize/basic/markdown.md | 1 - .../__snapshots__/image/basic/markdown.md | 3 - .../__snapshots__/image/nested/markdown.md | 7 - .../__snapshots__/image/noCaption/markdown.md | 1 - .../__snapshots__/image/noName/markdown.md | 3 - .../__snapshots__/mention/basic/markdown.md | 1 - .../__snapshots__/paragraph/empty/markdown.md | 0 .../simpleCustomParagraph/basic/markdown.md | 1 - .../simpleCustomParagraph/nested/markdown.md | 5 - .../simpleCustomParagraph/styled/markdown.md | 1 - .../simpleFile/basic/markdown.md | 3 - .../simpleFile/button/markdown.md | 1 - .../simpleFile/nested/markdown.md | 7 - .../simpleImage/basic/markdown.md | 3 - .../simpleImage/button/markdown.md | 1 - .../simpleImage/nested/markdown.md | 7 - .../simpleImage/noCaption/markdown.md | 1 - .../simpleImage/noName/markdown.md | 3 - .../simpleImage/noPreview/markdown.md | 3 - .../__snapshots__/small/basic/markdown.md | 1 - .../__snapshots__/tag/basic/markdown.md | 1 - .../markdown/markdownExporter.test.ts | 86 - .../nodeConversions.test.ts.snap | 3473 ----------------- .../nodeConversions/nodeConversions.test.ts | 83 - .../html/__snapshots__/parse-2-tables.json | 129 - .../html/__snapshots__/parse-codeblocks.json | 62 - .../parse-div-with-inline-content.json | 91 - .../__snapshots__/pasted/complex.json | 319 -- .../__snapshots__/pasted/issue-226-1.json | 81 - .../__snapshots__/pasted/issue-226-2.json | 165 - .../markdown/__snapshots__/pasted/nested.json | 81 - .../__snapshots__/pasted/non-nested.json | 81 - .../markdown/__snapshots__/pasted/styled.json | 61 - .../__snapshots__/pasted/whitespace bold.json | 42 - .../parsers/markdown/parseMarkdown.test.ts | 135 - .../src/api/testUtil/cases/customBlocks.ts | 342 -- .../api/testUtil/cases/customInlineContent.ts | 113 - .../src/api/testUtil/cases/customStyles.ts | 102 - .../src/api/testUtil/cases/defaultSchema.ts | 1493 ------- packages/core/src/api/testUtil/index.ts | 19 - packages/core/src/api/testUtil/paste.ts | 46 - .../api/tests/clipboard/clipboardTestUtil.ts | 93 + .../__snapshots__/text/html/basicBlocks.html | 1 + .../text/html/basicBlocksWithProps.html | 1 + .../text/html/childToParent.html | 1 + .../text/html/childrenToNextParent.html | 1 + .../html/childrenToNextParentsChildren.html | 1 + .../copy/__snapshots__/text/html}/image.html | 2 +- .../text/html}/multipleChildren.html | 0 .../text/html/multipleStyledText.html | 1 + .../__snapshots__/text/html/nestedImage.html | 1 + .../text/html/partialChildToParent.html | 1 + .../__snapshots__/text/html/styledText.html | 1 + .../text/html/tableAllCells.html | 1 + .../__snapshots__/text/html/tableCell.html | 1 + .../text/html/tableCellText.html | 1 + .../__snapshots__/text/html/tableCol.html | 1 + .../__snapshots__/text/html/tableRow.html | 1 + .../__snapshots__/text/html/unstyledText.html | 1 + .../tests/clipboard/copy/getCopyTestCases.ts | 611 +++ .../api/tests/clipboard/copy/testCopy.test.ts | 68 + .../__snapshots__/paragraphInCustomBlock.json | 36 + .../copyPaste/getCopyPasteTestCases.ts | 49 + .../clipboard/copyPaste/testCopyPaste.test.ts | 72 + .../getCopyPasteEqualityTestCases.ts | 27 + .../testCopyPasteEquality.test.ts | 67 + .../text/html/pasteEndOfParagraph.json} | 24 +- .../__snapshots__/text/html/pasteImage.json} | 37 +- .../html/pasteParagraphInCustomBlock.json | 19 + .../__snapshots__/text/html/pasteTable.json} | 38 +- .../text/html/pasteTableInExistingTable.json} | 47 +- .../text/plain/pasteEndOfParagraphText.json | 19 + .../clipboard/paste/getPasteTestCases.ts | 149 + .../tests/clipboard/paste/testPaste.test.ts | 59 + .../codeBlock/contains-newlines.html | 3 + .../codeBlock/defaultLanguage.html | 1 + .../blocknoteHTML/codeBlock/empty.html | 1 + .../blocknoteHTML/codeBlock/python.html | 1 + .../blocknoteHTML/complex/misc.html | 1 + .../blocknoteHTML/file/basic.html | 1 + .../blocknoteHTML/file/button.html | 1 + .../blocknoteHTML/file/nested.html | 1 + .../blocknoteHTML/file/noCaption.html | 1 + .../blocknoteHTML/file/noName.html | 1 + .../blocknoteHTML/hardbreak/basic.html | 1 + .../hardbreak/between-links.html | 1 + .../blocknoteHTML/hardbreak/end.html | 1 + .../blocknoteHTML/hardbreak/link.html | 1 + .../blocknoteHTML/hardbreak/multiple.html | 1 + .../blocknoteHTML/hardbreak/only.html | 1 + .../blocknoteHTML/hardbreak/start.html | 1 + .../blocknoteHTML/hardbreak/styles.html | 1 + .../blocknoteHTML/image/basic.html | 1 + .../blocknoteHTML/image/button.html | 1 + .../blocknoteHTML/image/nested.html | 1 + .../blocknoteHTML/image/noCaption.html | 1 + .../blocknoteHTML/image/noName.html | 1 + .../blocknoteHTML/image/noPreview.html | 1 + .../blocknoteHTML/link/adjacent.html | 1 + .../blocknoteHTML/link/basic.html | 1 + .../blocknoteHTML/link/styled.html | 1 + .../blocknoteHTML/lists/basic.html | 1 + .../blocknoteHTML/lists/nested.html | 1 + .../blocknoteHTML/paragraph/basic.html | 1 + .../blocknoteHTML/paragraph/empty.html | 1 + .../blocknoteHTML/paragraph/lineBreaks.html | 1 + .../blocknoteHTML/paragraph/nested.html | 1 + .../blocknoteHTML/paragraph/styled.html | 1 + .../blocknoteHTML/table/allColWidths.html | 1 + .../blocknoteHTML/table/basic.html | 1 + .../blocknoteHTML/table/headerCols.html | 1 + .../blocknoteHTML/table/headerRows.html | 1 + .../blocknoteHTML/table/mixedCellColors.html | 1 + .../blocknoteHTML/table/mixedColWidths.html | 1 + .../table/mixedRowspansAndColspans.html | 1 + .../html/codeBlock/contains-newlines.html} | 0 .../html/codeBlock/defaultLanguage.html} | 0 .../__snapshots__/html/codeBlock/empty.html} | 0 .../__snapshots__/html/codeBlock/python.html} | 0 .../__snapshots__/html/complex/misc.html} | 0 .../__snapshots__/html/file/basic.html} | 0 .../__snapshots__/html/file/button.html} | 0 .../__snapshots__/html/file/nested.html} | 0 .../__snapshots__/html/file/noCaption.html} | 0 .../__snapshots__/html/file/noName.html} | 0 .../__snapshots__/html/hardbreak/basic.html} | 0 .../html/hardbreak/between-links.html} | 0 .../__snapshots__/html/hardbreak/end.html} | 0 .../__snapshots__/html/hardbreak/link.html} | 0 .../html/hardbreak/multiple.html} | 0 .../__snapshots__/html/hardbreak/only.html} | 0 .../__snapshots__/html/hardbreak/start.html} | 0 .../__snapshots__/html/hardbreak/styles.html} | 0 .../__snapshots__/html/image/basic.html | 1 + .../__snapshots__/html/image/button.html} | 0 .../__snapshots__/html/image/nested.html | 1 + .../__snapshots__/html/image/noCaption.html | 1 + .../__snapshots__/html/image/noName.html | 1 + .../__snapshots__/html/image/noPreview.html} | 0 .../__snapshots__/html/link/adjacent.html} | 0 .../__snapshots__/html/link/basic.html} | 0 .../__snapshots__/html/link/styled.html} | 0 .../__snapshots__/html/lists/basic.html} | 0 .../__snapshots__/html/lists/nested.html} | 0 .../__snapshots__/html/paragraph/basic.html} | 0 .../__snapshots__/html/paragraph/empty.html} | 0 .../html/paragraph/lineBreaks.html} | 0 .../__snapshots__/html/paragraph/nested.html} | 0 .../__snapshots__/html/paragraph/styled.html} | 0 .../html/table/allColWidths.html} | 0 .../__snapshots__/html/table/basic.html} | 0 .../__snapshots__/html/table/headerCols.html} | 0 .../__snapshots__/html/table/headerRows.html} | 0 .../html/table/mixedCellColors.html} | 0 .../html/table/mixedColWidths.html} | 0 .../html/table/mixedRowspansAndColspans.html} | 0 .../markdown/codeBlock/contains-newlines.md} | 0 .../markdown/codeBlock/defaultLanguage.md} | 0 .../markdown/codeBlock/empty.md} | 0 .../markdown/codeBlock/python.md} | 0 .../__snapshots__/markdown/complex/misc.md} | 0 .../__snapshots__/markdown/file/basic.md} | 0 .../__snapshots__/markdown/file/button.md} | 0 .../__snapshots__/markdown/file/nested.md} | 0 .../__snapshots__/markdown/file/noCaption.md} | 0 .../__snapshots__/markdown/file/noName.md} | 0 .../markdown/hardbreak/basic.md} | 0 .../markdown/hardbreak/between-links.md} | 0 .../__snapshots__/markdown/hardbreak/end.md} | 0 .../__snapshots__/markdown/hardbreak/link.md} | 0 .../markdown/hardbreak/multiple.md} | 0 .../__snapshots__/markdown/hardbreak/only.md} | 0 .../markdown/hardbreak/start.md} | 0 .../markdown/hardbreak/styles.md} | 0 .../__snapshots__/markdown/image/basic.md} | 0 .../__snapshots__/markdown/image/button.md} | 0 .../__snapshots__/markdown/image/nested.md | 7 + .../__snapshots__/markdown/image/noCaption.md | 1 + .../__snapshots__/markdown/image/noName.md | 3 + .../__snapshots__/markdown/image/noPreview.md | 3 + .../__snapshots__/markdown/link/adjacent.md} | 0 .../__snapshots__/markdown/link/basic.md} | 0 .../__snapshots__/markdown/link/styled.md} | 0 .../__snapshots__/markdown/lists/basic.md} | 0 .../__snapshots__/markdown/lists/nested.md} | 0 .../markdown/paragraph/basic.md} | 0 .../markdown/paragraph/empty.md} | 0 .../markdown/paragraph/lineBreaks.md} | 0 .../markdown/paragraph/nested.md} | 0 .../markdown/paragraph/styled.md} | 0 .../markdown/table/allColWidths.md} | 0 .../__snapshots__/markdown/table/basic.md} | 0 .../markdown/table/headerCols.md} | 0 .../markdown/table/headerRows.md} | 0 .../markdown/table/mixedCellColors.md} | 0 .../markdown/table/mixedColWidths.md} | 0 .../table/mixedRowspansAndColspans.md} | 0 .../nodes/codeBlock/contains-newlines.json | 26 + .../nodes/codeBlock/defaultLanguage.json | 24 + .../__snapshots__/nodes/codeBlock/empty.json | 18 + .../__snapshots__/nodes/codeBlock/python.json | 24 + .../__snapshots__/nodes/complex/misc.json | 88 + .../__snapshots__/nodes/file/basic.json | 20 + .../__snapshots__/nodes/file/button.json | 20 + .../__snapshots__/nodes/file/nested.json | 43 + .../__snapshots__/nodes/file/noCaption.json | 20 + .../__snapshots__/nodes/file/noName.json | 20 + .../__snapshots__/nodes/hardbreak/basic.json | 31 + .../nodes/hardbreak/between-links.json | 53 + .../__snapshots__/nodes/hardbreak/end.json | 27 + .../__snapshots__/nodes/hardbreak/link.json | 53 + .../nodes/hardbreak/multiple.json | 38 + .../__snapshots__/nodes/hardbreak/only.json | 23 + .../__snapshots__/nodes/hardbreak/start.json | 27 + .../__snapshots__/nodes/hardbreak/styles.json | 36 + .../__snapshots__/nodes/image/basic.json | 23 + .../__snapshots__/nodes/image/button.json | 23 + .../__snapshots__/nodes/image/nested.json | 49 + .../__snapshots__/nodes/image/noCaption.json | 23 + .../__snapshots__/nodes/image/noName.json | 23 + .../__snapshots__/nodes/image/noPreview.json | 23 + .../__snapshots__/nodes/link/adjacent.json | 50 + .../__snapshots__/nodes/link/basic.json | 35 + .../__snapshots__/nodes/link/styled.json | 53 + .../__snapshots__/nodes/lists/basic.json | 140 + .../__snapshots__/nodes/lists/nested.json | 150 + .../__snapshots__/nodes/paragraph/basic.json | 24 + .../__snapshots__/nodes/paragraph/empty.json | 18 + .../nodes/paragraph/lineBreaks.json | 31 + .../__snapshots__/nodes/paragraph/nested.json | 73 + .../__snapshots__/nodes/paragraph/styled.json | 66 + .../nodes/table/allColWidths.json | 248 ++ .../__snapshots__/nodes/table/basic.json | 230 ++ .../__snapshots__/nodes/table/headerCols.json | 230 ++ .../__snapshots__/nodes/table/headerRows.json | 230 ++ .../nodes/table/mixedCellColors.json | 242 ++ .../nodes/table/mixedColWidths.json | 242 ++ .../nodes/table/mixedRowspansAndColspans.json | 178 + .../export/getExportTestCases.ts | 1521 ++++++++ .../export/testExport.test.ts | 75 + .../getExportParseEqualityTestCases.ts | 29 + .../testExportParseEquality.test.ts | 78 + .../formatConversionTestUtil.ts} | 12 +- .../__snapshots__/html/basicBlockTypes.json} | 153 +- .../parse/__snapshots__/html/codeBlocks.json | 62 + .../html/deepNestedContent.json} | 255 +- .../parse/__snapshots__/html/divs.json} | 132 +- .../__snapshots__/html/fakeImageCaption.json} | 37 +- .../parse/__snapshots__/html/googleDocs.json | 579 +++ .../__snapshots__/html/imageInParagraph.json} | 15 +- .../html/inlineContentAndNestedBlocks.json} | 104 +- .../parse/__snapshots__/html/lists.json} | 204 +- .../__snapshots__/html/mixedNestedLists.json} | 330 +- .../__snapshots__/html/nestedLists.json} | 330 +- .../html/nestedListsWithParagraphs.json} | 330 +- .../parse/__snapshots__/html/notion.json} | 609 +-- .../parse/__snapshots__/html/twoDivs.json} | 42 +- .../parse/__snapshots__/html/twoTables.json} | 96 +- .../parse/__snapshots__/markdown/basic.json} | 78 +- .../markdown/boldWithWhitespace.json} | 24 +- .../__snapshots__/markdown}/complex.json | 444 +-- .../markdown/issue226case1.json} | 78 +- .../markdown/issue226case2.json} | 166 +- .../parse/__snapshots__/markdown}/nested.json | 96 +- .../parse/__snapshots__/markdown}/styled.json | 64 +- .../parse/getParseTestCases.ts} | 776 ++-- .../formatConversion/parse/testParse.test.ts | 51 + .../core/src/api/tests/setupTestEditor.ts | 55 + packages/core/src/api/tests/testSchema.ts | 185 + packages/core/src/index.ts | 3 +- .../src/test/testCases/customReactBlocks.tsx | 10 +- .../testCases/customReactInlineContent.tsx | 10 +- .../src/test/testCases/customReactStyles.tsx | 10 +- .../src/test/conversions/testCases.ts | 9 +- shared/testDocument.ts | 1 + .../headings-json-chromium-darwin.json | 180 + .../paragraphs-json-chromium-darwin.json | 174 + .../dragdropsingle-chromium-darwin.json | 95 + 400 files changed, 9673 insertions(+), 11103 deletions(-) delete mode 100644 packages/core/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/external/pasteImage.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/external/pasteTable.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/basicBlocks.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/basicBlocksWithProps.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/childToParent.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/childrenToNextParent.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/childrenToNextParentsChildren.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/multipleStyledText.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/nestedImage.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/partialChildToParent.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/styledText.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/tableAllCells.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/tableCell.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/tableCellText.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/tableRow.html delete mode 100644 packages/core/src/api/clipboard/__snapshots__/internal/unstyledText.html delete mode 100644 packages/core/src/api/clipboard/clipboardExternal.test.ts delete mode 100644 packages/core/src/api/clipboard/clipboardInternal.test.ts delete mode 100644 packages/core/src/api/clipboard/testUtil.ts delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/codeBlock/contains-newlines/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/codeBlock/empty/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/codeBlock/python/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/complex/misc/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/customBlock/basic/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/customBlock/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/customParagraph/basic/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/customParagraph/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/customParagraph/nested/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/customParagraph/nested/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/customParagraph/styled/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/customParagraph/styled/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/file/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/file/button/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/file/nested/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/file/noCaption/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/file/noName/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/hardbreak/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/hardbreak/between-links/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/hardbreak/end/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/hardbreak/link/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/hardbreak/multiple/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/hardbreak/only/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/hardbreak/start/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/hardbreak/styles/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/image/basic/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/image/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/image/button/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/image/nested/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/image/nested/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/image/noCaption/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/image/noCaption/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/image/noName/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/image/noName/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/image/noPreview/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/link/adjacent/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/link/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/link/styled/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/lists/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/lists/nested/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/mention/basic/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/mention/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/pageBreak/basic/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/pageBreak/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/paragraph/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/paragraph/empty/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/paragraph/nested/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/paragraph/styled/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/paste/parse-basic-block-types.json delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/paste/parse-mixed-nested-lists.json delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/paste/parse-nested-lists-with-paragraphs.json delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/paste/parse-nested-lists.json delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleFile/basic/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleFile/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleFile/button/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleFile/button/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleFile/nested/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleFile/nested/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/button/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/button/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/small/basic/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/small/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/table/allColWidths/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/table/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/table/headerCols/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/table/headerRows/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/table/headersRows/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/table/headersRows/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/table/mixedCellColors/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/table/mixedColWidths/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/table/mixedRowspansAndColspans/internal.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/tag/basic/external.html delete mode 100644 packages/core/src/api/exporters/html/__snapshots__/tag/basic/internal.html delete mode 100644 packages/core/src/api/exporters/html/htmlConversion.test.ts delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/customBlock/basic/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/basic/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/lineBreaks/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/nested/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/styled/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/fontSize/basic/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/image/basic/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/image/nested/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/image/noCaption/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/image/noName/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/mention/basic/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/paragraph/empty/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/basic/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/nested/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/styled/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/basic/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/button/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/nested/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/button/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noPreview/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/small/basic/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/__snapshots__/tag/basic/markdown.md delete mode 100644 packages/core/src/api/exporters/markdown/markdownExporter.test.ts delete mode 100644 packages/core/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap delete mode 100644 packages/core/src/api/nodeConversions/nodeConversions.test.ts delete mode 100644 packages/core/src/api/parsers/html/__snapshots__/parse-2-tables.json delete mode 100644 packages/core/src/api/parsers/html/__snapshots__/parse-codeblocks.json delete mode 100644 packages/core/src/api/parsers/html/__snapshots__/parse-div-with-inline-content.json delete mode 100644 packages/core/src/api/parsers/markdown/__snapshots__/pasted/complex.json delete mode 100644 packages/core/src/api/parsers/markdown/__snapshots__/pasted/issue-226-1.json delete mode 100644 packages/core/src/api/parsers/markdown/__snapshots__/pasted/issue-226-2.json delete mode 100644 packages/core/src/api/parsers/markdown/__snapshots__/pasted/nested.json delete mode 100644 packages/core/src/api/parsers/markdown/__snapshots__/pasted/non-nested.json delete mode 100644 packages/core/src/api/parsers/markdown/__snapshots__/pasted/styled.json delete mode 100644 packages/core/src/api/parsers/markdown/__snapshots__/pasted/whitespace bold.json delete mode 100644 packages/core/src/api/parsers/markdown/parseMarkdown.test.ts delete mode 100644 packages/core/src/api/testUtil/cases/customBlocks.ts delete mode 100644 packages/core/src/api/testUtil/cases/customInlineContent.ts delete mode 100644 packages/core/src/api/testUtil/cases/customStyles.ts delete mode 100644 packages/core/src/api/testUtil/cases/defaultSchema.ts delete mode 100644 packages/core/src/api/testUtil/index.ts delete mode 100644 packages/core/src/api/testUtil/paste.ts create mode 100644 packages/core/src/api/tests/clipboard/clipboardTestUtil.ts create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocks.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childToParent.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html rename packages/core/src/api/{clipboard/__snapshots__/internal => tests/clipboard/copy/__snapshots__/text/html}/image.html (81%) rename packages/core/src/api/{clipboard/__snapshots__/internal => tests/clipboard/copy/__snapshots__/text/html}/multipleChildren.html (100%) create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleStyledText.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/nestedImage.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/partialChildToParent.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/styledText.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableAllCells.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCell.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCellText.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCol.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableRow.html create mode 100644 packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/unstyledText.html create mode 100644 packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts create mode 100644 packages/core/src/api/tests/clipboard/copy/testCopy.test.ts create mode 100644 packages/core/src/api/tests/clipboard/copyPaste/__snapshots__/paragraphInCustomBlock.json create mode 100644 packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts create mode 100644 packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts create mode 100644 packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.ts create mode 100644 packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts rename packages/core/src/api/{exporters/html/__snapshots__/paste/parse-divs.json => tests/clipboard/paste/__snapshots__/text/html/pasteEndOfParagraph.json} (60%) rename packages/core/src/api/{exporters/html/__snapshots__/paste/parse-fake-image-caption.json => tests/clipboard/paste/__snapshots__/text/html/pasteImage.json} (61%) create mode 100644 packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteParagraphInCustomBlock.json rename packages/core/src/api/{clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html => tests/clipboard/paste/__snapshots__/text/html/pasteTable.json} (80%) rename packages/core/src/api/{clipboard/__snapshots__/external/pasteTableInExistingTable.html => tests/clipboard/paste/__snapshots__/text/html/pasteTableInExistingTable.json} (83%) create mode 100644 packages/core/src/api/tests/clipboard/paste/__snapshots__/text/plain/pasteEndOfParagraphText.json create mode 100644 packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts create mode 100644 packages/core/src/api/tests/clipboard/paste/testPaste.test.ts create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html rename packages/core/src/api/{exporters/html/__snapshots__/codeBlock/contains-newlines/external.html => tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/codeBlock/defaultLanguage/external.html => tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/codeBlock/empty/external.html => tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/codeBlock/python/external.html => tests/formatConversion/export/__snapshots__/html/codeBlock/python.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/complex/misc/external.html => tests/formatConversion/export/__snapshots__/html/complex/misc.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/file/basic/external.html => tests/formatConversion/export/__snapshots__/html/file/basic.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/file/button/external.html => tests/formatConversion/export/__snapshots__/html/file/button.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/file/nested/external.html => tests/formatConversion/export/__snapshots__/html/file/nested.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/file/noCaption/external.html => tests/formatConversion/export/__snapshots__/html/file/noCaption.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/file/noName/external.html => tests/formatConversion/export/__snapshots__/html/file/noName.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/hardbreak/basic/external.html => tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/hardbreak/between-links/external.html => tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/hardbreak/end/external.html => tests/formatConversion/export/__snapshots__/html/hardbreak/end.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/hardbreak/link/external.html => tests/formatConversion/export/__snapshots__/html/hardbreak/link.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/hardbreak/multiple/external.html => tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/hardbreak/only/external.html => tests/formatConversion/export/__snapshots__/html/hardbreak/only.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/hardbreak/start/external.html => tests/formatConversion/export/__snapshots__/html/hardbreak/start.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/hardbreak/styles/external.html => tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html} (100%) create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/basic.html rename packages/core/src/api/{exporters/html/__snapshots__/image/button/external.html => tests/formatConversion/export/__snapshots__/html/image/button.html} (100%) create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/nested.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noCaption.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noName.html rename packages/core/src/api/{exporters/html/__snapshots__/image/noPreview/external.html => tests/formatConversion/export/__snapshots__/html/image/noPreview.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/link/adjacent/external.html => tests/formatConversion/export/__snapshots__/html/link/adjacent.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/link/basic/external.html => tests/formatConversion/export/__snapshots__/html/link/basic.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/link/styled/external.html => tests/formatConversion/export/__snapshots__/html/link/styled.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/lists/basic/external.html => tests/formatConversion/export/__snapshots__/html/lists/basic.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/lists/nested/external.html => tests/formatConversion/export/__snapshots__/html/lists/nested.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/paragraph/basic/external.html => tests/formatConversion/export/__snapshots__/html/paragraph/basic.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/paragraph/empty/external.html => tests/formatConversion/export/__snapshots__/html/paragraph/empty.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/paragraph/lineBreaks/external.html => tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/paragraph/nested/external.html => tests/formatConversion/export/__snapshots__/html/paragraph/nested.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/paragraph/styled/external.html => tests/formatConversion/export/__snapshots__/html/paragraph/styled.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/table/allColWidths/external.html => tests/formatConversion/export/__snapshots__/html/table/allColWidths.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/table/basic/external.html => tests/formatConversion/export/__snapshots__/html/table/basic.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/table/headerCols/external.html => tests/formatConversion/export/__snapshots__/html/table/headerCols.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/table/headerRows/external.html => tests/formatConversion/export/__snapshots__/html/table/headerRows.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/table/mixedCellColors/external.html => tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/table/mixedColWidths/external.html => tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html} (100%) rename packages/core/src/api/{exporters/html/__snapshots__/table/mixedRowspansAndColspans/external.html => tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/codeBlock/contains-newlines/markdown.md => tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/codeBlock/defaultLanguage/markdown.md => tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/codeBlock/empty/markdown.md => tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/codeBlock/python/markdown.md => tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/complex/misc/markdown.md => tests/formatConversion/export/__snapshots__/markdown/complex/misc.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/file/basic/markdown.md => tests/formatConversion/export/__snapshots__/markdown/file/basic.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/file/button/markdown.md => tests/formatConversion/export/__snapshots__/markdown/file/button.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/file/nested/markdown.md => tests/formatConversion/export/__snapshots__/markdown/file/nested.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/file/noCaption/markdown.md => tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/file/noName/markdown.md => tests/formatConversion/export/__snapshots__/markdown/file/noName.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/hardbreak/basic/markdown.md => tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/hardbreak/between-links/markdown.md => tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/hardbreak/end/markdown.md => tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/hardbreak/link/markdown.md => tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/hardbreak/multiple/markdown.md => tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/hardbreak/only/markdown.md => tests/formatConversion/export/__snapshots__/markdown/hardbreak/only.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/hardbreak/start/markdown.md => tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/hardbreak/styles/markdown.md => tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/image/noPreview/markdown.md => tests/formatConversion/export/__snapshots__/markdown/image/basic.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/image/button/markdown.md => tests/formatConversion/export/__snapshots__/markdown/image/button.md} (100%) create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/nested.md create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noName.md create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md rename packages/core/src/api/{exporters/markdown/__snapshots__/link/adjacent/markdown.md => tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/link/basic/markdown.md => tests/formatConversion/export/__snapshots__/markdown/link/basic.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/link/styled/markdown.md => tests/formatConversion/export/__snapshots__/markdown/link/styled.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/lists/basic/markdown.md => tests/formatConversion/export/__snapshots__/markdown/lists/basic.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/lists/nested/markdown.md => tests/formatConversion/export/__snapshots__/markdown/lists/nested.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/paragraph/basic/markdown.md => tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/pageBreak/basic/markdown.md => tests/formatConversion/export/__snapshots__/markdown/paragraph/empty.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/paragraph/lineBreaks/markdown.md => tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/paragraph/nested/markdown.md => tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/paragraph/styled/markdown.md => tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/table/allColWidths/markdown.md => tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/table/basic/markdown.md => tests/formatConversion/export/__snapshots__/markdown/table/basic.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/table/headerCols/markdown.md => tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/table/headerRows/markdown.md => tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/table/mixedCellColors/markdown.md => tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/table/mixedColWidths/markdown.md => tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md} (100%) rename packages/core/src/api/{exporters/markdown/__snapshots__/table/mixedRowspansAndColspans/markdown.md => tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md} (100%) create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/basic.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/button.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/nested.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noName.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/basic.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/button.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/nested.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noName.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/basic.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/styled.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/basic.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json create mode 100644 packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts create mode 100644 packages/core/src/api/tests/formatConversion/export/testExport.test.ts create mode 100644 packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts create mode 100644 packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts rename packages/core/src/api/{testUtil/partialBlockTestUtil.ts => tests/formatConversion/formatConversionTestUtil.ts} (93%) rename packages/core/src/api/{parsers/html/__snapshots__/parse-basic-block-types.json => tests/formatConversion/parse/__snapshots__/html/basicBlockTypes.json} (75%) create mode 100644 packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/codeBlocks.json rename packages/core/src/api/{exporters/html/__snapshots__/paste/parse-deep-nested-content.json => tests/formatConversion/parse/__snapshots__/html/deepNestedContent.json} (74%) rename packages/core/src/api/{parsers/html/__snapshots__/parse-divs.json => tests/formatConversion/parse/__snapshots__/html/divs.json} (72%) rename packages/core/src/api/{parsers/html/__snapshots__/parse-fake-image-caption.json => tests/formatConversion/parse/__snapshots__/html/fakeImageCaption.json} (73%) create mode 100644 packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/googleDocs.json rename packages/core/src/api/{parsers/html/__snapshots__/parse-image-in-paragraph.json => tests/formatConversion/parse/__snapshots__/html/imageInParagraph.json} (74%) rename packages/core/src/api/{exporters/html/__snapshots__/paste/parse-div-with-inline-content.json => tests/formatConversion/parse/__snapshots__/html/inlineContentAndNestedBlocks.json} (73%) rename packages/core/src/api/{parsers/html/__snapshots__/list-test.json => tests/formatConversion/parse/__snapshots__/html/lists.json} (75%) rename packages/core/src/api/{parsers/html/__snapshots__/parse-mixed-nested-lists.json => tests/formatConversion/parse/__snapshots__/html/mixedNestedLists.json} (76%) rename packages/core/src/api/{parsers/html/__snapshots__/parse-nested-lists.json => tests/formatConversion/parse/__snapshots__/html/nestedLists.json} (76%) rename packages/core/src/api/{parsers/html/__snapshots__/parse-nested-lists-with-paragraphs.json => tests/formatConversion/parse/__snapshots__/html/nestedListsWithParagraphs.json} (76%) rename packages/core/src/api/{parsers/html/__snapshots__/parse-notion-html.json => tests/formatConversion/parse/__snapshots__/html/notion.json} (75%) rename packages/core/src/api/{parsers/html/__snapshots__/parse-two-divs.json => tests/formatConversion/parse/__snapshots__/html/twoDivs.json} (72%) rename packages/core/src/api/{clipboard/__snapshots__/external/pasteEndOfParagraph.html => tests/formatConversion/parse/__snapshots__/html/twoTables.json} (71%) rename packages/core/src/api/{parsers/markdown/__snapshots__/non-nested.json => tests/formatConversion/parse/__snapshots__/markdown/basic.json} (74%) rename packages/core/src/api/{parsers/markdown/__snapshots__/whitespace bold.json => tests/formatConversion/parse/__snapshots__/markdown/boldWithWhitespace.json} (73%) rename packages/core/src/api/{parsers/markdown/__snapshots__ => tests/formatConversion/parse/__snapshots__/markdown}/complex.json (74%) rename packages/core/src/api/{parsers/markdown/__snapshots__/issue-226-1.json => tests/formatConversion/parse/__snapshots__/markdown/issue226case1.json} (74%) rename packages/core/src/api/{parsers/markdown/__snapshots__/issue-226-2.json => tests/formatConversion/parse/__snapshots__/markdown/issue226case2.json} (73%) rename packages/core/src/api/{parsers/markdown/__snapshots__ => tests/formatConversion/parse/__snapshots__/markdown}/nested.json (75%) rename packages/core/src/api/{parsers/markdown/__snapshots__ => tests/formatConversion/parse/__snapshots__/markdown}/styled.json (72%) rename packages/core/src/api/{parsers/html/parseHTML.test.ts => tests/formatConversion/parse/getParseTestCases.ts} (64%) create mode 100644 packages/core/src/api/tests/formatConversion/parse/testParse.test.ts create mode 100644 packages/core/src/api/tests/setupTestEditor.ts create mode 100644 packages/core/src/api/tests/testSchema.ts create mode 100644 tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-darwin.json create mode 100644 tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-darwin.json create mode 100644 tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-darwin.json diff --git a/packages/core/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html b/packages/core/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html deleted file mode 100644 index 0a607ca98c..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html +++ /dev/null @@ -1,138 +0,0 @@ -[ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "ParagraphParagraph", - "type": "text", - }, - ], - "id": "0", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, - { - "children": [], - "content": { - "columnWidths": [ - undefined, - undefined, - ], - "headerCols": undefined, - "headerRows": undefined, - "rows": [ - { - "cells": [ - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - ], - }, - { - "cells": [ - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - ], - }, - ], - "type": "tableContent", - }, - "id": "1", - "props": { - "textColor": "default", - }, - "type": "table", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Custom Paragraph", - "type": "text", - }, - ], - "id": "2", - "props": {}, - "type": "customParagraph", - }, - { - "children": [], - "content": [], - "id": "3", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, -] \ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/external/pasteImage.html b/packages/core/src/api/clipboard/__snapshots__/external/pasteImage.html deleted file mode 100644 index cab1cac6f1..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/external/pasteImage.html +++ /dev/null @@ -1,153 +0,0 @@ -[ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Paragraph", - "type": "text", - }, - ], - "id": "0", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, - { - "children": [], - "content": undefined, - "id": "4", - "props": { - "backgroundColor": "default", - "caption": "", - "name": "", - "previewWidth": 512, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - { - "children": [], - "content": { - "columnWidths": [ - undefined, - undefined, - ], - "headerCols": undefined, - "headerRows": undefined, - "rows": [ - { - "cells": [ - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - ], - }, - { - "cells": [ - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - ], - }, - ], - "type": "tableContent", - }, - "id": "1", - "props": { - "textColor": "default", - }, - "type": "table", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Custom Paragraph", - "type": "text", - }, - ], - "id": "2", - "props": {}, - "type": "customParagraph", - }, - { - "children": [], - "content": [], - "id": "3", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, -] \ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/external/pasteTable.html b/packages/core/src/api/clipboard/__snapshots__/external/pasteTable.html deleted file mode 100644 index b2724689d2..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/external/pasteTable.html +++ /dev/null @@ -1,233 +0,0 @@ -[ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Paragraph", - "type": "text", - }, - ], - "id": "0", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, - { - "children": [], - "content": { - "columnWidths": [ - undefined, - undefined, - ], - "headerCols": undefined, - "headerRows": undefined, - "rows": [ - { - "cells": [ - { - "content": [ - { - "styles": {}, - "text": "Cell 1", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - { - "content": [ - { - "styles": {}, - "text": "Cell 2", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - ], - }, - { - "cells": [ - { - "content": [ - { - "styles": {}, - "text": "Cell 3", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - { - "content": [ - { - "styles": {}, - "text": "Cell 4", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - ], - }, - ], - "type": "tableContent", - }, - "id": "4", - "props": { - "textColor": "default", - }, - "type": "table", - }, - { - "children": [], - "content": { - "columnWidths": [ - undefined, - undefined, - ], - "headerCols": undefined, - "headerRows": undefined, - "rows": [ - { - "cells": [ - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - ], - }, - { - "cells": [ - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - { - "content": [ - { - "styles": {}, - "text": "Table Cell", - "type": "text", - }, - ], - "props": { - "backgroundColor": "default", - "colspan": 1, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "tableCell", - }, - ], - }, - ], - "type": "tableContent", - }, - "id": "1", - "props": { - "textColor": "default", - }, - "type": "table", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Custom Paragraph", - "type": "text", - }, - ], - "id": "2", - "props": {}, - "type": "customParagraph", - }, - { - "children": [], - "content": [], - "id": "3", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, -] \ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/basicBlocks.html b/packages/core/src/api/clipboard/__snapshots__/internal/basicBlocks.html deleted file mode 100644 index ca208287e2..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/basicBlocks.html +++ /dev/null @@ -1 +0,0 @@ -

Paragraph

Heading

  1. Numbered List Item

console.log("Hello World");

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Add image

\ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/basicBlocksWithProps.html b/packages/core/src/api/clipboard/__snapshots__/internal/basicBlocksWithProps.html deleted file mode 100644 index eeaec68e38..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/basicBlocksWithProps.html +++ /dev/null @@ -1 +0,0 @@ -

Paragraph

Heading

  1. Numbered List Item

console.log("Hello World");

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

1280px-Placeholder_view_vector.svg.png
Placeholder

\ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/childToParent.html b/packages/core/src/api/clipboard/__snapshots__/internal/childToParent.html deleted file mode 100644 index a899fb60fe..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/childToParent.html +++ /dev/null @@ -1 +0,0 @@ -

Heading 1

Nested Paragraph 1

\ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/childrenToNextParent.html b/packages/core/src/api/clipboard/__snapshots__/internal/childrenToNextParent.html deleted file mode 100644 index 851b8973d6..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/childrenToNextParent.html +++ /dev/null @@ -1 +0,0 @@ -

Nested Paragraph 1

Nested Paragraph 2

Nested Paragraph 3

Heading 2

\ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/childrenToNextParentsChildren.html b/packages/core/src/api/clipboard/__snapshots__/internal/childrenToNextParentsChildren.html deleted file mode 100644 index ba81a3a20a..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/childrenToNextParentsChildren.html +++ /dev/null @@ -1 +0,0 @@ -

Nested Paragraph 1

Nested Paragraph 2

Nested Paragraph 3

Heading 2

Nested Paragraph 1

Nested Paragraph 2

Nested Paragraph 3

\ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/multipleStyledText.html b/packages/core/src/api/clipboard/__snapshots__/internal/multipleStyledText.html deleted file mode 100644 index a9991463bc..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/multipleStyledText.html +++ /dev/null @@ -1 +0,0 @@ -BoldItalicRegular \ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/nestedImage.html b/packages/core/src/api/clipboard/__snapshots__/internal/nestedImage.html deleted file mode 100644 index 4e181d251c..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/nestedImage.html +++ /dev/null @@ -1 +0,0 @@ -

BoldItalicRegular

BlockNote image

Nested Paragraph

\ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html b/packages/core/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html deleted file mode 100644 index c5c4d1fc71..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html +++ /dev/null @@ -1 +0,0 @@ -Paragraph \ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/partialChildToParent.html b/packages/core/src/api/clipboard/__snapshots__/internal/partialChildToParent.html deleted file mode 100644 index f4d82fbae5..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/partialChildToParent.html +++ /dev/null @@ -1 +0,0 @@ -

ding 1

Nested

\ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/styledText.html b/packages/core/src/api/clipboard/__snapshots__/internal/styledText.html deleted file mode 100644 index 03d564343b..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/styledText.html +++ /dev/null @@ -1 +0,0 @@ -Italic \ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/tableAllCells.html b/packages/core/src/api/clipboard/__snapshots__/internal/tableAllCells.html deleted file mode 100644 index 5a0ce46217..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/tableAllCells.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/tableCell.html b/packages/core/src/api/clipboard/__snapshots__/internal/tableCell.html deleted file mode 100644 index c4cc0e05d3..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/tableCell.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/tableCellText.html b/packages/core/src/api/clipboard/__snapshots__/internal/tableCellText.html deleted file mode 100644 index cd55158ac5..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/tableCellText.html +++ /dev/null @@ -1 +0,0 @@ -Table Cell \ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/tableRow.html b/packages/core/src/api/clipboard/__snapshots__/internal/tableRow.html deleted file mode 100644 index ffa15acbb9..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/tableRow.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/unstyledText.html b/packages/core/src/api/clipboard/__snapshots__/internal/unstyledText.html deleted file mode 100644 index ea9503c08c..0000000000 --- a/packages/core/src/api/clipboard/__snapshots__/internal/unstyledText.html +++ /dev/null @@ -1 +0,0 @@ -Regular \ No newline at end of file diff --git a/packages/core/src/api/clipboard/clipboardExternal.test.ts b/packages/core/src/api/clipboard/clipboardExternal.test.ts deleted file mode 100644 index 97ad51bedc..0000000000 --- a/packages/core/src/api/clipboard/clipboardExternal.test.ts +++ /dev/null @@ -1,161 +0,0 @@ -import { Node } from "prosemirror-model"; -import { Selection, TextSelection } from "prosemirror-state"; -import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest"; - -import { PartialBlock } from "../../blocks/defaultBlocks.js"; -import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js"; -import { initializeESMDependencies } from "../../util/esmDependencies.js"; -import { doPaste } from "../testUtil/paste.js"; -import { schema } from "./testUtil.js"; - -type SelectionTestCase = { - testName: string; - createSelection: (doc: Node) => Selection; -} & ( - | { - html: string; - } - | { - plainText: string; - } -); - -// These tests are meant to test the pasting of external HTML in the editor. -// Each test case has an HTML string to be pasted, and a selection in the editor -// to paste at. -describe("Test external clipboard HTML", () => { - const initialContent: PartialBlock[] = [ - { - type: "paragraph", - content: "Paragraph", - }, - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: ["Table Cell", "Table Cell"], - }, - { - cells: ["Table Cell", "Table Cell"], - }, - ], - }, - }, - { - type: "customParagraph", - content: "Custom Paragraph", - }, - { - type: "paragraph", - }, - ]; - - let editor: BlockNoteEditor; - const div = document.createElement("div"); - - beforeEach(() => { - editor.replaceBlocks(editor.document, initialContent); - }); - - beforeAll(async () => { - (window as any).__TEST_OPTIONS = (window as any).__TEST_OPTIONS || {}; - - editor = BlockNoteEditor.create({ schema }); - editor.mount(div); - - await initializeESMDependencies(); - }); - - afterAll(() => { - editor.mount(undefined); - editor._tiptapEditor.destroy(); - editor = undefined as any; - - delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS; - }); - - // Sets the editor selection to the given start and end positions, then - // pastes the HTML and compares it the document after to a snapshot. - async function testPasteExternalHTML(testCase: SelectionTestCase) { - if (!editor.prosemirrorView) { - throw new Error("Editor view not initialized."); - } - - editor.dispatch( - editor._tiptapEditor.state.tr.setSelection( - testCase.createSelection(editor.prosemirrorView.state.doc) - ) - ); - - doPaste( - editor.prosemirrorView, - "plainText" in testCase ? testCase.plainText : "", - "html" in testCase ? testCase.html : "", - "plainText" in testCase, - new ClipboardEvent("paste") - ); - - await expect(editor.document).toMatchFileSnapshot( - `./__snapshots__/external/${testCase.testName}.html` - ); - } - - const testCases: SelectionTestCase[] = [ - { - testName: "pasteEndOfParagraph", - createSelection: (doc) => TextSelection.create(doc, 12), - html: `

Paragraph

`, - }, - { - testName: "pasteEndOfParagraphText", - createSelection: (doc) => TextSelection.create(doc, 12), - plainText: `Paragraph`, - }, - { - testName: "pasteImage", - createSelection: (doc) => TextSelection.create(doc, 12), - html: ``, - }, - { - testName: "pasteTable", - createSelection: (doc) => TextSelection.create(doc, 12), - html: ` - - - - - - - - -
Cell 1Cell 2
Cell 3Cell 4
`, - }, - { - testName: "pasteTableInExistingTable", - createSelection: (doc) => TextSelection.create(doc, 73), - html: ` - - - - - - - - -
Cell 1Cell 2
Cell 3Cell 4
`, - }, - { - testName: "pasteParagraphInCustomBlock", - createSelection: (doc) => TextSelection.create(doc, 80, 96), - html: `

Paragraph

`, - }, - ]; - - for (const testCase of testCases) { - it(`${testCase.testName}`, async () => { - await testPasteExternalHTML(testCase); - }); - } -}); diff --git a/packages/core/src/api/clipboard/clipboardInternal.test.ts b/packages/core/src/api/clipboard/clipboardInternal.test.ts deleted file mode 100644 index 9f958ee60f..0000000000 --- a/packages/core/src/api/clipboard/clipboardInternal.test.ts +++ /dev/null @@ -1,435 +0,0 @@ -import { Node } from "prosemirror-model"; -import { NodeSelection, Selection, TextSelection } from "prosemirror-state"; -import { CellSelection } from "prosemirror-tables"; -import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest"; - -import { PartialBlock } from "../../blocks/defaultBlocks.js"; -import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js"; -import { initializeESMDependencies } from "../../util/esmDependencies.js"; -import { doPaste } from "../testUtil/paste.js"; -import { schema } from "./testUtil.js"; -import { selectedFragmentToHTML } from "./toClipboard/copyExtension.js"; - -type SelectionTestCase = { - testName: string; - createCopySelection: (doc: Node) => Selection; - createPasteSelection?: (doc: Node) => Selection; -}; - -// These tests are meant to test the copying of user selections in the editor. -// The test cases used for the other HTML conversion tests are not suitable here -// as they are represented in the BlockNote API, whereas here we want to test -// ProseMirror/TipTap selections directly. -describe("Test ProseMirror selection clipboard HTML", () => { - const initialContent: PartialBlock[] = [ - { - type: "heading", - props: { - level: 2, - textColor: "red", - }, - content: "Heading 1", - children: [ - { - type: "paragraph", - content: "Nested Paragraph 1", - }, - { - type: "paragraph", - content: "Nested Paragraph 2", - }, - { - type: "paragraph", - content: "Nested Paragraph 3", - }, - ], - }, - { - type: "heading", - props: { - level: 2, - textColor: "red", - }, - content: "Heading 2", - children: [ - { - type: "paragraph", - content: "Nested Paragraph 1", - }, - { - type: "paragraph", - content: "Nested Paragraph 2", - }, - { - type: "paragraph", - content: "Nested Paragraph 3", - }, - ], - }, - { - type: "heading", - props: { - level: 2, - textColor: "red", - }, - content: [ - { - type: "text", - text: "Bold", - styles: { - bold: true, - }, - }, - { - type: "text", - text: "Italic", - styles: { - italic: true, - }, - }, - { - type: "text", - text: "Regular", - styles: {}, - }, - ], - children: [ - { - type: "image", - props: { - url: "https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg", - }, - children: [ - { - type: "paragraph", - content: "Nested Paragraph", - }, - ], - }, - ], - }, - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: ["Table Cell", "Table Cell"], - }, - { - cells: ["Table Cell", "Table Cell"], - }, - ], - }, - // Not needed as selections starting in table cells will get snapped to - // the table boundaries. - // children: [ - // { - // type: "table", - // content: { - // type: "tableContent", - // rows: [ - // { - // cells: ["Table Cell", "Table Cell"], - // }, - // { - // cells: ["Table Cell", "Table Cell"], - // }, - // ], - // }, - // }, - // ], - }, - { - type: "paragraph", - content: "Paragraph", - }, - { - type: "customParagraph", - content: "Paragraph", - }, - { - type: "paragraph", - content: "Paragraph", - }, - { - type: "heading", - content: "Heading", - }, - { - type: "numberedListItem", - content: "Numbered List Item", - }, - { - type: "bulletListItem", - content: "Bullet List Item", - }, - { - type: "checkListItem", - content: "Check List Item", - }, - { - type: "codeBlock", - content: 'console.log("Hello World");', - }, - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]], - }, - { - cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]], - }, - { - cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]], - }, - ], - }, - }, - { - type: "image", - }, - { - type: "paragraph", - props: { - textColor: "red", - }, - content: "Paragraph", - }, - { - type: "heading", - props: { - level: 2, - }, - content: "Heading", - }, - { - type: "numberedListItem", - props: { - start: 2, - }, - content: "Numbered List Item", - }, - { - type: "bulletListItem", - props: { - backgroundColor: "red", - }, - content: "Bullet List Item", - }, - { - type: "checkListItem", - props: { - checked: true, - }, - content: "Check List Item", - }, - { - type: "codeBlock", - props: { - language: "typescript", - }, - content: 'console.log("Hello World");', - }, - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]], - }, - { - cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]], - }, - { - cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]], - }, - ], - }, - }, - { - type: "image", - props: { - name: "1280px-Placeholder_view_vector.svg.png", - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/Placeholder_view_vector.svg/1280px-Placeholder_view_vector.svg.png", - caption: "Placeholder", - showPreview: true, - previewWidth: 256, - }, - }, - { - type: "paragraph", - }, - ]; - - let editor: BlockNoteEditor; - const div = document.createElement("div"); - - beforeEach(() => { - editor.replaceBlocks(editor.document, initialContent); - }); - - beforeAll(async () => { - (window as any).__TEST_OPTIONS = (window as any).__TEST_OPTIONS || {}; - - editor = BlockNoteEditor.create({ schema }); - editor.mount(div); - - await initializeESMDependencies(); - }); - - afterAll(() => { - editor.mount(undefined); - editor._tiptapEditor.destroy(); - editor = undefined as any; - - delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS; - }); - - // Sets the editor selection to the given start and end positions, then - // exports the selected content to HTML and compares it to a snapshot. - async function testSelection(testCase: SelectionTestCase) { - if (!editor.prosemirrorView) { - throw new Error("Editor view not initialized."); - } - - editor.dispatch( - editor._tiptapEditor.state.tr.setSelection( - testCase.createCopySelection(editor.prosemirrorView.state.doc) - ) - ); - - const { clipboardHTML, externalHTML } = selectedFragmentToHTML( - editor.prosemirrorView, - editor - ); - - await expect(externalHTML).toMatchFileSnapshot( - `./__snapshots__/internal/${testCase.testName}.html` - ); - - if (testCase.createPasteSelection) { - editor.dispatch( - editor._tiptapEditor.state.tr.setSelection( - testCase.createPasteSelection(editor.prosemirrorView.state.doc) - ) - ); - } - - const originalDocument = editor.document; - doPaste( - editor.prosemirrorView, - "text", - clipboardHTML, - false, - new ClipboardEvent("paste") - ); - const newDocument = editor.document; - - expect(newDocument).toStrictEqual(originalDocument); - } - - const testCases: SelectionTestCase[] = [ - // TODO: Consider adding test cases for nested blocks & double nested blocks. - // Copy/paste all of first heading's children. - { - testName: "multipleChildren", - createCopySelection: (doc) => TextSelection.create(doc, 16, 78), - }, - // Copy/paste from start of first heading to end of its first child. - { - testName: "childToParent", - createCopySelection: (doc) => TextSelection.create(doc, 3, 34), - }, - // Copy/paste from middle of first heading to the middle of its first child. - { - testName: "partialChildToParent", - createCopySelection: (doc) => TextSelection.create(doc, 6, 23), - }, - // Copy/paste from start of first heading's first child to end of second - // heading's content (does not include second heading's children). - { - testName: "childrenToNextParent", - createCopySelection: (doc) => TextSelection.create(doc, 16, 93), - }, - // Copy/paste from start of first heading's first child to end of second - // heading's last child. - { - testName: "childrenToNextParentsChildren", - createCopySelection: (doc) => TextSelection.create(doc, 16, 159), - }, - // Copy/paste "Regular" text inside third heading. - { - testName: "unstyledText", - createCopySelection: (doc) => TextSelection.create(doc, 175, 182), - }, - // Copy/paste "Italic" text inside third heading. - { - testName: "styledText", - createCopySelection: (doc) => TextSelection.create(doc, 169, 175), - }, - // Copy/paste third heading's content (does not include third heading's - // children). - { - testName: "multipleStyledText", - createCopySelection: (doc) => TextSelection.create(doc, 165, 182), - }, - // Copy/paste the image block content. - { - testName: "image", - createCopySelection: (doc) => NodeSelection.create(doc, 185), - }, - // Copy/paste from start of third heading to end of it's last descendant. - { - testName: "nestedImage", - createCopySelection: (doc) => TextSelection.create(doc, 165, 205), - }, - // Copy/paste text in first cell of the table. - { - testName: "tableCellText", - createCopySelection: (doc) => TextSelection.create(doc, 216, 226), - }, - // Copy/paste first cell of the table. - // TODO: External HTML is wrapped in unnecessary `tr` element. - { - testName: "tableCell", - createCopySelection: (doc) => CellSelection.create(doc, 214), - }, - // Copy/paste first row of the table. - { - testName: "tableRow", - createCopySelection: (doc) => CellSelection.create(doc, 214, 228), - }, - // Copy/paste all cells of the table. - { - testName: "tableAllCells", - createCopySelection: (doc) => CellSelection.create(doc, 214, 258), - }, - // Copy regular paragraph content and paste over custom block content. - { - testName: "paragraphInCustomBlock", - createCopySelection: (doc) => TextSelection.create(doc, 277, 286), - createPasteSelection: (doc) => TextSelection.create(doc, 290, 299), - }, - // Copy/paste basic blocks. - { - testName: "basicBlocks", - createCopySelection: (doc) => TextSelection.create(doc, 303, 558), - }, - // Copy/paste basic blocks with props. - { - testName: "basicBlocksWithProps", - createCopySelection: (doc) => TextSelection.create(doc, 558, 813), - }, - ]; - - for (const testCase of testCases) { - it(`${testCase.testName}`, async () => { - await testSelection(testCase); - }); - } -}); diff --git a/packages/core/src/api/clipboard/testUtil.ts b/packages/core/src/api/clipboard/testUtil.ts deleted file mode 100644 index 33bcf8305b..0000000000 --- a/packages/core/src/api/clipboard/testUtil.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createBlockSpec } from "../../schema/index.js"; -import { BlockNoteSchema } from "../../editor/BlockNoteSchema.js"; -import { defaultBlockSpecs } from "../../blocks/defaultBlocks.js"; - -const CustomParagraph = createBlockSpec( - { - type: "customParagraph", - content: "inline", - propSchema: {}, - }, - { - render: () => { - const customParagraph = document.createElement("p"); - - return { - dom: customParagraph, - contentDOM: customParagraph, - }; - }, - } -); -export const schema = BlockNoteSchema.create({ - blockSpecs: { - ...defaultBlockSpecs, - customParagraph: CustomParagraph as any, - }, -}); diff --git a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/contains-newlines/internal.html b/packages/core/src/api/exporters/html/__snapshots__/codeBlock/contains-newlines/internal.html deleted file mode 100644 index d8a93830eb..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/contains-newlines/internal.html +++ /dev/null @@ -1,3 +0,0 @@ -
const hello = 'world';
-console.log(hello);
-
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/internal.html b/packages/core/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/internal.html deleted file mode 100644 index ef3a373f9a..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/internal.html +++ /dev/null @@ -1 +0,0 @@ -
console.log('Hello, world!');
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/empty/internal.html b/packages/core/src/api/exporters/html/__snapshots__/codeBlock/empty/internal.html deleted file mode 100644 index abe6b97dc8..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/empty/internal.html +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/python/internal.html b/packages/core/src/api/exporters/html/__snapshots__/codeBlock/python/internal.html deleted file mode 100644 index fee165d05a..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/python/internal.html +++ /dev/null @@ -1 +0,0 @@ -
print('Hello, world!')
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/complex/misc/internal.html b/packages/core/src/api/exporters/html/__snapshots__/complex/misc/internal.html deleted file mode 100644 index efec8f89d3..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/complex/misc/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Heading 2

Paragraph

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/customBlock/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/customBlock/basic/external.html deleted file mode 100644 index 2e4d2094e3..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/customBlock/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -
Custom customBlock
Custom customBlock
with
line breaks
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/customBlock/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/customBlock/basic/internal.html deleted file mode 100644 index 382b54c065..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/customBlock/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -
Custom customBlock
Custom customBlock
with
line breaks
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/customParagraph/basic/external.html deleted file mode 100644 index 1930c65a95..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -

Hello World

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/customParagraph/basic/internal.html deleted file mode 100644 index 46cfe14e45..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Custom Paragraph

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/external.html b/packages/core/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/external.html deleted file mode 100644 index 1930c65a95..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/external.html +++ /dev/null @@ -1 +0,0 @@ -

Hello World

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/internal.html b/packages/core/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/internal.html deleted file mode 100644 index a004965707..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Line 1
Line 2

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/nested/external.html b/packages/core/src/api/exporters/html/__snapshots__/customParagraph/nested/external.html deleted file mode 100644 index d1017bf473..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/nested/external.html +++ /dev/null @@ -1 +0,0 @@ -

Hello World

Hello World

Hello World

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/nested/internal.html b/packages/core/src/api/exporters/html/__snapshots__/customParagraph/nested/internal.html deleted file mode 100644 index 7688d5c7c0..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Custom Paragraph

Nested Custom Paragraph 1

Nested Custom Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/styled/external.html b/packages/core/src/api/exporters/html/__snapshots__/customParagraph/styled/external.html deleted file mode 100644 index d56197b21a..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/styled/external.html +++ /dev/null @@ -1 +0,0 @@ -

Hello World

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/styled/internal.html b/packages/core/src/api/exporters/html/__snapshots__/customParagraph/styled/internal.html deleted file mode 100644 index aec9bca191..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/customParagraph/styled/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/file/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/file/basic/internal.html deleted file mode 100644 index a219d1be53..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/file/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/file/button/internal.html b/packages/core/src/api/exporters/html/__snapshots__/file/button/internal.html deleted file mode 100644 index 8b639920d1..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/file/button/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Add file

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/file/nested/internal.html b/packages/core/src/api/exporters/html/__snapshots__/file/nested/internal.html deleted file mode 100644 index 72208b450c..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/file/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -

example

Caption

example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/file/noCaption/internal.html b/packages/core/src/api/exporters/html/__snapshots__/file/noCaption/internal.html deleted file mode 100644 index 490e9fead0..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/file/noCaption/internal.html +++ /dev/null @@ -1 +0,0 @@ -

example

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/file/noName/internal.html b/packages/core/src/api/exporters/html/__snapshots__/file/noName/internal.html deleted file mode 100644 index c16f385f31..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/file/noName/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/external.html deleted file mode 100644 index f6e857fdfe..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -

This is text with a custom fontSize

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/internal.html deleted file mode 100644 index 717b1ad7d4..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

This is text with a custom fontSize

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/hardbreak/basic/internal.html deleted file mode 100644 index a88858f652..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Text1
Text2

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/between-links/internal.html b/packages/core/src/api/exporters/html/__snapshots__/hardbreak/between-links/internal.html deleted file mode 100644 index f710f08741..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/between-links/internal.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/end/internal.html b/packages/core/src/api/exporters/html/__snapshots__/hardbreak/end/internal.html deleted file mode 100644 index d441ef69af..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/end/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Text1

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/link/internal.html b/packages/core/src/api/exporters/html/__snapshots__/hardbreak/link/internal.html deleted file mode 100644 index eb0b99808d..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/link/internal.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/multiple/internal.html b/packages/core/src/api/exporters/html/__snapshots__/hardbreak/multiple/internal.html deleted file mode 100644 index 5ae6ac8b30..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/multiple/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Text1
Text2
Text3

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/only/internal.html b/packages/core/src/api/exporters/html/__snapshots__/hardbreak/only/internal.html deleted file mode 100644 index c78443c0ac..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/only/internal.html +++ /dev/null @@ -1 +0,0 @@ -


\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/start/internal.html b/packages/core/src/api/exporters/html/__snapshots__/hardbreak/start/internal.html deleted file mode 100644 index 436596e499..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/start/internal.html +++ /dev/null @@ -1 +0,0 @@ -


Text1

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/styles/internal.html b/packages/core/src/api/exporters/html/__snapshots__/hardbreak/styles/internal.html deleted file mode 100644 index f08d9c579f..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/styles/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Text1
Text2

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/image/basic/external.html deleted file mode 100644 index 9295cf8f38..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/image/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -
example
Caption
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/image/basic/internal.html deleted file mode 100644 index 4861c132e7..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/image/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -
example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/button/internal.html b/packages/core/src/api/exporters/html/__snapshots__/image/button/internal.html deleted file mode 100644 index 1af0abaabd..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/image/button/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Add image

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/nested/external.html b/packages/core/src/api/exporters/html/__snapshots__/image/nested/external.html deleted file mode 100644 index 9c87fef63d..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/image/nested/external.html +++ /dev/null @@ -1 +0,0 @@ -
Caption
Caption
Caption
Caption
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/nested/internal.html b/packages/core/src/api/exporters/html/__snapshots__/image/nested/internal.html deleted file mode 100644 index 41ce95a083..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/image/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -
Caption

Caption

Caption

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/noCaption/external.html b/packages/core/src/api/exporters/html/__snapshots__/image/noCaption/external.html deleted file mode 100644 index 22408bfc12..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/image/noCaption/external.html +++ /dev/null @@ -1 +0,0 @@ -example \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/noCaption/internal.html b/packages/core/src/api/exporters/html/__snapshots__/image/noCaption/internal.html deleted file mode 100644 index 416651286a..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/image/noCaption/internal.html +++ /dev/null @@ -1 +0,0 @@ -
example
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/noName/external.html b/packages/core/src/api/exporters/html/__snapshots__/image/noName/external.html deleted file mode 100644 index df180bf54e..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/image/noName/external.html +++ /dev/null @@ -1 +0,0 @@ -
Caption
Caption
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/noName/internal.html b/packages/core/src/api/exporters/html/__snapshots__/image/noName/internal.html deleted file mode 100644 index 4ca54f0aea..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/image/noName/internal.html +++ /dev/null @@ -1 +0,0 @@ -
Caption

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/noPreview/internal.html b/packages/core/src/api/exporters/html/__snapshots__/image/noPreview/internal.html deleted file mode 100644 index a91118a162..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +++ /dev/null @@ -1 +0,0 @@ -

example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/link/adjacent/internal.html b/packages/core/src/api/exporters/html/__snapshots__/link/adjacent/internal.html deleted file mode 100644 index e11c631cac..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/link/adjacent/internal.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/link/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/link/basic/internal.html deleted file mode 100644 index 5d7d50c2bc..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/link/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/link/styled/internal.html b/packages/core/src/api/exporters/html/__snapshots__/link/styled/internal.html deleted file mode 100644 index 84e54b7e4a..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/link/styled/internal.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/lists/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/lists/basic/internal.html deleted file mode 100644 index 5c8448a855..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/lists/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Bullet List Item 1

Bullet List Item 2

Numbered List Item 1

Numbered List Item 2

Check List Item 1

Check List Item 2

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/lists/nested/internal.html b/packages/core/src/api/exporters/html/__snapshots__/lists/nested/internal.html deleted file mode 100644 index 47dc2ccffc..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/lists/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Bullet List Item 1

Bullet List Item 2

Numbered List Item 1

Numbered List Item 2

Check List Item 1

Check List Item 2

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/mention/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/mention/basic/external.html deleted file mode 100644 index 967b6d2fd7..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/mention/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -

I enjoy working with @Matthew

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/mention/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/mention/basic/internal.html deleted file mode 100644 index fa3e3e8414..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/mention/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

I enjoy working with @Matthew

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/pageBreak/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/pageBreak/basic/external.html deleted file mode 100644 index ba65bb0620..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/pageBreak/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/pageBreak/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/pageBreak/basic/internal.html deleted file mode 100644 index f4303a5ad1..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/pageBreak/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paragraph/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/paragraph/basic/internal.html deleted file mode 100644 index 7a7fe019c2..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/paragraph/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Paragraph

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paragraph/empty/internal.html b/packages/core/src/api/exporters/html/__snapshots__/paragraph/empty/internal.html deleted file mode 100644 index 96547312cd..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/paragraph/empty/internal.html +++ /dev/null @@ -1 +0,0 @@ -

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/internal.html b/packages/core/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/internal.html deleted file mode 100644 index 4463caa33e..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Line 1
Line 2

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paragraph/nested/internal.html b/packages/core/src/api/exporters/html/__snapshots__/paragraph/nested/internal.html deleted file mode 100644 index 79557fb3a3..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/paragraph/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Paragraph

Nested Paragraph 1

Nested Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paragraph/styled/internal.html b/packages/core/src/api/exporters/html/__snapshots__/paragraph/styled/internal.html deleted file mode 100644 index fa01c74894..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/paragraph/styled/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-basic-block-types.json b/packages/core/src/api/exporters/html/__snapshots__/paste/parse-basic-block-types.json deleted file mode 100644 index 2d11e081f6..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-basic-block-types.json +++ /dev/null @@ -1,140 +0,0 @@ -[ - { - "id": "1", - "type": "heading", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left", - "level": 1 - }, - "content": [ - { - "type": "text", - "text": "Heading 1", - "styles": {} - } - ], - "children": [] - }, - { - "id": "2", - "type": "heading", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left", - "level": 2 - }, - "content": [ - { - "type": "text", - "text": "Heading 2", - "styles": {} - } - ], - "children": [] - }, - { - "id": "3", - "type": "heading", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left", - "level": 3 - }, - "content": [ - { - "type": "text", - "text": "Heading 3", - "styles": {} - } - ], - "children": [] - }, - { - "id": "4", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Paragraph", - "styles": {} - } - ], - "children": [] - }, - { - "id": "5", - "type": "image", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "url": "exampleURL", - "caption": "Image Caption", - "width": 512 - }, - "children": [] - }, - { - "id": "6", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "None ", - "styles": {} - }, - { - "type": "text", - "text": "Bold ", - "styles": { - "bold": true - } - }, - { - "type": "text", - "text": "Italic ", - "styles": { - "italic": true - } - }, - { - "type": "text", - "text": "Underline ", - "styles": { - "underline": true - } - }, - { - "type": "text", - "text": "Strikethrough ", - "styles": { - "strike": true - } - }, - { - "type": "text", - "text": "All", - "styles": { - "bold": true, - "italic": true, - "underline": true, - "strike": true - } - } - ], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-mixed-nested-lists.json b/packages/core/src/api/exporters/html/__snapshots__/paste/parse-mixed-nested-lists.json deleted file mode 100644 index 1acc524e82..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-mixed-nested-lists.json +++ /dev/null @@ -1,70 +0,0 @@ -[ - { - "id": "1", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "2", - "type": "numberedListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Nested Numbered List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "3", - "type": "numberedListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Nested Numbered List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "4", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-nested-lists-with-paragraphs.json b/packages/core/src/api/exporters/html/__snapshots__/paste/parse-nested-lists-with-paragraphs.json deleted file mode 100644 index 6c5bcf5056..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-nested-lists-with-paragraphs.json +++ /dev/null @@ -1,70 +0,0 @@ -[ - { - "id": "1", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "2", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Nested Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "3", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Nested Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "4", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-nested-lists.json b/packages/core/src/api/exporters/html/__snapshots__/paste/parse-nested-lists.json deleted file mode 100644 index 6c5bcf5056..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-nested-lists.json +++ /dev/null @@ -1,70 +0,0 @@ -[ - { - "id": "1", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "2", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Nested Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "3", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Nested Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "4", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/external.html deleted file mode 100644 index eff23b23a3..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -

Custom Paragraph

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/internal.html deleted file mode 100644 index d8f1f1cf02..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Custom Paragraph

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/external.html deleted file mode 100644 index 7f3f7817a5..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/external.html +++ /dev/null @@ -1 +0,0 @@ -

Custom Paragraph

Nested Custom Paragraph 1

Nested Custom Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/internal.html deleted file mode 100644 index 8dfb4fdd8a..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Custom Paragraph

Nested Custom Paragraph 1

Nested Custom Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/external.html deleted file mode 100644 index 639e0a20bd..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/external.html +++ /dev/null @@ -1 +0,0 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/internal.html deleted file mode 100644 index c0922dcb84..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleFile/basic/external.html deleted file mode 100644 index a7d4b8d146..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -
exampleURL

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleFile/basic/internal.html deleted file mode 100644 index 7f5bec940c..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -
exampleURL

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/button/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleFile/button/external.html deleted file mode 100644 index 26f6f1a3ea..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/button/external.html +++ /dev/null @@ -1 +0,0 @@ -

Add file

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/button/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleFile/button/internal.html deleted file mode 100644 index 3933e1ccf3..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/button/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Add file

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/nested/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleFile/nested/external.html deleted file mode 100644 index e0cffe581c..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/nested/external.html +++ /dev/null @@ -1 +0,0 @@ -
exampleURL

Caption

exampleURL

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/nested/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleFile/nested/internal.html deleted file mode 100644 index 079d157fe0..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleFile/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -
exampleURL

Caption

exampleURL

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html deleted file mode 100644 index 76bc3d4ceb..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -
example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html deleted file mode 100644 index 7e827005d2..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -
example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/button/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/button/external.html deleted file mode 100644 index b8f59a9535..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/button/external.html +++ /dev/null @@ -1 +0,0 @@ -

Add image

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/button/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/button/internal.html deleted file mode 100644 index 89600026f7..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/button/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Add image

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html deleted file mode 100644 index 773dd9cb8f..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +++ /dev/null @@ -1 +0,0 @@ -
example

Caption

example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html deleted file mode 100644 index ffedb462fa..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -
example

Caption

example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html deleted file mode 100644 index 2a44ef4fc3..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +++ /dev/null @@ -1 +0,0 @@ -
example
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html deleted file mode 100644 index a594242e00..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html +++ /dev/null @@ -1 +0,0 @@ -
example
\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html deleted file mode 100644 index fb302b1c46..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +++ /dev/null @@ -1 +0,0 @@ -
Caption

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html deleted file mode 100644 index 0afeec0b4f..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +++ /dev/null @@ -1 +0,0 @@ -
Caption

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html deleted file mode 100644 index e32f659eac..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +++ /dev/null @@ -1 +0,0 @@ -

example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html b/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html deleted file mode 100644 index 12568d4971..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html +++ /dev/null @@ -1 +0,0 @@ -

example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/small/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/small/basic/external.html deleted file mode 100644 index 8bfcd2ed1d..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/small/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -

This is a small text

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/small/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/small/basic/internal.html deleted file mode 100644 index 2c4b0446df..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/small/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

This is a small text

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/allColWidths/internal.html b/packages/core/src/api/exporters/html/__snapshots__/table/allColWidths/internal.html deleted file mode 100644 index 7247411a1e..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/table/allColWidths/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/table/basic/internal.html deleted file mode 100644 index f00383b3d6..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/table/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/headerCols/internal.html b/packages/core/src/api/exporters/html/__snapshots__/table/headerCols/internal.html deleted file mode 100644 index 972eb90512..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/table/headerCols/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/headerRows/internal.html b/packages/core/src/api/exporters/html/__snapshots__/table/headerRows/internal.html deleted file mode 100644 index b07ff89563..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/table/headerRows/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/headersRows/external.html b/packages/core/src/api/exporters/html/__snapshots__/table/headersRows/external.html deleted file mode 100644 index 4c1d3e7203..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/table/headersRows/external.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/headersRows/internal.html b/packages/core/src/api/exporters/html/__snapshots__/table/headersRows/internal.html deleted file mode 100644 index 95f848187d..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/table/headersRows/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/mixedCellColors/internal.html b/packages/core/src/api/exporters/html/__snapshots__/table/mixedCellColors/internal.html deleted file mode 100644 index 10e00b6852..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/table/mixedCellColors/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/mixedColWidths/internal.html b/packages/core/src/api/exporters/html/__snapshots__/table/mixedColWidths/internal.html deleted file mode 100644 index b2b6765da5..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/table/mixedColWidths/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/mixedRowspansAndColspans/internal.html b/packages/core/src/api/exporters/html/__snapshots__/table/mixedRowspansAndColspans/internal.html deleted file mode 100644 index 49f80e058f..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/table/mixedRowspansAndColspans/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/tag/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/tag/basic/external.html deleted file mode 100644 index d6e63c9cec..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/tag/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -

I love #BlockNote

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/tag/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/tag/basic/internal.html deleted file mode 100644 index dcb80c2f33..0000000000 --- a/packages/core/src/api/exporters/html/__snapshots__/tag/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

I love #BlockNote

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/htmlConversion.test.ts b/packages/core/src/api/exporters/html/htmlConversion.test.ts deleted file mode 100644 index efae08cc13..0000000000 --- a/packages/core/src/api/exporters/html/htmlConversion.test.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it } from "vitest"; - -import { PartialBlock } from "../../../blocks/defaultBlocks.js"; -import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js"; -import { - addIdsToBlocks, - partialBlocksToBlocksForTesting, -} from "../../../index.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../schema/index.js"; -import { initializeESMDependencies } from "../../../util/esmDependencies.js"; -import { customBlocksTestCases } from "../../testUtil/cases/customBlocks.js"; -import { customInlineContentTestCases } from "../../testUtil/cases/customInlineContent.js"; -import { customStylesTestCases } from "../../testUtil/cases/customStyles.js"; -import { defaultSchemaTestCases } from "../../testUtil/cases/defaultSchema.js"; -import { createExternalHTMLExporter } from "./externalHTMLExporter.js"; -import { createInternalHTMLSerializer } from "./internalHTMLSerializer.js"; - -async function convertToHTMLAndCompareSnapshots< - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - editor: BlockNoteEditor, - blocks: PartialBlock[], - snapshotDirectory: string, - snapshotName: string -) { - addIdsToBlocks(blocks); - - const serializer = createInternalHTMLSerializer(editor.pmSchema, editor); - const internalHTML = serializer.serializeBlocks(blocks, {}); - const internalHTMLSnapshotPath = - "./__snapshots__/" + - snapshotDirectory + - "/" + - snapshotName + - "/internal.html"; - await expect(internalHTML).toMatchFileSnapshot(internalHTMLSnapshotPath); - - // turn the internalHTML back into blocks, and make sure no data was lost - const fullBlocks = partialBlocksToBlocksForTesting(editor.schema, blocks); - const parsed = await editor.tryParseHTMLToBlocks(internalHTML); - - expect(parsed).toStrictEqual(fullBlocks); - - await initializeESMDependencies(); - // Create the "external" HTML, which is a cleaned up HTML representation, but lossy - const exporter = createExternalHTMLExporter(editor.pmSchema, editor); - const externalHTML = exporter.exportBlocks(blocks, {}); - const externalHTMLSnapshotPath = - "./__snapshots__/" + - snapshotDirectory + - "/" + - snapshotName + - "/external.html"; - await expect(externalHTML).toMatchFileSnapshot(externalHTMLSnapshotPath); -} - -const testCases = [ - defaultSchemaTestCases, - customBlocksTestCases, - customStylesTestCases, - customInlineContentTestCases, -]; - -describe("Test HTML conversion", () => { - for (const testCase of testCases) { - describe("Case: " + testCase.name, () => { - let editor: BlockNoteEditor; - const div = document.createElement("div"); - beforeEach(() => { - editor = testCase.createEditor(); - - // Note that we don't necessarily need to mount a root - // Currently, we do mount to a root so that it reflects the "production" use-case more closely. - - // However, it would be nice to increased converage and share the same set of tests for these cases: - // - does render to a root - // - does not render to a root - // - runs in server (jsdom) environment using server-util - editor.mount(div); - }); - - afterEach(() => { - editor.mount(undefined); - editor._tiptapEditor.destroy(); - editor = undefined as any; - - delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS; - }); - - for (const document of testCase.documents) { - // eslint-disable-next-line no-loop-func - it("Convert " + document.name + " to HTML", async () => { - const nameSplit = document.name.split("/"); - await convertToHTMLAndCompareSnapshots( - editor, - document.blocks, - nameSplit[0], - nameSplit[1] - ); - }); - } - }); - } -}); diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/customBlock/basic/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/customBlock/basic/markdown.md deleted file mode 100644 index a757429e4f..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/customBlock/basic/markdown.md +++ /dev/null @@ -1,5 +0,0 @@ -Custom customBlock - -Custom customBlock\ -with\ -line breaks diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/basic/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/basic/markdown.md deleted file mode 100644 index 557db03de9..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/basic/markdown.md +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/lineBreaks/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/lineBreaks/markdown.md deleted file mode 100644 index 557db03de9..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/lineBreaks/markdown.md +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/nested/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/nested/markdown.md deleted file mode 100644 index f4f110c5fb..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/nested/markdown.md +++ /dev/null @@ -1,5 +0,0 @@ -Hello World - -Hello World - -Hello World diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/styled/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/styled/markdown.md deleted file mode 100644 index 557db03de9..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/customParagraph/styled/markdown.md +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/fontSize/basic/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/fontSize/basic/markdown.md deleted file mode 100644 index a14913bf9b..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/fontSize/basic/markdown.md +++ /dev/null @@ -1 +0,0 @@ -This is text with a custom fontSize diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/image/basic/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/image/basic/markdown.md deleted file mode 100644 index b350ae21e0..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/image/basic/markdown.md +++ /dev/null @@ -1,3 +0,0 @@ -![example](exampleURL) - -Caption diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/image/nested/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/image/nested/markdown.md deleted file mode 100644 index 7a13551364..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/image/nested/markdown.md +++ /dev/null @@ -1,7 +0,0 @@ -![Caption](exampleURL) - -Caption - -![Caption](exampleURL) - -Caption diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/image/noCaption/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/image/noCaption/markdown.md deleted file mode 100644 index 2c05062cd4..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/image/noCaption/markdown.md +++ /dev/null @@ -1 +0,0 @@ -![example](exampleURL) diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/image/noName/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/image/noName/markdown.md deleted file mode 100644 index c6b5864d90..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/image/noName/markdown.md +++ /dev/null @@ -1,3 +0,0 @@ -![Caption](exampleURL) - -Caption diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/mention/basic/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/mention/basic/markdown.md deleted file mode 100644 index b6a2ae25b3..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/mention/basic/markdown.md +++ /dev/null @@ -1 +0,0 @@ -I enjoy working with @Matthew diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/paragraph/empty/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/paragraph/empty/markdown.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/basic/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/basic/markdown.md deleted file mode 100644 index fd50b044f8..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/basic/markdown.md +++ /dev/null @@ -1 +0,0 @@ -Custom Paragraph diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/nested/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/nested/markdown.md deleted file mode 100644 index 147effc747..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/nested/markdown.md +++ /dev/null @@ -1,5 +0,0 @@ -Custom Paragraph - -Nested Custom Paragraph 1 - -Nested Custom Paragraph 2 diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/styled/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/styled/markdown.md deleted file mode 100644 index 4f45e63c5c..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleCustomParagraph/styled/markdown.md +++ /dev/null @@ -1 +0,0 @@ -Plain Red Text Blue Background Mixed Colors diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/basic/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/basic/markdown.md deleted file mode 100644 index 4cca42f87d..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/basic/markdown.md +++ /dev/null @@ -1,3 +0,0 @@ -exampleURL - -Caption diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/button/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/button/markdown.md deleted file mode 100644 index 8d3fa6a207..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/button/markdown.md +++ /dev/null @@ -1 +0,0 @@ -Add file diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/nested/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/nested/markdown.md deleted file mode 100644 index c170d952c5..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleFile/nested/markdown.md +++ /dev/null @@ -1,7 +0,0 @@ -exampleURL - -Caption - -exampleURL - -Caption diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md deleted file mode 100644 index b350ae21e0..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +++ /dev/null @@ -1,3 +0,0 @@ -![example](exampleURL) - -Caption diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/button/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/button/markdown.md deleted file mode 100644 index 02184caf8a..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/button/markdown.md +++ /dev/null @@ -1 +0,0 @@ -Add image diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md deleted file mode 100644 index 27ac3f5776..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +++ /dev/null @@ -1,7 +0,0 @@ -![example](exampleURL) - -Caption - -![example](exampleURL) - -Caption diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md deleted file mode 100644 index 2c05062cd4..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md +++ /dev/null @@ -1 +0,0 @@ -![example](exampleURL) diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md deleted file mode 100644 index c6b5864d90..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md +++ /dev/null @@ -1,3 +0,0 @@ -![Caption](exampleURL) - -Caption diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noPreview/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noPreview/markdown.md deleted file mode 100644 index 07b71c0ea6..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/simpleImage/noPreview/markdown.md +++ /dev/null @@ -1,3 +0,0 @@ -example - -Caption diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/small/basic/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/small/basic/markdown.md deleted file mode 100644 index 02738ab95b..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/small/basic/markdown.md +++ /dev/null @@ -1 +0,0 @@ -This is a small text diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/tag/basic/markdown.md b/packages/core/src/api/exporters/markdown/__snapshots__/tag/basic/markdown.md deleted file mode 100644 index 8adc77839a..0000000000 --- a/packages/core/src/api/exporters/markdown/__snapshots__/tag/basic/markdown.md +++ /dev/null @@ -1 +0,0 @@ -I love #BlockNote diff --git a/packages/core/src/api/exporters/markdown/markdownExporter.test.ts b/packages/core/src/api/exporters/markdown/markdownExporter.test.ts deleted file mode 100644 index 3502f6ddbb..0000000000 --- a/packages/core/src/api/exporters/markdown/markdownExporter.test.ts +++ /dev/null @@ -1,86 +0,0 @@ -import fs from "node:fs"; -import path from "node:path"; -import { afterEach, beforeEach, describe, expect, it } from "vitest"; -import { PartialBlock } from "../../../blocks/defaultBlocks.js"; -import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js"; -import { BlockSchema } from "../../../schema/blocks/types.js"; -import { InlineContentSchema } from "../../../schema/inlineContent/types.js"; -import { StyleSchema } from "../../../schema/styles/types.js"; -import { customBlocksTestCases } from "../../testUtil/cases/customBlocks.js"; -import { customInlineContentTestCases } from "../../testUtil/cases/customInlineContent.js"; -import { customStylesTestCases } from "../../testUtil/cases/customStyles.js"; -import { defaultSchemaTestCases } from "../../testUtil/cases/defaultSchema.js"; -import { partialBlocksToBlocksForTesting } from "../../testUtil/partialBlockTestUtil.js"; - -async function convertToMarkdownAndCompareSnapshots< - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - editor: BlockNoteEditor, - blocks: PartialBlock[], - snapshotDirectory: string, - snapshotName: string -) { - const fullBlocks = partialBlocksToBlocksForTesting(editor.schema, blocks); - const md = await editor.blocksToMarkdownLossy(fullBlocks); - const snapshotPath = - "./__snapshots__/" + - snapshotDirectory + - "/" + - snapshotName + - "/markdown.md"; - - // vitest empty snapshots are broken on CI. might be fixed on next vitest, use workaround for now - if (!md.length && process.env.CI) { - if ( - fs.readFileSync(path.join(__dirname, snapshotPath), "utf8").length === 0 - ) { - // both are empty, so it's fine - return; - } - } - await expect(md).toMatchFileSnapshot(snapshotPath); -} - -const testCases = [ - defaultSchemaTestCases, - customBlocksTestCases, - customStylesTestCases, - customInlineContentTestCases, -]; - -describe("markdownExporter", () => { - for (const testCase of testCases) { - describe("Case: " + testCase.name, () => { - let editor: BlockNoteEditor; - const div = document.createElement("div"); - - beforeEach(() => { - editor = testCase.createEditor(); - editor.mount(div); - }); - - afterEach(() => { - editor.mount(undefined); - editor._tiptapEditor.destroy(); - editor = undefined as any; - - delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS; - }); - - for (const document of testCase.documents) { - // eslint-disable-next-line no-loop-func - it("Convert " + document.name + " to Markdown", async () => { - const nameSplit = document.name.split("/"); - await convertToMarkdownAndCompareSnapshots( - editor, - document.blocks, - nameSplit[0], - nameSplit[1] - ); - }); - } - }); - } -}); diff --git a/packages/core/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap b/packages/core/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap deleted file mode 100644 index cfc33073f3..0000000000 --- a/packages/core/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +++ /dev/null @@ -1,3473 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert customParagraph/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Custom Paragraph", - "type": "text", - }, - ], - "type": "customParagraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert customParagraph/lineBreaks to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Line 1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "text": "Line 2", - "type": "text", - }, - ], - "type": "customParagraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert customParagraph/nested to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Custom Paragraph", - "type": "text", - }, - ], - "type": "customParagraph", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested Custom Paragraph 1", - "type": "text", - }, - ], - "type": "customParagraph", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "3", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested Custom Paragraph 2", - "type": "text", - }, - ], - "type": "customParagraph", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert customParagraph/styled to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "pink", - "id": "1", - "textColor": "orange", - }, - "content": [ - { - "attrs": { - "textAlignment": "center", - }, - "content": [ - { - "text": "Plain ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - ], - "text": "Red Text ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Blue Background ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Mixed Colors", - "type": "text", - }, - ], - "type": "customParagraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert simpleCustomParagraph/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Custom Paragraph", - "type": "text", - }, - ], - "type": "simpleCustomParagraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert simpleCustomParagraph/nested to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Custom Paragraph", - "type": "text", - }, - ], - "type": "simpleCustomParagraph", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested Custom Paragraph 1", - "type": "text", - }, - ], - "type": "simpleCustomParagraph", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "3", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested Custom Paragraph 2", - "type": "text", - }, - ], - "type": "simpleCustomParagraph", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert simpleCustomParagraph/styled to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "pink", - "id": "1", - "textColor": "orange", - }, - "content": [ - { - "attrs": { - "textAlignment": "center", - }, - "content": [ - { - "text": "Plain ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - ], - "text": "Red Text ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Blue Background ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Mixed Colors", - "type": "text", - }, - ], - "type": "simpleCustomParagraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert simpleImage/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "simpleImage", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert simpleImage/button to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "", - "previewWidth": 512, - "showPreview": true, - "textAlignment": "left", - "url": "", - }, - "type": "simpleImage", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert simpleImage/nested to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "simpleImage", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "simpleImage", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert simpleImage/noCaption to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "simpleImage", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert simpleImage/noName to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "simpleImage", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom blocks schema > Convert simpleImage/noPreview to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": false, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "simpleImage", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom inline content schema > Convert mention/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "I enjoy working with ", - "type": "text", - }, - { - "attrs": { - "user": "Matthew", - }, - "type": "mention", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom inline content schema > Convert tag/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "I love ", - "type": "text", - }, - { - "content": [ - { - "text": "BlockNote", - "type": "text", - }, - ], - "type": "tag", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom style schema > Convert fontSize/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "attrs": { - "stringValue": "18px", - }, - "type": "fontSize", - }, - ], - "text": "This is text with a custom fontSize", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: custom style schema > Convert small/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "type": "small", - }, - ], - "text": "This is a small text", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert codeBlock/contains-newlines to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "language": "javascript", - }, - "content": [ - { - "text": "const hello = 'world'; -console.log(hello); -", - "type": "text", - }, - ], - "type": "codeBlock", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert codeBlock/defaultLanguage to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "language": "text", - }, - "content": [ - { - "text": "console.log('Hello, world!');", - "type": "text", - }, - ], - "type": "codeBlock", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert codeBlock/empty to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "language": "text", - }, - "type": "codeBlock", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert codeBlock/python to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "language": "python", - }, - "content": [ - { - "text": "print('Hello, world!')", - "type": "text", - }, - ], - "type": "codeBlock", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert complex/misc to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "blue", - "id": "1", - "textColor": "yellow", - }, - "content": [ - { - "attrs": { - "level": 2, - "textAlignment": "right", - }, - "content": [ - { - "marks": [ - { - "type": "bold", - }, - { - "type": "underline", - }, - ], - "text": "Heading ", - "type": "text", - }, - { - "marks": [ - { - "type": "italic", - }, - { - "type": "strike", - }, - ], - "text": "2", - "type": "text", - }, - ], - "type": "heading", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "red", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Paragraph", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "3", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "type": "bulletListItem", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert file/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert file/button to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "", - "url": "", - }, - "type": "file", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert file/nested to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert file/noCaption to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert file/noName to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert hardbreak/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Text1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "text": "Text2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert hardbreak/between-links to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Link1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website2.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Link2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert hardbreak/end to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Text1", - "type": "text", - }, - { - "type": "hardBreak", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert hardbreak/link to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Link1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Link1", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert hardbreak/multiple to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Text1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "text": "Text2", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "text": "Text3", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert hardbreak/only to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "type": "hardBreak", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert hardbreak/start to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "type": "hardBreak", - }, - { - "text": "Text1", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert hardbreak/styles to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Text1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "marks": [ - { - "type": "bold", - }, - ], - "text": "Text2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert image/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert image/button to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "", - "previewWidth": 512, - "showPreview": true, - "textAlignment": "left", - "url": "", - }, - "type": "image", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert image/nested to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert image/noCaption to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert image/noName to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert image/noPreview to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": false, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert link/adjacent to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Website", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website2.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Website2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert link/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Website", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert link/styled to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "type": "bold", - }, - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Web", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "site", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert lists/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Bullet List Item 1", - "type": "text", - }, - ], - "type": "bulletListItem", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert lists/nested to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Bullet List Item 1", - "type": "text", - }, - ], - "type": "bulletListItem", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert pageBreak/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "type": "pageBreak", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert paragraph/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Paragraph", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert paragraph/empty to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert paragraph/lineBreaks to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Line 1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "text": "Line 2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert paragraph/nested to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Paragraph", - "type": "text", - }, - ], - "type": "paragraph", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested Paragraph 1", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "3", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested Paragraph 2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert paragraph/styled to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "pink", - "id": "1", - "textColor": "orange", - }, - "content": [ - { - "attrs": { - "textAlignment": "center", - }, - "content": [ - { - "text": "Plain ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - ], - "text": "Red Text ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Blue Background ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Mixed Colors", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert table/allColWidths to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 200, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 200, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 200, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert table/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert table/headerCols to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert table/headerRows to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert table/mixedCellColors to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "red", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "blue", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "blue", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "yellow", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "red", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert table/mixedColWidths to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert table/mixedRowspansAndColspans to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "red", - "colspan": 2, - "colwidth": [ - 100, - 200, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "blue", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "yellow", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "red", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 2, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 2, - "colwidth": [ - 200, - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 200, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", -} -`; diff --git a/packages/core/src/api/nodeConversions/nodeConversions.test.ts b/packages/core/src/api/nodeConversions/nodeConversions.test.ts deleted file mode 100644 index b196af924a..0000000000 --- a/packages/core/src/api/nodeConversions/nodeConversions.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it } from "vitest"; - -import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js"; - -import { PartialBlock } from "../../blocks/defaultBlocks.js"; -import { customBlocksTestCases } from "../testUtil/cases/customBlocks.js"; -import { customInlineContentTestCases } from "../testUtil/cases/customInlineContent.js"; -import { customStylesTestCases } from "../testUtil/cases/customStyles.js"; -import { defaultSchemaTestCases } from "../testUtil/cases/defaultSchema.js"; -import { - addIdsToBlock, - partialBlockToBlockForTesting, -} from "../testUtil/partialBlockTestUtil.js"; -import { blockToNode } from "./blockToNode.js"; -import { nodeToBlock } from "./nodeToBlock.js"; - -function validateConversion( - block: PartialBlock, - editor: BlockNoteEditor -) { - addIdsToBlock(block); - const node = blockToNode(block, editor.pmSchema, editor.schema.styleSchema); - - expect(node).toMatchSnapshot(); - - const outputBlock = nodeToBlock( - node, - editor.schema.blockSchema, - editor.schema.inlineContentSchema, - editor.schema.styleSchema - ); - - const fullOriginalBlock = partialBlockToBlockForTesting( - editor.schema.blockSchema, - block - ); - - expect(outputBlock).toStrictEqual(fullOriginalBlock); -} - -const testCases = [ - defaultSchemaTestCases, - customStylesTestCases, - customInlineContentTestCases, - customBlocksTestCases, -]; - -describe("Test BlockNote-Prosemirror conversion", () => { - for (const testCase of testCases) { - describe("Case: " + testCase.name, () => { - let editor: BlockNoteEditor; - const div = document.createElement("div"); - - beforeEach(() => { - editor = testCase.createEditor(); - // Note that we don't necessarily need to mount a root - // Currently, we do mount to a root so that it reflects the "production" use-case more closely. - - // However, it would be nice to increased converage and share the same set of tests for these cases: - // - does render to a root - // - does not render to a root - // - runs in server (jsdom) environment using server-util - editor.mount(div); - }); - - afterEach(() => { - editor.mount(undefined); - editor._tiptapEditor.destroy(); - editor = undefined as any; - - delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS; - }); - - for (const document of testCase.documents) { - // eslint-disable-next-line no-loop-func - it("Convert " + document.name + " to/from prosemirror", () => { - // NOTE: only converts first block - validateConversion(document.blocks[0], editor); - }); - } - }); - } -}); diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-2-tables.json b/packages/core/src/api/parsers/html/__snapshots__/parse-2-tables.json deleted file mode 100644 index 7983dc88c2..0000000000 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-2-tables.json +++ /dev/null @@ -1,129 +0,0 @@ -[ - { - "id": "1", - "type": "table", - "props": { - "textColor": "default" - }, - "content": { - "type": "tableContent", - "columnWidths": [ - null - ], - "rows": [ - { - "cells": [ - { - "type": "tableCell", - "content": [ - { - "type": "text", - "text": "Company", - "styles": { - "underline": true - } - } - ], - "props": { - "colspan": 1, - "rowspan": 1, - "backgroundColor": "default", - "textColor": "default", - "textAlignment": "left" - } - } - ] - }, - { - "cells": [ - { - "type": "tableCell", - "content": [ - { - "type": "text", - "text": "Example Company Inc.", - "styles": { - "bold": true - } - }, - { - "type": "text", - "text": "\n \nName: [Company Representative]\nTitle: Chief Executive Officer", - "styles": {} - } - ], - "props": { - "colspan": 1, - "rowspan": 1, - "backgroundColor": "default", - "textColor": "default", - "textAlignment": "left" - } - } - ] - } - ] - }, - "children": [] - }, - { - "id": "2", - "type": "table", - "props": { - "textColor": "default" - }, - "content": { - "type": "tableContent", - "columnWidths": [ - null - ], - "rows": [ - { - "cells": [ - { - "type": "tableCell", - "content": [ - { - "type": "text", - "text": "Advisor", - "styles": { - "underline": true - } - } - ], - "props": { - "colspan": 1, - "rowspan": 1, - "backgroundColor": "default", - "textColor": "default", - "textAlignment": "left" - } - } - ] - }, - { - "cells": [ - { - "type": "tableCell", - "content": [ - { - "type": "text", - "text": "[Advisor Name]", - "styles": {} - } - ], - "props": { - "colspan": 1, - "rowspan": 1, - "backgroundColor": "default", - "textColor": "default", - "textAlignment": "left" - } - } - ] - } - ] - }, - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-codeblocks.json b/packages/core/src/api/parsers/html/__snapshots__/parse-codeblocks.json deleted file mode 100644 index 6387ab020d..0000000000 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-codeblocks.json +++ /dev/null @@ -1,62 +0,0 @@ -[ - { - "id": "1", - "type": "codeBlock", - "props": { - "language": "text" - }, - "content": [ - { - "type": "text", - "text": "console.log(\"Should default to JS\")", - "styles": {} - } - ], - "children": [] - }, - { - "id": "2", - "type": "codeBlock", - "props": { - "language": "typescript" - }, - "content": [ - { - "type": "text", - "text": "console.log(\"Should parse TS from data-language\")", - "styles": {} - } - ], - "children": [] - }, - { - "id": "3", - "type": "codeBlock", - "props": { - "language": "python" - }, - "content": [ - { - "type": "text", - "text": "print(\"Should parse Python from language- class\")", - "styles": {} - } - ], - "children": [] - }, - { - "id": "4", - "type": "codeBlock", - "props": { - "language": "typescript" - }, - "content": [ - { - "type": "text", - "text": "console.log(\"Should prioritize TS from data-language over language- class\")", - "styles": {} - } - ], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-div-with-inline-content.json b/packages/core/src/api/parsers/html/__snapshots__/parse-div-with-inline-content.json deleted file mode 100644 index d06969a05f..0000000000 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-div-with-inline-content.json +++ /dev/null @@ -1,91 +0,0 @@ -[ - { - "id": "1", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "None ", - "styles": {} - }, - { - "type": "text", - "text": "Bold ", - "styles": { - "bold": true - } - }, - { - "type": "text", - "text": "Italic ", - "styles": { - "italic": true - } - }, - { - "type": "text", - "text": "Underline ", - "styles": { - "underline": true - } - }, - { - "type": "text", - "text": "Strikethrough ", - "styles": { - "strike": true - } - }, - { - "type": "text", - "text": "All", - "styles": { - "bold": true, - "italic": true, - "underline": true, - "strike": true - } - } - ], - "children": [] - }, - { - "id": "2", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Nested Div", - "styles": {} - } - ], - "children": [] - }, - { - "id": "3", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Nested Paragraph", - "styles": {} - } - ], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/complex.json b/packages/core/src/api/parsers/markdown/__snapshots__/pasted/complex.json deleted file mode 100644 index e0d619a9e6..0000000000 --- a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/complex.json +++ /dev/null @@ -1,319 +0,0 @@ -[ - { - "id": "19", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "# Heading 1", - "styles": {} - } - ], - "children": [] - }, - { - "id": "20", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "## Heading 2", - "styles": {} - } - ], - "children": [] - }, - { - "id": "21", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "### Heading 3", - "styles": {} - } - ], - "children": [] - }, - { - "id": "22", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Paragraph", - "styles": {} - } - ], - "children": [] - }, - { - "id": "23", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "P**ara***grap*h", - "styles": {} - } - ], - "children": [] - }, - { - "id": "24", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "P*ara*~~grap~~h", - "styles": {} - } - ], - "children": [] - }, - { - "id": "25", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "* Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "26", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "* Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "27", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": " * Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "28", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": " * Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "29", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": " Paragraph", - "styles": {} - } - ], - "children": [] - }, - { - "id": "30", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": " 1. Numbered List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "31", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": " 2. Numbered List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "32", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": " 3. Numbered List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "33", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": " 1. Numbered List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "34", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": " * Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "35", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": " * Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "36", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "* Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "37", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/issue-226-1.json b/packages/core/src/api/parsers/markdown/__snapshots__/pasted/issue-226-1.json deleted file mode 100644 index 3c17433c13..0000000000 --- a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/issue-226-1.json +++ /dev/null @@ -1,81 +0,0 @@ -[ - { - "id": "5", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "- 📝 item1", - "styles": {} - } - ], - "children": [] - }, - { - "id": "6", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "- ⚙️ item2", - "styles": {} - } - ], - "children": [] - }, - { - "id": "7", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "- 🔗 item3", - "styles": {} - } - ], - "children": [] - }, - { - "id": "8", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "# h1", - "styles": {} - } - ], - "children": [] - }, - { - "id": "9", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/issue-226-2.json b/packages/core/src/api/parsers/markdown/__snapshots__/pasted/issue-226-2.json deleted file mode 100644 index 3ee19cf3ee..0000000000 --- a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/issue-226-2.json +++ /dev/null @@ -1,165 +0,0 @@ -[ - { - "id": "9", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "* a", - "styles": {} - } - ], - "children": [] - }, - { - "id": "10", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "* b", - "styles": {} - } - ], - "children": [] - }, - { - "id": "11", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "* c", - "styles": {} - } - ], - "children": [] - }, - { - "id": "12", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "* d", - "styles": {} - } - ], - "children": [] - }, - { - "id": "13", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "anything", - "styles": {} - } - ], - "children": [] - }, - { - "id": "14", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "[a link](", - "styles": {} - }, - { - "type": "link", - "href": "http://example.com", - "content": [ - { - "type": "text", - "text": "http://example.com", - "styles": {} - } - ] - }, - { - "type": "text", - "text": ")", - "styles": {} - } - ], - "children": [] - }, - { - "id": "15", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "* another", - "styles": {} - } - ], - "children": [] - }, - { - "id": "16", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "* list", - "styles": {} - } - ], - "children": [] - }, - { - "id": "17", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/nested.json b/packages/core/src/api/parsers/markdown/__snapshots__/pasted/nested.json deleted file mode 100644 index 84e352628a..0000000000 --- a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/nested.json +++ /dev/null @@ -1,81 +0,0 @@ -[ - { - "id": "5", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "# Heading", - "styles": {} - } - ], - "children": [] - }, - { - "id": "6", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Paragraph", - "styles": {} - } - ], - "children": [] - }, - { - "id": "7", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "* Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "8", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": " 1. Numbered List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "9", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/non-nested.json b/packages/core/src/api/parsers/markdown/__snapshots__/pasted/non-nested.json deleted file mode 100644 index f72ab28fa1..0000000000 --- a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/non-nested.json +++ /dev/null @@ -1,81 +0,0 @@ -[ - { - "id": "5", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "# Heading", - "styles": {} - } - ], - "children": [] - }, - { - "id": "6", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Paragraph", - "styles": {} - } - ], - "children": [] - }, - { - "id": "7", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "* Bullet List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "8", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "1. Numbered List Item", - "styles": {} - } - ], - "children": [] - }, - { - "id": "9", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/styled.json b/packages/core/src/api/parsers/markdown/__snapshots__/pasted/styled.json deleted file mode 100644 index 43eeaff32d..0000000000 --- a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/styled.json +++ /dev/null @@ -1,61 +0,0 @@ -[ - { - "id": "0", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Bold", - "styles": { - "bold": true - } - }, - { - "type": "text", - "text": " ", - "styles": {} - }, - { - "type": "text", - "text": "Italic", - "styles": { - "italic": true - } - }, - { - "type": "text", - "text": " ", - "styles": {} - }, - { - "type": "text", - "text": "Strikethrough", - "styles": { - "strike": true - } - }, - { - "type": "text", - "text": " ***Multiple***", - "styles": {} - } - ], - "children": [] - }, - { - "id": "2", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/whitespace bold.json b/packages/core/src/api/parsers/markdown/__snapshots__/pasted/whitespace bold.json deleted file mode 100644 index 91798b8de7..0000000000 --- a/packages/core/src/api/parsers/markdown/__snapshots__/pasted/whitespace bold.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "id": "0", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "hello ", - "styles": {} - }, - { - "type": "text", - "text": "beautiful ", - "styles": { - "bold": true - } - }, - { - "type": "text", - "text": " world", - "styles": {} - } - ], - "children": [] - }, - { - "id": "2", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [], - "children": [] - } -] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/parseMarkdown.test.ts b/packages/core/src/api/parsers/markdown/parseMarkdown.test.ts deleted file mode 100644 index c8766028e9..0000000000 --- a/packages/core/src/api/parsers/markdown/parseMarkdown.test.ts +++ /dev/null @@ -1,135 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { BlockNoteEditor } from "../../../index.js"; -import { doPaste } from "../../testUtil/paste.js"; - -async function parseMarkdownAndCompareSnapshots( - md: string, - snapshotName: string -) { - const editor = BlockNoteEditor.create(); - const div = document.createElement("div"); - editor.mount(div); - const blocks = await editor.tryParseMarkdownToBlocks(md); - - const snapshotPath = "./__snapshots__/" + snapshotName + ".json"; - await expect(JSON.stringify(blocks, undefined, 2)).toMatchFileSnapshot( - snapshotPath - ); - - if (!editor.prosemirrorView) { - throw new Error("Editor view not initialized."); - } - - doPaste(editor.prosemirrorView, md, null, true, new ClipboardEvent("paste")); - - const pastedSnapshotPath = "./__snapshots__/pasted/" + snapshotName + ".json"; - await expect(JSON.stringify(editor.document, undefined, 2)).toMatchFileSnapshot( - pastedSnapshotPath - ); - - editor.mount(undefined); -} - -describe("Parse Markdown", () => { - it("Convert non-nested Markdown to blocks", async () => { - const markdown = `# Heading - -Paragraph - -* Bullet List Item - -1. Numbered List Item - `; - await parseMarkdownAndCompareSnapshots(markdown, "non-nested"); - }); - - // Failing due to nested block parsing bug. - it("Convert nested Markdown to blocks", async () => { - const markdown = `# Heading - -Paragraph - -* Bullet List Item - - 1. Numbered List Item -`; - await parseMarkdownAndCompareSnapshots(markdown, "nested"); - }); - - it("Convert styled Markdown to blocks", async () => { - const markdown = `**Bold** *Italic* ~~Strikethrough~~ ***Multiple***`; - await parseMarkdownAndCompareSnapshots(markdown, "styled"); - }); - - it("Convert complex Markdown to blocks", async () => { - const markdown = `# Heading 1 - -## Heading 2 - -### Heading 3 - -Paragraph - -P**ara***grap*h - -P*ara*~~grap~~h - -* Bullet List Item - -* Bullet List Item - - * Bullet List Item - - * Bullet List Item - - Paragraph - - 1. Numbered List Item - - 2. Numbered List Item - - 3. Numbered List Item - - 1. Numbered List Item - - * Bullet List Item - - * Bullet List Item - -* Bullet List Item`; - await parseMarkdownAndCompareSnapshots(markdown, "complex"); - }); - - it("whitespace bold", async () => { - const markdown = `hello **beautiful ** world`; - await parseMarkdownAndCompareSnapshots(markdown, "whitespace bold"); - }); -}); - -describe("Issue 226", () => { - it("Case 1", async () => { - const markdown = ` -- 📝 item1 -- ⚙️ item2 -- 🔗 item3 - -# h1 -`; - await parseMarkdownAndCompareSnapshots(markdown, "issue-226-1"); - }); - - it("Case 2", async () => { - const markdown = `* a -* b -* c -* d - -anything - -[a link](http://example.com) - -* another -* list`; - await parseMarkdownAndCompareSnapshots(markdown, "issue-226-2"); - }); -}); diff --git a/packages/core/src/api/testUtil/cases/customBlocks.ts b/packages/core/src/api/testUtil/cases/customBlocks.ts deleted file mode 100644 index 7da9894b38..0000000000 --- a/packages/core/src/api/testUtil/cases/customBlocks.ts +++ /dev/null @@ -1,342 +0,0 @@ -import { EditorTestCases } from "../index.js"; - -import { uploadToTmpFilesDotOrg_DEV_ONLY } from "../../../blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js"; -import { - imagePropSchema, - imageRender, -} from "../../../blocks/ImageBlockContent/ImageBlockContent.js"; -import { - DefaultInlineContentSchema, - DefaultStyleSchema, - defaultBlockSpecs, -} from "../../../blocks/defaultBlocks.js"; -import { defaultProps } from "../../../blocks/defaultProps.js"; -import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js"; -import { BlockNoteSchema } from "../../../editor/BlockNoteSchema.js"; -import { createBlockSpec } from "../../../schema/index.js"; - -// This is a modified version of the default image block that does not implement -// a `toExternalHTML` function. It's used to test if the custom serializer by -// default serializes custom blocks using their `render` function. -const SimpleImage = createBlockSpec( - { - type: "simpleImage", - propSchema: imagePropSchema, - content: "none", - }, - { - render: (block, editor) => imageRender(block as any, editor as any), - } -); - -const CustomParagraph = createBlockSpec( - { - type: "customParagraph", - propSchema: defaultProps, - content: "inline", - }, - { - render: () => { - const paragraph = document.createElement("p"); - paragraph.className = "custom-paragraph"; - - return { - dom: paragraph, - contentDOM: paragraph, - }; - }, - toExternalHTML: () => { - const paragraph = document.createElement("p"); - paragraph.className = "custom-paragraph"; - paragraph.innerHTML = "Hello World"; - - return { - dom: paragraph, - }; - }, - } -); - -const SimpleCustomParagraph = createBlockSpec( - { - type: "simpleCustomParagraph", - propSchema: defaultProps, - content: "inline", - }, - { - render: () => { - const paragraph = document.createElement("p"); - paragraph.className = "simple-custom-paragraph"; - - return { - dom: paragraph, - contentDOM: paragraph, - }; - }, - } -); - -const schema = BlockNoteSchema.create({ - blockSpecs: { - ...defaultBlockSpecs, - simpleImage: SimpleImage, - customParagraph: CustomParagraph, - simpleCustomParagraph: SimpleCustomParagraph, - }, -}); - -export const customBlocksTestCases: EditorTestCases< - typeof schema.blockSchema, - DefaultInlineContentSchema, - DefaultStyleSchema -> = { - name: "custom blocks schema", - createEditor: () => { - return BlockNoteEditor.create({ - schema, - uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY, - }); - }, - documents: [ - // Because images need to fetch the download URL async, their output HTML is - // initially rendered without a `src` attribute, which is reflected in the - // tests. - { - name: "simpleImage/button", - blocks: [ - { - type: "simpleImage", - }, - ], - }, - { - name: "simpleImage/basic", - blocks: [ - { - type: "simpleImage", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - { - name: "simpleImage/noName", - blocks: [ - { - type: "simpleImage", - props: { - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - { - name: "simpleImage/noCaption", - blocks: [ - { - type: "simpleImage", - props: { - name: "example", - url: "exampleURL", - previewWidth: 256, - }, - }, - ], - }, - { - name: "simpleImage/noPreview", - blocks: [ - { - type: "simpleImage", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - showPreview: false, - previewWidth: 256, - }, - }, - ], - }, - { - name: "simpleImage/nested", - blocks: [ - { - type: "simpleImage", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - children: [ - { - type: "simpleImage", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - ], - }, - { - name: "customParagraph/basic", - blocks: [ - { - type: "customParagraph", - content: "Custom Paragraph", - }, - ], - }, - { - name: "customParagraph/styled", - blocks: [ - { - type: "customParagraph", - props: { - textAlignment: "center", - textColor: "orange", - backgroundColor: "pink", - }, - content: [ - { - type: "text", - styles: {}, - text: "Plain ", - }, - { - type: "text", - styles: { - textColor: "red", - }, - text: "Red Text ", - }, - { - type: "text", - styles: { - backgroundColor: "blue", - }, - text: "Blue Background ", - }, - { - type: "text", - styles: { - textColor: "red", - backgroundColor: "blue", - }, - text: "Mixed Colors", - }, - ], - }, - ], - }, - { - name: "customParagraph/nested", - blocks: [ - { - type: "customParagraph", - content: "Custom Paragraph", - children: [ - { - type: "customParagraph", - content: "Nested Custom Paragraph 1", - }, - { - type: "customParagraph", - content: "Nested Custom Paragraph 2", - }, - ], - }, - ], - }, - { - name: "customParagraph/lineBreaks", - blocks: [ - { - type: "customParagraph", - content: "Line 1\nLine 2", - }, - ], - }, - { - name: "simpleCustomParagraph/basic", - blocks: [ - { - type: "simpleCustomParagraph", - content: "Custom Paragraph", - }, - ], - }, - { - name: "simpleCustomParagraph/styled", - blocks: [ - { - type: "simpleCustomParagraph", - props: { - textAlignment: "center", - textColor: "orange", - backgroundColor: "pink", - }, - content: [ - { - type: "text", - styles: {}, - text: "Plain ", - }, - { - type: "text", - styles: { - textColor: "red", - }, - text: "Red Text ", - }, - { - type: "text", - styles: { - backgroundColor: "blue", - }, - text: "Blue Background ", - }, - { - type: "text", - styles: { - textColor: "red", - backgroundColor: "blue", - }, - text: "Mixed Colors", - }, - ], - }, - ], - }, - { - name: "simpleCustomParagraph/nested", - blocks: [ - { - type: "simpleCustomParagraph", - content: "Custom Paragraph", - children: [ - { - type: "simpleCustomParagraph", - content: "Nested Custom Paragraph 1", - }, - { - type: "simpleCustomParagraph", - content: "Nested Custom Paragraph 2", - }, - ], - }, - ], - }, - ], -}; diff --git a/packages/core/src/api/testUtil/cases/customInlineContent.ts b/packages/core/src/api/testUtil/cases/customInlineContent.ts deleted file mode 100644 index 106ba91379..0000000000 --- a/packages/core/src/api/testUtil/cases/customInlineContent.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { EditorTestCases } from "../index.js"; - -import { uploadToTmpFilesDotOrg_DEV_ONLY } from "../../../blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js"; -import { - DefaultBlockSchema, - DefaultStyleSchema, - defaultInlineContentSpecs, -} from "../../../blocks/defaultBlocks.js"; -import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js"; -import { BlockNoteSchema } from "../../../editor/BlockNoteSchema.js"; -import { createInlineContentSpec } from "../../../schema/inlineContent/createSpec.js"; - -const mention = createInlineContentSpec( - { - type: "mention" as const, - propSchema: { - user: { - default: "", - }, - }, - content: "none", - }, - { - render: (ic) => { - const dom = document.createElement("span"); - dom.appendChild(document.createTextNode("@" + ic.props.user)); - - return { - dom, - }; - }, - } -); - -const tag = createInlineContentSpec( - { - type: "tag" as const, - propSchema: {}, - content: "styled", - }, - { - render: () => { - const dom = document.createElement("span"); - dom.textContent = "#"; - - const contentDOM = document.createElement("span"); - dom.appendChild(contentDOM); - - return { - dom, - contentDOM, - }; - }, - } -); - -const schema = BlockNoteSchema.create({ - inlineContentSpecs: { - ...defaultInlineContentSpecs, - mention, - tag, - }, -}); - -export const customInlineContentTestCases: EditorTestCases< - DefaultBlockSchema, - typeof schema.inlineContentSchema, - DefaultStyleSchema -> = { - name: "custom inline content schema", - createEditor: () => { - return BlockNoteEditor.create({ - uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY, - schema, - }); - }, - documents: [ - { - name: "mention/basic", - blocks: [ - { - type: "paragraph", - content: [ - "I enjoy working with ", - { - type: "mention", - props: { - user: "Matthew", - }, - content: undefined, - }, - ], - }, - ], - }, - { - name: "tag/basic", - blocks: [ - { - type: "paragraph", - content: [ - "I love ", - { - type: "tag", - // props: {}, - content: "BlockNote", - }, - ], - }, - ], - }, - ], -}; diff --git a/packages/core/src/api/testUtil/cases/customStyles.ts b/packages/core/src/api/testUtil/cases/customStyles.ts deleted file mode 100644 index 0ee9e01706..0000000000 --- a/packages/core/src/api/testUtil/cases/customStyles.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { EditorTestCases } from "../index.js"; - -import { uploadToTmpFilesDotOrg_DEV_ONLY } from "../../../blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js"; -import { - DefaultBlockSchema, - DefaultInlineContentSchema, - defaultStyleSpecs, -} from "../../../blocks/defaultBlocks.js"; -import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js"; -import { BlockNoteSchema } from "../../../editor/BlockNoteSchema.js"; -import { createStyleSpec } from "../../../schema/styles/createSpec.js"; - -const small = createStyleSpec( - { - type: "small", - propSchema: "boolean", - }, - { - render: () => { - const dom = document.createElement("small"); - return { - dom, - contentDOM: dom, - }; - }, - } -); - -const fontSize = createStyleSpec( - { - type: "fontSize", - propSchema: "string", - }, - { - render: (value) => { - const dom = document.createElement("span"); - dom.setAttribute("style", "font-size: " + value); - return { - dom, - contentDOM: dom, - }; - }, - } -); - -const schema = BlockNoteSchema.create({ - styleSpecs: { - ...defaultStyleSpecs, - small, - fontSize, - }, -}); - -export const customStylesTestCases: EditorTestCases< - DefaultBlockSchema, - DefaultInlineContentSchema, - typeof schema.styleSchema -> = { - name: "custom style schema", - createEditor: () => { - return BlockNoteEditor.create({ - uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY, - schema, - }); - }, - documents: [ - { - name: "small/basic", - blocks: [ - { - type: "paragraph", - content: [ - { - type: "text", - text: "This is a small text", - styles: { - small: true, - }, - }, - ], - }, - ], - }, - { - name: "fontSize/basic", - blocks: [ - { - type: "paragraph", - content: [ - { - type: "text", - text: "This is text with a custom fontSize", - styles: { - fontSize: "18px", - }, - }, - ], - }, - ], - }, - ], -}; diff --git a/packages/core/src/api/testUtil/cases/defaultSchema.ts b/packages/core/src/api/testUtil/cases/defaultSchema.ts deleted file mode 100644 index 2b1b47e5ec..0000000000 --- a/packages/core/src/api/testUtil/cases/defaultSchema.ts +++ /dev/null @@ -1,1493 +0,0 @@ -import { EditorTestCases } from "../index.js"; - -import { uploadToTmpFilesDotOrg_DEV_ONLY } from "../../../blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js"; -import { - DefaultBlockSchema, - DefaultInlineContentSchema, - DefaultStyleSchema, -} from "../../../blocks/defaultBlocks.js"; -import { - pageBreakSchema, - withPageBreak, -} from "../../../blocks/PageBreakBlockContent/schema.js"; -import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js"; -import { BlockNoteSchema } from "../../../editor/BlockNoteSchema.js"; - -export const defaultSchemaTestCases: EditorTestCases< - DefaultBlockSchema & typeof pageBreakSchema.blockSchema, - DefaultInlineContentSchema, - DefaultStyleSchema -> = { - name: "default schema", - createEditor: () => { - return BlockNoteEditor.create({ - schema: withPageBreak(BlockNoteSchema.create()), - uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY, - codeBlock: { - supportedLanguages: { - javascript: { - name: "JavaScript", - aliases: ["js"], - }, - python: { - name: "Python", - aliases: ["py"], - }, - }, - }, - }); - }, - documents: [ - { - name: "paragraph/empty", - blocks: [ - { - type: "paragraph", - }, - ], - }, - { - name: "paragraph/basic", - blocks: [ - { - type: "paragraph", - content: "Paragraph", - }, - ], - }, - { - name: "paragraph/styled", - blocks: [ - { - type: "paragraph", - props: { - textAlignment: "center", - textColor: "orange", - backgroundColor: "pink", - }, - content: [ - { - type: "text", - styles: {}, - text: "Plain ", - }, - { - type: "text", - styles: { - textColor: "red", - }, - text: "Red Text ", - }, - { - type: "text", - styles: { - backgroundColor: "blue", - }, - text: "Blue Background ", - }, - { - type: "text", - styles: { - textColor: "red", - backgroundColor: "blue", - }, - text: "Mixed Colors", - }, - ], - }, - ], - }, - { - name: "paragraph/nested", - blocks: [ - { - type: "paragraph", - content: "Paragraph", - children: [ - { - type: "paragraph", - content: "Nested Paragraph 1", - }, - { - type: "paragraph", - content: "Nested Paragraph 2", - }, - ], - }, - ], - }, - { - name: "paragraph/lineBreaks", - blocks: [ - { - type: "paragraph", - content: "Line 1\nLine 2", - }, - ], - }, - { - name: "lists/basic", - blocks: [ - { - type: "bulletListItem", - content: "Bullet List Item 1", - }, - { - type: "bulletListItem", - content: "Bullet List Item 2", - }, - { - type: "numberedListItem", - content: "Numbered List Item 1", - }, - { - type: "numberedListItem", - content: "Numbered List Item 2", - }, - { - type: "checkListItem", - content: "Check List Item 1", - }, - { - type: "checkListItem", - props: { - checked: true, - }, - content: "Check List Item 2", - }, - ], - }, - { - name: "lists/nested", - blocks: [ - { - type: "bulletListItem", - content: "Bullet List Item 1", - }, - { - type: "bulletListItem", - content: "Bullet List Item 2", - children: [ - { - type: "numberedListItem", - content: "Numbered List Item 1", - }, - { - type: "numberedListItem", - content: "Numbered List Item 2", - children: [ - { - type: "checkListItem", - content: "Check List Item 1", - }, - { - type: "checkListItem", - props: { - checked: true, - }, - content: "Check List Item 2", - }, - ], - }, - ], - }, - ], - }, - { - name: "codeBlock/empty", - blocks: [ - { - type: "codeBlock", - }, - ], - }, - { - name: "codeBlock/defaultLanguage", - blocks: [ - { - type: "codeBlock", - content: "console.log('Hello, world!');", - }, - ], - }, - { - name: "codeBlock/python", - blocks: [ - { - type: "codeBlock", - props: { language: "python" }, - content: "print('Hello, world!')", - }, - ], - }, - { - name: "codeBlock/contains-newlines", - blocks: [ - { - type: "codeBlock", - props: { language: "javascript" }, - content: "const hello = 'world';\nconsole.log(hello);\n", - }, - ], - }, - { - name: "pageBreak/basic", - blocks: [ - { - type: "pageBreak", - }, - ], - }, - { - name: "file/button", - blocks: [ - { - type: "file", - }, - ], - }, - { - name: "file/basic", - blocks: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - { - name: "file/noName", - blocks: [ - { - type: "file", - props: { - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - { - name: "file/noCaption", - blocks: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - }, - }, - ], - }, - { - name: "file/nested", - blocks: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - children: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - ], - }, - // Because images need to fetch the download URL async, their internal HTML - // is initially rendered without a `src` attribute, which is reflected in - // the tests. - { - name: "image/button", - blocks: [ - { - type: "image", - }, - ], - }, - { - name: "image/basic", - blocks: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - { - name: "image/noName", - blocks: [ - { - type: "image", - props: { - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - { - name: "image/noCaption", - blocks: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - previewWidth: 256, - }, - }, - ], - }, - { - name: "image/noPreview", - blocks: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - showPreview: false, - previewWidth: 256, - }, - }, - ], - }, - { - name: "image/nested", - blocks: [ - { - type: "image", - props: { - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - children: [ - { - type: "image", - props: { - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - ], - }, - { - name: "table/basic", - blocks: [ - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/allColWidths", - blocks: [ - { - type: "table", - content: { - type: "tableContent", - columnWidths: [100, 200, 300], - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/mixedColWidths", - blocks: [ - { - type: "table", - content: { - type: "tableContent", - columnWidths: [100, undefined, 300], - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/mixedCellColors", - blocks: [ - { - type: "table", - content: { - type: "tableContent", - columnWidths: [100, undefined, 300], - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "red", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "blue", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "blue", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "yellow", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "red", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/mixedRowspansAndColspans", - blocks: [ - { - type: "table", - content: { - type: "tableContent", - columnWidths: [100, 200, 300], - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "red", - colspan: 2, - rowspan: 1, - textAlignment: "left", - textColor: "blue", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "yellow", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "red", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 2, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 2, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/headerRows", - blocks: [ - { - type: "table", - content: { - headerRows: 1, - type: "tableContent", - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/headerCols", - blocks: [ - { - type: "table", - content: { - headerCols: 1, - type: "tableContent", - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "link/basic", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "link", - href: "https://www.website.com", - content: "Website", - }, - ], - }, - ], - }, - { - name: "link/styled", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "link", - href: "https://www.website.com", - content: [ - { - type: "text", - text: "Web", - styles: { - bold: true, - }, - }, - { - type: "text", - text: "site", - styles: {}, - }, - ], - }, - ], - }, - ], - }, - { - name: "link/adjacent", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "link", - href: "https://www.website.com", - content: "Website", - }, - { - type: "link", - href: "https://www.website2.com", - content: "Website2", - }, - ], - }, - ], - }, - { - name: "hardbreak/basic", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "Text1\nText2", - styles: {}, - }, - ], - }, - ], - }, - { - name: "hardbreak/multiple", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "Text1\nText2\nText3", - styles: {}, - }, - ], - }, - ], - }, - { - name: "hardbreak/start", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "\nText1", - styles: {}, - }, - ], - }, - ], - }, - { - name: "hardbreak/end", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "Text1\n", - styles: {}, - }, - ], - }, - ], - }, - { - name: "hardbreak/only", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "\n", - styles: {}, - }, - ], - }, - ], - }, - { - name: "hardbreak/styles", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "Text1\n", - styles: {}, - }, - { - type: "text", - text: "Text2", - styles: { bold: true }, - }, - ], - }, - ], - }, - { - name: "hardbreak/link", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "link", - href: "https://www.website.com", - content: "Link1\nLink1", - }, - ], - }, - ], - }, - { - name: "hardbreak/between-links", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "link", - href: "https://www.website.com", - content: "Link1\n", - }, - { - type: "link", - href: "https://www.website2.com", - content: "Link2", - }, - ], - }, - ], - }, - { - name: "complex/misc", - blocks: [ - { - // id: UniqueID.options.generateID(), - type: "heading", - props: { - backgroundColor: "blue", - textColor: "yellow", - textAlignment: "right", - level: 2, - }, - content: [ - { - type: "text", - text: "Heading ", - styles: { - bold: true, - underline: true, - }, - }, - { - type: "text", - text: "2", - styles: { - italic: true, - strike: true, - }, - }, - ], - children: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - props: { - backgroundColor: "red", - }, - content: "Paragraph", - children: [], - }, - { - // id: UniqueID.options.generateID(), - type: "bulletListItem", - props: {}, - }, - ], - }, - ], - }, - ], -}; diff --git a/packages/core/src/api/testUtil/index.ts b/packages/core/src/api/testUtil/index.ts deleted file mode 100644 index 3413613f6c..0000000000 --- a/packages/core/src/api/testUtil/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { PartialBlock } from "../../blocks/defaultBlocks.js"; -import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js"; -import { BlockSchema } from "../../schema/blocks/types.js"; -import { InlineContentSchema } from "../../schema/inlineContent/types.js"; -import { StyleSchema } from "../../schema/styles/types.js"; -import { NoInfer } from "../../util/typescript.js"; - -export type EditorTestCases< - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema -> = { - name: string; - createEditor: () => BlockNoteEditor; - documents: Array<{ - name: string; - blocks: PartialBlock, NoInfer, NoInfer>[]; - }>; -}; diff --git a/packages/core/src/api/testUtil/paste.ts b/packages/core/src/api/testUtil/paste.ts deleted file mode 100644 index a25874313f..0000000000 --- a/packages/core/src/api/testUtil/paste.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Slice } from "@tiptap/pm/model"; -import { EditorView } from "@tiptap/pm/view"; -import * as pmView from "@tiptap/pm/view"; - -function sliceSingleNode(slice: Slice) { - return slice.openStart === 0 && - slice.openEnd === 0 && - slice.content.childCount === 1 - ? slice.content.firstChild - : null; -} - -// This function is a copy of the `doPaste` function from `@tiptap/pm/view`, -// but made to work in a JSDOM environment. To do this, the `tr.scrollIntoView` -// call has been removed. -// https://github.com/ProseMirror/prosemirror-view/blob/17b508f618c944c54776f8ddac45edcb49970796/src/input.ts#L624 -export function doPaste( - view: EditorView, - text: string, - html: string | null, - preferPlain: boolean, - event: ClipboardEvent -) { - const slice = (pmView as any).__parseFromClipboard( - view, - text, - html, - preferPlain, - view.state.selection.$from - ); - if ( - view.someProp("handlePaste", (f) => f(view, event, slice || Slice.empty)) - ) { - return true; - } - if (!slice) { - return false; - } - - const singleNode = sliceSingleNode(slice); - const tr = singleNode - ? view.state.tr.replaceSelectionWith(singleNode, preferPlain) - : view.state.tr.replaceSelection(slice); - view.dispatch(tr.setMeta("paste", true).setMeta("uiEvent", "paste")); - return true; -} diff --git a/packages/core/src/api/tests/clipboard/clipboardTestUtil.ts b/packages/core/src/api/tests/clipboard/clipboardTestUtil.ts new file mode 100644 index 0000000000..b7a54db524 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/clipboardTestUtil.ts @@ -0,0 +1,93 @@ +import { Node, Slice } from "@tiptap/pm/model"; +import { EditorView } from "@tiptap/pm/view"; +import * as pmView from "@tiptap/pm/view"; + +// Helper function to get the position of a text node with given text content. +// By default, returns the position just before the node, but can be just after +// instead if `after` is set to true. +export const getPosOfTextNode = ( + doc: Node, + textContent: string, + after = false +) => { + let ret: number | undefined = undefined; + + doc.descendants((node, pos) => { + if (node.isText && node.textContent === textContent) { + ret = pos + (after ? node.nodeSize : 0); + return false; + } + + return ret === undefined; + }); + + if (ret === undefined) { + throw new Error(`Text node with content "${textContent}" not found.`); + } + + return ret; +}; + +// Helper function to get the position of a table cell node with given text +// content. Returns the position just before the node. +export const getPosOfTableCellNode = (doc: Node, textContent: string) => { + let ret: number | undefined = undefined; + + doc.descendants((node, pos) => { + if (node.type.name === "tableCell" && node.textContent === textContent) { + ret = pos; + return false; + } + + return ret === undefined; + }); + + if (ret === undefined) { + throw new Error(`Table cell node with content "${textContent}" not found.`); + } + + return ret; +}; + +function sliceSingleNode(slice: Slice) { + return slice.openStart === 0 && + slice.openEnd === 0 && + slice.content.childCount === 1 + ? slice.content.firstChild + : null; +} + +// This function is a copy of the `doPaste` function from `@tiptap/pm/view`, +// but made to work in a JSDOM environment. To do this, the `tr.scrollIntoView` +// call has been removed. +// https://github.com/ProseMirror/prosemirror-view/blob/17b508f618c944c54776f8ddac45edcb49970796/src/input.ts#L624 +export function doPaste( + view: EditorView, + text: string, + html: string | null, + preferPlain: boolean, + event: ClipboardEvent +) { + const slice = (pmView as any).__parseFromClipboard( + view, + text, + html, + preferPlain, + view.state.selection.$from + ); + if ( + view.someProp("handlePaste", (f) => f(view, event, slice || Slice.empty)) + ) { + return true; + } + if (!slice) { + return false; + } + + const singleNode = sliceSingleNode(slice); + const tr = singleNode + ? view.state.tr.replaceSelectionWith(singleNode, preferPlain) + : view.state.tr.replaceSelection(slice); + view.dispatch(tr.setMeta("paste", true).setMeta("uiEvent", "paste")); + return true; +} diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocks.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocks.html new file mode 100644 index 0000000000..ec3fa8a4e2 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocks.html @@ -0,0 +1 @@ +

Paragraph 1

Heading 1

  1. Numbered List Item 1

  • Bullet List Item 1

  • Check List Item 1

console.log("Hello World");

Table Cell 1

Table Cell 2

Table Cell 3

Table Cell 4

Add image

Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html new file mode 100644 index 0000000000..2f670e89d2 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html @@ -0,0 +1 @@ +

Paragraph 1

Heading 1

  1. Numbered List Item 1

  • Bullet List Item 1

  • Check List Item 1

console.log("Hello World");

Table Cell 1

Table Cell 2

Table Cell 3

Table Cell 4

1280px-Placeholder_view_vector.svg.png
Placeholder

Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childToParent.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childToParent.html new file mode 100644 index 0000000000..dd8f8a98d5 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childToParent.html @@ -0,0 +1 @@ +

Paragraph 1

Nested Paragraph 1

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html new file mode 100644 index 0000000000..5bad4edb45 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html @@ -0,0 +1 @@ +

Nested Paragraph 1

Nested Paragraph 2

Nested Paragraph 3

Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html new file mode 100644 index 0000000000..0835489372 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html @@ -0,0 +1 @@ +

Nested Paragraph 1

Nested Paragraph 2

Nested Paragraph 3

Paragraph 2

Nested Paragraph 4

Nested Paragraph 5

Nested Paragraph 6

\ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/image.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/image.html similarity index 81% rename from packages/core/src/api/clipboard/__snapshots__/internal/image.html rename to packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/image.html index 09248e5920..1a86821862 100644 --- a/packages/core/src/api/clipboard/__snapshots__/internal/image.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/image.html @@ -1 +1 @@ -BlockNote image

Nested Paragraph

\ No newline at end of file +BlockNote image \ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/internal/multipleChildren.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleChildren.html similarity index 100% rename from packages/core/src/api/clipboard/__snapshots__/internal/multipleChildren.html rename to packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleChildren.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleStyledText.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleStyledText.html new file mode 100644 index 0000000000..6d1372fc71 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleStyledText.html @@ -0,0 +1 @@ +Unstyled TextItalic TextBold Text \ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/nestedImage.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/nestedImage.html new file mode 100644 index 0000000000..f23120b803 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/nestedImage.html @@ -0,0 +1 @@ +

Paragraph 1

BlockNote image

Nested Paragraph 1

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/partialChildToParent.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/partialChildToParent.html new file mode 100644 index 0000000000..38f4f5b8a5 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/partialChildToParent.html @@ -0,0 +1 @@ +

aragraph 1

N

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/styledText.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/styledText.html new file mode 100644 index 0000000000..3e4402a48e --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/styledText.html @@ -0,0 +1 @@ +Italic Text \ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableAllCells.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableAllCells.html new file mode 100644 index 0000000000..6d9b71c451 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableAllCells.html @@ -0,0 +1 @@ +

Table Cell 1

Table Cell 2

Table Cell 3

Table Cell 4

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCell.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCell.html new file mode 100644 index 0000000000..7e12584ba8 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCell.html @@ -0,0 +1 @@ +

Table Cell 1

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCellText.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCellText.html new file mode 100644 index 0000000000..925f07b3fd --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCellText.html @@ -0,0 +1 @@ +Table Cell 1 \ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCol.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCol.html new file mode 100644 index 0000000000..0501d5e8a0 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCol.html @@ -0,0 +1 @@ +

Table Cell 1

Table Cell 3

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableRow.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableRow.html new file mode 100644 index 0000000000..7dfe7da261 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableRow.html @@ -0,0 +1 @@ +

Table Cell 1

Table Cell 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/unstyledText.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/unstyledText.html new file mode 100644 index 0000000000..6147731f88 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/unstyledText.html @@ -0,0 +1 @@ +Unstyled Text \ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts b/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts new file mode 100644 index 0000000000..b850adbea6 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts @@ -0,0 +1,611 @@ +import { Node } from "@tiptap/pm/model"; +import { NodeSelection, Selection, TextSelection } from "@tiptap/pm/state"; +import { CellSelection } from "@tiptap/pm/tables"; + +import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { + getPosOfTableCellNode, + getPosOfTextNode, +} from "../clipboardTestUtil.js"; + +export type CopyTestCase = { + name: string; + // At some point we probably want to only have one HTML format that is both + // lossless when converting to/from blocks, in which case we will only need + // "html" test cases and can remove "blockNoteHTML". + clipboardDataType: "blocknote/html" | "text/html" | "text/plain"; + document: PartialBlock< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >[]; + getCopySelection: (pmDoc: Node) => Selection; +}; + +export const getCopyTestCases = (): CopyTestCase[] => [ + { + name: "multipleChildren", + clipboardDataType: "text/html", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + { + type: "paragraph", + content: "Nested Paragraph 3", + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Nested Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Nested Paragraph 3", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + { + name: "childToParent", + clipboardDataType: "text/html", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + { + type: "paragraph", + content: "Nested Paragraph 3", + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Nested Paragraph 1", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + { + name: "partialChildToParent", + clipboardDataType: "text/html", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + { + type: "paragraph", + content: "Nested Paragraph 3", + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1") + 1; + const endPos = getPosOfTextNode(doc, "Nested Paragraph 1") + 1; + + return TextSelection.create(doc, startPos, endPos); + }, + }, + { + name: "childrenToNextParent", + clipboardDataType: "text/html", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + { + type: "paragraph", + content: "Nested Paragraph 3", + }, + ], + }, + { + type: "paragraph", + content: "Paragraph 2", + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Nested Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Paragraph 2", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + { + name: "childrenToNextParentsChildren", + clipboardDataType: "text/html", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + { + type: "paragraph", + content: "Nested Paragraph 3", + }, + ], + }, + { + type: "paragraph", + content: "Paragraph 2", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 4", + }, + { + type: "paragraph", + content: "Nested Paragraph 5", + }, + { + type: "paragraph", + content: "Nested Paragraph 6", + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Nested Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Nested Paragraph 6", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + { + name: "unstyledText", + clipboardDataType: "text/html", + document: [ + { + type: "heading", + content: "Unstyled Text", + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Unstyled Text"); + const endPos = getPosOfTextNode(doc, "Unstyled Text", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + { + name: "styledText", + clipboardDataType: "text/html", + document: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "Unstyled Text", + styles: {}, + }, + { + type: "text", + text: "Italic Text", + styles: { + italic: true, + }, + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Italic Text"); + const endPos = getPosOfTextNode(doc, "Italic Text", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + { + name: "multipleStyledText", + clipboardDataType: "text/html", + document: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "Unstyled Text", + styles: {}, + }, + { + type: "text", + text: "Italic Text", + styles: { + italic: true, + }, + }, + { + type: "text", + text: "Bold Text", + styles: { + bold: true, + }, + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Unstyled Text"); + const endPos = getPosOfTextNode(doc, "Bold Text", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + { + name: "image", + clipboardDataType: "text/html", + document: [ + { + type: "image", + props: { + url: "https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg", + }, + }, + ], + getCopySelection: (doc) => { + let startPos: number | undefined = undefined; + + doc.descendants((node, pos) => { + if (node.type.name === "image") { + startPos = pos; + } + }); + + if (startPos === undefined) { + throw new Error("Image node not found."); + } + + return NodeSelection.create(doc, startPos); + }, + }, + { + name: "nestedImage", + clipboardDataType: "text/html", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "image", + props: { + url: "https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg", + }, + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + ], + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Nested Paragraph 1", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + { + name: "tableCellText", + clipboardDataType: "text/html", + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Table Cell 1"); + const endPos = getPosOfTextNode(doc, "Table Cell 1", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + // TODO: External HTML is wrapped in unnecessary `tr` element. + { + name: "tableCell", + clipboardDataType: "text/html", + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); + + return CellSelection.create(doc, startPos); + }, + }, + { + name: "tableRow", + clipboardDataType: "text/html", + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); + const endPos = getPosOfTableCellNode(doc, "Table Cell 2"); + + return CellSelection.create(doc, startPos, endPos); + }, + }, + { + name: "tableCol", + clipboardDataType: "text/html", + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); + const endPos = getPosOfTableCellNode(doc, "Table Cell 3"); + + return CellSelection.create(doc, startPos, endPos); + }, + }, + { + name: "tableAllCells", + clipboardDataType: "text/html", + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); + const endPos = getPosOfTableCellNode(doc, "Table Cell 4"); + + return CellSelection.create(doc, startPos, endPos); + }, + }, + // TODO: 2 tests below necessary? + { + name: "basicBlocks", + clipboardDataType: "text/html", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + { + type: "heading", + content: "Heading 1", + }, + { + type: "numberedListItem", + content: "Numbered List Item 1", + }, + { + type: "bulletListItem", + content: "Bullet List Item 1", + }, + { + type: "checkListItem", + content: "Check List Item 1", + }, + { + type: "codeBlock", + content: 'console.log("Hello World");', + }, + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + { + type: "image", + }, + { + type: "paragraph", + content: "Paragraph 2", + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Paragraph 2", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + { + name: "basicBlocksWithProps", + clipboardDataType: "text/html", + document: [ + { + type: "paragraph", + props: { + textColor: "red", + }, + content: "Paragraph 1", + }, + { + type: "heading", + props: { + level: 2, + }, + content: "Heading 1", + }, + { + type: "numberedListItem", + props: { + start: 2, + }, + content: "Numbered List Item 1", + }, + { + type: "bulletListItem", + props: { + backgroundColor: "red", + }, + content: "Bullet List Item 1", + }, + { + type: "checkListItem", + props: { + checked: true, + }, + content: "Check List Item 1", + }, + { + type: "codeBlock", + props: { + language: "typescript", + }, + content: 'console.log("Hello World");', + }, + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + { + type: "image", + props: { + name: "1280px-Placeholder_view_vector.svg.png", + url: "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/Placeholder_view_vector.svg/1280px-Placeholder_view_vector.svg.png", + caption: "Placeholder", + showPreview: true, + previewWidth: 256, + }, + }, + { + type: "paragraph", + content: "Paragraph 2", + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Paragraph 2", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, +]; diff --git a/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts b/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts new file mode 100644 index 0000000000..25158039cf --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts @@ -0,0 +1,68 @@ +import { describe, expect, it } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { UnreachableCaseError } from "../../../../util/typescript.js"; +import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; +import { setupTestEditor } from "../../setupTestEditor.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { CopyTestCase, getCopyTestCases } from "./getCopyTestCases.js"; + +// Test for verifying content that gets put on the clipboard when copying within +// the editor. Used broadly to ensure each block or set of blocks is correctly +// converted into different types of clipboard data. +const testCopyTest = async ( + editor: BlockNoteEditor< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + testCase: CopyTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + editor.replaceBlocks(editor.document, testCase.document); + + if (!editor.prosemirrorView) { + throw new Error("Editor view not initialized."); + } + + editor.dispatch( + editor._tiptapEditor.state.tr.setSelection( + testCase.getCopySelection(editor.prosemirrorView.state.doc) + ) + ); + + const { clipboardHTML, externalHTML, markdown } = selectedFragmentToHTML( + editor.prosemirrorView, + editor + ); + + if (testCase.clipboardDataType === "blocknote/html") { + await expect(clipboardHTML).toMatchFileSnapshot( + `./__snapshots__/${testCase.clipboardDataType}/${testCase.name}.html` + ); + } else if (testCase.clipboardDataType === "text/html") { + await expect(externalHTML).toMatchFileSnapshot( + `./__snapshots__/${testCase.clipboardDataType}/${testCase.name}.html` + ); + } else if (testCase.clipboardDataType === "text/plain") { + await expect(markdown).toMatchFileSnapshot( + `./__snapshots__/${testCase.clipboardDataType}/${testCase.name}.md` + ); + } else { + throw new UnreachableCaseError(testCase.clipboardDataType); + } +}; + +describe("Copy tests", () => { + const getEditor = setupTestEditor(); + + for (const testCase of getCopyTestCases()) { + it(`${testCase.name}`, async () => { + await testCopyTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/clipboard/copyPaste/__snapshots__/paragraphInCustomBlock.json b/packages/core/src/api/tests/clipboard/copyPaste/__snapshots__/paragraphInCustomBlock.json new file mode 100644 index 0000000000..dae7ce6eed --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPaste/__snapshots__/paragraphInCustomBlock.json @@ -0,0 +1,36 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 1", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 1", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "customParagraph", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts b/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts new file mode 100644 index 0000000000..736696d213 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts @@ -0,0 +1,49 @@ +import { Node } from "@tiptap/pm/model"; +import { Selection, TextSelection } from "@tiptap/pm/state"; + +import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { getPosOfTextNode } from "../clipboardTestUtil.js"; + +export type CopyPasteTestCase = { + name: string; + document: PartialBlock< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >[]; + getCopySelection: (pmDoc: Node) => Selection; + getPasteSelection: (pmDoc: Node) => Selection; +}; + +export const getCopyPasteTestCases = (): CopyPasteTestCase[] => [ + { + name: "paragraphInCustomBlock", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + { + type: "customParagraph", + content: "Custom Paragraph 1", + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Paragraph 1", true); + + return TextSelection.create(doc, startPos, endPos); + }, + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Custom Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Custom Paragraph 1", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, +]; diff --git a/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts b/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts new file mode 100644 index 0000000000..522755e9c2 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts @@ -0,0 +1,72 @@ +import { describe, expect, it } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; +import { setupTestEditor } from "../../setupTestEditor.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { doPaste } from "../clipboardTestUtil.js"; +import { + CopyPasteTestCase, + getCopyPasteTestCases, +} from "./getCopyPasteTestCases.js"; + +// Test for verifying that copying and pasting content within the editor works +// as expected. Used for specific cases where unexpected behaviour was noticed. +const testCopyPasteTest = async ( + editor: BlockNoteEditor< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + testCase: CopyPasteTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + editor.replaceBlocks(editor.document, testCase.document); + + if (!editor.prosemirrorView) { + throw new Error("Editor view not initialized."); + } + + editor.dispatch( + editor._tiptapEditor.state.tr.setSelection( + testCase.getCopySelection(editor.prosemirrorView.state.doc) + ) + ); + + const { clipboardHTML } = selectedFragmentToHTML( + editor.prosemirrorView, + editor + ); + + editor.dispatch( + editor._tiptapEditor.state.tr.setSelection( + testCase.getPasteSelection(editor.prosemirrorView.state.doc) + ) + ); + + doPaste( + editor.prosemirrorView, + "text", + clipboardHTML, + false, + new ClipboardEvent("paste") + ); + + await expect(editor.document).toMatchFileSnapshot( + `./__snapshots__/${testCase.name}.json` + ); +}; + +describe("Copy/paste tests", async () => { + const getEditor = setupTestEditor(); + + for (const testCase of getCopyPasteTestCases()) { + it(`${testCase.name}`, async () => { + await testCopyPasteTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.ts b/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.ts new file mode 100644 index 0000000000..5f564c9d06 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.ts @@ -0,0 +1,27 @@ +import { Node } from "@tiptap/pm/model"; +import { Selection } from "@tiptap/pm/state"; + +import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { getCopyTestCases } from "../copy/getCopyTestCases.js"; + +export type CopyPasteEqualityTestCase = { + name: string; + document: PartialBlock< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >[]; + getCopyAndPasteSelection: (pmDoc: Node) => Selection; +}; + +export const getCopyPasteEqualityTestCases = (): CopyPasteEqualityTestCase[] => + getCopyTestCases().map(({ name, document, getCopySelection }) => ({ + name, + document, + getCopyAndPasteSelection: getCopySelection, + })); diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts b/packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts new file mode 100644 index 0000000000..ff3af2e179 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts @@ -0,0 +1,67 @@ +import { describe, expect, it } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; +import { setupTestEditor } from "../../setupTestEditor.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { + CopyPasteEqualityTestCase, + getCopyPasteEqualityTestCases, +} from "./getCopyPasteEqualityTestCases.js"; +import { doPaste } from "../clipboardTestUtil.js"; + +// Test for verifying that copying and pasting content in place within the +// editor results in the same document as the original. Used broadly to ensure +// that converting to and from clipboard data does not result in any data loss. +const testCopyPasteEqualityTest = ( + editor: BlockNoteEditor< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + testCase: CopyPasteEqualityTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + editor.replaceBlocks(editor.document, testCase.document); + + if (!editor.prosemirrorView) { + throw new Error("Editor view not initialized."); + } + + editor.dispatch( + editor._tiptapEditor.state.tr.setSelection( + testCase.getCopyAndPasteSelection(editor.prosemirrorView.state.doc) + ) + ); + + const { clipboardHTML } = selectedFragmentToHTML( + editor.prosemirrorView, + editor + ); + + const originalDocument = editor.document; + doPaste( + editor.prosemirrorView, + "text", + clipboardHTML, + false, + new ClipboardEvent("paste") + ); + const newDocument = editor.document; + + expect(newDocument).toStrictEqual(originalDocument); +}; + +describe("Copy/paste equality tests", () => { + const getEditor = setupTestEditor(); + + for (const testCase of getCopyPasteEqualityTestCases()) { + it(`${testCase.name}`, async () => { + testCopyPasteEqualityTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-divs.json b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteEndOfParagraph.json similarity index 60% rename from packages/core/src/api/exporters/html/__snapshots__/paste/parse-divs.json rename to packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteEndOfParagraph.json index 33f2f5010b..97c76edcff 100644 --- a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-divs.json +++ b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteEndOfParagraph.json @@ -1,19 +1,19 @@ [ { - "id": "1", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { + "styles": {}, + "text": "Paragraph 1Paragraph", "type": "text", - "text": "Single Div", - "styles": {} - } + }, ], - "children": [] - } + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-fake-image-caption.json b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteImage.json similarity index 61% rename from packages/core/src/api/exporters/html/__snapshots__/paste/parse-fake-image-caption.json rename to packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteImage.json index 86a0cb8168..c0252a327f 100644 --- a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-fake-image-caption.json +++ b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteImage.json @@ -1,31 +1,34 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 1", + "type": "text", + }, + ], "id": "1", - "type": "image", "props": { "backgroundColor": "default", "textAlignment": "left", - "url": "exampleURL", - "caption": "", - "width": 512 + "textColor": "default", }, - "children": [] + "type": "paragraph", }, { + "children": [], + "content": undefined, "id": "2", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "caption": "", + "name": "", + "previewWidth": 512, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", }, - "content": [ - { - "type": "text", - "text": "Image Caption", - "styles": {} - } - ], - "children": [] - } + "type": "image", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteParagraphInCustomBlock.json b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteParagraphInCustomBlock.json new file mode 100644 index 0000000000..6ebff558bb --- /dev/null +++ b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteParagraphInCustomBlock.json @@ -0,0 +1,19 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Custom Paragraph 1Paragraph", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "customParagraph", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteTable.json similarity index 80% rename from packages/core/src/api/clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html rename to packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteTable.json index 9c4f9b7629..871e788cbf 100644 --- a/packages/core/src/api/clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html +++ b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteTable.json @@ -4,11 +4,11 @@ "content": [ { "styles": {}, - "text": "Paragraph", + "text": "Paragraph 1", "type": "text", }, ], - "id": "0", + "id": "1", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -32,7 +32,7 @@ "content": [ { "styles": {}, - "text": "Table Cell", + "text": "Cell 1", "type": "text", }, ], @@ -49,7 +49,7 @@ "content": [ { "styles": {}, - "text": "Table Cell", + "text": "Cell 2", "type": "text", }, ], @@ -70,7 +70,7 @@ "content": [ { "styles": {}, - "text": "Table Cell", + "text": "Cell 3", "type": "text", }, ], @@ -87,7 +87,7 @@ "content": [ { "styles": {}, - "text": "Table Cell", + "text": "Cell 4", "type": "text", }, ], @@ -105,34 +105,10 @@ ], "type": "tableContent", }, - "id": "1", - "props": { - "textColor": "default", - }, - "type": "table", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Paragraph", - "type": "text", - }, - ], "id": "2", - "props": {}, - "type": "customParagraph", - }, - { - "children": [], - "content": [], - "id": "3", "props": { - "backgroundColor": "default", - "textAlignment": "left", "textColor": "default", }, - "type": "paragraph", + "type": "table", }, ] \ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/external/pasteTableInExistingTable.html b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteTableInExistingTable.json similarity index 83% rename from packages/core/src/api/clipboard/__snapshots__/external/pasteTableInExistingTable.html rename to packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteTableInExistingTable.json index 034816337e..d968fe9dd4 100644 --- a/packages/core/src/api/clipboard/__snapshots__/external/pasteTableInExistingTable.html +++ b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteTableInExistingTable.json @@ -1,21 +1,4 @@ [ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Paragraph", - "type": "text", - }, - ], - "id": "0", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, { "children": [], "content": { @@ -33,7 +16,7 @@ "content": [ { "styles": {}, - "text": "Table Cell", + "text": "Table Cell 1", "type": "text", }, ], @@ -50,7 +33,7 @@ "content": [ { "styles": {}, - "text": "Table Cell", + "text": "Table Cell 2", "type": "text", }, ], @@ -82,7 +65,7 @@ "content": [ { "styles": {}, - "text": "Table Cell", + "text": "Table Cell 3", "type": "text", }, ], @@ -189,28 +172,4 @@ }, "type": "table", }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Custom Paragraph", - "type": "text", - }, - ], - "id": "2", - "props": {}, - "type": "customParagraph", - }, - { - "children": [], - "content": [], - "id": "3", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, ] \ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/plain/pasteEndOfParagraphText.json b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/plain/pasteEndOfParagraphText.json new file mode 100644 index 0000000000..97c76edcff --- /dev/null +++ b/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/plain/pasteEndOfParagraphText.json @@ -0,0 +1,19 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 1Paragraph", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts b/packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts new file mode 100644 index 0000000000..6379926036 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts @@ -0,0 +1,149 @@ +import { Node } from "@tiptap/pm/model"; +import { Selection, TextSelection } from "@tiptap/pm/state"; + +import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { getPosOfTextNode } from "../clipboardTestUtil.js"; + +export type PasteTestCase = { + name: string; + clipboardDataType: "text/html" | "text/markdown" | "text/plain"; + content: string; + document: PartialBlock< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >[]; + getPasteSelection: (pmDoc: Node) => Selection; +}; + +export const getPasteTestCases = (): PasteTestCase[] => [ + { + name: "pasteEndOfParagraph", + clipboardDataType: "text/html", + content: `

Paragraph

`, + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1", true); + + return TextSelection.create(doc, startPos); + }, + }, + { + name: "pasteEndOfParagraphText", + clipboardDataType: "text/plain", + content: `Paragraph`, + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1", true); + + return TextSelection.create(doc, startPos); + }, + }, + { + name: "pasteImage", + clipboardDataType: "text/html", + content: ``, + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1", true); + + return TextSelection.create(doc, startPos); + }, + }, + { + name: "pasteTable", + clipboardDataType: "text/html", + content: ` + + + + + + + + +
Cell 1Cell 2
Cell 3Cell 4
`, + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1", true); + + return TextSelection.create(doc, startPos); + }, + }, + { + name: "pasteTableInExistingTable", + clipboardDataType: "text/html", + content: ` + + + + + + + + +
Cell 1Cell 2
Cell 3Cell 4
`, + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Table Cell 4", true); + + return TextSelection.create(doc, startPos); + }, + }, + { + name: "pasteParagraphInCustomBlock", + clipboardDataType: "text/html", + content: `

Paragraph

`, + document: [ + { + type: "customParagraph", + content: "Custom Paragraph 1", + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Custom Paragraph 1", true); + + return TextSelection.create(doc, startPos); + }, + }, +]; diff --git a/packages/core/src/api/tests/clipboard/paste/testPaste.test.ts b/packages/core/src/api/tests/clipboard/paste/testPaste.test.ts new file mode 100644 index 0000000000..ff712fd872 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/paste/testPaste.test.ts @@ -0,0 +1,59 @@ +import { describe, expect, it } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { setupTestEditor } from "../../setupTestEditor.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { doPaste } from "../clipboardTestUtil.js"; +import { getPasteTestCases, PasteTestCase } from "./getPasteTestCases.js"; + +// Test for verifying that clipboard data gets pasted into the editor properly. +// Used for specific cases for when content from outside the editor is pasted +// into it. This includes content from other editors, as well as content from +// the web that has produced bugs in the past. +const testPasteTest = async ( + editor: BlockNoteEditor< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + testCase: PasteTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + editor.replaceBlocks(editor.document, testCase.document); + + if (!editor.prosemirrorView) { + throw new Error("Editor view not initialized."); + } + + editor.dispatch( + editor._tiptapEditor.state.tr.setSelection( + testCase.getPasteSelection(editor.prosemirrorView.state.doc) + ) + ); + + doPaste( + editor.prosemirrorView, + testCase.content, + testCase.content, + testCase.clipboardDataType !== "text/html", + new ClipboardEvent("paste") + ); + + await expect(editor.document).toMatchFileSnapshot( + `./__snapshots__/${testCase.clipboardDataType}/${testCase.name}.json` + ); +}; + +describe("Paste tests", () => { + const getEditor = setupTestEditor(); + + for (const testCase of getPasteTestCases()) { + it(`${testCase.name}`, async () => { + await testPasteTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html new file mode 100644 index 0000000000..0726d52681 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html @@ -0,0 +1,3 @@ +
const hello = 'world';
+console.log(hello);
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html new file mode 100644 index 0000000000..1bdf06d688 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html @@ -0,0 +1 @@ +
console.log('Hello, world!');
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html new file mode 100644 index 0000000000..1affa24729 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html new file mode 100644 index 0000000000..79bee36d05 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html @@ -0,0 +1 @@ +
print('Hello, world!')
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html new file mode 100644 index 0000000000..9c93196626 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html @@ -0,0 +1 @@ +

Heading 2

Paragraph

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html new file mode 100644 index 0000000000..1319139845 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html @@ -0,0 +1 @@ +

example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html new file mode 100644 index 0000000000..eec0bad77e --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html @@ -0,0 +1 @@ +

Add file

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html new file mode 100644 index 0000000000..78fc188b14 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html @@ -0,0 +1 @@ +

example

Caption

example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html new file mode 100644 index 0000000000..c840e3bf3d --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html @@ -0,0 +1 @@ +

example

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html new file mode 100644 index 0000000000..95094bba1c --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html @@ -0,0 +1 @@ +

Caption

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html new file mode 100644 index 0000000000..a2330209d8 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html @@ -0,0 +1 @@ +

Text1
Text2

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html new file mode 100644 index 0000000000..a2bfa95fcc --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html new file mode 100644 index 0000000000..8a31eda9c1 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html @@ -0,0 +1 @@ +

Text1

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html new file mode 100644 index 0000000000..e521018b55 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html new file mode 100644 index 0000000000..f1d84c28ea --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html @@ -0,0 +1 @@ +

Text1
Text2
Text3

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html new file mode 100644 index 0000000000..719876c082 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html @@ -0,0 +1 @@ +


\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html new file mode 100644 index 0000000000..59b4513961 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html @@ -0,0 +1 @@ +


Text1

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html new file mode 100644 index 0000000000..2e363d05b6 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html @@ -0,0 +1 @@ +

Text1
Text2

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html new file mode 100644 index 0000000000..f0a941fa7d --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html @@ -0,0 +1 @@ +
example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html new file mode 100644 index 0000000000..17bb6273f2 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html @@ -0,0 +1 @@ +

Add image

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html new file mode 100644 index 0000000000..2c4ec32a7e --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html @@ -0,0 +1 @@ +
Caption

Caption

Caption

Caption

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html new file mode 100644 index 0000000000..d31f966332 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html @@ -0,0 +1 @@ +
example
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html new file mode 100644 index 0000000000..94a1c1eca4 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html @@ -0,0 +1 @@ +
Caption

Caption

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html new file mode 100644 index 0000000000..16e87d8805 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html @@ -0,0 +1 @@ +

example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html new file mode 100644 index 0000000000..84e53fbec0 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html new file mode 100644 index 0000000000..abb46733e3 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html new file mode 100644 index 0000000000..30390a6b85 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html new file mode 100644 index 0000000000..0c946d8b79 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html @@ -0,0 +1 @@ +

Bullet List Item 1

Bullet List Item 2

Numbered List Item 1

Numbered List Item 2

Check List Item 1

Check List Item 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html new file mode 100644 index 0000000000..0b8783cbeb --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html @@ -0,0 +1 @@ +

Bullet List Item 1

Bullet List Item 2

Numbered List Item 1

Numbered List Item 2

Check List Item 1

Check List Item 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html new file mode 100644 index 0000000000..1d5a3f2400 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html @@ -0,0 +1 @@ +

Paragraph

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html new file mode 100644 index 0000000000..f54bf0da2f --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html @@ -0,0 +1 @@ +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html new file mode 100644 index 0000000000..38d71a5d77 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html @@ -0,0 +1 @@ +

Line 1
Line 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html new file mode 100644 index 0000000000..27d18b09f0 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html @@ -0,0 +1 @@ +

Paragraph

Nested Paragraph 1

Nested Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html new file mode 100644 index 0000000000..14c8ccfa6d --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html @@ -0,0 +1 @@ +

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html new file mode 100644 index 0000000000..d0c3bee7be --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html @@ -0,0 +1 @@ +

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html new file mode 100644 index 0000000000..34d6bd6fbf --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html @@ -0,0 +1 @@ +

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html new file mode 100644 index 0000000000..0530d9e66c --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html @@ -0,0 +1 @@ +

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html new file mode 100644 index 0000000000..572aab33bf --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html @@ -0,0 +1 @@ +

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html new file mode 100644 index 0000000000..e0313a2b39 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html @@ -0,0 +1 @@ +

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html new file mode 100644 index 0000000000..5f4cc9af6e --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html @@ -0,0 +1 @@ +

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html new file mode 100644 index 0000000000..62114b9765 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html @@ -0,0 +1 @@ +

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/contains-newlines/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/codeBlock/contains-newlines/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/empty/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/codeBlock/empty/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/codeBlock/python/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/codeBlock/python/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/complex/misc/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/complex/misc.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/complex/misc/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/complex/misc.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/file/basic/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/basic.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/file/basic/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/basic.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/file/button/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/button.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/file/button/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/button.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/file/nested/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/nested.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/file/nested/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/nested.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/file/noCaption/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noCaption.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/file/noCaption/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noCaption.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/file/noName/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noName.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/file/noName/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noName.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/basic/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/hardbreak/basic/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/between-links/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/hardbreak/between-links/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/end/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/hardbreak/end/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/link/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/hardbreak/link/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/multiple/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/hardbreak/multiple/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/only/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/hardbreak/only/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/start/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/hardbreak/start/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/hardbreak/styles/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/hardbreak/styles/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/basic.html new file mode 100644 index 0000000000..6b8bf9fb50 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/basic.html @@ -0,0 +1 @@ +
example

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/button/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/button.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/image/button/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/button.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/nested.html new file mode 100644 index 0000000000..e1c7e7eb92 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/nested.html @@ -0,0 +1 @@ +
exampleURL

Caption

exampleURL

Caption

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noCaption.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noCaption.html new file mode 100644 index 0000000000..00a10df4fa --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noCaption.html @@ -0,0 +1 @@ +example \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noName.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noName.html new file mode 100644 index 0000000000..08b9fe6e61 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noName.html @@ -0,0 +1 @@ +
exampleURL

Caption

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/image/noPreview/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noPreview.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/image/noPreview/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noPreview.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/link/adjacent/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/adjacent.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/link/adjacent/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/adjacent.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/link/basic/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/basic.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/link/basic/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/basic.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/link/styled/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/styled.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/link/styled/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/styled.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/lists/basic/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/basic.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/lists/basic/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/basic.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/lists/nested/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/nested.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/lists/nested/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/nested.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/paragraph/basic/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/basic.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/paragraph/basic/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/basic.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/paragraph/empty/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/empty.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/paragraph/empty/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/empty.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/paragraph/nested/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/paragraph/nested/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/paragraph/styled/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/paragraph/styled/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/allColWidths/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/table/allColWidths/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/basic/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/basic.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/table/basic/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/basic.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/headerCols/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerCols.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/table/headerCols/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerCols.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/headerRows/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerRows.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/table/headerRows/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerRows.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/mixedCellColors/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/table/mixedCellColors/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/mixedColWidths/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/table/mixedColWidths/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html diff --git a/packages/core/src/api/exporters/html/__snapshots__/table/mixedRowspansAndColspans/external.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html similarity index 100% rename from packages/core/src/api/exporters/html/__snapshots__/table/mixedRowspansAndColspans/external.html rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/codeBlock/contains-newlines/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/codeBlock/contains-newlines/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/codeBlock/defaultLanguage/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/codeBlock/defaultLanguage/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/codeBlock/empty/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/codeBlock/empty/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/codeBlock/python/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/codeBlock/python/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/complex/misc/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/complex/misc/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/file/basic/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/basic.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/file/basic/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/basic.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/file/button/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/button.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/file/button/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/button.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/file/nested/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/nested.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/file/nested/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/nested.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/file/noCaption/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/file/noCaption/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/file/noName/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/noName.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/file/noName/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/noName.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/basic/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/basic/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/between-links/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/between-links/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/end/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/end/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/link/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/link/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/multiple/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/multiple/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/only/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/only.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/only/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/only.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/start/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/start/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/styles/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/hardbreak/styles/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/image/noPreview/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/basic.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/image/noPreview/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/basic.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/image/button/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/button.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/image/button/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/button.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/nested.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/nested.md new file mode 100644 index 0000000000..83c6df00ed --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/nested.md @@ -0,0 +1,7 @@ +[exampleURL](exampleURL) + +Caption + +[exampleURL](exampleURL) + +Caption diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md new file mode 100644 index 0000000000..f525eb2143 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md @@ -0,0 +1 @@ +[example](exampleURL) diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noName.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noName.md new file mode 100644 index 0000000000..c7fefc547f --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noName.md @@ -0,0 +1,3 @@ +[exampleURL](exampleURL) + +Caption diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md new file mode 100644 index 0000000000..3acd9e1ad0 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md @@ -0,0 +1,3 @@ +[example](exampleURL) + +Caption diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/link/adjacent/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/link/adjacent/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/link/basic/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/basic.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/link/basic/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/basic.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/link/styled/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/styled.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/link/styled/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/styled.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/lists/basic/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/lists/basic/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/lists/nested/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/lists/nested/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/paragraph/basic/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/paragraph/basic/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/pageBreak/basic/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/empty.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/pageBreak/basic/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/empty.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/paragraph/lineBreaks/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/paragraph/lineBreaks/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/paragraph/nested/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/paragraph/nested/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/paragraph/styled/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/paragraph/styled/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/table/allColWidths/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/table/allColWidths/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/table/basic/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/basic.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/table/basic/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/basic.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/table/headerCols/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/table/headerCols/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/table/headerRows/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/table/headerRows/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/table/mixedCellColors/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/table/mixedCellColors/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/table/mixedColWidths/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/table/mixedColWidths/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md diff --git a/packages/core/src/api/exporters/markdown/__snapshots__/table/mixedRowspansAndColspans/markdown.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md similarity index 100% rename from packages/core/src/api/exporters/markdown/__snapshots__/table/mixedRowspansAndColspans/markdown.md rename to packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json new file mode 100644 index 0000000000..da4c135551 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json @@ -0,0 +1,26 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "language": "javascript", + }, + "content": [ + { + "text": "const hello = 'world'; +console.log(hello); +", + "type": "text", + }, + ], + "type": "codeBlock", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json new file mode 100644 index 0000000000..97b0374bfb --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json @@ -0,0 +1,24 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "language": "text", + }, + "content": [ + { + "text": "console.log('Hello, world!');", + "type": "text", + }, + ], + "type": "codeBlock", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json new file mode 100644 index 0000000000..4fd34ff835 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json @@ -0,0 +1,18 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "language": "text", + }, + "type": "codeBlock", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json new file mode 100644 index 0000000000..01b6f86580 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json @@ -0,0 +1,24 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "language": "python", + }, + "content": [ + { + "text": "print('Hello, world!')", + "type": "text", + }, + ], + "type": "codeBlock", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json new file mode 100644 index 0000000000..85f484ec68 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json @@ -0,0 +1,88 @@ +[ + { + "attrs": { + "backgroundColor": "blue", + "id": "1", + "textColor": "yellow", + }, + "content": [ + { + "attrs": { + "level": 2, + "textAlignment": "right", + }, + "content": [ + { + "marks": [ + { + "type": "bold", + }, + { + "type": "underline", + }, + ], + "text": "Heading ", + "type": "text", + }, + { + "marks": [ + { + "type": "italic", + }, + { + "type": "strike", + }, + ], + "text": "2", + "type": "text", + }, + ], + "type": "heading", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "red", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Paragraph", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "3", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "type": "bulletListItem", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/basic.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/basic.json new file mode 100644 index 0000000000..0de31316e1 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/basic.json @@ -0,0 +1,20 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "example", + "url": "exampleURL", + }, + "type": "file", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/button.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/button.json new file mode 100644 index 0000000000..42be1c0985 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/button.json @@ -0,0 +1,20 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "", + "name": "", + "url": "", + }, + "type": "file", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/nested.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/nested.json new file mode 100644 index 0000000000..f122b855d8 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/nested.json @@ -0,0 +1,43 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "example", + "url": "exampleURL", + }, + "type": "file", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "example", + "url": "exampleURL", + }, + "type": "file", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json new file mode 100644 index 0000000000..7b9cd6f1c4 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json @@ -0,0 +1,20 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "", + "name": "example", + "url": "exampleURL", + }, + "type": "file", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noName.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noName.json new file mode 100644 index 0000000000..393aff6af8 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noName.json @@ -0,0 +1,20 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "", + "url": "exampleURL", + }, + "type": "file", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json new file mode 100644 index 0000000000..8f3e362113 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json @@ -0,0 +1,31 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Text1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "text": "Text2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json new file mode 100644 index 0000000000..93e7571b21 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json @@ -0,0 +1,53 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Link1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website2.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Link2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json new file mode 100644 index 0000000000..781e539991 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json @@ -0,0 +1,27 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Text1", + "type": "text", + }, + { + "type": "hardBreak", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json new file mode 100644 index 0000000000..aee93b47d3 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json @@ -0,0 +1,53 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Link1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Link1", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json new file mode 100644 index 0000000000..b8cd0f19ec --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json @@ -0,0 +1,38 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Text1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "text": "Text2", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "text": "Text3", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json new file mode 100644 index 0000000000..6a1a4d2554 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "type": "hardBreak", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json new file mode 100644 index 0000000000..dc2396df1f --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json @@ -0,0 +1,27 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "type": "hardBreak", + }, + { + "text": "Text1", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json new file mode 100644 index 0000000000..034bf8b726 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json @@ -0,0 +1,36 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Text1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "marks": [ + { + "type": "bold", + }, + ], + "text": "Text2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/basic.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/basic.json new file mode 100644 index 0000000000..ad2d0f7a69 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/basic.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "example", + "previewWidth": 256, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/button.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/button.json new file mode 100644 index 0000000000..e0aef86d8e --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/button.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "", + "name": "", + "previewWidth": 512, + "showPreview": true, + "textAlignment": "left", + "url": "", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/nested.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/nested.json new file mode 100644 index 0000000000..db8fee4b1d --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/nested.json @@ -0,0 +1,49 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "", + "previewWidth": 256, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "", + "previewWidth": 256, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json new file mode 100644 index 0000000000..aaa57c857a --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "", + "name": "example", + "previewWidth": 256, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noName.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noName.json new file mode 100644 index 0000000000..10a9c03a69 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noName.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "", + "previewWidth": 256, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json new file mode 100644 index 0000000000..946ca5f86e --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "example", + "previewWidth": 256, + "showPreview": false, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json new file mode 100644 index 0000000000..13f609f82e --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json @@ -0,0 +1,50 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Website", + "type": "text", + }, + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website2.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Website2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/basic.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/basic.json new file mode 100644 index 0000000000..a760a4ad4f --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/basic.json @@ -0,0 +1,35 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Website", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/styled.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/styled.json new file mode 100644 index 0000000000..2d4dc02bec --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/styled.json @@ -0,0 +1,53 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "marks": [ + { + "type": "bold", + }, + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Web", + "type": "text", + }, + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "site", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json new file mode 100644 index 0000000000..70a1a0aaa4 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json @@ -0,0 +1,140 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Bullet List Item 1", + "type": "text", + }, + ], + "type": "bulletListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Bullet List Item 2", + "type": "text", + }, + ], + "type": "bulletListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "3", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "index": null, + "start": undefined, + "textAlignment": "left", + }, + "content": [ + { + "text": "Numbered List Item 1", + "type": "text", + }, + ], + "type": "numberedListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "4", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "index": null, + "start": undefined, + "textAlignment": "left", + }, + "content": [ + { + "text": "Numbered List Item 2", + "type": "text", + }, + ], + "type": "numberedListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "5", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "checked": false, + "textAlignment": "left", + }, + "content": [ + { + "text": "Check List Item 1", + "type": "text", + }, + ], + "type": "checkListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "6", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "checked": true, + "textAlignment": "left", + }, + "content": [ + { + "text": "Check List Item 2", + "type": "text", + }, + ], + "type": "checkListItem", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json new file mode 100644 index 0000000000..b0f224fec8 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json @@ -0,0 +1,150 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Bullet List Item 1", + "type": "text", + }, + ], + "type": "bulletListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Bullet List Item 2", + "type": "text", + }, + ], + "type": "bulletListItem", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "id": "3", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "index": null, + "start": undefined, + "textAlignment": "left", + }, + "content": [ + { + "text": "Numbered List Item 1", + "type": "text", + }, + ], + "type": "numberedListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "4", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "index": null, + "start": undefined, + "textAlignment": "left", + }, + "content": [ + { + "text": "Numbered List Item 2", + "type": "text", + }, + ], + "type": "numberedListItem", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "id": "5", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "checked": false, + "textAlignment": "left", + }, + "content": [ + { + "text": "Check List Item 1", + "type": "text", + }, + ], + "type": "checkListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "6", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "checked": true, + "textAlignment": "left", + }, + "content": [ + { + "text": "Check List Item 2", + "type": "text", + }, + ], + "type": "checkListItem", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json new file mode 100644 index 0000000000..03c5eb0a1b --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json @@ -0,0 +1,24 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Paragraph", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json new file mode 100644 index 0000000000..34dcd51ce9 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json @@ -0,0 +1,18 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json new file mode 100644 index 0000000000..14d1230246 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json @@ -0,0 +1,31 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Line 1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "text": "Line 2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json new file mode 100644 index 0000000000..8b7532615d --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json @@ -0,0 +1,73 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Paragraph", + "type": "text", + }, + ], + "type": "paragraph", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Nested Paragraph 1", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "3", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Nested Paragraph 2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json new file mode 100644 index 0000000000..debf389327 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json @@ -0,0 +1,66 @@ +[ + { + "attrs": { + "backgroundColor": "pink", + "id": "1", + "textColor": "orange", + }, + "content": [ + { + "attrs": { + "textAlignment": "center", + }, + "content": [ + { + "text": "Plain ", + "type": "text", + }, + { + "marks": [ + { + "attrs": { + "stringValue": "red", + }, + "type": "textColor", + }, + ], + "text": "Red Text ", + "type": "text", + }, + { + "marks": [ + { + "attrs": { + "stringValue": "blue", + }, + "type": "backgroundColor", + }, + ], + "text": "Blue Background ", + "type": "text", + }, + { + "marks": [ + { + "attrs": { + "stringValue": "red", + }, + "type": "textColor", + }, + { + "attrs": { + "stringValue": "blue", + }, + "type": "backgroundColor", + }, + ], + "text": "Mixed Colors", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json new file mode 100644 index 0000000000..519391c98f --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json @@ -0,0 +1,248 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 200, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 200, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 200, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/basic.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/basic.json new file mode 100644 index 0000000000..8fd5f7f2d3 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/basic.json @@ -0,0 +1,230 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json new file mode 100644 index 0000000000..3933a56ca3 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json @@ -0,0 +1,230 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json new file mode 100644 index 0000000000..dc9ee26a35 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json @@ -0,0 +1,230 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json new file mode 100644 index 0000000000..69b25e9bfa --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json @@ -0,0 +1,242 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "red", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "blue", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "blue", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "yellow", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "red", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json new file mode 100644 index 0000000000..60600bb04e --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json @@ -0,0 +1,242 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json new file mode 100644 index 0000000000..11fb672923 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json @@ -0,0 +1,178 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "red", + "colspan": 2, + "colwidth": [ + 100, + 200, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "blue", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "yellow", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "red", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 2, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 2, + "colwidth": [ + 200, + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 200, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts b/packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts new file mode 100644 index 0000000000..c3267c2c56 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts @@ -0,0 +1,1521 @@ +import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; + +export type ExportTestCase< + // At some point we probably want to only have one HTML format that is both + // lossless when converting to/from conversionType, content, in which case we will only need + // "html" test cases and can remove "blockNoteHTML". + ConversionType extends "blocknoteHTML" | "html" | "markdown" | "nodes" +> = { + name: string; + conversionType: ConversionType; + content: PartialBlock< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >[]; +}; + +export const getExportTestCases = < + ConversionType extends "blocknoteHTML" | "html" | "markdown" | "nodes" +>( + conversionType: ConversionType +): ExportTestCase[] => [ + { + name: "paragraph/empty", + conversionType, + content: [ + { + type: "paragraph", + }, + ], + }, + { + name: "paragraph/basic", + conversionType, + content: [ + { + type: "paragraph", + content: "Paragraph", + }, + ], + }, + { + name: "paragraph/styled", + conversionType, + content: [ + { + type: "paragraph", + props: { + textAlignment: "center", + textColor: "orange", + backgroundColor: "pink", + }, + content: [ + { + type: "text", + styles: {}, + text: "Plain ", + }, + { + type: "text", + styles: { + textColor: "red", + }, + text: "Red Text ", + }, + { + type: "text", + styles: { + backgroundColor: "blue", + }, + text: "Blue Background ", + }, + { + type: "text", + styles: { + textColor: "red", + backgroundColor: "blue", + }, + text: "Mixed Colors", + }, + ], + }, + ], + }, + { + name: "paragraph/nested", + conversionType, + content: [ + { + type: "paragraph", + content: "Paragraph", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + ], + }, + ], + }, + { + name: "paragraph/lineBreaks", + conversionType, + content: [ + { + type: "paragraph", + content: "Line 1\nLine 2", + }, + ], + }, + { + name: "lists/basic", + conversionType, + content: [ + { + type: "bulletListItem", + content: "Bullet List Item 1", + }, + { + type: "bulletListItem", + content: "Bullet List Item 2", + }, + { + type: "numberedListItem", + content: "Numbered List Item 1", + }, + { + type: "numberedListItem", + content: "Numbered List Item 2", + }, + { + type: "checkListItem", + content: "Check List Item 1", + }, + { + type: "checkListItem", + props: { + checked: true, + }, + content: "Check List Item 2", + }, + ], + }, + { + name: "lists/nested", + conversionType, + content: [ + { + type: "bulletListItem", + content: "Bullet List Item 1", + }, + { + type: "bulletListItem", + content: "Bullet List Item 2", + children: [ + { + type: "numberedListItem", + content: "Numbered List Item 1", + }, + { + type: "numberedListItem", + content: "Numbered List Item 2", + children: [ + { + type: "checkListItem", + content: "Check List Item 1", + }, + { + type: "checkListItem", + props: { + checked: true, + }, + content: "Check List Item 2", + }, + ], + }, + ], + }, + ], + }, + { + name: "codeBlock/empty", + conversionType, + content: [ + { + type: "codeBlock", + }, + ], + }, + { + name: "codeBlock/defaultLanguage", + conversionType, + content: [ + { + type: "codeBlock", + content: "console.log('Hello, world!');", + }, + ], + }, + { + name: "codeBlock/python", + conversionType, + content: [ + { + type: "codeBlock", + props: { language: "python" }, + content: "print('Hello, world!')", + }, + ], + }, + { + name: "codeBlock/contains-newlines", + conversionType, + content: [ + { + type: "codeBlock", + props: { language: "javascript" }, + content: "const hello = 'world';\nconsole.log(hello);\n", + }, + ], + }, + { + name: "pageBreak/basic", + conversionType, + content: [ + { + type: "pageBreak", + }, + ], + }, + { + name: "file/button", + conversionType, + content: [ + { + type: "file", + }, + ], + }, + { + name: "file/basic", + conversionType, + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + { + name: "file/noName", + conversionType, + content: [ + { + type: "file", + props: { + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + { + name: "file/noCaption", + conversionType, + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + }, + }, + ], + }, + { + name: "file/nested", + conversionType, + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + children: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + ], + }, + // Because images need to fetch the download URL async, their internal HTML + // is initially rendered without a `src` attribute, which is reflected in + // the tests. + { + name: "image/button", + conversionType, + content: [ + { + type: "image", + }, + ], + }, + { + name: "image/basic", + conversionType, + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + { + name: "image/noName", + conversionType, + content: [ + { + type: "image", + props: { + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + { + name: "image/noCaption", + conversionType, + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + previewWidth: 256, + }, + }, + ], + }, + { + name: "image/noPreview", + conversionType, + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + showPreview: false, + previewWidth: 256, + }, + }, + ], + }, + { + name: "image/nested", + conversionType, + content: [ + { + type: "image", + props: { + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + children: [ + { + type: "image", + props: { + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + ], + }, + { + name: "table/basic", + conversionType, + content: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + { + name: "table/allColWidths", + conversionType, + content: [ + { + type: "table", + content: { + type: "tableContent", + columnWidths: [100, 200, 300], + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + { + name: "table/mixedColWidths", + conversionType, + content: [ + { + type: "table", + content: { + type: "tableContent", + columnWidths: [100, undefined, 300], + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + { + name: "table/mixedCellColors", + conversionType, + content: [ + { + type: "table", + content: { + type: "tableContent", + columnWidths: [100, undefined, 300], + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "red", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "blue", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "blue", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "yellow", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "red", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + { + name: "table/mixedRowspansAndColspans", + conversionType, + content: [ + { + type: "table", + content: { + type: "tableContent", + columnWidths: [100, 200, 300], + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "red", + colspan: 2, + rowspan: 1, + textAlignment: "left", + textColor: "blue", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "yellow", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "red", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 2, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 2, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + { + name: "table/headerRows", + conversionType, + content: [ + { + type: "table", + content: { + headerRows: 1, + type: "tableContent", + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + { + name: "table/headerCols", + conversionType, + content: [ + { + type: "table", + content: { + headerCols: 1, + type: "tableContent", + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + { + name: "link/basic", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "link", + href: "https://www.website.com", + content: "Website", + }, + ], + }, + ], + }, + { + name: "link/styled", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "link", + href: "https://www.website.com", + content: [ + { + type: "text", + text: "Web", + styles: { + bold: true, + }, + }, + { + type: "text", + text: "site", + styles: {}, + }, + ], + }, + ], + }, + ], + }, + { + name: "link/adjacent", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "link", + href: "https://www.website.com", + content: "Website", + }, + { + type: "link", + href: "https://www.website2.com", + content: "Website2", + }, + ], + }, + ], + }, + { + name: "hardbreak/basic", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "Text1\nText2", + styles: {}, + }, + ], + }, + ], + }, + { + name: "hardbreak/multiple", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "Text1\nText2\nText3", + styles: {}, + }, + ], + }, + ], + }, + { + name: "hardbreak/start", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "\nText1", + styles: {}, + }, + ], + }, + ], + }, + { + name: "hardbreak/end", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "Text1\n", + styles: {}, + }, + ], + }, + ], + }, + { + name: "hardbreak/only", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "\n", + styles: {}, + }, + ], + }, + ], + }, + { + name: "hardbreak/styles", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "Text1\n", + styles: {}, + }, + { + type: "text", + text: "Text2", + styles: { bold: true }, + }, + ], + }, + ], + }, + { + name: "hardbreak/link", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "link", + href: "https://www.website.com", + content: "Link1\nLink1", + }, + ], + }, + ], + }, + { + name: "hardbreak/between-links", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "link", + href: "https://www.website.com", + content: "Link1\n", + }, + { + type: "link", + href: "https://www.website2.com", + content: "Link2", + }, + ], + }, + ], + }, + { + name: "complex/misc", + conversionType, + content: [ + { + // id: UniqueID.options.generateID(), + type: "heading", + props: { + backgroundColor: "blue", + textColor: "yellow", + textAlignment: "right", + level: 2, + }, + content: [ + { + type: "text", + text: "Heading ", + styles: { + bold: true, + underline: true, + }, + }, + { + type: "text", + text: "2", + styles: { + italic: true, + strike: true, + }, + }, + ], + children: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + props: { + backgroundColor: "red", + }, + content: "Paragraph", + children: [], + }, + { + // id: UniqueID.options.generateID(), + type: "bulletListItem", + props: {}, + }, + ], + }, + ], + }, +]; diff --git a/packages/core/src/api/tests/formatConversion/export/testExport.test.ts b/packages/core/src/api/tests/formatConversion/export/testExport.test.ts new file mode 100644 index 0000000000..e85bfecea0 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/testExport.test.ts @@ -0,0 +1,75 @@ +import { describe, expect, it } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { UnreachableCaseError } from "../../../../util/typescript.js"; +import { blockToNode } from "../../../nodeConversions/blockToNode.js"; +import { setupTestEditor } from "../../setupTestEditor.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { addIdsToBlock } from "../formatConversionTestUtil.js"; +import { ExportTestCase, getExportTestCases } from "./getExportTestCases.js"; + +// Test for verifying that exporting blocks to other formats works as expected. +// Used broadly to ensure each block or set of blocks is correctly converted +// into different formats. +const testExportTest = async < + ConversionType extends "blocknoteHTML" | "html" | "markdown" | "nodes" +>( + editor: BlockNoteEditor< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + testCase: ExportTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + if (testCase.conversionType === "blocknoteHTML") { + await expect( + await editor.blocksToFullHTML(testCase.content) + ).toMatchFileSnapshot( + `./__snapshots__/${testCase.conversionType}/${testCase.name}.html` + ); + } else if (testCase.conversionType === "html") { + await expect( + await editor.blocksToHTMLLossy(testCase.content) + ).toMatchFileSnapshot( + `./__snapshots__/${testCase.conversionType}/${testCase.name}.html` + ); + } else if (testCase.conversionType === "markdown") { + await expect( + await editor.blocksToMarkdownLossy(testCase.content) + ).toMatchFileSnapshot( + `./__snapshots__/${testCase.conversionType}/${testCase.name}.md` + ); + } else if (testCase.conversionType === "nodes") { + await expect( + testCase.content.map((block) => { + addIdsToBlock(block); + + return blockToNode(block, editor.pmSchema, editor.schema.styleSchema); + }) + ).toMatchFileSnapshot( + `./__snapshots__/${testCase.conversionType}/${testCase.name}.json` + ); + } else { + throw new UnreachableCaseError(testCase.conversionType); + } +}; + +describe("Export tests", async () => { + const getEditor = setupTestEditor(); + + for (const testCase of [ + ...getExportTestCases("blocknoteHTML"), + ...getExportTestCases("html"), + ...getExportTestCases("markdown"), + ...getExportTestCases("nodes"), + ]) { + it(`${testCase.name}`, async () => { + await testExportTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts new file mode 100644 index 0000000000..89596a8a9a --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts @@ -0,0 +1,29 @@ +import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { getExportTestCases } from "../export/getExportTestCases.js"; + +export type ExportParseEqualityTestCase = { + name: string; + // At some point we probably want to only have one HTML format that is both + // lossless when converting to/from blocks, in which case we will only need + // "html" test cases and can remove "blockNoteHTML". + conversionType: "blocknoteHTML" | "nodes"; + content: PartialBlock< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >[]; +}; + +export const getExportParseEqualityTestCases = ( + conversionType: ExportParseEqualityTestCase["conversionType"] +): ExportParseEqualityTestCase[] => + getExportTestCases(conversionType).map(({ name, content }) => ({ + name, + conversionType, + content, + })); diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts new file mode 100644 index 0000000000..c699d8f3d2 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts @@ -0,0 +1,78 @@ +import { describe, expect, it } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { UnreachableCaseError } from "../../../../util/typescript.js"; +import { blockToNode } from "../../../nodeConversions/blockToNode.js"; +import { nodeToBlock } from "../../../nodeConversions/nodeToBlock.js"; +import { setupTestEditor } from "../../setupTestEditor.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { + addIdsToBlock, + partialBlocksToBlocksForTesting, +} from "../formatConversionTestUtil.js"; +import { + ExportParseEqualityTestCase, + getExportParseEqualityTestCases, +} from "./getExportParseEqualityTestCases.js"; + +// Test for verifying that exporting blocks to another format, then importing +// them back results in the same blocks as the original. Used broadly to ensure +// that exporting and importing blocks does not result in any data loss. +const testExportParseEqualityTest = async ( + editor: BlockNoteEditor< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + testCase: ExportParseEqualityTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + + if (testCase.conversionType === "blocknoteHTML") { + const exported = await editor.blocksToFullHTML(testCase.content); + + expect(await editor.tryParseHTMLToBlocks(exported)).toStrictEqual( + partialBlocksToBlocksForTesting(editor.schema, testCase.content) + ); + } else if (testCase.conversionType === "nodes") { + const exported = testCase.content.map((block) => { + addIdsToBlock(block); + + return blockToNode(block, editor.pmSchema, editor.schema.styleSchema); + }); + + expect( + exported.map((node) => + nodeToBlock( + node, + editor.schema.blockSchema, + editor.schema.inlineContentSchema, + editor.schema.styleSchema + ) + ) + ).toStrictEqual( + partialBlocksToBlocksForTesting(editor.schema, testCase.content) + ); + } else { + throw new UnreachableCaseError(testCase.conversionType); + } + + expect(true).toBeTruthy(); +}; + +describe("Export/parse equality tests", async () => { + const getEditor = setupTestEditor(); + + for (const testCase of [ + ...getExportParseEqualityTestCases("blocknoteHTML"), + ...getExportParseEqualityTestCases("nodes"), + ]) { + it(`${testCase.name}`, async () => { + await testExportParseEqualityTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/testUtil/partialBlockTestUtil.ts b/packages/core/src/api/tests/formatConversion/formatConversionTestUtil.ts similarity index 93% rename from packages/core/src/api/testUtil/partialBlockTestUtil.ts rename to packages/core/src/api/tests/formatConversion/formatConversionTestUtil.ts index 8c6a15f623..b0dd27d71a 100644 --- a/packages/core/src/api/testUtil/partialBlockTestUtil.ts +++ b/packages/core/src/api/tests/formatConversion/formatConversionTestUtil.ts @@ -1,12 +1,12 @@ -import { Block, PartialBlock } from "../../blocks/defaultBlocks.js"; -import { BlockNoteSchema } from "../../editor/BlockNoteSchema.js"; -import UniqueID from "../../extensions/UniqueID/UniqueID.js"; +import { Block, PartialBlock } from "../../../blocks/defaultBlocks.js"; +import { BlockNoteSchema } from "../../../editor/BlockNoteSchema.js"; +import UniqueID from "../../../extensions/UniqueID/UniqueID.js"; import { BlockSchema, PartialTableCell, TableCell, TableContent, -} from "../../schema/blocks/types.js"; +} from "../../../schema/blocks/types.js"; import { InlineContent, InlineContentSchema, @@ -14,8 +14,8 @@ import { StyledText, isPartialLinkInlineContent, isStyledTextInlineContent, -} from "../../schema/inlineContent/types.js"; -import { StyleSchema } from "../../schema/styles/types.js"; +} from "../../../schema/inlineContent/types.js"; +import { StyleSchema } from "../../../schema/styles/types.js"; function textShorthandToStyledText( content: string | StyledText[] = "" diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-basic-block-types.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/basicBlockTypes.json similarity index 75% rename from packages/core/src/api/parsers/html/__snapshots__/parse-basic-block-types.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/basicBlockTypes.json index 66c01ba90c..1a9bd562f2 100644 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-basic-block-types.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/basicBlockTypes.json @@ -1,142 +1,143 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 1", + "type": "text", + }, + ], "id": "1", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 1, "textAlignment": "left", - "level": 1 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Heading 2", "type": "text", - "text": "Heading 1", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "2", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 2, "textAlignment": "left", - "level": 2 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Heading 3", "type": "text", - "text": "Heading 2", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "3", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 3, "textAlignment": "left", - "level": 3 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Paragraph", "type": "text", - "text": "Heading 3", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "4", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Paragraph", - "styles": {} - } - ], - "children": [] + "type": "paragraph", }, { + "children": [], + "content": undefined, "id": "5", - "type": "image", "props": { "backgroundColor": "default", - "textAlignment": "left", - "name": "", - "url": "exampleURL", "caption": "Image Caption", + "name": "", + "previewWidth": 512, "showPreview": true, - "previewWidth": 512 + "textAlignment": "left", + "url": "exampleURL", }, - "children": [] + "type": "image", }, { - "id": "6", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "None ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "Bold ", "styles": { - "bold": true - } + "bold": true, + }, + "text": "Bold ", + "type": "text", }, { - "type": "text", - "text": "Italic ", "styles": { - "italic": true - } + "italic": true, + }, + "text": "Italic ", + "type": "text", }, { - "type": "text", - "text": "Underline ", "styles": { - "underline": true - } + "underline": true, + }, + "text": "Underline ", + "type": "text", }, { - "type": "text", - "text": "Strikethrough ", "styles": { - "strike": true - } + "strike": true, + }, + "text": "Strikethrough ", + "type": "text", }, { - "type": "text", - "text": "All", "styles": { "bold": true, "italic": true, + "strike": true, "underline": true, - "strike": true - } - } + }, + "text": "All", + "type": "text", + }, ], - "children": [] - } + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/codeBlocks.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/codeBlocks.json new file mode 100644 index 0000000000..f9bd791440 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/codeBlocks.json @@ -0,0 +1,62 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "console.log("Should default to JS")", + "type": "text", + }, + ], + "id": "1", + "props": { + "language": "text", + }, + "type": "codeBlock", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "console.log("Should parse TS from data-language")", + "type": "text", + }, + ], + "id": "2", + "props": { + "language": "typescript", + }, + "type": "codeBlock", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "print("Should parse Python from language- class")", + "type": "text", + }, + ], + "id": "3", + "props": { + "language": "python", + }, + "type": "codeBlock", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "console.log("Should prioritize TS from data-language over language- class")", + "type": "text", + }, + ], + "id": "4", + "props": { + "language": "typescript", + }, + "type": "codeBlock", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-deep-nested-content.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/deepNestedContent.json similarity index 74% rename from packages/core/src/api/exporters/html/__snapshots__/paste/parse-deep-nested-content.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/deepNestedContent.json index ae11e36cb7..959dbbcd5a 100644 --- a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-deep-nested-content.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/deepNestedContent.json @@ -1,240 +1,243 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Outer 1 Div Before", + "type": "text", + }, + ], "id": "1", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": " Outer 2 Div Before", "type": "text", - "text": "Outer 1 Div Before", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "2", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": " Outer 3 Div Before", "type": "text", - "text": " Outer 2 Div Before", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "3", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": " Outer 4 Div Before", "type": "text", - "text": " Outer 3 Div Before", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "4", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Heading 1", "type": "text", - "text": " Outer 4 Div Before", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "5", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 1, "textAlignment": "left", - "level": 1 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Heading 2", "type": "text", - "text": "Heading 1", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "6", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 2, "textAlignment": "left", - "level": 2 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Heading 3", "type": "text", - "text": "Heading 2", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "7", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 3, "textAlignment": "left", - "level": 3 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Paragraph", "type": "text", - "text": "Heading 3", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "8", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Paragraph", - "styles": {} - } - ], - "children": [] + "type": "paragraph", }, { + "children": [], + "content": undefined, "id": "9", - "type": "image", "props": { "backgroundColor": "default", + "caption": "Image Caption", + "name": "", + "previewWidth": 512, + "showPreview": true, "textAlignment": "left", "url": "exampleURL", - "caption": "Image Caption", - "width": 512 }, - "children": [] + "type": "image", }, { - "id": "10", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", - "text": "Bold", "styles": { - "bold": true - } + "bold": true, + }, + "text": "Bold", + "type": "text", }, { - "type": "text", + "styles": {}, "text": " ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "Italic", "styles": { - "italic": true - } + "italic": true, + }, + "text": "Italic", + "type": "text", }, { - "type": "text", + "styles": {}, "text": " ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "Underline", "styles": { - "underline": true - } + "underline": true, + }, + "text": "Underline", + "type": "text", }, { - "type": "text", + "styles": {}, "text": " ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "Strikethrough", "styles": { - "strike": true - } + "strike": true, + }, + "text": "Strikethrough", + "type": "text", }, { - "type": "text", + "styles": {}, "text": " ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "All", "styles": { "bold": true, "italic": true, + "strike": true, "underline": true, - "strike": true - } - } + }, + "text": "All", + "type": "text", + }, ], - "children": [] - }, - { - "id": "11", - "type": "paragraph", + "id": "10", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": " Outer 4 Div After Outer 3 Div After Outer 2 Div After Outer 1 Div After", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } + "id": "11", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-divs.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/divs.json similarity index 72% rename from packages/core/src/api/parsers/html/__snapshots__/parse-divs.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/divs.json index 764afd66ac..1e08669f16 100644 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-divs.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/divs.json @@ -1,121 +1,121 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Single Div", + "type": "text", + }, + ], "id": "1", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": " Div", "type": "text", - "text": "Single Div", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "2", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Nested Div", "type": "text", - "text": " Div", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "3", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Div", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "4", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Single Div 2", "type": "text", - "text": "Nested Div", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "5", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Nested Div", "type": "text", - "text": "Single Div 2", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "6", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Div", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "7", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Nested Div", - "styles": {} - } - ], - "children": [] - } + "type": "paragraph", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-fake-image-caption.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/fakeImageCaption.json similarity index 73% rename from packages/core/src/api/parsers/html/__snapshots__/parse-fake-image-caption.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/fakeImageCaption.json index 319d16a003..3964251638 100644 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-fake-image-caption.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/fakeImageCaption.json @@ -1,33 +1,34 @@ [ { + "children": [], + "content": undefined, "id": "1", - "type": "image", "props": { "backgroundColor": "default", - "textAlignment": "left", - "name": "", - "url": "exampleURL", "caption": "", + "name": "", + "previewWidth": 512, "showPreview": true, - "previewWidth": 512 + "textAlignment": "left", + "url": "exampleURL", }, - "children": [] + "type": "image", }, { - "id": "2", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Image Caption", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/googleDocs.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/googleDocs.json new file mode 100644 index 0000000000..5a7912dcd1 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/googleDocs.json @@ -0,0 +1,579 @@ +[ + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Heading 1", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "level": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Heading 2", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "level": 2, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Heading 3", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "level": 3, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 1", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 2", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 3", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph With +Hard Break", + "type": "text", + }, + ], + "id": "7", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Bold", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "italic": true, + }, + "text": "Italic", + "type": "text", + }, + { + "styles": {}, + "text": " Underline ", + "type": "text", + }, + { + "styles": { + "strike": true, + }, + "text": "Strikethrough", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "bold": true, + "italic": true, + "strike": true, + }, + "text": "All", + "type": "text", + }, + ], + "id": "8", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Nested Numbered List Item 1", + "type": "text", + }, + ], + "id": "11", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Nested Numbered List Item 2", + "type": "text", + }, + ], + "id": "12", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": " Nested Bullet List Item 1", + "type": "text", + }, + ], + "id": "10", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Nested Bullet List Item 2", + "type": "text", + }, + ], + "id": "13", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": " Bullet List Item 1", + "type": "text", + }, + ], + "id": "9", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Bullet List Item 2", + "type": "text", + }, + ], + "id": "14", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Numbered List Item 1", + "type": "text", + }, + ], + "id": "15", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Numbered List Item 2", + "type": "text", + }, + ], + "id": "16", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": undefined, + "id": "17", + "props": { + "backgroundColor": "default", + "caption": "", + "name": "", + "previewWidth": 447, + "showPreview": true, + "textAlignment": "left", + "url": "https://lh7-us.googleusercontent.com/SGyYp6hfLvNkli62NKFJB6NQz-fNa2Sjy8QxfUuqipW--qCCXmCz-dJmeZUGaDXIF9TEZHzbhNJsw4_w-B09eaFOn0oUChKsrSt3cwAIFu6d4SoSjHTR_DRTPr415_P7an7Lue-EwlUcVBk1WCzcoVQ", + }, + "type": "image", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " +", + "type": "text", + }, + ], + "id": "18", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": { + "columnWidths": [ + undefined, + undefined, + undefined, + ], + "headerCols": undefined, + "headerRows": undefined, + "rows": [ + { + "cells": [ + { + "content": [ + { + "styles": {}, + "text": "Cell 1", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 2", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 3", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + { + "cells": [ + { + "content": [ + { + "styles": {}, + "text": "Cell 4", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 5", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 6", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + { + "cells": [ + { + "content": [ + { + "styles": {}, + "text": "Cell 7", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 8", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 9", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + ], + "type": "tableContent", + }, + "id": "19", + "props": { + "textColor": "default", + }, + "type": "table", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "20", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " +", + "type": "text", + }, + ], + "id": "21", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-image-in-paragraph.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/imageInParagraph.json similarity index 74% rename from packages/core/src/api/parsers/html/__snapshots__/parse-image-in-paragraph.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/imageInParagraph.json index 1a581a00c3..28369c981f 100644 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-image-in-paragraph.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/imageInParagraph.json @@ -1,16 +1,17 @@ [ { + "children": [], + "content": undefined, "id": "1", - "type": "image", "props": { "backgroundColor": "default", - "textAlignment": "left", - "name": "", - "url": "exampleURL", "caption": "", + "name": "", + "previewWidth": 512, "showPreview": true, - "previewWidth": 512 + "textAlignment": "left", + "url": "exampleURL", }, - "children": [] - } + "type": "image", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-div-with-inline-content.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/inlineContentAndNestedBlocks.json similarity index 73% rename from packages/core/src/api/exporters/html/__snapshots__/paste/parse-div-with-inline-content.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/inlineContentAndNestedBlocks.json index d06969a05f..b21c97408c 100644 --- a/packages/core/src/api/exporters/html/__snapshots__/paste/parse-div-with-inline-content.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/inlineContentAndNestedBlocks.json @@ -1,91 +1,91 @@ [ { - "id": "1", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "None ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "Bold ", "styles": { - "bold": true - } + "bold": true, + }, + "text": "Bold ", + "type": "text", }, { - "type": "text", - "text": "Italic ", "styles": { - "italic": true - } + "italic": true, + }, + "text": "Italic ", + "type": "text", }, { - "type": "text", - "text": "Underline ", "styles": { - "underline": true - } + "underline": true, + }, + "text": "Underline ", + "type": "text", }, { - "type": "text", - "text": "Strikethrough ", "styles": { - "strike": true - } + "strike": true, + }, + "text": "Strikethrough ", + "type": "text", }, { - "type": "text", - "text": "All", "styles": { "bold": true, "italic": true, + "strike": true, "underline": true, - "strike": true - } - } + }, + "text": "All", + "type": "text", + }, ], - "children": [] - }, - { - "id": "2", - "type": "paragraph", + "id": "1", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Div", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "3", - "type": "paragraph", + "id": "2", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Paragraph", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/__snapshots__/list-test.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/lists.json similarity index 75% rename from packages/core/src/api/parsers/html/__snapshots__/list-test.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/lists.json index 67e64c4521..cdd50b6d47 100644 --- a/packages/core/src/api/parsers/html/__snapshots__/list-test.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/lists.json @@ -1,177 +1,177 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "First", + "type": "text", + }, + ], "id": "1", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Second", "type": "text", - "text": "First", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "2", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Third", "type": "text", - "text": "Second", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "3", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Fourth", "type": "text", - "text": "Third", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "4", - "type": "checkListItem", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": false + "textColor": "default", }, + "type": "checkListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Fifth", "type": "text", - "text": "Fourth", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "5", - "type": "checkListItem", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": false + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Fifth", - "styles": {} - } - ], - "children": [] + "type": "checkListItem", }, { - "id": "6", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Five Parent", - "styles": {} - } - ], "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Child 1", + "type": "text", + }, + ], "id": "7", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Child 2", "type": "text", - "text": "Child 1", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "8", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Child 3", "type": "text", - "text": "Child 2", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "9", - "type": "checkListItem", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": false + "textColor": "default", }, + "type": "checkListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Child 4", "type": "text", - "text": "Child 3", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "10", - "type": "checkListItem", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": false + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Child 4", - "styles": {} - } - ], - "children": [] - } - ] - } + "type": "checkListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Five Parent", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-mixed-nested-lists.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/mixedNestedLists.json similarity index 76% rename from packages/core/src/api/parsers/html/__snapshots__/parse-mixed-nested-lists.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/mixedNestedLists.json index 26371dc417..5b79ba865f 100644 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-mixed-nested-lists.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/mixedNestedLists.json @@ -1,265 +1,265 @@ [ { - "id": "1", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "2", - "type": "bulletListItem", + "id": "1", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], + "type": "bulletListItem", + }, + { "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item", + "type": "text", + }, + ], "id": "3", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Numbered List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "4", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Nested Numbered List Item", - "styles": {} - } - ], - "children": [] - } - ] - }, - { - "id": "5", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "type": "numberedListItem", + }, + ], "content": [ { - "type": "text", + "styles": {}, "text": "Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "6", - "type": "numberedListItem", + "id": "2", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Bullet List Item", "type": "text", - "text": "Numbered List Item", - "styles": {} - } + }, ], - "children": [] - }, - { - "id": "7", - "type": "numberedListItem", + "id": "5", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Numbered List Item", - "styles": {} - } + "type": "text", + }, ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Check List Item", + "type": "text", + }, + ], "id": "8", - "type": "checkListItem", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": true, "textAlignment": "left", - "checked": true + "textColor": "default", }, + "type": "checkListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Check List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "9", - "type": "checkListItem", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": false + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Nested Check List Item", - "styles": {} - } - ], - "children": [] - } - ] - }, - { - "id": "10", - "type": "numberedListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "type": "checkListItem", + }, + ], "content": [ { - "type": "text", + "styles": {}, "text": "Numbered List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "11", - "type": "checkListItem", + "id": "7", "props": { - "textColor": "default", "backgroundColor": "default", "textAlignment": "left", - "checked": true + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Numbered List Item", "type": "text", - "text": "Check List Item", - "styles": {} - } + }, ], - "children": [] - }, - { - "id": "12", - "type": "checkListItem", + "id": "10", "props": { - "textColor": "default", "backgroundColor": "default", "textAlignment": "left", - "checked": false + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Check List Item", - "styles": {} - } + "type": "text", + }, ], + "id": "11", + "props": { + "backgroundColor": "default", + "checked": true, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item", + "type": "text", + }, + ], "id": "13", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "14", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Nested Bullet List Item", - "styles": {} - } - ], - "children": [] - } - ] - }, - { - "id": "15", - "type": "checkListItem", + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Check List Item", + "type": "text", + }, + ], + "id": "12", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": true + "textColor": "default", }, + "type": "checkListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Check List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } + "id": "15", + "props": { + "backgroundColor": "default", + "checked": true, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-nested-lists.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/nestedLists.json similarity index 76% rename from packages/core/src/api/parsers/html/__snapshots__/parse-nested-lists.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/nestedLists.json index f617673f05..061ca1c5bc 100644 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-nested-lists.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/nestedLists.json @@ -1,265 +1,265 @@ [ { - "id": "1", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "2", - "type": "bulletListItem", + "id": "1", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], + "type": "bulletListItem", + }, + { "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item", + "type": "text", + }, + ], "id": "3", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "4", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Nested Bullet List Item", - "styles": {} - } - ], - "children": [] - } - ] - }, - { - "id": "5", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "type": "bulletListItem", + }, + ], "content": [ { - "type": "text", + "styles": {}, "text": "Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "6", - "type": "numberedListItem", + "id": "2", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Bullet List Item", "type": "text", - "text": "Numbered List Item", - "styles": {} - } + }, ], - "children": [] - }, - { - "id": "7", - "type": "numberedListItem", + "id": "5", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Numbered List Item", - "styles": {} - } + "type": "text", + }, ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item", + "type": "text", + }, + ], "id": "8", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Numbered List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "9", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Nested Numbered List Item", - "styles": {} - } - ], - "children": [] - } - ] - }, - { - "id": "10", - "type": "numberedListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "type": "numberedListItem", + }, + ], "content": [ { - "type": "text", + "styles": {}, "text": "Numbered List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "11", - "type": "checkListItem", + "id": "7", "props": { - "textColor": "default", "backgroundColor": "default", "textAlignment": "left", - "checked": false + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Numbered List Item", "type": "text", - "text": "Check List Item", - "styles": {} - } + }, ], - "children": [] - }, - { - "id": "12", - "type": "checkListItem", + "id": "10", "props": { - "textColor": "default", "backgroundColor": "default", "textAlignment": "left", - "checked": false + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Check List Item", - "styles": {} - } + "type": "text", + }, ], + "id": "11", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Check List Item", + "type": "text", + }, + ], "id": "13", - "type": "checkListItem", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": false + "textColor": "default", }, + "type": "checkListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Check List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "14", - "type": "checkListItem", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": false + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Nested Check List Item", - "styles": {} - } - ], - "children": [] - } - ] - }, - { - "id": "15", - "type": "checkListItem", + "type": "checkListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Check List Item", + "type": "text", + }, + ], + "id": "12", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": false + "textColor": "default", }, + "type": "checkListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Check List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } + "id": "15", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-nested-lists-with-paragraphs.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/nestedListsWithParagraphs.json similarity index 76% rename from packages/core/src/api/parsers/html/__snapshots__/parse-nested-lists-with-paragraphs.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/nestedListsWithParagraphs.json index 0d3b65965d..055d8f7d31 100644 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-nested-lists-with-paragraphs.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/nestedListsWithParagraphs.json @@ -1,265 +1,265 @@ [ { - "id": "1", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "2", - "type": "bulletListItem", + "id": "1", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], + "type": "bulletListItem", + }, + { "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item", + "type": "text", + }, + ], "id": "3", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "4", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Nested Bullet List Item", - "styles": {} - } - ], - "children": [] - } - ] - }, - { - "id": "5", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "type": "bulletListItem", + }, + ], "content": [ { - "type": "text", + "styles": {}, "text": "Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "6", - "type": "numberedListItem", + "id": "2", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Bullet List Item", "type": "text", - "text": "Numbered List Item", - "styles": {} - } + }, ], - "children": [] - }, - { - "id": "7", - "type": "numberedListItem", + "id": "5", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Numbered List Item", - "styles": {} - } + "type": "text", + }, ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item", + "type": "text", + }, + ], "id": "8", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Numbered List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "9", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Nested Numbered List Item", - "styles": {} - } - ], - "children": [] - } - ] - }, - { - "id": "10", - "type": "numberedListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "type": "numberedListItem", + }, + ], "content": [ { - "type": "text", + "styles": {}, "text": "Numbered List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "11", - "type": "checkListItem", + "id": "7", "props": { - "textColor": "default", "backgroundColor": "default", "textAlignment": "left", - "checked": false + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Numbered List Item", "type": "text", - "text": "Checked List Item", - "styles": {} - } + }, ], - "children": [] - }, - { - "id": "12", - "type": "checkListItem", + "id": "10", "props": { - "textColor": "default", "backgroundColor": "default", "textAlignment": "left", - "checked": false + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Checked List Item", - "styles": {} - } + "type": "text", + }, ], + "id": "11", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Checked List Item", + "type": "text", + }, + ], "id": "13", - "type": "checkListItem", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": false + "textColor": "default", }, + "type": "checkListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Checked List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "14", - "type": "checkListItem", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": false + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Nested Checked List Item", - "styles": {} - } - ], - "children": [] - } - ] - }, - { - "id": "15", - "type": "checkListItem", + "type": "checkListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Checked List Item", + "type": "text", + }, + ], + "id": "12", "props": { - "textColor": "default", "backgroundColor": "default", + "checked": false, "textAlignment": "left", - "checked": false + "textColor": "default", }, + "type": "checkListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Checked List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } + "id": "15", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-notion-html.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/notion.json similarity index 75% rename from packages/core/src/api/parsers/html/__snapshots__/parse-notion-html.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/notion.json index b1ebb03e09..b1eb97dd2d 100644 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-notion-html.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/notion.json @@ -1,565 +1,566 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 1", + "type": "text", + }, + ], "id": "1", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 1, "textAlignment": "left", - "level": 1 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Heading 2", "type": "text", - "text": "Heading 1", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "2", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 2, "textAlignment": "left", - "level": 2 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Heading 3", "type": "text", - "text": "Heading 2", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "3", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 3, "textAlignment": "left", - "level": 3 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Paragraph 1", "type": "text", - "text": "Heading 3", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "4", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Nested Paragraph 1", "type": "text", - "text": "Paragraph 1", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "5", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Nested Paragraph 2", "type": "text", - "text": "Nested Paragraph 1", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "6", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Paragraph With Hard Break", "type": "text", - "text": "Nested Paragraph 2", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "7", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Paragraph With Hard Break", - "styles": {} - } - ], - "children": [] + "type": "paragraph", }, { - "id": "8", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", - "text": "Bold", "styles": { - "bold": true - } + "bold": true, + }, + "text": "Bold", + "type": "text", }, { - "type": "text", + "styles": {}, "text": " ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "Italic", "styles": { - "italic": true - } + "italic": true, + }, + "text": "Italic", + "type": "text", }, { - "type": "text", + "styles": {}, "text": " Underline ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "Strikethrough", "styles": { - "strike": true - } + "strike": true, + }, + "text": "Strikethrough", + "type": "text", }, { - "type": "text", + "styles": {}, "text": " ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "All", "styles": { "bold": true, "italic": true, - "strike": true - } - } + "strike": true, + }, + "text": "All", + "type": "text", + }, ], - "children": [] - }, - { - "id": "9", - "type": "bulletListItem", + "id": "8", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Bullet List Item 1", - "styles": {} - } - ], + "type": "paragraph", + }, + { "children": [ { - "id": "10", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Nested Bullet List Item 1", - "styles": {} - } - ], "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item 1", + "type": "text", + }, + ], "id": "11", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Nested Numbered List Item 2", "type": "text", - "text": "Nested Numbered List Item 1", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "12", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Nested Numbered List Item 2", - "styles": {} - } - ], - "children": [] - } - ] - }, - { - "id": "13", - "type": "bulletListItem", + "type": "numberedListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item 1", + "type": "text", + }, + ], + "id": "10", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Nested Bullet List Item 2", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } - ] + "id": "13", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Bullet List Item 1", + "type": "text", + }, + ], + "id": "9", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", }, { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item 2", + "type": "text", + }, + ], "id": "14", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Numbered List Item 1", "type": "text", - "text": "Bullet List Item 2", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "15", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Numbered List Item 2", "type": "text", - "text": "Numbered List Item 1", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "16", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Background Color Paragraph", "type": "text", - "text": "Numbered List Item 2", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "17", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Background Color Paragraph", - "styles": {} - } - ], - "children": [] + "type": "paragraph", }, { - "id": "18", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "!", - "styles": {} + "type": "text", }, { - "type": "link", - "href": "https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg", "content": [ { - "type": "text", + "styles": {}, "text": "https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg", - "styles": {} - } - ] - } + "type": "text", + }, + ], + "href": "https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg", + "type": "link", + }, ], - "children": [] - }, - { - "id": "19", - "type": "table", + "id": "18", "props": { - "textColor": "default" + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": { - "type": "tableContent", "columnWidths": [ - null, - null, - null + undefined, + undefined, + undefined, ], + "headerCols": undefined, "headerRows": 1, "rows": [ { "cells": [ { - "type": "tableCell", "content": [ { - "type": "text", + "styles": {}, "text": "Cell 1", - "styles": {} - } + "type": "text", + }, ], "props": { + "backgroundColor": "default", "colspan": 1, "rowspan": 1, - "backgroundColor": "default", + "textAlignment": "left", "textColor": "default", - "textAlignment": "left" - } + }, + "type": "tableCell", }, { - "type": "tableCell", "content": [ { - "type": "text", + "styles": {}, "text": "Cell 2", - "styles": {} - } + "type": "text", + }, ], "props": { + "backgroundColor": "default", "colspan": 1, "rowspan": 1, - "backgroundColor": "default", + "textAlignment": "left", "textColor": "default", - "textAlignment": "left" - } + }, + "type": "tableCell", }, { - "type": "tableCell", "content": [ { - "type": "text", + "styles": {}, "text": "Cell 3", - "styles": {} - } + "type": "text", + }, ], "props": { + "backgroundColor": "default", "colspan": 1, "rowspan": 1, - "backgroundColor": "default", + "textAlignment": "left", "textColor": "default", - "textAlignment": "left" - } - } - ] + }, + "type": "tableCell", + }, + ], }, { "cells": [ { - "type": "tableCell", "content": [ { - "type": "text", + "styles": {}, "text": "Cell 4", - "styles": {} - } + "type": "text", + }, ], "props": { + "backgroundColor": "default", "colspan": 1, "rowspan": 1, - "backgroundColor": "default", + "textAlignment": "left", "textColor": "default", - "textAlignment": "left" - } + }, + "type": "tableCell", }, { - "type": "tableCell", "content": [ { - "type": "text", + "styles": {}, "text": "Cell 5", - "styles": {} - } + "type": "text", + }, ], "props": { + "backgroundColor": "default", "colspan": 1, "rowspan": 1, - "backgroundColor": "default", + "textAlignment": "left", "textColor": "default", - "textAlignment": "left" - } + }, + "type": "tableCell", }, { - "type": "tableCell", "content": [ { - "type": "text", + "styles": {}, "text": "Cell 6", - "styles": {} - } + "type": "text", + }, ], "props": { + "backgroundColor": "default", "colspan": 1, "rowspan": 1, - "backgroundColor": "default", + "textAlignment": "left", "textColor": "default", - "textAlignment": "left" - } - } - ] + }, + "type": "tableCell", + }, + ], }, { "cells": [ { - "type": "tableCell", "content": [ { - "type": "text", + "styles": {}, "text": "Cell 7", - "styles": {} - } + "type": "text", + }, ], "props": { + "backgroundColor": "default", "colspan": 1, "rowspan": 1, - "backgroundColor": "default", + "textAlignment": "left", "textColor": "default", - "textAlignment": "left" - } + }, + "type": "tableCell", }, { - "type": "tableCell", "content": [ { - "type": "text", + "styles": {}, "text": "Cell 8", - "styles": {} - } + "type": "text", + }, ], "props": { + "backgroundColor": "default", "colspan": 1, "rowspan": 1, - "backgroundColor": "default", + "textAlignment": "left", "textColor": "default", - "textAlignment": "left" - } + }, + "type": "tableCell", }, { - "type": "tableCell", "content": [ { - "type": "text", + "styles": {}, "text": "Cell 9", - "styles": {} - } + "type": "text", + }, ], "props": { + "backgroundColor": "default", "colspan": 1, "rowspan": 1, - "backgroundColor": "default", + "textAlignment": "left", "textColor": "default", - "textAlignment": "left" - } - } - ] - } - ] + }, + "type": "tableCell", + }, + ], + }, + ], + "type": "tableContent", }, - "children": [] - }, - { - "id": "20", - "type": "paragraph", + "id": "19", "props": { "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" }, + "type": "table", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Paragraph", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } + "id": "20", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/__snapshots__/parse-two-divs.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/twoDivs.json similarity index 72% rename from packages/core/src/api/parsers/html/__snapshots__/parse-two-divs.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/twoDivs.json index aa21de34f0..e91570e36b 100644 --- a/packages/core/src/api/parsers/html/__snapshots__/parse-two-divs.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/twoDivs.json @@ -1,36 +1,36 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Single Div", + "type": "text", + }, + ], "id": "1", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "second Div", "type": "text", - "text": "Single Div", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "2", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "second Div", - "styles": {} - } - ], - "children": [] - } + "type": "paragraph", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/clipboard/__snapshots__/external/pasteEndOfParagraph.html b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/twoTables.json similarity index 71% rename from packages/core/src/api/clipboard/__snapshots__/external/pasteEndOfParagraph.html rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/twoTables.json index 0a607ca98c..3ffbb3ead1 100644 --- a/packages/core/src/api/clipboard/__snapshots__/external/pasteEndOfParagraph.html +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/twoTables.json @@ -1,27 +1,9 @@ [ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "ParagraphParagraph", - "type": "text", - }, - ], - "id": "0", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, { "children": [], "content": { "columnWidths": [ undefined, - undefined, ], "headerCols": undefined, "headerRows": undefined, @@ -31,8 +13,10 @@ { "content": [ { - "styles": {}, - "text": "Table Cell", + "styles": { + "underline": true, + }, + "text": "Company", "type": "text", }, ], @@ -45,11 +29,25 @@ }, "type": "tableCell", }, + ], + }, + { + "cells": [ { "content": [ + { + "styles": { + "bold": true, + }, + "text": "Example Company Inc.", + "type": "text", + }, { "styles": {}, - "text": "Table Cell", + "text": " + +Name: [Company Representative] +Title: Chief Executive Officer", "type": "text", }, ], @@ -64,13 +62,33 @@ }, ], }, + ], + "type": "tableContent", + }, + "id": "1", + "props": { + "textColor": "default", + }, + "type": "table", + }, + { + "children": [], + "content": { + "columnWidths": [ + undefined, + ], + "headerCols": undefined, + "headerRows": undefined, + "rows": [ { "cells": [ { "content": [ { - "styles": {}, - "text": "Table Cell", + "styles": { + "underline": true, + }, + "text": "Advisor", "type": "text", }, ], @@ -83,11 +101,15 @@ }, "type": "tableCell", }, + ], + }, + { + "cells": [ { "content": [ { "styles": {}, - "text": "Table Cell", + "text": "[Advisor Name]", "type": "text", }, ], @@ -105,34 +127,10 @@ ], "type": "tableContent", }, - "id": "1", - "props": { - "textColor": "default", - }, - "type": "table", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Custom Paragraph", - "type": "text", - }, - ], "id": "2", - "props": {}, - "type": "customParagraph", - }, - { - "children": [], - "content": [], - "id": "3", "props": { - "backgroundColor": "default", - "textAlignment": "left", "textColor": "default", }, - "type": "paragraph", + "type": "table", }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/non-nested.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/basic.json similarity index 74% rename from packages/core/src/api/parsers/markdown/__snapshots__/non-nested.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/basic.json index 05911c4983..632e74dcb7 100644 --- a/packages/core/src/api/parsers/markdown/__snapshots__/non-nested.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/basic.json @@ -1,71 +1,71 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading", + "type": "text", + }, + ], "id": "1", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 1, "textAlignment": "left", - "level": 1 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Paragraph", "type": "text", - "text": "Heading", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "2", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Bullet List Item", "type": "text", - "text": "Paragraph", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "3", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Numbered List Item", "type": "text", - "text": "Bullet List Item", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "4", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Numbered List Item", - "styles": {} - } - ], - "children": [] - } + "type": "numberedListItem", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/whitespace bold.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/boldWithWhitespace.json similarity index 73% rename from packages/core/src/api/parsers/markdown/__snapshots__/whitespace bold.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/boldWithWhitespace.json index 0fafd59cb1..3331f6218a 100644 --- a/packages/core/src/api/parsers/markdown/__snapshots__/whitespace bold.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/boldWithWhitespace.json @@ -1,19 +1,19 @@ [ { - "id": "1", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "hello **beautiful ** world", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/complex.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/complex.json similarity index 74% rename from packages/core/src/api/parsers/markdown/__snapshots__/complex.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/complex.json index 37036e205d..81ac21d79a 100644 --- a/packages/core/src/api/parsers/markdown/__snapshots__/complex.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/complex.json @@ -1,353 +1,353 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 1", + "type": "text", + }, + ], "id": "1", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 1, "textAlignment": "left", - "level": 1 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Heading 2", "type": "text", - "text": "Heading 1", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "2", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 2, "textAlignment": "left", - "level": 2 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Heading 3", "type": "text", - "text": "Heading 2", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "3", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 3, "textAlignment": "left", - "level": 3 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Paragraph", "type": "text", - "text": "Heading 3", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "4", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Paragraph", - "styles": {} - } - ], - "children": [] + "type": "paragraph", }, { - "id": "5", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "P", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "ara", "styles": { - "bold": true - } + "bold": true, + }, + "text": "ara", + "type": "text", }, { - "type": "text", - "text": "grap", "styles": { - "italic": true - } + "italic": true, + }, + "text": "grap", + "type": "text", }, { - "type": "text", + "styles": {}, "text": "h", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "6", - "type": "paragraph", + "id": "5", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "P", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "ara", "styles": { - "italic": true - } + "italic": true, + }, + "text": "ara", + "type": "text", }, { - "type": "text", - "text": "grap", "styles": { - "strike": true - } + "strike": true, + }, + "text": "grap", + "type": "text", }, { - "type": "text", + "styles": {}, "text": "h", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "7", - "type": "bulletListItem", + "id": "6", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "8", - "type": "bulletListItem", + "id": "7", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], + "type": "bulletListItem", + }, + { "children": [ { - "id": "9", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], "children": [ { - "id": "10", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } - ] - }, - { - "id": "11", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "id": "10", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], "content": [ { + "styles": {}, + "text": "Bullet List Item", "type": "text", - "text": "Paragraph", - "styles": {} - } + }, ], + "id": "9", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { "children": [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], "id": "12", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Numbered List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "13", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "15", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + ], "content": [ { - "type": "text", + "styles": {}, "text": "Numbered List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { "id": "14", - "type": "numberedListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "numberedListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Bullet List Item", "type": "text", - "text": "Numbered List Item", - "styles": {} - } + }, ], - "children": [ - { - "id": "15", - "type": "numberedListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Numbered List Item", - "styles": {} - } - ], - "children": [] - } - ] - }, - { "id": "16", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], - "children": [] - } - ] - }, - { - "id": "17", - "type": "bulletListItem", + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "11", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } - ] - }, - { - "id": "18", - "type": "bulletListItem", + "id": "17", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "8", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Bullet List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } + "id": "18", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/issue-226-1.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/issue226case1.json similarity index 74% rename from packages/core/src/api/parsers/markdown/__snapshots__/issue-226-1.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/issue226case1.json index 9c186d37b0..8ca8b088a3 100644 --- a/packages/core/src/api/parsers/markdown/__snapshots__/issue-226-1.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/issue226case1.json @@ -1,71 +1,71 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "📝 item1", + "type": "text", + }, + ], "id": "1", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "⚙️ item2", "type": "text", - "text": "📝 item1", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "2", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "🔗 item3", "type": "text", - "text": "⚙️ item2", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "3", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "h1", "type": "text", - "text": "🔗 item3", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "4", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 1, "textAlignment": "left", - "level": 1 + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "h1", - "styles": {} - } - ], - "children": [] - } + "type": "heading", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/issue-226-2.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/issue226case2.json similarity index 73% rename from packages/core/src/api/parsers/markdown/__snapshots__/issue-226-2.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/issue226case2.json index fc1b9f3de9..e0939c1645 100644 --- a/packages/core/src/api/parsers/markdown/__snapshots__/issue-226-2.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/issue226case2.json @@ -1,144 +1,144 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "a", + "type": "text", + }, + ], "id": "1", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "b", "type": "text", - "text": "a", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "2", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "c", "type": "text", - "text": "b", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "3", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "d", "type": "text", - "text": "c", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "4", - "type": "bulletListItem", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "anything", "type": "text", - "text": "d", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "5", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "anything", - "styles": {} - } - ], - "children": [] + "type": "paragraph", }, { - "id": "6", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "link", - "href": "http://example.com", "content": [ { - "type": "text", + "styles": {}, "text": "a link", - "styles": {} - } - ] - } + "type": "text", + }, + ], + "href": "http://example.com", + "type": "link", + }, ], - "children": [] - }, - { - "id": "7", - "type": "bulletListItem", + "id": "6", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "paragraph", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "another", - "styles": {} - } + "type": "text", + }, ], - "children": [] - }, - { - "id": "8", - "type": "bulletListItem", + "id": "7", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, + "type": "bulletListItem", + }, + { + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "list", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } + "id": "8", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/nested.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/nested.json similarity index 75% rename from packages/core/src/api/parsers/markdown/__snapshots__/nested.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/nested.json index 627349f4f8..df04f955b6 100644 --- a/packages/core/src/api/parsers/markdown/__snapshots__/nested.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/nested.json @@ -1,72 +1,72 @@ [ { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading", + "type": "text", + }, + ], "id": "1", - "type": "heading", "props": { - "textColor": "default", "backgroundColor": "default", + "level": 1, "textAlignment": "left", - "level": 1 + "textColor": "default", }, + "type": "heading", + }, + { + "children": [], "content": [ { + "styles": {}, + "text": "Paragraph", "type": "text", - "text": "Heading", - "styles": {} - } + }, ], - "children": [] - }, - { "id": "2", - "type": "paragraph", "props": { - "textColor": "default", "backgroundColor": "default", - "textAlignment": "left" + "textAlignment": "left", + "textColor": "default", }, - "content": [ - { - "type": "text", - "text": "Paragraph", - "styles": {} - } - ], - "children": [] + "type": "paragraph", }, { - "id": "3", - "type": "bulletListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Bullet List Item", - "styles": {} - } - ], "children": [ { - "id": "4", - "type": "numberedListItem", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", + "styles": {}, "text": "Numbered List Item", - "styles": {} - } + "type": "text", + }, ], - "children": [] - } - ] - } + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/markdown/__snapshots__/styled.json b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/styled.json similarity index 72% rename from packages/core/src/api/parsers/markdown/__snapshots__/styled.json rename to packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/styled.json index 43a1efe52d..a2c32954d5 100644 --- a/packages/core/src/api/parsers/markdown/__snapshots__/styled.json +++ b/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/styled.json @@ -1,58 +1,58 @@ [ { - "id": "1", - "type": "paragraph", - "props": { - "textColor": "default", - "backgroundColor": "default", - "textAlignment": "left" - }, + "children": [], "content": [ { - "type": "text", - "text": "Bold", "styles": { - "bold": true - } + "bold": true, + }, + "text": "Bold", + "type": "text", }, { - "type": "text", + "styles": {}, "text": " ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "Italic", "styles": { - "italic": true - } + "italic": true, + }, + "text": "Italic", + "type": "text", }, { - "type": "text", + "styles": {}, "text": " ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "Strikethrough", "styles": { - "strike": true - } + "strike": true, + }, + "text": "Strikethrough", + "type": "text", }, { - "type": "text", + "styles": {}, "text": " ", - "styles": {} + "type": "text", }, { - "type": "text", - "text": "Multiple", "styles": { "bold": true, - "italic": true - } - } + "italic": true, + }, + "text": "Multiple", + "type": "text", + }, ], - "children": [] - } + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, ] \ No newline at end of file diff --git a/packages/core/src/api/parsers/html/parseHTML.test.ts b/packages/core/src/api/tests/formatConversion/parse/getParseTestCases.ts similarity index 64% rename from packages/core/src/api/parsers/html/parseHTML.test.ts rename to packages/core/src/api/tests/formatConversion/parse/getParseTestCases.ts index 7602d0be1c..8ab3e404f5 100644 --- a/packages/core/src/api/parsers/html/parseHTML.test.ts +++ b/packages/core/src/api/tests/formatConversion/parse/getParseTestCases.ts @@ -1,354 +1,287 @@ -import * as pmView from "prosemirror-view"; -import { describe, expect, it } from "vitest"; -import { BlockNoteEditor } from "../../../index.js"; -import { nestedListsToBlockNoteStructure } from "./util/nestedLists.js"; - -async function parseHTMLAndCompareSnapshots( - html: string, - snapshotName: string -) { - const editor = BlockNoteEditor.create(); - const div = document.createElement("div"); - editor.mount(div); - const blocks = await editor.tryParseHTMLToBlocks(html); - - const snapshotPath = "./__snapshots__/" + snapshotName + ".json"; - await expect(JSON.stringify(blocks, undefined, 2)).toMatchFileSnapshot( - snapshotPath - ); - - // Now, we also want to test actually pasting in the editor, and not just calling - // tryParseHTMLToBlocks directly. - // The reason is that the prosemirror logic for pasting can be a bit different, because - // it's related to the context of where the user is pasting exactly (selection) - // - // The internal difference come that in tryParseHTMLToBlocks, we use DOMParser.parse, - // while when pasting, Prosemirror uses DOMParser.parseSlice, and then tries to fit the - // slice in the document. This fitting might change the structure / interpretation of the pasted blocks - - // Simulate a paste event (this uses DOMParser.parseSlice internally) - - (window as any).__TEST_OPTIONS.mockID = 0; // reset id counter - const htmlNode = nestedListsToBlockNoteStructure(html); - - const slice = (pmView as any).__parseFromClipboard( - editor.prosemirrorView, - "", - htmlNode.innerHTML, - false, - editor._tiptapEditor.state.selection.$from - ); - editor.dispatch(editor._tiptapEditor.state.tr.replaceSelection(slice)); - - // alternative paste simulation doesn't work in a non-browser vitest env - // editor._tiptapEditor.view.pasteHTML(html, { - // preventDefault: () => { - // // noop - // }, - // clipboardData: { - // types: ["text/html"], - // getData: () => html, - // }, - // } as any); - - const pastedBlocks = editor.document; - pastedBlocks.pop(); // trailing paragraph - expect(pastedBlocks).toStrictEqual(blocks); - - editor.mount(undefined); -} - -describe("Parse HTML", () => { - it("Parse basic block types", async () => { - const html = `

Heading 1

-

Heading 2

-

Heading 3

-

Paragraph

-
Image Caption
-

None Bold Italic Underline Strikethrough All

`; - - await parseHTMLAndCompareSnapshots(html, "parse-basic-block-types"); - }); - - it("list test", async () => { - const html = `
    -
  • First
  • -
  • Second
  • -
  • Third
  • -
  • - - Fourth -
  • -
  • - - Fifth -
  • -
  • Five Parent -
      -
    • Child 1
    • -
    • Child 2
    • -
    • - - Child 3 -
    • -
    • - - Child 4 -
    • -
    -
  • -
`; - await parseHTMLAndCompareSnapshots(html, "list-test"); - }); - - it("Parse nested lists", async () => { - const html = `
    -
  • Bullet List Item
  • -
  • Bullet List Item -
      -
    • Nested Bullet List Item
    • -
    • Nested Bullet List Item
    • -
    -
  • -
  • Bullet List Item
  • -
-
    -
  1. Numbered List Item
  2. -
  3. Numbered List Item -
      -
    1. Nested Numbered List Item
    2. -
    3. Nested Numbered List Item
    4. -
    -
  4. -
  5. Numbered List Item
  6. -
-
    -
  • - - Check List Item -
  • -
  • - - Check List Item -
      -
    • - - Nested Check List Item -
    • -
    • - - Nested Check List Item -
    • -
    -
  • -
  • - - Nested Check List Item -
  • -
`; - - await parseHTMLAndCompareSnapshots(html, "parse-nested-lists"); - }); - - it("Parse nested lists with paragraphs", async () => { - const html = `
    -
  • -

    Bullet List Item

    -
  • -
  • -

    Bullet List Item

    -
      -
    • -

      Nested Bullet List Item

      -
    • -
    • -

      Nested Bullet List Item

      -
    • -
    -
  • -
  • -

    Bullet List Item

    -
  • -
-
    -
  1. -

    Numbered List Item

    -
  2. -
  3. -

    Numbered List Item

    -
      -
    1. -

      Nested Numbered List Item

      -
    2. -
    3. -

      Nested Numbered List Item

      -
    4. -
    -
  4. -
  5. -

    Numbered List Item

    -
  6. -
+export type ParseTestCase = { + name: string; + conversionType: "html" | "markdown"; + content: string; +}; + +export const getParseTestCases = (): ParseTestCase[] => [ + { + name: "basicBlockTypes", + conversionType: "html", + content: `

Heading 1

+

Heading 2

+

Heading 3

+

Paragraph

+
Image Caption
+

None Bold Italic Underline Strikethrough All

`, + }, + { + name: "lists", + conversionType: "html", + content: `
    +
  • First
  • +
  • Second
  • +
  • Third
  • +
  • + + Fourth +
  • +
  • + + Fifth +
  • +
  • Five Parent
      +
    • Child 1
    • +
    • Child 2
    • -

      Checked List Item

      -
    • -
    • - -

      Checked List Item

      -
        -
      • - -

        Nested Checked List Item

        -
      • -
      • - -

        Nested Checked List Item

        -
      • -
      + Child 3
    • -

      Checked List Item

      + Child 4
    • -
    `; - - await parseHTMLAndCompareSnapshots( - html, - "parse-nested-lists-with-paragraphs" - ); - }); - - it("Parse mixed nested lists", async () => { - const html = `
      -
    • Bullet List Item
    • -
    • Bullet List Item -
        -
      1. Nested Numbered List Item
      2. -
      3. Nested Numbered List Item
      4. -
      -
    • -
    • Bullet List Item
    -
      -
    1. Numbered List Item
    2. -
    3. Numbered List Item -
        -
      • - - Nested Check List Item -
      • -
      • - - Nested Check List Item -
      • -
      -
    4. -
    5. Numbered List Item
    6. -
    -
      -
    • - - Check List Item -
    • -
    • - - Check List Item -
        -
      • Nested Bullet List Item
      • -
      • Nested Bullet List Item
      • -
      -
    • -
    • - - Nested Check List Item -
    • -
    `; - - await parseHTMLAndCompareSnapshots(html, "parse-mixed-nested-lists"); - }); - - it("Parse divs", async () => { - const html = `
    Single Div
    -
    - Div -
    Nested Div
    -
    Nested Div
    -
    -
    Single Div 2
    +
  • +
`, + }, + { + name: "nestedLists", + conversionType: "html", + content: `
    +
  • Bullet List Item
  • +
  • Bullet List Item +
      +
    • Nested Bullet List Item
    • +
    • Nested Bullet List Item
    • +
    +
  • +
  • Bullet List Item
  • +
+
    +
  1. Numbered List Item
  2. +
  3. Numbered List Item +
      +
    1. Nested Numbered List Item
    2. +
    3. Nested Numbered List Item
    4. +
    +
  4. +
  5. Numbered List Item
  6. +
+
    +
  • + + Check List Item +
  • +
  • + + Check List Item +
      +
    • + + Nested Check List Item +
    • +
    • + + Nested Check List Item +
    • +
    +
  • +
  • + + Nested Check List Item +
  • +
`, + }, + { + name: "nestedListsWithParagraphs", + conversionType: "html", + content: `
    +
  • +

    Bullet List Item

    +
  • +
  • +

    Bullet List Item

    +
      +
    • +

      Nested Bullet List Item

      +
    • +
    • +

      Nested Bullet List Item

      +
    • +
    +
  • +
  • +

    Bullet List Item

    +
  • +
+
    +
  1. +

    Numbered List Item

    +
  2. +
  3. +

    Numbered List Item

    +
      +
    1. +

      Nested Numbered List Item

      +
    2. +
    3. +

      Nested Numbered List Item

      +
    4. +
    +
  4. +
  5. +

    Numbered List Item

    +
  6. +
+
    +
  • + +

    Checked List Item

    +
  • +
  • + +

    Checked List Item

    +
      +
    • + +

      Nested Checked List Item

      +
    • +
    • + +

      Nested Checked List Item

      +
    • +
    +
  • +
  • + +

    Checked List Item

    +
  • +
`, + }, + { + name: "mixedNestedLists", + conversionType: "html", + content: `
    +
  • Bullet List Item
  • +
  • Bullet List Item +
      +
    1. Nested Numbered List Item
    2. +
    3. Nested Numbered List Item
    4. +
    +
  • +
  • Bullet List Item
  • +
+
    +
  1. Numbered List Item
  2. +
  3. Numbered List Item +
      +
    • + + Nested Check List Item +
    • +
    • + + Nested Check List Item +
    • +
    +
  4. +
  5. Numbered List Item
  6. +
+
    +
  • + + Check List Item +
  • +
  • + + Check List Item +
      +
    • Nested Bullet List Item
    • +
    • Nested Bullet List Item
    • +
    +
  • +
  • + + Nested Check List Item +
  • +
`, + }, + { + name: "divs", + conversionType: "html", + content: `
Single Div
+
+ Div +
Nested Div
+
Nested Div
+
+
Single Div 2
+
+
Nested Div
+
Nested Div
+
`, + }, + { + name: "twoDivs", + conversionType: "html", + content: `
Single Div
second Div
`, + }, + { + name: "imageInParagraph", + conversionType: "html", + content: `

+ +

`, + }, + { + name: "fakeImageCaption", + conversionType: "html", + content: `
+ +

Image Caption

+
`, + }, + { + name: "deepNestedContent", + conversionType: "html", + content: `
+ Outer 1 Div Before
-
Nested Div
-
Nested Div
-
`; - - await parseHTMLAndCompareSnapshots(html, "parse-divs"); - }); - - it("Parse two divs", async () => { - const html = `
Single Div
second Div
`; - - await parseHTMLAndCompareSnapshots(html, "parse-two-divs"); - }); - - it("Parse image in paragraph", async () => { - const html = `

- -

`; - - await parseHTMLAndCompareSnapshots(html, "parse-image-in-paragraph"); - }); - - it("Parse fake image caption", async () => { - const html = `
- -

Image Caption

-
`; - - await parseHTMLAndCompareSnapshots(html, "parse-fake-image-caption"); - }); - - // TODO: this one fails - it.skip("Parse deep nested content", async () => { - const html = `
- Outer 1 Div Before + Outer 2 Div Before
- Outer 2 Div Before + Outer 3 Div Before
- Outer 3 Div Before -
- Outer 4 Div Before -

Heading 1

-

Heading 2

-

Heading 3

-

Paragraph

-
Image Caption
-

Bold Italic Underline Strikethrough All

- Outer 4 Div After -
- Outer 3 Div After + Outer 4 Div Before +

Heading 1

+

Heading 2

+

Heading 3

+

Paragraph

+
Image Caption
+

Bold Italic Underline Strikethrough All

+ Outer 4 Div After
- Outer 2 Div After + Outer 3 Div After
- Outer 1 Div After -
`; - - await parseHTMLAndCompareSnapshots(html, "parse-deep-nested-content"); - }); - - it("Parse div with inline content and nested blocks", async () => { - const html = `
- None Bold Italic Underline Strikethrough All -
Nested Div
-

Nested Paragraph

-
`; - - await parseHTMLAndCompareSnapshots(html, "parse-div-with-inline-content"); - }); - - it("Parses 2 tables", async () => { - const html = ` - + Outer 2 Div After + + Outer 1 Div After +`, + }, + { + name: "inlineContentAndNestedBlocks", + conversionType: "html", + content: `
+ None Bold Italic Underline Strikethrough All +
Nested Div
+

Nested Paragraph

+
`, + }, + { + name: "twoTables", + conversionType: "html", + content: `
-

Company

@@ -376,21 +309,12 @@ describe("Parse HTML", () => {

[Advisor Name]

`; - - await parseHTMLAndCompareSnapshots(html, "parse-2-tables"); - }); - - it("Parse Notion HTML", async () => { - // A few notes on Notion output HTML: - // - Does not preserve text/background colors - // - Does not preserve non-list-item block nesting - // - Hard breaks are represented using white space, not `
` elements - // - Images are converted to links with a "!" at the start - // - Cells in first row of a table are converted to `th` elements, regardless - // of if the row is set as a header row - - const html = `

Heading 1

+`, + }, + { + name: "notion", + conversionType: "html", + content: `

Heading 1

Heading 2

Heading 3

Paragraph 1

@@ -441,22 +365,12 @@ With Hard Break

Paragraph

-`; - - await parseHTMLAndCompareSnapshots(html, "parse-notion-html"); - }); - - // Currently breaking, seems related to parsing `
` elements - it.skip("Parse Google Docs HTML", async () => { - // A few notes on Google Docs output HTML: - // - All inline markup is represented as `` elements with inline - // styles (bold, italic, etc.) - // - The nested list structure is not valid, i.e. `
    ` elements are not - // placed within `
  • ` elements - // - Images are wrapped in two spans and a paragraph - // - Everything is nested within a `` element - - const html = ` +`, + }, + { + name: "googleDocs", + conversionType: "html", + content: `

    Heading 1

    @@ -547,17 +461,113 @@ With Hard Break

Paragraph

-
`; - - await parseHTMLAndCompareSnapshots(html, "parse-google-docs-html"); - }); - - it("Parse codeblocks", async () => { - const html = `
console.log("Should default to JS")
-
console.log("Should parse TS from data-language")
-
print("Should parse Python from language- class")
-
console.log("Should prioritize TS from data-language over language- class")
`; - - await parseHTMLAndCompareSnapshots(html, "parse-codeblocks"); - }); -}); +
`, + }, + { + name: "codeBlocks", + conversionType: "html", + content: `
console.log("Should default to JS")
+
console.log("Should parse TS from data-language")
+
print("Should parse Python from language- class")
+
console.log("Should prioritize TS from data-language over language- class")
`, + }, + { + name: "basic", + conversionType: "markdown", + content: `# Heading + +Paragraph + +* Bullet List Item + +1. Numbered List Item +`, + }, + { + name: "nested", + conversionType: "markdown", + content: `# Heading + +Paragraph + +* Bullet List Item + + 1. Numbered List Item +`, + }, + { + name: "styled", + conversionType: "markdown", + content: `**Bold** *Italic* ~~Strikethrough~~ ***Multiple***`, + }, + { + name: "complex", + conversionType: "markdown", + content: `# Heading 1 + +## Heading 2 + +### Heading 3 + +Paragraph + +P**ara***grap*h + +P*ara*~~grap~~h + +* Bullet List Item + +* Bullet List Item + + * Bullet List Item + + * Bullet List Item + + Paragraph + + 1. Numbered List Item + + 2. Numbered List Item + + 3. Numbered List Item + + 1. Numbered List Item + + * Bullet List Item + + * Bullet List Item + +* Bullet List Item`, + }, + { + name: "boldWithWhitespace", + conversionType: "markdown", + content: `hello **beautiful ** world`, + }, + { + name: "issue226case1", + conversionType: "markdown", + content: ` +- 📝 item1 +- ⚙️ item2 +- 🔗 item3 + +# h1 +`, + }, + { + name: "issue226case2", + conversionType: "markdown", + content: `* a +* b +* c +* d + +anything + +[a link](http://example.com) + +* another +* list`, + }, +]; diff --git a/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts b/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts new file mode 100644 index 0000000000..18883f34ca --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts @@ -0,0 +1,51 @@ +import { describe, expect, it } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { UnreachableCaseError } from "../../../../util/typescript.js"; +import { setupTestEditor } from "../../setupTestEditor.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { getParseTestCases, ParseTestCase } from "./getParseTestCases.js"; + +// Test for verifying that importing blocks from other formats works as +// expected. Used for specific cases for when content from outside the editor is +// imported as blocks. This includes content from other editors, as well as +// content from the web that has produced bugs in the past. +const testParseTest = async ( + editor: BlockNoteEditor< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + testCase: ParseTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + if (testCase.conversionType === "html") { + await expect( + await editor.tryParseHTMLToBlocks(testCase.content) + ).toMatchFileSnapshot( + `./__snapshots__/${testCase.conversionType}/${testCase.name}.json` + ); + } else if (testCase.conversionType === "markdown") { + await expect( + await editor.tryParseMarkdownToBlocks(testCase.content) + ).toMatchFileSnapshot( + `./__snapshots__/${testCase.conversionType}/${testCase.name}.json` + ); + } else { + throw new UnreachableCaseError(testCase.conversionType); + } +}; + +describe("Export tests", async () => { + const getEditor = setupTestEditor(); + + for (const testCase of getParseTestCases()) { + it(`${testCase.name}`, async () => { + await testParseTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/setupTestEditor.ts b/packages/core/src/api/tests/setupTestEditor.ts new file mode 100644 index 0000000000..54fdfe8801 --- /dev/null +++ b/packages/core/src/api/tests/setupTestEditor.ts @@ -0,0 +1,55 @@ +import { afterAll, beforeAll } from "vitest"; + +import { uploadToTmpFilesDotOrg_DEV_ONLY } from "../../blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js"; +import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js"; +import { initializeESMDependencies } from "../../util/esmDependencies.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + testSchema, + TestStyleSchema, +} from "./testSchema.js"; + +export const setupTestEditor = () => { + let editor: BlockNoteEditor< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >; + const div = document.createElement("div"); + + beforeAll(async () => { + (window as any).__TEST_OPTIONS = (window as any).__TEST_OPTIONS || {}; + + editor = BlockNoteEditor.create({ + codeBlock: { + supportedLanguages: { + javascript: { + name: "JavaScript", + aliases: ["js"], + }, + python: { + name: "Python", + aliases: ["py"], + }, + }, + }, + schema: testSchema, + trailingBlock: false, + uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY, + }); + editor.mount(div); + + await initializeESMDependencies(); + }); + + afterAll(() => { + editor.mount(undefined); + editor._tiptapEditor.destroy(); + editor = undefined as any; + + delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS; + }); + + return () => editor; +}; diff --git a/packages/core/src/api/tests/testSchema.ts b/packages/core/src/api/tests/testSchema.ts new file mode 100644 index 0000000000..4560d12ee3 --- /dev/null +++ b/packages/core/src/api/tests/testSchema.ts @@ -0,0 +1,185 @@ +import { + defaultBlockSpecs, + defaultInlineContentSpecs, + defaultStyleSpecs, +} from "../../blocks/defaultBlocks.js"; +import { defaultProps } from "../../blocks/defaultProps.js"; +import { + imagePropSchema, + imageRender, +} from "../../blocks/ImageBlockContent/ImageBlockContent.js"; +import { BlockNoteSchema } from "../../editor/BlockNoteSchema.js"; +import { + createBlockSpec, + createInlineContentSpec, + createStyleSpec, +} from "../../schema/index.js"; + +// BLOCKS ---------------------------------------------------------------------- + +// This is a modified version of the default image block that does not implement +// a `toExternalHTML` function. It's used to test if the custom serializer by +// default serializes custom blocks using their `render` function. +const SimpleImage = createBlockSpec( + { + type: "simpleImage", + propSchema: imagePropSchema, + content: "none", + }, + { + render: (block, editor) => imageRender(block as any, editor as any), + } +); + +const CustomParagraph = createBlockSpec( + { + type: "customParagraph", + propSchema: defaultProps, + content: "inline", + }, + { + render: () => { + const paragraph = document.createElement("p"); + paragraph.className = "custom-paragraph"; + + return { + dom: paragraph, + contentDOM: paragraph, + }; + }, + toExternalHTML: () => { + const paragraph = document.createElement("p"); + paragraph.className = "custom-paragraph"; + paragraph.innerHTML = "Hello World"; + + return { + dom: paragraph, + }; + }, + } +); + +const SimpleCustomParagraph = createBlockSpec( + { + type: "simpleCustomParagraph", + propSchema: defaultProps, + content: "inline", + }, + { + render: () => { + const paragraph = document.createElement("p"); + paragraph.className = "simple-custom-paragraph"; + + return { + dom: paragraph, + contentDOM: paragraph, + }; + }, + } +); + +// INLINE CONTENT -------------------------------------------------------------- + +const Mention = createInlineContentSpec( + { + type: "mention", + propSchema: { + user: { + default: "", + }, + }, + content: "none", + }, + { + render: (ic) => { + const dom = document.createElement("span"); + dom.appendChild(document.createTextNode("@" + ic.props.user)); + + return { + dom, + }; + }, + } +); + +const Tag = createInlineContentSpec( + { + type: "tag" as const, + propSchema: {}, + content: "styled", + }, + { + render: () => { + const dom = document.createElement("span"); + dom.textContent = "#"; + + const contentDOM = document.createElement("span"); + dom.appendChild(contentDOM); + + return { + dom, + contentDOM, + }; + }, + } +); + +// STYLES ---------------------------------------------------------------------- + +const Small = createStyleSpec( + { + type: "small", + propSchema: "boolean", + }, + { + render: () => { + const dom = document.createElement("small"); + return { + dom, + contentDOM: dom, + }; + }, + } +); + +const FontSize = createStyleSpec( + { + type: "fontSize", + propSchema: "string", + }, + { + render: (value) => { + const dom = document.createElement("span"); + dom.setAttribute("style", "font-size: " + value); + return { + dom, + contentDOM: dom, + }; + }, + } +); + +// SCHEMA ---------------------------------------------------------------------- + +export const testSchema = BlockNoteSchema.create({ + blockSpecs: { + ...defaultBlockSpecs, + customParagraph: CustomParagraph, + simpleCustomParagraph: SimpleCustomParagraph, + simpleImage: SimpleImage, + }, + inlineContentSpecs: { + ...defaultInlineContentSpecs, + mention: Mention, + tag: Tag, + }, + styleSpecs: { + ...defaultStyleSpecs, + small: Small, + fontSize: FontSize, + }, +}); + +export type TestBlockSchema = typeof testSchema.blockSchema; +export type TestInlineContentSchema = typeof testSchema.inlineContentSchema; +export type TestStyleSchema = typeof testSchema.styleSchema; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index d872af5368..e0771b03df 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -3,7 +3,6 @@ export * from "./api/exporters/html/externalHTMLExporter.js"; export * from "./api/exporters/html/internalHTMLSerializer.js"; export * from "./api/getBlockInfoFromPos.js"; export * from "./api/nodeUtil.js"; -export * from "./api/testUtil/index.js"; export * from "./blocks/AudioBlockContent/AudioBlockContent.js"; export * from "./blocks/CodeBlockContent/CodeBlockContent.js"; export * from "./blocks/FileBlockContent/FileBlockContent.js"; @@ -62,7 +61,7 @@ export { UnreachableCaseError, assertEmpty } from "./util/typescript.js"; // for testing from react (TODO: move): export * from "./api/nodeConversions/blockToNode.js"; export * from "./api/nodeConversions/nodeToBlock.js"; -export * from "./api/testUtil/partialBlockTestUtil.js"; +export * from "./api/tests/formatConversion/formatConversionTestUtil.js"; export * from "./extensions/UniqueID/UniqueID.js"; // for server-util (TODO: maybe move): diff --git a/packages/react/src/test/testCases/customReactBlocks.tsx b/packages/react/src/test/testCases/customReactBlocks.tsx index b1dc6ce448..e1bdd8c7c3 100644 --- a/packages/react/src/test/testCases/customReactBlocks.tsx +++ b/packages/react/src/test/testCases/customReactBlocks.tsx @@ -1,9 +1,6 @@ import { BlockNoteEditor, BlockNoteSchema, - DefaultInlineContentSchema, - DefaultStyleSchema, - EditorTestCases, defaultBlockSpecs, defaultProps, uploadToTmpFilesDotOrg_DEV_ONLY, @@ -76,11 +73,8 @@ const schema = BlockNoteSchema.create({ }, }); -export const customReactBlockSchemaTestCases: EditorTestCases< - typeof schema.blockSchema, - DefaultInlineContentSchema, - DefaultStyleSchema -> = { +// TODO +export const customReactBlockSchemaTestCases: any = { name: "custom react block schema", createEditor: () => { return BlockNoteEditor.create({ diff --git a/packages/react/src/test/testCases/customReactInlineContent.tsx b/packages/react/src/test/testCases/customReactInlineContent.tsx index 17c53d7d76..1f285432fd 100644 --- a/packages/react/src/test/testCases/customReactInlineContent.tsx +++ b/packages/react/src/test/testCases/customReactInlineContent.tsx @@ -1,9 +1,6 @@ import { BlockNoteEditor, BlockNoteSchema, - DefaultBlockSchema, - DefaultStyleSchema, - EditorTestCases, defaultInlineContentSpecs, uploadToTmpFilesDotOrg_DEV_ONLY, } from "@blocknote/core"; @@ -51,11 +48,8 @@ const schema = BlockNoteSchema.create({ }, }); -export const customReactInlineContentTestCases: EditorTestCases< - DefaultBlockSchema, - typeof schema.inlineContentSchema, - DefaultStyleSchema -> = { +// TODO +export const customReactInlineContentTestCases: any = { name: "custom react inline content schema", createEditor: () => { return BlockNoteEditor.create({ diff --git a/packages/react/src/test/testCases/customReactStyles.tsx b/packages/react/src/test/testCases/customReactStyles.tsx index 3b4c717178..021c3945d0 100644 --- a/packages/react/src/test/testCases/customReactStyles.tsx +++ b/packages/react/src/test/testCases/customReactStyles.tsx @@ -1,9 +1,6 @@ import { BlockNoteEditor, BlockNoteSchema, - DefaultBlockSchema, - DefaultInlineContentSchema, - EditorTestCases, defaultStyleSpecs, uploadToTmpFilesDotOrg_DEV_ONLY, } from "@blocknote/core"; @@ -43,11 +40,8 @@ const schema = BlockNoteSchema.create({ }, }); -export const customReactStylesTestCases: EditorTestCases< - DefaultBlockSchema, - DefaultInlineContentSchema, - typeof schema.styleSchema -> = { +// TODO +export const customReactStylesTestCases: any = { name: "custom react style schema", createEditor: () => { return BlockNoteEditor.create({ diff --git a/packages/xl-multi-column/src/test/conversions/testCases.ts b/packages/xl-multi-column/src/test/conversions/testCases.ts index fd3ba6dbeb..376cf02b43 100644 --- a/packages/xl-multi-column/src/test/conversions/testCases.ts +++ b/packages/xl-multi-column/src/test/conversions/testCases.ts @@ -1,12 +1,9 @@ -import { BlockNoteEditor, EditorTestCases } from "@blocknote/core"; +import { BlockNoteEditor } from "@blocknote/core"; import { testEditorSchema } from "../setupTestEnv.js"; -export const multiColumnSchemaTestCases: EditorTestCases< - typeof testEditorSchema.blockSchema, - typeof testEditorSchema.inlineContentSchema, - typeof testEditorSchema.styleSchema -> = { +// TODO +export const multiColumnSchemaTestCases: any = { name: "multi-column-schema", createEditor: () => { return BlockNoteEditor.create({ diff --git a/shared/testDocument.ts b/shared/testDocument.ts index 1e85eb2870..f61fd9df31 100644 --- a/shared/testDocument.ts +++ b/shared/testDocument.ts @@ -5,6 +5,7 @@ import { partialBlocksToBlocksForTesting, } from "@blocknote/core"; +// TODO export const testDocument = partialBlocksToBlocksForTesting( BlockNoteSchema.create({ blockSpecs: { ...defaultBlockSpecs, pageBreak: PageBreak }, diff --git a/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-darwin.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-darwin.json new file mode 100644 index 0000000000..efc45cfa6f --- /dev/null +++ b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-darwin.json @@ -0,0 +1,180 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "heading", + "attrs": { + "textAlignment": "left", + "level": 1 + }, + "content": [ + { + "type": "text", + "text": "Heading" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "heading", + "attrs": { + "textAlignment": "left", + "level": 2 + }, + "content": [ + { + "type": "text", + "text": "Heading" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "2", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "heading", + "attrs": { + "textAlignment": "left", + "level": 3 + }, + "content": [ + { + "type": "text", + "text": "Heading" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "3", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "5", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "heading", + "attrs": { + "textAlignment": "left", + "level": 1 + }, + "content": [ + { + "type": "text", + "text": "Heading" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "6", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "heading", + "attrs": { + "textAlignment": "left", + "level": 2 + }, + "content": [ + { + "type": "text", + "text": "Heading" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "7", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "heading", + "attrs": { + "textAlignment": "left", + "level": 3 + }, + "content": [ + { + "type": "text", + "text": "Heading" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "8", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-darwin.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-darwin.json new file mode 100644 index 0000000000..9c6d0d2406 --- /dev/null +++ b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-darwin.json @@ -0,0 +1,174 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + }, + "content": [ + { + "type": "text", + "text": "Paragraph" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + }, + "content": [ + { + "type": "text", + "text": "Paragraph" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "2", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + }, + "content": [ + { + "type": "text", + "text": "Paragraph" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "3", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "5", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + }, + "content": [ + { + "type": "text", + "text": "Paragraph" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "6", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + }, + "content": [ + { + "type": "text", + "text": "Paragraph" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "7", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + }, + "content": [ + { + "type": "text", + "text": "Paragraph" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "8", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-darwin.json b/tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-darwin.json new file mode 100644 index 0000000000..ed1986da9f --- /dev/null +++ b/tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-darwin.json @@ -0,0 +1,95 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "heading", + "attrs": { + "textAlignment": "left", + "level": 2 + }, + "content": [ + { + "type": "text", + "text": "Heading" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "heading", + "attrs": { + "textAlignment": "left", + "level": 1 + }, + "content": [ + { + "type": "text", + "text": "Heading" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "2", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "heading", + "attrs": { + "textAlignment": "left", + "level": 3 + }, + "content": [ + { + "type": "text", + "text": "Heading" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "3", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file From ff63f61575c7ddf37ca8e2819b4d6d71390f8175 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Tue, 8 Apr 2025 18:51:34 +0200 Subject: [PATCH 02/12] Fixed build & formatted HTML snapshots --- packages/core/package.json | 1 + .../__snapshots__/text/html/basicBlocks.html | 40 +++++++++++- .../text/html/basicBlocksWithProps.html | 52 ++++++++++++++- .../text/html/childToParent.html | 3 +- .../text/html/childrenToNextParent.html | 5 +- .../html/childrenToNextParentsChildren.html | 8 ++- .../copy/__snapshots__/text/html/image.html | 7 ++- .../text/html/multipleChildren.html | 4 +- .../text/html/multipleStyledText.html | 4 +- .../__snapshots__/text/html/nestedImage.html | 9 ++- .../text/html/partialChildToParent.html | 3 +- .../text/html/tableAllCells.html | 19 +++++- .../__snapshots__/text/html/tableCell.html | 8 ++- .../__snapshots__/text/html/tableCol.html | 13 +++- .../__snapshots__/text/html/tableRow.html | 11 +++- .../tests/clipboard/copy/getCopyTestCases.ts | 1 - .../api/tests/clipboard/copy/testCopy.test.ts | 9 ++- .../clipboard/copyPaste/testCopyPaste.test.ts | 2 +- .../codeBlock/contains-newlines.html | 14 ++++- .../codeBlock/defaultLanguage.html | 12 +++- .../blocknoteHTML/codeBlock/empty.html | 12 +++- .../blocknoteHTML/codeBlock/python.html | 12 +++- .../blocknoteHTML/complex/misc.html | 60 +++++++++++++++++- .../blocknoteHTML/file/basic.html | 29 ++++++++- .../blocknoteHTML/file/button.html | 21 ++++++- .../blocknoteHTML/file/nested.html | 57 ++++++++++++++++- .../blocknoteHTML/file/noCaption.html | 27 +++++++- .../blocknoteHTML/file/noName.html | 28 ++++++++- .../blocknoteHTML/hardbreak/basic.html | 14 ++++- .../hardbreak/between-links.html | 22 ++++++- .../blocknoteHTML/hardbreak/end.html | 13 +++- .../blocknoteHTML/hardbreak/link.html | 22 ++++++- .../blocknoteHTML/hardbreak/multiple.html | 16 ++++- .../blocknoteHTML/hardbreak/only.html | 12 +++- .../blocknoteHTML/hardbreak/start.html | 13 +++- .../blocknoteHTML/hardbreak/styles.html | 14 ++++- .../blocknoteHTML/image/basic.html | 23 ++++++- .../blocknoteHTML/image/button.html | 21 ++++++- .../blocknoteHTML/image/nested.html | 43 ++++++++++++- .../blocknoteHTML/image/noCaption.html | 21 ++++++- .../blocknoteHTML/image/noName.html | 22 ++++++- .../blocknoteHTML/image/noPreview.html | 31 ++++++++- .../blocknoteHTML/link/adjacent.html | 21 ++++++- .../blocknoteHTML/link/basic.html | 16 ++++- .../blocknoteHTML/link/styled.html | 23 ++++++- .../blocknoteHTML/lists/basic.html | 59 ++++++++++++++++- .../blocknoteHTML/lists/nested.html | 63 ++++++++++++++++++- .../blocknoteHTML/pageBreak/basic.html | 9 +++ .../blocknoteHTML/paragraph/basic.html | 10 ++- .../blocknoteHTML/paragraph/empty.html | 10 ++- .../blocknoteHTML/paragraph/lineBreaks.html | 14 ++++- .../blocknoteHTML/paragraph/nested.html | 26 +++++++- .../blocknoteHTML/paragraph/styled.html | 33 +++++++++- .../blocknoteHTML/table/allColWidths.html | 44 ++++++++++++- .../blocknoteHTML/table/basic.html | 44 ++++++++++++- .../blocknoteHTML/table/headerCols.html | 44 ++++++++++++- .../blocknoteHTML/table/headerRows.html | 44 ++++++++++++- .../blocknoteHTML/table/mixedCellColors.html | 56 ++++++++++++++++- .../blocknoteHTML/table/mixedColWidths.html | 44 ++++++++++++- .../table/mixedRowspansAndColspans.html | 47 +++++++++++++- .../html/codeBlock/contains-newlines.html | 9 ++- .../html/codeBlock/defaultLanguage.html | 4 +- .../__snapshots__/html/codeBlock/empty.html | 4 +- .../__snapshots__/html/codeBlock/python.html | 4 +- .../__snapshots__/html/complex/misc.html | 15 ++++- .../export/__snapshots__/html/file/basic.html | 5 +- .../__snapshots__/html/file/nested.html | 9 ++- .../__snapshots__/html/file/noName.html | 5 +- .../__snapshots__/html/hardbreak/basic.html | 6 +- .../html/hardbreak/between-links.html | 14 ++++- .../__snapshots__/html/hardbreak/end.html | 5 +- .../__snapshots__/html/hardbreak/link.html | 14 ++++- .../html/hardbreak/multiple.html | 8 ++- .../__snapshots__/html/hardbreak/only.html | 4 +- .../__snapshots__/html/hardbreak/start.html | 5 +- .../__snapshots__/html/hardbreak/styles.html | 6 +- .../__snapshots__/html/image/basic.html | 10 ++- .../__snapshots__/html/image/nested.html | 9 ++- .../__snapshots__/html/image/noCaption.html | 7 ++- .../__snapshots__/html/image/noName.html | 5 +- .../__snapshots__/html/image/noPreview.html | 11 +++- .../__snapshots__/html/link/adjacent.html | 13 +++- .../export/__snapshots__/html/link/basic.html | 8 ++- .../__snapshots__/html/link/styled.html | 15 ++++- .../__snapshots__/html/lists/basic.html | 27 +++++++- .../__snapshots__/html/lists/nested.html | 27 +++++++- .../__snapshots__/html/pageBreak/basic.html | 1 + .../html/paragraph/lineBreaks.html | 6 +- .../__snapshots__/html/paragraph/nested.html | 4 +- .../__snapshots__/html/paragraph/styled.html | 13 +++- .../html/table/allColWidths.html | 36 ++++++++++- .../__snapshots__/html/table/basic.html | 36 ++++++++++- .../__snapshots__/html/table/headerCols.html | 36 ++++++++++- .../__snapshots__/html/table/headerRows.html | 36 ++++++++++- .../html/table/mixedCellColors.html | 48 +++++++++++++- .../html/table/mixedColWidths.html | 36 ++++++++++- .../html/table/mixedRowspansAndColspans.html | 39 +++++++++++- .../__snapshots__/markdown/pageBreak/basic.md | 0 .../__snapshots__/nodes/pageBreak/basic.json | 15 +++++ .../export/testExport.test.ts | 24 ++++--- .../testExportParseEquality.test.ts | 14 ++--- .../formatConversion/parse/testParse.test.ts | 2 +- packages/core/src/api/tests/testSchema.ts | 2 + pnpm-lock.yaml | 8 +++ 104 files changed, 1856 insertions(+), 114 deletions(-) create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md create mode 100644 packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json diff --git a/packages/core/package.json b/packages/core/package.json index c4bc6193f8..3ea4572574 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -94,6 +94,7 @@ "@tiptap/pm": "^2.11.5", "emoji-mart": "^5.6.0", "hast-util-from-dom": "^5.0.1", + "htmlfy": "^0.6.7", "prosemirror-dropcursor": "^1.8.1", "prosemirror-highlight": "^0.13.0", "prosemirror-model": "^1.24.1", diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocks.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocks.html index ec3fa8a4e2..4b0fff5d10 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocks.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocks.html @@ -1 +1,39 @@ -

Paragraph 1

Heading 1

  1. Numbered List Item 1

  • Bullet List Item 1

  • Check List Item 1

console.log("Hello World");

Table Cell 1

Table Cell 2

Table Cell 3

Table Cell 4

Add image

Paragraph 2

\ No newline at end of file +

Paragraph 1

+

Heading 1

+
    +
  1. +

    Numbered List Item 1

    +
  2. +
+
    +
  • +

    Bullet List Item 1

    +
  • +
  • + +

    Check List Item 1

    +
  • +
+
+  console.log("Hello World");
+
+ + + + + + + + + +
+

Table Cell 1

+
+

Table Cell 2

+
+

Table Cell 3

+
+

Table Cell 4

+
+

Add image

+

Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html index 2f670e89d2..aa29f7463c 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html @@ -1 +1,51 @@ -

Paragraph 1

Heading 1

  1. Numbered List Item 1

  • Bullet List Item 1

  • Check List Item 1

console.log("Hello World");

Table Cell 1

Table Cell 2

Table Cell 3

Table Cell 4

1280px-Placeholder_view_vector.svg.png
Placeholder

Paragraph 2

\ No newline at end of file +

Paragraph 1

+

Heading 1

+
    +
  1. +

    Numbered List Item 1

    +
  2. +
+
    +
  • +

    Bullet List Item 1

    +
  • +
  • + +

    Check List Item 1

    +
  • +
+
+  console.log("Hello World");
+
+ + + + + + + + + +
+

Table Cell 1

+
+

Table Cell 2

+
+

Table Cell 3

+
+

Table Cell 4

+
+
+ 1280px-Placeholder_view_vector.svg.png +
Placeholder
+
+

Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childToParent.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childToParent.html index dd8f8a98d5..a39b61fc62 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childToParent.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childToParent.html @@ -1 +1,2 @@ -

Paragraph 1

Nested Paragraph 1

\ No newline at end of file +

Paragraph 1

+

Nested Paragraph 1

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html index 5bad4edb45..5482d90cfa 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html @@ -1 +1,4 @@ -

Nested Paragraph 1

Nested Paragraph 2

Nested Paragraph 3

Paragraph 2

\ No newline at end of file +

Nested Paragraph 1

+

Nested Paragraph 2

+

Nested Paragraph 3

+

Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html index 0835489372..5f11c91d10 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html @@ -1 +1,7 @@ -

Nested Paragraph 1

Nested Paragraph 2

Nested Paragraph 3

Paragraph 2

Nested Paragraph 4

Nested Paragraph 5

Nested Paragraph 6

\ No newline at end of file +

Nested Paragraph 1

+

Nested Paragraph 2

+

Nested Paragraph 3

+

Paragraph 2

+

Nested Paragraph 4

+

Nested Paragraph 5

+

Nested Paragraph 6

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/image.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/image.html index 1a86821862..3d97d675dd 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/image.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/image.html @@ -1 +1,6 @@ -BlockNote image \ No newline at end of file +BlockNote image \ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleChildren.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleChildren.html index 8bb03060e1..bad0f9b365 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleChildren.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleChildren.html @@ -1 +1,3 @@ -

Nested Paragraph 1

Nested Paragraph 2

Nested Paragraph 3

\ No newline at end of file +

Nested Paragraph 1

+

Nested Paragraph 2

+

Nested Paragraph 3

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleStyledText.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleStyledText.html index 6d1372fc71..8f6d4fcb54 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleStyledText.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleStyledText.html @@ -1 +1,3 @@ -Unstyled TextItalic TextBold Text \ No newline at end of file +Unstyled Text +Italic Text +Bold Text \ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/nestedImage.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/nestedImage.html index f23120b803..7983b6974c 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/nestedImage.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/nestedImage.html @@ -1 +1,8 @@ -

Paragraph 1

BlockNote image

Nested Paragraph 1

\ No newline at end of file +

Paragraph 1

+BlockNote image +

Nested Paragraph 1

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/partialChildToParent.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/partialChildToParent.html index 38f4f5b8a5..3599c4a943 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/partialChildToParent.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/partialChildToParent.html @@ -1 +1,2 @@ -

aragraph 1

N

\ No newline at end of file +

aragraph 1

+

N

\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableAllCells.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableAllCells.html index 6d9b71c451..67be1a7c03 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableAllCells.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableAllCells.html @@ -1 +1,18 @@ -

Table Cell 1

Table Cell 2

Table Cell 3

Table Cell 4

\ No newline at end of file + + + + + + + + + +
+

Table Cell 1

+
+

Table Cell 2

+
+

Table Cell 3

+
+

Table Cell 4

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCell.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCell.html index 7e12584ba8..8493ba34a0 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCell.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCell.html @@ -1 +1,7 @@ -

Table Cell 1

\ No newline at end of file + + + + +
+

Table Cell 1

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCol.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCol.html index 0501d5e8a0..9b3beaa5ce 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCol.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCol.html @@ -1 +1,12 @@ -

Table Cell 1

Table Cell 3

\ No newline at end of file + + + + + + + +
+

Table Cell 1

+
+

Table Cell 3

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableRow.html b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableRow.html index 7dfe7da261..f36b6de978 100644 --- a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableRow.html +++ b/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableRow.html @@ -1 +1,10 @@ -

Table Cell 1

Table Cell 2

\ No newline at end of file + + + + + +
+

Table Cell 1

+
+

Table Cell 2

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts b/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts index b850adbea6..26bc09f0bd 100644 --- a/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts +++ b/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts @@ -364,7 +364,6 @@ export const getCopyTestCases = (): CopyTestCase[] => [ return TextSelection.create(doc, startPos, endPos); }, }, - // TODO: External HTML is wrapped in unnecessary `tr` element. { name: "tableCell", clipboardDataType: "text/html", diff --git a/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts b/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts index 25158039cf..156580721e 100644 --- a/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts +++ b/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts @@ -1,3 +1,4 @@ +import { prettify } from "htmlfy"; import { describe, expect, it } from "vitest"; import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; @@ -41,11 +42,15 @@ const testCopyTest = async ( ); if (testCase.clipboardDataType === "blocknote/html") { - await expect(clipboardHTML).toMatchFileSnapshot( + await expect( + prettify(clipboardHTML, { tag_wrap: true }) + ).toMatchFileSnapshot( `./__snapshots__/${testCase.clipboardDataType}/${testCase.name}.html` ); } else if (testCase.clipboardDataType === "text/html") { - await expect(externalHTML).toMatchFileSnapshot( + await expect( + prettify(externalHTML, { tag_wrap: true }) + ).toMatchFileSnapshot( `./__snapshots__/${testCase.clipboardDataType}/${testCase.name}.html` ); } else if (testCase.clipboardDataType === "text/plain") { diff --git a/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts b/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts index 522755e9c2..164b58d459 100644 --- a/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts +++ b/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts @@ -61,7 +61,7 @@ const testCopyPasteTest = async ( ); }; -describe("Copy/paste tests", async () => { +describe("Copy/paste tests", () => { const getEditor = setupTestEditor(); for (const testCase of getCopyPasteTestCases()) { diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html index 0726d52681..32e032f09d 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html @@ -1,3 +1,11 @@ -
const hello = 'world';
-console.log(hello);
-
\ No newline at end of file +
+
+
+
+
+          const hello ='world';console.log(hello);
+        
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html index 1bdf06d688..a8fb6870f0 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html @@ -1 +1,11 @@ -
console.log('Hello, world!');
\ No newline at end of file +
+
+
+
+
+          console.log('Hello, world!');
+        
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html index 1affa24729..7df4533925 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html @@ -1 +1,11 @@ -
\ No newline at end of file +
+
+
+
+
+          
+        
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html index 79bee36d05..232edd4914 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html @@ -1 +1,11 @@ -
print('Hello, world!')
\ No newline at end of file +
+
+
+
+
+          print('Hello, world!')
+        
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html index 9c93196626..7587f35366 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html @@ -1 +1,59 @@ -

Heading 2

Paragraph

\ No newline at end of file +
+
+
+
+

+ + Heading + + + 2 + +

+
+
+
+
+
+

Paragraph

+
+
+
+
+
+
+

+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html index 1319139845..9974d8d975 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html @@ -1 +1,28 @@ -

example

Caption

\ No newline at end of file +
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html index eec0bad77e..db235fd792 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html @@ -1 +1,20 @@ -

Add file

\ No newline at end of file +
+
+
+
+
+
+
+ + + +
+

Add file

+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html index 78fc188b14..6553a5c4a8 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html @@ -1 +1,56 @@ -

example

Caption

example

Caption

\ No newline at end of file +
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html index c840e3bf3d..48340682e8 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html @@ -1 +1,26 @@ -

example

\ No newline at end of file +
+
+
+
+
+
+
+ + + +
+

example

+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html index 95094bba1c..47ae5b3bf9 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html @@ -1 +1,27 @@ -

Caption

\ No newline at end of file +
+
+
+
+
+
+
+ + + +
+

+
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html index a2330209d8..ca0de5979f 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html @@ -1 +1,13 @@ -

Text1
Text2

\ No newline at end of file +
+
+
+
+

+ Text1 +
+ Text2 +

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html index a2bfa95fcc..9e4b427c62 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html @@ -1 +1,21 @@ - \ No newline at end of file +
+
+
+
+

+ Link1 +
+ Link2 +

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html index 8a31eda9c1..cc08190f01 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html @@ -1 +1,12 @@ -

Text1

\ No newline at end of file +
+
+
+
+

+ Text1 +
+

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html index e521018b55..4cae02d67b 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html @@ -1 +1,21 @@ - \ No newline at end of file +
+
+
+
+

+ Link1 +
+ Link1 +

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html index f1d84c28ea..06a2a6a7e5 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html @@ -1 +1,15 @@ -

Text1
Text2
Text3

\ No newline at end of file +
+
+
+
+

+ Text1 +
+ Text2 +
+ Text3 +

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html index 719876c082..030fa48828 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html @@ -1 +1,11 @@ -


\ No newline at end of file +
+
+
+
+

+
+

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html index 59b4513961..29e2b8ece4 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html @@ -1 +1,12 @@ -


Text1

\ No newline at end of file +
+
+
+
+

+
+ Text1 +

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html index 2e363d05b6..b6b8eadb30 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html @@ -1 +1,13 @@ -

Text1
Text2

\ No newline at end of file +
+
+
+
+

+ Text1 +
+ Text2 +

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html index f0a941fa7d..fe9509a5e3 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html @@ -1 +1,22 @@ -
example

Caption

\ No newline at end of file +
+
+
+
+
+
+ example +
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html index 17bb6273f2..250700bb22 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html @@ -1 +1,20 @@ -

Add image

\ No newline at end of file +
+
+
+
+
+
+
+ + + +
+

Add image

+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html index 2c4ec32a7e..90e46213fe 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html @@ -1 +1,42 @@ -
Caption

Caption

Caption

Caption

\ No newline at end of file +
+
+
+
+
+
+ Caption +
+

Caption

+
+
+
+
+
+
+
+
+ Caption +
+

Caption

+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html index d31f966332..2daf51143b 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html @@ -1 +1,20 @@ -
example
\ No newline at end of file +
+
+
+
+
+
+ example +
+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html index 94a1c1eca4..05bc98c060 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html @@ -1 +1,21 @@ -
Caption

Caption

\ No newline at end of file +
+
+
+
+
+
+ Caption +
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html index 16e87d8805..84f2dbfc76 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html @@ -1 +1,30 @@ -

example

Caption

\ No newline at end of file +
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html index 84e53fbec0..2408c611ac 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html @@ -1 +1,20 @@ - \ No newline at end of file +
+
+
+
+

+ Website + Website2 +

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html index abb46733e3..3daea90831 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html @@ -1 +1,15 @@ - \ No newline at end of file +
+
+
+
+

+ Website +

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html index 30390a6b85..2b9d4cb574 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html @@ -1 +1,22 @@ - \ No newline at end of file +
+
+
+
+

+ + Web + + site +

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html index 0c946d8b79..3cb5ed5e94 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html @@ -1 +1,58 @@ -

Bullet List Item 1

Bullet List Item 2

Numbered List Item 1

Numbered List Item 2

Check List Item 1

Check List Item 2

\ No newline at end of file +
+
+
+
+

Bullet List Item 1

+
+
+
+
+
+
+

Bullet List Item 2

+
+
+
+
+
+
+

Numbered List Item 1

+
+
+
+
+
+
+

Numbered List Item 2

+
+
+
+
+
+
+ +

Check List Item 1

+
+
+
+
+
+
+ +

Check List Item 2

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html index 0b8783cbeb..f9aaf463f8 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html @@ -1 +1,62 @@ -

Bullet List Item 1

Bullet List Item 2

Numbered List Item 1

Numbered List Item 2

Check List Item 1

Check List Item 2

\ No newline at end of file +
+
+
+
+

Bullet List Item 1

+
+
+
+
+
+
+

Bullet List Item 2

+
+
+
+
+
+

Numbered List Item 1

+
+
+
+
+
+
+

Numbered List Item 2

+
+
+
+
+
+ +

Check List Item 1

+
+
+
+
+
+
+ +

Check List Item 2

+
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html new file mode 100644 index 0000000000..545ab1bbac --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html @@ -0,0 +1,9 @@ +
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html index 1d5a3f2400..326c6a037b 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html @@ -1 +1,9 @@ -

Paragraph

\ No newline at end of file +
+
+
+
+

Paragraph

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html index f54bf0da2f..8c0240ae7c 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html @@ -1 +1,9 @@ -

\ No newline at end of file +
+
+
+
+

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html index 38d71a5d77..0aa8dffa67 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html @@ -1 +1,13 @@ -

Line 1
Line 2

\ No newline at end of file +
+
+
+
+

+ Line 1 +
+ Line 2 +

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html index 27d18b09f0..7d99f8188d 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html @@ -1 +1,25 @@ -

Paragraph

Nested Paragraph 1

Nested Paragraph 2

\ No newline at end of file +
+
+
+
+

Paragraph

+
+
+
+
+
+

Nested Paragraph 1

+
+
+
+
+
+
+

Nested Paragraph 2

+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html index 14c8ccfa6d..5ae4c7b95c 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html @@ -1 +1,32 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file +
+
+
+
+

+ Plain + Red Text + Blue Background + + Mixed Colors + +

+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html index d0c3bee7be..778749b580 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html @@ -1 +1,43 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html index 34d6bd6fbf..a9e249effe 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html @@ -1 +1,43 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html index 0530d9e66c..6f5dcb8982 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html @@ -1 +1,43 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html index 572aab33bf..2ce617f949 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html @@ -1 +1,43 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html index e0313a2b39..8cafca0c72 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html @@ -1 +1,55 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html index 5f4cc9af6e..a5e5bdf3b4 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html @@ -1 +1,43 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html index 62114b9765..eb7dd2ce02 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html @@ -1 +1,46 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file +
+
+
+
+ + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html index 8de18f9605..1b766eb380 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html @@ -1 +1,8 @@ -
const hello = 'world';
console.log(hello);
\ No newline at end of file +
+  
+    const hello ='world';
+    
+ console.log(hello); +
+
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html index 8db77070b5..c5939c1b5e 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html @@ -1 +1,3 @@ -
console.log('Hello, world!');
\ No newline at end of file +
+  console.log('Hello, world!');
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html index 22baaf1757..9bbe62c374 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html @@ -1 +1,3 @@ -
\ No newline at end of file +
+  
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html index 4872e5904f..2d95c0d45d 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html @@ -1 +1,3 @@ -
print('Hello, world!')
\ No newline at end of file +
+  print('Hello, world!')
+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/complex/misc.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/complex/misc.html index eee2368524..0df8a18343 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/complex/misc.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/complex/misc.html @@ -1 +1,14 @@ -

Heading 2

Paragraph

\ No newline at end of file +

+ + Heading + + + 2 + +

+

Paragraph

+
    +
  • +

    +
  • +
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/basic.html index 2fef8bae04..22fe1c373a 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/basic.html @@ -1 +1,4 @@ -
example

Caption

\ No newline at end of file +
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/nested.html index 76ff9df2a3..226ee83250 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/nested.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/nested.html @@ -1 +1,8 @@ -
example

Caption

example

Caption

\ No newline at end of file +
+ example +

Caption

+
+
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noName.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noName.html index b29226235b..f0ac923a66 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noName.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noName.html @@ -1 +1,4 @@ -
exampleURL

Caption

\ No newline at end of file +
+ exampleURL +

Caption

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html index e64f4a3a23..d0444869cc 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html @@ -1 +1,5 @@ -

Text1
Text2

\ No newline at end of file +

+ Text1 +
+ Text2 +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html index ccc63111c8..701b5d4213 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html @@ -1 +1,13 @@ -

Link1
Link2

\ No newline at end of file +

+ Link1 +
+ Link2 +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html index dac217f275..1f7bcf996b 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html @@ -1 +1,4 @@ -

Text1

\ No newline at end of file +

+ Text1 +
+

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html index 5e3a2e2cc4..2c762aedc5 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html @@ -1 +1,13 @@ -

Link1
Link1

\ No newline at end of file +

+ Link1 +
+ Link1 +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html index 89dd31150d..5d957daa62 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html @@ -1 +1,7 @@ -

Text1
Text2
Text3

\ No newline at end of file +

+ Text1 +
+ Text2 +
+ Text3 +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html index 1d98fbbf16..b96f89d7a0 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html @@ -1 +1,3 @@ -


\ No newline at end of file +

+
+

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html index 3504d3778d..f0370a6c68 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html @@ -1 +1,4 @@ -


Text1

\ No newline at end of file +

+
+ Text1 +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html index e2e96c2cfe..7a49318b49 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html @@ -1 +1,5 @@ -

Text1
Text2

\ No newline at end of file +

+ Text1 +
+ Text2 +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/basic.html index 6b8bf9fb50..59f782dbb1 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/basic.html @@ -1 +1,9 @@ -
example

Caption

\ No newline at end of file +
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/nested.html index e1c7e7eb92..8cc825084e 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/nested.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/nested.html @@ -1 +1,8 @@ -
exampleURL

Caption

exampleURL

Caption

\ No newline at end of file +
+ exampleURL +

Caption

+
+
+ exampleURL +

Caption

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noCaption.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noCaption.html index 00a10df4fa..269bdeca7e 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noCaption.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noCaption.html @@ -1 +1,6 @@ -example \ No newline at end of file +example \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noName.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noName.html index 08b9fe6e61..decd178fbe 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noName.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noName.html @@ -1 +1,4 @@ -
exampleURL

Caption

\ No newline at end of file +
+ exampleURL +

Caption

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noPreview.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noPreview.html index 591a3abb43..21bf2faaf1 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noPreview.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noPreview.html @@ -1 +1,10 @@ -
example

Caption

\ No newline at end of file +
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/adjacent.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/adjacent.html index 849c727028..db99691d33 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/adjacent.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/adjacent.html @@ -1 +1,12 @@ -

WebsiteWebsite2

\ No newline at end of file +

+ Website + Website2 +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/basic.html index 3873eaa8ba..4b61e8c582 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/basic.html @@ -1 +1,7 @@ -

Website

\ No newline at end of file +

+ Website +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/styled.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/styled.html index 3304968a98..fb7737f7f8 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/styled.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/styled.html @@ -1 +1,14 @@ -

Website

\ No newline at end of file +

+ + Web + + site +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/basic.html index ed9e33e52a..aee1048a87 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/basic.html @@ -1 +1,26 @@ -
  • Bullet List Item 1

  • Bullet List Item 2

  1. Numbered List Item 1

  2. Numbered List Item 2

  • Check List Item 1

  • Check List Item 2

\ No newline at end of file +
    +
  • +

    Bullet List Item 1

    +
  • +
  • +

    Bullet List Item 2

    +
  • +
+
    +
  1. +

    Numbered List Item 1

    +
  2. +
  3. +

    Numbered List Item 2

    +
  4. +
+
    +
  • + +

    Check List Item 1

    +
  • +
  • + +

    Check List Item 2

    +
  • +
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/nested.html index 73877536f1..b2497ae937 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/nested.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/nested.html @@ -1 +1,26 @@ -
  • Bullet List Item 1

  • Bullet List Item 2

    1. Numbered List Item 1

    2. Numbered List Item 2

      • Check List Item 1

      • Check List Item 2

\ No newline at end of file +
    +
  • +

    Bullet List Item 1

    +
  • +
  • +

    Bullet List Item 2

    +
      +
    1. +

      Numbered List Item 1

      +
    2. +
    3. +

      Numbered List Item 2

      +
        +
      • + +

        Check List Item 1

        +
      • +
      • + +

        Check List Item 2

        +
      • +
      +
    4. +
    +
  • +
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html new file mode 100644 index 0000000000..ba65bb0620 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html index 02b91a8da0..7dafa23c42 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html @@ -1 +1,5 @@ -

Line 1
Line 2

\ No newline at end of file +

+ Line 1 +
+ Line 2 +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html index 9490db41f4..5e80eb83e2 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html @@ -1 +1,3 @@ -

Paragraph

Nested Paragraph 1

Nested Paragraph 2

\ No newline at end of file +

Paragraph

+

Nested Paragraph 1

+

Nested Paragraph 2

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html index 402117f50b..65e55c08bf 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html @@ -1 +1,12 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file +

+ Plain + Red Text + Blue Background + + Mixed Colors + +

\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html index fca2730213..9ce9e3e5c6 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html @@ -1 +1,35 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/basic.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/basic.html index ce73c75aa8..00f73d172c 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/basic.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/basic.html @@ -1 +1,35 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerCols.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerCols.html index 03ecb174b0..eeebae59df 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerCols.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerCols.html @@ -1 +1,35 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerRows.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerRows.html index 9306b01089..008f208fdc 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerRows.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerRows.html @@ -1 +1,35 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html index 780396996c..05bcfd2bfc 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html @@ -1 +1,47 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html index c7018c749b..72d863ebea 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html @@ -1 +1,35 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html index 1e0671ec07..9ec43c73e7 100644 --- a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html @@ -1 +1,38 @@ -

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

Table Cell

\ No newline at end of file + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md b/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json new file mode 100644 index 0000000000..f054006323 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json @@ -0,0 +1,15 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "type": "pageBreak", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/core/src/api/tests/formatConversion/export/testExport.test.ts b/packages/core/src/api/tests/formatConversion/export/testExport.test.ts index e85bfecea0..4e41c535a4 100644 --- a/packages/core/src/api/tests/formatConversion/export/testExport.test.ts +++ b/packages/core/src/api/tests/formatConversion/export/testExport.test.ts @@ -1,3 +1,4 @@ +import { prettify } from "htmlfy"; import { describe, expect, it } from "vitest"; import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; @@ -9,7 +10,7 @@ import { TestInlineContentSchema, TestStyleSchema, } from "../../testSchema.js"; -import { addIdsToBlock } from "../formatConversionTestUtil.js"; +import { addIdsToBlocks } from "../formatConversionTestUtil.js"; import { ExportTestCase, getExportTestCases } from "./getExportTestCases.js"; // Test for verifying that exporting blocks to other formats works as expected. @@ -26,15 +27,22 @@ const testExportTest = async < testCase: ExportTestCase ) => { (window as any).__TEST_OPTIONS.mockID = 0; + + addIdsToBlocks(testCase.content); + if (testCase.conversionType === "blocknoteHTML") { await expect( - await editor.blocksToFullHTML(testCase.content) + prettify(await editor.blocksToFullHTML(testCase.content), { + tag_wrap: true, + }) ).toMatchFileSnapshot( `./__snapshots__/${testCase.conversionType}/${testCase.name}.html` ); } else if (testCase.conversionType === "html") { await expect( - await editor.blocksToHTMLLossy(testCase.content) + prettify(await editor.blocksToHTMLLossy(testCase.content), { + tag_wrap: true, + }) ).toMatchFileSnapshot( `./__snapshots__/${testCase.conversionType}/${testCase.name}.html` ); @@ -46,11 +54,9 @@ const testExportTest = async < ); } else if (testCase.conversionType === "nodes") { await expect( - testCase.content.map((block) => { - addIdsToBlock(block); - - return blockToNode(block, editor.pmSchema, editor.schema.styleSchema); - }) + testCase.content.map((block) => + blockToNode(block, editor.pmSchema, editor.schema.styleSchema) + ) ).toMatchFileSnapshot( `./__snapshots__/${testCase.conversionType}/${testCase.name}.json` ); @@ -59,7 +65,7 @@ const testExportTest = async < } }; -describe("Export tests", async () => { +describe("Export tests", () => { const getEditor = setupTestEditor(); for (const testCase of [ diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts index c699d8f3d2..df9adbfb94 100644 --- a/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts +++ b/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts @@ -11,7 +11,7 @@ import { TestStyleSchema, } from "../../testSchema.js"; import { - addIdsToBlock, + addIdsToBlocks, partialBlocksToBlocksForTesting, } from "../formatConversionTestUtil.js"; import { @@ -32,6 +32,8 @@ const testExportParseEqualityTest = async ( ) => { (window as any).__TEST_OPTIONS.mockID = 0; + addIdsToBlocks(testCase.content); + if (testCase.conversionType === "blocknoteHTML") { const exported = await editor.blocksToFullHTML(testCase.content); @@ -39,11 +41,9 @@ const testExportParseEqualityTest = async ( partialBlocksToBlocksForTesting(editor.schema, testCase.content) ); } else if (testCase.conversionType === "nodes") { - const exported = testCase.content.map((block) => { - addIdsToBlock(block); - - return blockToNode(block, editor.pmSchema, editor.schema.styleSchema); - }); + const exported = testCase.content.map((block) => + blockToNode(block, editor.pmSchema, editor.schema.styleSchema) + ); expect( exported.map((node) => @@ -64,7 +64,7 @@ const testExportParseEqualityTest = async ( expect(true).toBeTruthy(); }; -describe("Export/parse equality tests", async () => { +describe("Export/parse equality tests", () => { const getEditor = setupTestEditor(); for (const testCase of [ diff --git a/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts b/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts index 18883f34ca..2b43fae39d 100644 --- a/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts +++ b/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts @@ -40,7 +40,7 @@ const testParseTest = async ( } }; -describe("Export tests", async () => { +describe("Export tests", () => { const getEditor = setupTestEditor(); for (const testCase of getParseTestCases()) { diff --git a/packages/core/src/api/tests/testSchema.ts b/packages/core/src/api/tests/testSchema.ts index 4560d12ee3..0bb434f4c1 100644 --- a/packages/core/src/api/tests/testSchema.ts +++ b/packages/core/src/api/tests/testSchema.ts @@ -8,6 +8,7 @@ import { imagePropSchema, imageRender, } from "../../blocks/ImageBlockContent/ImageBlockContent.js"; +import { PageBreak } from "../../blocks/PageBreakBlockContent/PageBreakBlockContent.js"; import { BlockNoteSchema } from "../../editor/BlockNoteSchema.js"; import { createBlockSpec, @@ -164,6 +165,7 @@ const FontSize = createStyleSpec( export const testSchema = BlockNoteSchema.create({ blockSpecs: { ...defaultBlockSpecs, + pageBreak: PageBreak, customParagraph: CustomParagraph, simpleCustomParagraph: SimpleCustomParagraph, simpleImage: SimpleImage, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bae4453885..e86d2346d2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2917,6 +2917,9 @@ importers: hast-util-from-dom: specifier: ^5.0.1 version: 5.0.1 + htmlfy: + specifier: ^0.6.7 + version: 0.6.7 prosemirror-dropcursor: specifier: ^1.8.1 version: 1.8.1 @@ -9767,6 +9770,9 @@ packages: html-whitespace-sensitive-tag-names@3.0.1: resolution: {integrity: sha512-q+310vW8zmymYHALr1da4HyXUQ0zgiIwIicEfotYPWGN0OJVEN/58IJ3A4GBYcEq3LGAZqKb+ugvP0GNB9CEAA==} + htmlfy@0.6.7: + resolution: {integrity: sha512-r8hRd+oIM10lufovN+zr3VKPTYEIvIwqXGucidh2XQufmiw6sbUXFUFjWlfjo3AnefIDTyzykVzQ8IUVuT1peQ==} + http-proxy-agent@5.0.0: resolution: {integrity: sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==} engines: {node: '>= 6'} @@ -20540,6 +20546,8 @@ snapshots: html-whitespace-sensitive-tag-names@3.0.1: {} + htmlfy@0.6.7: {} + http-proxy-agent@5.0.0: dependencies: '@tootallnate/once': 2.0.0 From 9fa60192536d08ddcc7c941366e33421f4f97ca1 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Tue, 8 Apr 2025 18:56:31 +0200 Subject: [PATCH 03/12] Small fix --- .../exportParseEquality/testExportParseEquality.test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts index df9adbfb94..604a8e7887 100644 --- a/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts +++ b/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts @@ -60,8 +60,6 @@ const testExportParseEqualityTest = async ( } else { throw new UnreachableCaseError(testCase.conversionType); } - - expect(true).toBeTruthy(); }; describe("Export/parse equality tests", () => { From 0e418d5a77992116ed16b29025b2211889c6e7d8 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Tue, 8 Apr 2025 20:30:30 +0200 Subject: [PATCH 04/12] Fixed react setup --- .../tests/clipboard/copy/getCopyTestCases.ts | 23 +- .../api/tests/clipboard/copy/testCopy.test.ts | 29 +- .../copyPaste/getCopyPasteTestCases.ts | 23 +- .../clipboard/copyPaste/testCopyPaste.test.ts | 29 +- .../getCopyPasteEqualityTestCases.ts | 23 +- .../testCopyPasteEquality.test.ts | 29 +- .../clipboard/paste/getPasteTestCases.ts | 23 +- .../tests/clipboard/paste/testPaste.test.ts | 29 +- .../export/getExportTestCases.ts | 34 +- .../export/testExport.test.ts | 29 +- .../getExportParseEqualityTestCases.ts | 29 +- .../testExportParseEquality.test.ts | 29 +- .../formatConversion/parse/testParse.test.ts | 27 +- .../core/src/api/tests/setupTestEditor.ts | 30 +- packages/core/src/index.ts | 23 +- .../fontSize/basic/external.html | 1 - .../fontSize/basic/internal.html | 1 - .../__snapshots__/mention/basic/external.html | 1 - .../__snapshots__/mention/basic/internal.html | 1 - .../nodeConversion.test.tsx.snap | 816 ------------------ .../reactContextParagraph/basic/internal.html | 1 - .../reactCustomParagraph/basic/internal.html | 1 - .../lineBreaks/internal.html | 1 - .../reactCustomParagraph/nested/external.html | 1 - .../reactCustomParagraph/nested/internal.html | 1 - .../reactCustomParagraph/styled/external.html | 1 - .../reactCustomParagraph/styled/internal.html | 1 - .../reactFile/basic/external.html | 1 - .../reactFile/basic/internal.html | 1 - .../reactFile/button/internal.html | 1 - .../reactFile/nested/external.html | 1 - .../reactFile/nested/internal.html | 1 - .../reactFile/noCaption/internal.html | 1 - .../reactFile/noName/external.html | 1 - .../reactFile/noName/internal.html | 1 - .../reactImage/basic/external.html | 1 - .../reactImage/basic/internal.html | 1 - .../reactImage/button/internal.html | 1 - .../reactImage/nested/external.html | 1 - .../reactImage/nested/internal.html | 1 - .../reactImage/noCaption/external.html | 1 - .../reactImage/noCaption/internal.html | 1 - .../reactImage/noName/external.html | 1 - .../reactImage/noName/internal.html | 1 - .../reactImage/noPreview/external.html | 1 - .../reactImage/noPreview/internal.html | 1 - .../basic/internal.html | 1 - .../nested/external.html | 1 - .../nested/internal.html | 1 - .../styled/external.html | 1 - .../styled/internal.html | 1 - .../__snapshots__/small/basic/external.html | 1 - .../__snapshots__/small/basic/internal.html | 1 - .../__snapshots__/tag/basic/external.html | 1 - .../__snapshots__/tag/basic/internal.html | 1 - .../react/src/test/htmlConversion.test.tsx | 123 --- .../react/src/test/nodeConversion.test.tsx | 99 --- .../src/test/testCases/customReactBlocks.tsx | 404 --------- .../testCases/customReactInlineContent.tsx | 96 --- .../src/test/testCases/customReactStyles.tsx | 88 -- .../codeBlock/contains-newlines.html | 11 + .../codeBlock/defaultLanguage.html | 11 + .../blocknoteHTML/codeBlock/empty.html | 11 + .../blocknoteHTML/codeBlock/python.html | 11 + .../blocknoteHTML/complex/misc.html | 59 ++ .../blocknoteHTML/contextParagraph/basic.html | 14 + .../blocknoteHTML/customParagraph/basic.html | 14 + .../customParagraph/lineBreaks.html | 18 + .../blocknoteHTML/customParagraph/nested.html | 40 + .../blocknoteHTML/customParagraph/styled.html | 34 + .../blocknoteHTML/file/basic.html | 28 + .../blocknoteHTML/file/button.html | 20 + .../blocknoteHTML/file/nested.html | 56 ++ .../blocknoteHTML/file/noCaption.html | 26 + .../blocknoteHTML/file/noName.html | 27 + .../blocknoteHTML/fontSize/basic.html | 16 + .../blocknoteHTML/hardbreak/basic.html | 13 + .../hardbreak/between-links.html | 21 + .../blocknoteHTML/hardbreak/end.html | 12 + .../blocknoteHTML/hardbreak/link.html | 21 + .../blocknoteHTML/hardbreak/multiple.html | 15 + .../blocknoteHTML/hardbreak/only.html | 11 + .../blocknoteHTML/hardbreak/start.html | 12 + .../blocknoteHTML/hardbreak/styles.html | 13 + .../blocknoteHTML/image/basic.html | 22 + .../blocknoteHTML/image/button.html | 20 + .../blocknoteHTML/image/nested.html | 42 + .../blocknoteHTML/image/noCaption.html | 20 + .../blocknoteHTML/image/noName.html | 21 + .../blocknoteHTML/image/noPreview.html | 30 + .../blocknoteHTML/link/adjacent.html | 20 + .../blocknoteHTML/link/basic.html | 15 + .../blocknoteHTML/link/styled.html | 22 + .../blocknoteHTML/lists/basic.html | 58 ++ .../blocknoteHTML/lists/nested.html | 62 ++ .../blocknoteHTML/mention/basic.html | 12 + .../blocknoteHTML/pageBreak/basic.html | 9 + .../blocknoteHTML/paragraph/basic.html | 9 + .../blocknoteHTML/paragraph/empty.html | 9 + .../blocknoteHTML/paragraph/lineBreaks.html | 13 + .../blocknoteHTML/paragraph/nested.html | 25 + .../blocknoteHTML/paragraph/styled.html | 32 + .../blocknoteHTML/reactFile/basic.html | 28 + .../blocknoteHTML/reactFile/button.html | 20 + .../blocknoteHTML/reactFile/nested.html | 56 ++ .../blocknoteHTML/reactFile/noCaption.html | 26 + .../blocknoteHTML/reactFile/noName.html | 27 + .../blocknoteHTML/reactImage/basic.html | 22 + .../blocknoteHTML/reactImage/button.html | 20 + .../blocknoteHTML/reactImage/nested.html | 44 + .../blocknoteHTML/reactImage/noCaption.html | 20 + .../blocknoteHTML/reactImage/noName.html | 21 + .../blocknoteHTML/reactImage/noPreview.html | 30 + .../simpleCustomParagraph/basic.html | 14 + .../simpleCustomParagraph/nested.html | 40 + .../simpleCustomParagraph/styled.html | 34 + .../blocknoteHTML/small/basic.html | 11 + .../blocknoteHTML/table/allColWidths.html | 43 + .../blocknoteHTML/table/basic.html | 43 + .../blocknoteHTML/table/headerCols.html | 43 + .../blocknoteHTML/table/headerRows.html | 43 + .../blocknoteHTML/table/mixedCellColors.html | 55 ++ .../blocknoteHTML/table/mixedColWidths.html | 43 + .../table/mixedRowspansAndColspans.html | 46 + .../blocknoteHTML/tag/basic.html | 15 + .../__snapshots__/html/basicBlockTypes.json | 143 +++ .../html/codeBlock/contains-newlines.html | 8 + .../html/codeBlock/defaultLanguage.html | 3 + .../__snapshots__/html/codeBlock/empty.html | 3 + .../__snapshots__/html/codeBlock/python.html | 3 + .../export/__snapshots__/html/codeBlocks.json | 62 ++ .../__snapshots__/html/complex/misc.html | 14 + .../html/contextParagraph/basic.html} | 0 .../html/customParagraph/basic.html} | 0 .../html/customParagraph/lineBreaks.html} | 0 .../html/customParagraph/nested.html | 3 + .../html/customParagraph/styled.html | 6 + .../__snapshots__/html/deepNestedContent.json | 243 ++++++ .../export/__snapshots__/html/divs.json | 121 +++ .../__snapshots__/html/fakeImageCaption.json | 34 + .../export/__snapshots__/html/file/basic.html | 4 + .../__snapshots__/html/file/button.html} | 0 .../__snapshots__/html/file/nested.html | 8 + .../__snapshots__/html/file/noCaption.html} | 0 .../__snapshots__/html/file/noName.html | 4 + .../__snapshots__/html/fontSize/basic.html | 8 + .../export/__snapshots__/html/googleDocs.json | 579 +++++++++++++ .../__snapshots__/html/hardbreak/basic.html | 5 + .../html/hardbreak/between-links.html | 13 + .../__snapshots__/html/hardbreak/end.html | 4 + .../__snapshots__/html/hardbreak/link.html | 13 + .../html/hardbreak/multiple.html | 7 + .../__snapshots__/html/hardbreak/only.html | 3 + .../__snapshots__/html/hardbreak/start.html | 4 + .../__snapshots__/html/hardbreak/styles.html | 5 + .../__snapshots__/html/image/basic.html | 9 + .../__snapshots__/html/image/button.html} | 0 .../__snapshots__/html/image/nested.html | 8 + .../__snapshots__/html/image/noCaption.html | 6 + .../__snapshots__/html/image/noName.html | 4 + .../__snapshots__/html/image/noPreview.html | 10 + .../__snapshots__/html/imageInParagraph.json | 17 + .../html/inlineContentAndNestedBlocks.json | 91 ++ .../__snapshots__/html/link/adjacent.html | 12 + .../export/__snapshots__/html/link/basic.html | 7 + .../__snapshots__/html/link/styled.html | 14 + .../export/__snapshots__/html/lists.json | 177 ++++ .../__snapshots__/html/lists/basic.html | 26 + .../__snapshots__/html/lists/nested.html | 26 + .../__snapshots__/html/mention/basic.html | 4 + .../__snapshots__/html/mixedNestedLists.json | 265 ++++++ .../__snapshots__/html/nestedLists.json | 265 ++++++ .../html/nestedListsWithParagraphs.json | 265 ++++++ .../export/__snapshots__/html/notion.json | 566 ++++++++++++ .../__snapshots__/html/pageBreak/basic.html | 1 + .../__snapshots__/html/paragraph/basic.html | 1 + .../__snapshots__/html/paragraph/empty.html | 1 + .../html/paragraph/lineBreaks.html | 5 + .../__snapshots__/html/paragraph/nested.html | 3 + .../__snapshots__/html/paragraph/styled.html | 12 + .../__snapshots__/html/reactFile/basic.html | 4 + .../__snapshots__/html/reactFile/button.html | 1 + .../__snapshots__/html/reactFile/nested.html | 8 + .../html/reactFile/noCaption.html | 1 + .../__snapshots__/html/reactFile/noName.html | 4 + .../__snapshots__/html/reactImage/basic.html | 9 + .../__snapshots__/html/reactImage/button.html | 1 + .../__snapshots__/html/reactImage/nested.html | 18 + .../html/reactImage/noCaption.html | 6 + .../__snapshots__/html/reactImage/noName.html | 4 + .../html/reactImage/noPreview.html | 10 + .../html/simpleCustomParagraph/basic.html} | 0 .../html/simpleCustomParagraph/nested.html | 3 + .../html/simpleCustomParagraph/styled.html | 14 + .../__snapshots__/html/small/basic.html | 3 + .../html/table/allColWidths.html | 35 + .../__snapshots__/html/table/basic.html | 35 + .../__snapshots__/html/table/headerCols.html | 35 + .../__snapshots__/html/table/headerRows.html | 35 + .../html/table/mixedCellColors.html | 47 + .../html/table/mixedColWidths.html | 35 + .../html/table/mixedRowspansAndColspans.html | 38 + .../export/__snapshots__/html/tag/basic.html | 7 + .../export/__snapshots__/html/twoDivs.json | 36 + .../export/__snapshots__/html/twoTables.json | 136 +++ .../export/__snapshots__/markdown/basic.json | 71 ++ .../markdown/boldWithWhitespace.json | 19 + .../markdown/codeBlock/contains-newlines.md | 4 + .../markdown/codeBlock/defaultLanguage.md | 3 + .../__snapshots__/markdown/codeBlock/empty.md | 2 + .../markdown/codeBlock/python.md | 3 + .../__snapshots__/markdown/complex.json | 353 ++++++++ .../__snapshots__/markdown/complex/misc.md | 5 + .../__snapshots__/markdown/file/basic.md | 3 + .../__snapshots__/markdown/file/button.md | 1 + .../__snapshots__/markdown/file/nested.md | 7 + .../__snapshots__/markdown/file/noCaption.md | 1 + .../__snapshots__/markdown/file/noName.md | 3 + .../__snapshots__/markdown/hardbreak/basic.md | 2 + .../markdown/hardbreak/between-links.md | 2 + .../__snapshots__/markdown/hardbreak/end.md | 1 + .../__snapshots__/markdown/hardbreak/link.md | 2 + .../markdown/hardbreak/multiple.md | 3 + .../__snapshots__/markdown/hardbreak/only.md | 0 .../__snapshots__/markdown/hardbreak/start.md | 1 + .../markdown/hardbreak/styles.md | 2 + .../__snapshots__/markdown/image/basic.md | 3 + .../__snapshots__/markdown/image/button.md | 1 + .../__snapshots__/markdown/image/nested.md | 7 + .../__snapshots__/markdown/image/noCaption.md | 1 + .../__snapshots__/markdown/image/noName.md | 3 + .../__snapshots__/markdown/image/noPreview.md | 3 + .../__snapshots__/markdown/issue226case1.json | 71 ++ .../__snapshots__/markdown/issue226case2.json | 144 ++++ .../__snapshots__/markdown/link/adjacent.md | 1 + .../__snapshots__/markdown/link/basic.md | 1 + .../__snapshots__/markdown/link/styled.md | 1 + .../__snapshots__/markdown/lists/basic.md | 10 + .../__snapshots__/markdown/lists/nested.md | 10 + .../export/__snapshots__/markdown/nested.json | 72 ++ .../__snapshots__/markdown/pageBreak/basic.md | 0 .../__snapshots__/markdown/paragraph/basic.md | 1 + .../__snapshots__/markdown/paragraph/empty.md | 0 .../markdown/paragraph/lineBreaks.md | 2 + .../markdown/paragraph/nested.md | 5 + .../markdown/paragraph/styled.md | 1 + .../export/__snapshots__/markdown/styled.json | 58 ++ .../markdown/table/allColWidths.md | 5 + .../__snapshots__/markdown/table/basic.md | 5 + .../markdown/table/headerCols.md | 4 + .../markdown/table/headerRows.md | 4 + .../markdown/table/mixedCellColors.md | 5 + .../markdown/table/mixedColWidths.md | 5 + .../table/mixedRowspansAndColspans.md | 5 + .../nodes/codeBlock/contains-newlines.json | 26 + .../nodes/codeBlock/defaultLanguage.json | 24 + .../__snapshots__/nodes/codeBlock/empty.json | 18 + .../__snapshots__/nodes/codeBlock/python.json | 24 + .../__snapshots__/nodes/complex/misc.json | 88 ++ .../__snapshots__/nodes/file/basic.json | 20 + .../__snapshots__/nodes/file/button.json | 20 + .../__snapshots__/nodes/file/nested.json | 43 + .../__snapshots__/nodes/file/noCaption.json | 20 + .../__snapshots__/nodes/file/noName.json | 20 + .../__snapshots__/nodes/hardbreak/basic.json | 31 + .../nodes/hardbreak/between-links.json | 53 ++ .../__snapshots__/nodes/hardbreak/end.json | 27 + .../__snapshots__/nodes/hardbreak/link.json | 53 ++ .../nodes/hardbreak/multiple.json | 38 + .../__snapshots__/nodes/hardbreak/only.json | 23 + .../__snapshots__/nodes/hardbreak/start.json | 27 + .../__snapshots__/nodes/hardbreak/styles.json | 36 + .../__snapshots__/nodes/image/basic.json | 23 + .../__snapshots__/nodes/image/button.json | 23 + .../__snapshots__/nodes/image/nested.json | 49 ++ .../__snapshots__/nodes/image/noCaption.json | 23 + .../__snapshots__/nodes/image/noName.json | 23 + .../__snapshots__/nodes/image/noPreview.json | 23 + .../__snapshots__/nodes/link/adjacent.json | 50 ++ .../__snapshots__/nodes/link/basic.json | 35 + .../__snapshots__/nodes/link/styled.json | 53 ++ .../__snapshots__/nodes/lists/basic.json | 140 +++ .../__snapshots__/nodes/lists/nested.json | 150 ++++ .../__snapshots__/nodes/pageBreak/basic.json | 15 + .../__snapshots__/nodes/paragraph/basic.json | 24 + .../__snapshots__/nodes/paragraph/empty.json | 18 + .../nodes/paragraph/lineBreaks.json | 31 + .../__snapshots__/nodes/paragraph/nested.json | 73 ++ .../__snapshots__/nodes/paragraph/styled.json | 66 ++ .../nodes/table/allColWidths.json | 248 ++++++ .../__snapshots__/nodes/table/basic.json | 230 +++++ .../__snapshots__/nodes/table/headerCols.json | 230 +++++ .../__snapshots__/nodes/table/headerRows.json | 230 +++++ .../nodes/table/mixedCellColors.json | 242 ++++++ .../nodes/table/mixedColWidths.json | 242 ++++++ .../nodes/table/mixedRowspansAndColspans.json | 178 ++++ .../export/getExportTestCases.ts | 428 +++++++++ .../export/testExport.test.ts | 19 + .../getExportParseEqualityTestCases.ts | 25 + .../testExportParseEquality.test.ts | 19 + packages/react/src/tests/setupTestEditor.tsx | 66 ++ packages/react/src/tests/testSchema.tsx | 156 ++++ 302 files changed, 10203 insertions(+), 1829 deletions(-) delete mode 100644 packages/react/src/test/__snapshots__/fontSize/basic/external.html delete mode 100644 packages/react/src/test/__snapshots__/fontSize/basic/internal.html delete mode 100644 packages/react/src/test/__snapshots__/mention/basic/external.html delete mode 100644 packages/react/src/test/__snapshots__/mention/basic/internal.html delete mode 100644 packages/react/src/test/__snapshots__/nodeConversion.test.tsx.snap delete mode 100644 packages/react/src/test/__snapshots__/reactContextParagraph/basic/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactCustomParagraph/basic/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactCustomParagraph/lineBreaks/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactCustomParagraph/nested/external.html delete mode 100644 packages/react/src/test/__snapshots__/reactCustomParagraph/nested/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactCustomParagraph/styled/external.html delete mode 100644 packages/react/src/test/__snapshots__/reactCustomParagraph/styled/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactFile/basic/external.html delete mode 100644 packages/react/src/test/__snapshots__/reactFile/basic/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactFile/button/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactFile/nested/external.html delete mode 100644 packages/react/src/test/__snapshots__/reactFile/nested/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactFile/noCaption/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactFile/noName/external.html delete mode 100644 packages/react/src/test/__snapshots__/reactFile/noName/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactImage/basic/external.html delete mode 100644 packages/react/src/test/__snapshots__/reactImage/basic/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactImage/button/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactImage/nested/external.html delete mode 100644 packages/react/src/test/__snapshots__/reactImage/nested/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactImage/noCaption/external.html delete mode 100644 packages/react/src/test/__snapshots__/reactImage/noCaption/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactImage/noName/external.html delete mode 100644 packages/react/src/test/__snapshots__/reactImage/noName/internal.html delete mode 100644 packages/react/src/test/__snapshots__/reactImage/noPreview/external.html delete mode 100644 packages/react/src/test/__snapshots__/reactImage/noPreview/internal.html delete mode 100644 packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/internal.html delete mode 100644 packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/external.html delete mode 100644 packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/internal.html delete mode 100644 packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/external.html delete mode 100644 packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/internal.html delete mode 100644 packages/react/src/test/__snapshots__/small/basic/external.html delete mode 100644 packages/react/src/test/__snapshots__/small/basic/internal.html delete mode 100644 packages/react/src/test/__snapshots__/tag/basic/external.html delete mode 100644 packages/react/src/test/__snapshots__/tag/basic/internal.html delete mode 100644 packages/react/src/test/htmlConversion.test.tsx delete mode 100644 packages/react/src/test/nodeConversion.test.tsx delete mode 100644 packages/react/src/test/testCases/customReactBlocks.tsx delete mode 100644 packages/react/src/test/testCases/customReactInlineContent.tsx delete mode 100644 packages/react/src/test/testCases/customReactStyles.tsx create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/contextParagraph/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/lineBreaks.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/styled.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/fontSize/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/mention/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/button.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noCaption.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noName.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/button.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noCaption.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noName.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noPreview.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/styled.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/small/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/tag/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/basicBlockTypes.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlocks.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/complex/misc.html rename packages/react/src/{test/__snapshots__/reactContextParagraph/basic/external.html => tests/formatConversion/export/__snapshots__/html/contextParagraph/basic.html} (100%) rename packages/react/src/{test/__snapshots__/reactCustomParagraph/basic/external.html => tests/formatConversion/export/__snapshots__/html/customParagraph/basic.html} (100%) rename packages/react/src/{test/__snapshots__/reactCustomParagraph/lineBreaks/external.html => tests/formatConversion/export/__snapshots__/html/customParagraph/lineBreaks.html} (100%) create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/styled.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/deepNestedContent.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/divs.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/fakeImageCaption.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/file/basic.html rename packages/react/src/{test/__snapshots__/reactFile/button/external.html => tests/formatConversion/export/__snapshots__/html/file/button.html} (100%) create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/file/nested.html rename packages/react/src/{test/__snapshots__/reactFile/noCaption/external.html => tests/formatConversion/export/__snapshots__/html/file/noCaption.html} (100%) create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/file/noName.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/fontSize/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/googleDocs.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/image/basic.html rename packages/react/src/{test/__snapshots__/reactImage/button/external.html => tests/formatConversion/export/__snapshots__/html/image/button.html} (100%) create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/image/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noCaption.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noName.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noPreview.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/imageInParagraph.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/inlineContentAndNestedBlocks.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/link/adjacent.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/link/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/link/styled.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/lists.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/mention/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/mixedNestedLists.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedLists.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedListsWithParagraphs.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/notion.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/empty.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/button.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noCaption.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noName.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/button.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noCaption.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noName.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noPreview.html rename packages/react/src/{test/__snapshots__/simpleReactCustomParagraph/basic/external.html => tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/basic.html} (100%) create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/nested.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/styled.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/small/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/table/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerCols.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerRows.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/tag/basic.html create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/twoDivs.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/html/twoTables.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/basic.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/boldWithWhitespace.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/basic.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/button.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/nested.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noName.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/only.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/basic.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/button.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/nested.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noName.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case1.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case2.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/basic.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/styled.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/nested.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/empty.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/styled.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/basic.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/basic.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/button.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/nested.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noName.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/basic.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/button.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/nested.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noName.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/basic.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/styled.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/basic.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json create mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json create mode 100644 packages/react/src/tests/formatConversion/export/getExportTestCases.ts create mode 100644 packages/react/src/tests/formatConversion/export/testExport.test.ts create mode 100644 packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts create mode 100644 packages/react/src/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts create mode 100644 packages/react/src/tests/setupTestEditor.tsx create mode 100644 packages/react/src/tests/testSchema.tsx diff --git a/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts b/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts index 26bc09f0bd..f9b2b1dedc 100644 --- a/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts +++ b/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts @@ -3,6 +3,11 @@ import { NodeSelection, Selection, TextSelection } from "@tiptap/pm/state"; import { CellSelection } from "@tiptap/pm/tables"; import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { TestBlockSchema, TestInlineContentSchema, @@ -13,21 +18,25 @@ import { getPosOfTextNode, } from "../clipboardTestUtil.js"; -export type CopyTestCase = { +export type CopyTestCase< + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = { name: string; // At some point we probably want to only have one HTML format that is both // lossless when converting to/from blocks, in which case we will only need // "html" test cases and can remove "blockNoteHTML". clipboardDataType: "blocknote/html" | "text/html" | "text/plain"; - document: PartialBlock< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >[]; + document: PartialBlock[]; getCopySelection: (pmDoc: Node) => Selection; }; -export const getCopyTestCases = (): CopyTestCase[] => [ +export const getCopyTestCases = (): CopyTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => [ { name: "multipleChildren", clipboardDataType: "text/html", diff --git a/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts b/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts index 156580721e..d58355d199 100644 --- a/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts +++ b/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts @@ -2,26 +2,27 @@ import { prettify } from "htmlfy"; import { describe, expect, it } from "vitest"; import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { UnreachableCaseError } from "../../../../util/typescript.js"; import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; import { setupTestEditor } from "../../setupTestEditor.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; +import { testSchema } from "../../testSchema.js"; import { CopyTestCase, getCopyTestCases } from "./getCopyTestCases.js"; // Test for verifying content that gets put on the clipboard when copying within // the editor. Used broadly to ensure each block or set of blocks is correctly // converted into different types of clipboard data. -const testCopyTest = async ( - editor: BlockNoteEditor< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >, - testCase: CopyTestCase +export const testCopy = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: CopyTestCase ) => { (window as any).__TEST_OPTIONS.mockID = 0; editor.replaceBlocks(editor.document, testCase.document); @@ -63,11 +64,11 @@ const testCopyTest = async ( }; describe("Copy tests", () => { - const getEditor = setupTestEditor(); + const getEditor = setupTestEditor(testSchema); for (const testCase of getCopyTestCases()) { it(`${testCase.name}`, async () => { - await testCopyTest(getEditor(), testCase); + await testCopy(getEditor(), testCase); }); } }); diff --git a/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts b/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts index 736696d213..b5b9f73b16 100644 --- a/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts +++ b/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts @@ -2,6 +2,11 @@ import { Node } from "@tiptap/pm/model"; import { Selection, TextSelection } from "@tiptap/pm/state"; import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { TestBlockSchema, TestInlineContentSchema, @@ -9,18 +14,22 @@ import { } from "../../testSchema.js"; import { getPosOfTextNode } from "../clipboardTestUtil.js"; -export type CopyPasteTestCase = { +export type CopyPasteTestCase< + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = { name: string; - document: PartialBlock< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >[]; + document: PartialBlock[]; getCopySelection: (pmDoc: Node) => Selection; getPasteSelection: (pmDoc: Node) => Selection; }; -export const getCopyPasteTestCases = (): CopyPasteTestCase[] => [ +export const getCopyPasteTestCases = (): CopyPasteTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => [ { name: "paragraphInCustomBlock", document: [ diff --git a/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts b/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts index 164b58d459..3d63c718a3 100644 --- a/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts +++ b/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts @@ -1,13 +1,14 @@ import { describe, expect, it } from "vitest"; import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; import { setupTestEditor } from "../../setupTestEditor.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; +import { testSchema } from "../../testSchema.js"; import { doPaste } from "../clipboardTestUtil.js"; import { CopyPasteTestCase, @@ -16,13 +17,13 @@ import { // Test for verifying that copying and pasting content within the editor works // as expected. Used for specific cases where unexpected behaviour was noticed. -const testCopyPasteTest = async ( - editor: BlockNoteEditor< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >, - testCase: CopyPasteTestCase +export const testCopyPaste = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: CopyPasteTestCase ) => { (window as any).__TEST_OPTIONS.mockID = 0; editor.replaceBlocks(editor.document, testCase.document); @@ -62,11 +63,11 @@ const testCopyPasteTest = async ( }; describe("Copy/paste tests", () => { - const getEditor = setupTestEditor(); + const getEditor = setupTestEditor(testSchema); for (const testCase of getCopyPasteTestCases()) { it(`${testCase.name}`, async () => { - await testCopyPasteTest(getEditor(), testCase); + await testCopyPaste(getEditor(), testCase); }); } }); diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.ts b/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.ts index 5f564c9d06..742a793e39 100644 --- a/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.ts +++ b/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.ts @@ -2,6 +2,11 @@ import { Node } from "@tiptap/pm/model"; import { Selection } from "@tiptap/pm/state"; import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { TestBlockSchema, TestInlineContentSchema, @@ -9,17 +14,21 @@ import { } from "../../testSchema.js"; import { getCopyTestCases } from "../copy/getCopyTestCases.js"; -export type CopyPasteEqualityTestCase = { +export type CopyPasteEqualityTestCase< + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = { name: string; - document: PartialBlock< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >[]; + document: PartialBlock[]; getCopyAndPasteSelection: (pmDoc: Node) => Selection; }; -export const getCopyPasteEqualityTestCases = (): CopyPasteEqualityTestCase[] => +export const getCopyPasteEqualityTestCases = (): CopyPasteEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => getCopyTestCases().map(({ name, document, getCopySelection }) => ({ name, document, diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts b/packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts index ff3af2e179..763b54c644 100644 --- a/packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts +++ b/packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts @@ -1,13 +1,14 @@ import { describe, expect, it } from "vitest"; import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; import { setupTestEditor } from "../../setupTestEditor.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; +import { testSchema } from "../../testSchema.js"; import { CopyPasteEqualityTestCase, getCopyPasteEqualityTestCases, @@ -17,13 +18,13 @@ import { doPaste } from "../clipboardTestUtil.js"; // Test for verifying that copying and pasting content in place within the // editor results in the same document as the original. Used broadly to ensure // that converting to and from clipboard data does not result in any data loss. -const testCopyPasteEqualityTest = ( - editor: BlockNoteEditor< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >, - testCase: CopyPasteEqualityTestCase +export const testCopyPasteEquality = < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: CopyPasteEqualityTestCase ) => { (window as any).__TEST_OPTIONS.mockID = 0; editor.replaceBlocks(editor.document, testCase.document); @@ -57,11 +58,11 @@ const testCopyPasteEqualityTest = ( }; describe("Copy/paste equality tests", () => { - const getEditor = setupTestEditor(); + const getEditor = setupTestEditor(testSchema); for (const testCase of getCopyPasteEqualityTestCases()) { it(`${testCase.name}`, async () => { - testCopyPasteEqualityTest(getEditor(), testCase); + testCopyPasteEquality(getEditor(), testCase); }); } }); diff --git a/packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts b/packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts index 6379926036..1ab365a829 100644 --- a/packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts +++ b/packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts @@ -2,6 +2,11 @@ import { Node } from "@tiptap/pm/model"; import { Selection, TextSelection } from "@tiptap/pm/state"; import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { TestBlockSchema, TestInlineContentSchema, @@ -9,19 +14,23 @@ import { } from "../../testSchema.js"; import { getPosOfTextNode } from "../clipboardTestUtil.js"; -export type PasteTestCase = { +export type PasteTestCase< + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = { name: string; clipboardDataType: "text/html" | "text/markdown" | "text/plain"; content: string; - document: PartialBlock< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >[]; + document: PartialBlock[]; getPasteSelection: (pmDoc: Node) => Selection; }; -export const getPasteTestCases = (): PasteTestCase[] => [ +export const getPasteTestCases = (): PasteTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => [ { name: "pasteEndOfParagraph", clipboardDataType: "text/html", diff --git a/packages/core/src/api/tests/clipboard/paste/testPaste.test.ts b/packages/core/src/api/tests/clipboard/paste/testPaste.test.ts index ff712fd872..a79dd62a46 100644 --- a/packages/core/src/api/tests/clipboard/paste/testPaste.test.ts +++ b/packages/core/src/api/tests/clipboard/paste/testPaste.test.ts @@ -1,12 +1,13 @@ import { describe, expect, it } from "vitest"; import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; -import { setupTestEditor } from "../../setupTestEditor.js"; import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; import { doPaste } from "../clipboardTestUtil.js"; import { getPasteTestCases, PasteTestCase } from "./getPasteTestCases.js"; @@ -14,13 +15,13 @@ import { getPasteTestCases, PasteTestCase } from "./getPasteTestCases.js"; // Used for specific cases for when content from outside the editor is pasted // into it. This includes content from other editors, as well as content from // the web that has produced bugs in the past. -const testPasteTest = async ( - editor: BlockNoteEditor< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >, - testCase: PasteTestCase +export const testPaste = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: PasteTestCase ) => { (window as any).__TEST_OPTIONS.mockID = 0; editor.replaceBlocks(editor.document, testCase.document); @@ -49,11 +50,11 @@ const testPasteTest = async ( }; describe("Paste tests", () => { - const getEditor = setupTestEditor(); + const getEditor = setupTestEditor(testSchema); for (const testCase of getPasteTestCases()) { it(`${testCase.name}`, async () => { - await testPasteTest(getEditor(), testCase); + await testPaste(getEditor(), testCase); }); } }); diff --git a/packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts b/packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts index c3267c2c56..fc9c12e1f3 100644 --- a/packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts +++ b/packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts @@ -1,4 +1,9 @@ import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { TestBlockSchema, TestInlineContentSchema, @@ -6,25 +11,26 @@ import { } from "../../testSchema.js"; export type ExportTestCase< - // At some point we probably want to only have one HTML format that is both - // lossless when converting to/from conversionType, content, in which case we will only need - // "html" test cases and can remove "blockNoteHTML". - ConversionType extends "blocknoteHTML" | "html" | "markdown" | "nodes" + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema > = { name: string; - conversionType: ConversionType; - content: PartialBlock< + conversionType: "blocknoteHTML" | "html" | "markdown" | "nodes"; + content: PartialBlock[]; +}; + +export const getExportTestCases = ( + conversionType: ExportTestCase< TestBlockSchema, TestInlineContentSchema, TestStyleSchema - >[]; -}; - -export const getExportTestCases = < - ConversionType extends "blocknoteHTML" | "html" | "markdown" | "nodes" ->( - conversionType: ConversionType -): ExportTestCase[] => [ + >["conversionType"] +): ExportTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => [ { name: "paragraph/empty", conversionType, diff --git a/packages/core/src/api/tests/formatConversion/export/testExport.test.ts b/packages/core/src/api/tests/formatConversion/export/testExport.test.ts index 4e41c535a4..22e1ceadb5 100644 --- a/packages/core/src/api/tests/formatConversion/export/testExport.test.ts +++ b/packages/core/src/api/tests/formatConversion/export/testExport.test.ts @@ -2,29 +2,28 @@ import { prettify } from "htmlfy"; import { describe, expect, it } from "vitest"; import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { UnreachableCaseError } from "../../../../util/typescript.js"; import { blockToNode } from "../../../nodeConversions/blockToNode.js"; import { setupTestEditor } from "../../setupTestEditor.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; +import { testSchema } from "../../testSchema.js"; import { addIdsToBlocks } from "../formatConversionTestUtil.js"; import { ExportTestCase, getExportTestCases } from "./getExportTestCases.js"; // Test for verifying that exporting blocks to other formats works as expected. // Used broadly to ensure each block or set of blocks is correctly converted // into different formats. -const testExportTest = async < - ConversionType extends "blocknoteHTML" | "html" | "markdown" | "nodes" +export const testExport = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema >( - editor: BlockNoteEditor< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >, - testCase: ExportTestCase + editor: BlockNoteEditor, + testCase: ExportTestCase ) => { (window as any).__TEST_OPTIONS.mockID = 0; @@ -66,7 +65,7 @@ const testExportTest = async < }; describe("Export tests", () => { - const getEditor = setupTestEditor(); + const getEditor = setupTestEditor(testSchema); for (const testCase of [ ...getExportTestCases("blocknoteHTML"), @@ -75,7 +74,7 @@ describe("Export tests", () => { ...getExportTestCases("nodes"), ]) { it(`${testCase.name}`, async () => { - await testExportTest(getEditor(), testCase); + await testExport(getEditor(), testCase); }); } }); diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts index 89596a8a9a..5252080053 100644 --- a/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts +++ b/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts @@ -1,4 +1,9 @@ import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { TestBlockSchema, TestInlineContentSchema, @@ -6,22 +11,30 @@ import { } from "../../testSchema.js"; import { getExportTestCases } from "../export/getExportTestCases.js"; -export type ExportParseEqualityTestCase = { +export type ExportParseEqualityTestCase< + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = { name: string; // At some point we probably want to only have one HTML format that is both // lossless when converting to/from blocks, in which case we will only need // "html" test cases and can remove "blockNoteHTML". conversionType: "blocknoteHTML" | "nodes"; - content: PartialBlock< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >[]; + content: PartialBlock[]; }; export const getExportParseEqualityTestCases = ( - conversionType: ExportParseEqualityTestCase["conversionType"] -): ExportParseEqualityTestCase[] => + conversionType: ExportParseEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >["conversionType"] +): ExportParseEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => getExportTestCases(conversionType).map(({ name, content }) => ({ name, conversionType, diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts index 604a8e7887..4f421cc849 100644 --- a/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts +++ b/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts @@ -1,15 +1,16 @@ import { describe, expect, it } from "vitest"; import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { UnreachableCaseError } from "../../../../util/typescript.js"; import { blockToNode } from "../../../nodeConversions/blockToNode.js"; import { nodeToBlock } from "../../../nodeConversions/nodeToBlock.js"; import { setupTestEditor } from "../../setupTestEditor.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; +import { testSchema } from "../../testSchema.js"; import { addIdsToBlocks, partialBlocksToBlocksForTesting, @@ -22,13 +23,13 @@ import { // Test for verifying that exporting blocks to another format, then importing // them back results in the same blocks as the original. Used broadly to ensure // that exporting and importing blocks does not result in any data loss. -const testExportParseEqualityTest = async ( - editor: BlockNoteEditor< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >, - testCase: ExportParseEqualityTestCase +export const testExportParseEquality = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: ExportParseEqualityTestCase ) => { (window as any).__TEST_OPTIONS.mockID = 0; @@ -63,14 +64,14 @@ const testExportParseEqualityTest = async ( }; describe("Export/parse equality tests", () => { - const getEditor = setupTestEditor(); + const getEditor = setupTestEditor(testSchema); for (const testCase of [ ...getExportParseEqualityTestCases("blocknoteHTML"), ...getExportParseEqualityTestCases("nodes"), ]) { it(`${testCase.name}`, async () => { - await testExportParseEqualityTest(getEditor(), testCase); + await testExportParseEquality(getEditor(), testCase); }); } }); diff --git a/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts b/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts index 2b43fae39d..d854a146a5 100644 --- a/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts +++ b/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts @@ -1,25 +1,26 @@ import { describe, expect, it } from "vitest"; import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; import { UnreachableCaseError } from "../../../../util/typescript.js"; import { setupTestEditor } from "../../setupTestEditor.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; +import { testSchema } from "../../testSchema.js"; import { getParseTestCases, ParseTestCase } from "./getParseTestCases.js"; // Test for verifying that importing blocks from other formats works as // expected. Used for specific cases for when content from outside the editor is // imported as blocks. This includes content from other editors, as well as // content from the web that has produced bugs in the past. -const testParseTest = async ( - editor: BlockNoteEditor< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >, +export const testParse = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, testCase: ParseTestCase ) => { (window as any).__TEST_OPTIONS.mockID = 0; @@ -41,11 +42,11 @@ const testParseTest = async ( }; describe("Export tests", () => { - const getEditor = setupTestEditor(); + const getEditor = setupTestEditor(testSchema); for (const testCase of getParseTestCases()) { it(`${testCase.name}`, async () => { - await testParseTest(getEditor(), testCase); + await testParse(getEditor(), testCase); }); } }); diff --git a/packages/core/src/api/tests/setupTestEditor.ts b/packages/core/src/api/tests/setupTestEditor.ts index 54fdfe8801..24a5ad8988 100644 --- a/packages/core/src/api/tests/setupTestEditor.ts +++ b/packages/core/src/api/tests/setupTestEditor.ts @@ -2,20 +2,22 @@ import { afterAll, beforeAll } from "vitest"; import { uploadToTmpFilesDotOrg_DEV_ONLY } from "../../blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js"; import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js"; -import { initializeESMDependencies } from "../../util/esmDependencies.js"; +import { BlockNoteSchema } from "../../editor/BlockNoteSchema.js"; import { - TestBlockSchema, - TestInlineContentSchema, - testSchema, - TestStyleSchema, -} from "./testSchema.js"; - -export const setupTestEditor = () => { - let editor: BlockNoteEditor< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >; + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../schema/index.js"; +import { initializeESMDependencies } from "../../util/esmDependencies.js"; + +export const setupTestEditor = < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + schema: BlockNoteSchema +): (() => BlockNoteEditor) => { + let editor: BlockNoteEditor; const div = document.createElement("div"); beforeAll(async () => { @@ -34,7 +36,7 @@ export const setupTestEditor = () => { }, }, }, - schema: testSchema, + schema, trailingBlock: false, uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY, }); diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index e0771b03df..5424d53064 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -58,10 +58,29 @@ export * from "./util/typescript.js"; export type { CodeBlockOptions } from "./blocks/CodeBlockContent/CodeBlockContent.js"; export { UnreachableCaseError, assertEmpty } from "./util/typescript.js"; -// for testing from react (TODO: move): +// Unit testing +export { setupTestEditor } from "./api/tests/setupTestEditor.js"; +export { testSchema } from "./api/tests/testSchema.js"; +export * from "./api/tests/clipboard/clipboardTestUtil.js"; +export type { CopyTestCase } from "./api/tests/clipboard/copy/getCopyTestCases.js"; +export { testCopy } from "./api/tests/clipboard/copy/testCopy.test.js"; +export type { CopyPasteTestCase } from "./api/tests/clipboard/copyPaste/getCopyPasteTestCases.js"; +export { testCopyPaste } from "./api/tests/clipboard/copyPaste/testCopyPaste.test.js"; +export type { CopyPasteEqualityTestCase } from "./api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.js"; +export { testCopyPasteEquality } from "./api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.js"; +export type { PasteTestCase } from "./api/tests/clipboard/paste/getPasteTestCases.js"; +export { testPaste } from "./api/tests/clipboard/paste/testPaste.test.js"; +export * from "./api/tests/formatConversion/formatConversionTestUtil.js"; +export type { ExportTestCase } from "./api/tests/formatConversion/export/getExportTestCases.js"; +export { testExport } from "./api/tests/formatConversion/export/testExport.test.js"; +export type { ExportParseEqualityTestCase } from "./api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.js"; +export { testExportParseEquality } from "./api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.js"; +export type { ParseTestCase } from "./api/tests/formatConversion/parse/getParseTestCases.js"; +export { testParse } from "./api/tests/formatConversion/parse/testParse.test.js"; + +// Node conversions export * from "./api/nodeConversions/blockToNode.js"; export * from "./api/nodeConversions/nodeToBlock.js"; -export * from "./api/tests/formatConversion/formatConversionTestUtil.js"; export * from "./extensions/UniqueID/UniqueID.js"; // for server-util (TODO: maybe move): diff --git a/packages/react/src/test/__snapshots__/fontSize/basic/external.html b/packages/react/src/test/__snapshots__/fontSize/basic/external.html deleted file mode 100644 index f10ad63bc8..0000000000 --- a/packages/react/src/test/__snapshots__/fontSize/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -

This is text with a custom fontSize

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/fontSize/basic/internal.html b/packages/react/src/test/__snapshots__/fontSize/basic/internal.html deleted file mode 100644 index 4b0f00259b..0000000000 --- a/packages/react/src/test/__snapshots__/fontSize/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

This is text with a custom fontSize

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/mention/basic/external.html b/packages/react/src/test/__snapshots__/mention/basic/external.html deleted file mode 100644 index 967b6d2fd7..0000000000 --- a/packages/react/src/test/__snapshots__/mention/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -

I enjoy working with @Matthew

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/mention/basic/internal.html b/packages/react/src/test/__snapshots__/mention/basic/internal.html deleted file mode 100644 index b429a68a6f..0000000000 --- a/packages/react/src/test/__snapshots__/mention/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

I enjoy working with @Matthew

diff --git a/packages/react/src/test/__snapshots__/nodeConversion.test.tsx.snap b/packages/react/src/test/__snapshots__/nodeConversion.test.tsx.snap deleted file mode 100644 index a550b082c5..0000000000 --- a/packages/react/src/test/__snapshots__/nodeConversion.test.tsx.snap +++ /dev/null @@ -1,816 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactContextParagraph/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "React Context Paragraph", - "type": "text", - }, - ], - "type": "reactContextParagraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactCustomParagraph/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "React Custom Paragraph", - "type": "text", - }, - ], - "type": "reactCustomParagraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactCustomParagraph/lineBreaks to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Line 1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "text": "Line 2", - "type": "text", - }, - ], - "type": "reactCustomParagraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactCustomParagraph/nested to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "React Custom Paragraph", - "type": "text", - }, - ], - "type": "reactCustomParagraph", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested React Custom Paragraph 1", - "type": "text", - }, - ], - "type": "reactCustomParagraph", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "3", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested React Custom Paragraph 2", - "type": "text", - }, - ], - "type": "reactCustomParagraph", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactCustomParagraph/styled to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "pink", - "id": "1", - "textColor": "orange", - }, - "content": [ - { - "attrs": { - "textAlignment": "center", - }, - "content": [ - { - "text": "Plain ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - ], - "text": "Red Text ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Blue Background ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Mixed Colors", - "type": "text", - }, - ], - "type": "reactCustomParagraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactFile/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactFile/button to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "", - "url": "", - }, - "type": "file", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactFile/nested to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactFile/noCaption to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactFile/noName to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactImage/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactImage/button to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "", - "previewWidth": 512, - "showPreview": true, - "textAlignment": "left", - "url": "", - }, - "type": "image", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactImage/nested to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactImage/noCaption to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactImage/noName to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert reactImage/noPreview to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": false, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert simpleReactCustomParagraph/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "React Custom Paragraph", - "type": "text", - }, - ], - "type": "simpleReactCustomParagraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert simpleReactCustomParagraph/nested to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Custom React Paragraph", - "type": "text", - }, - ], - "type": "simpleReactCustomParagraph", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested React Custom Paragraph 1", - "type": "text", - }, - ], - "type": "simpleReactCustomParagraph", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "3", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested React Custom Paragraph 2", - "type": "text", - }, - ], - "type": "simpleReactCustomParagraph", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react block schema > Convert simpleReactCustomParagraph/styled to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "pink", - "id": "1", - "textColor": "orange", - }, - "content": [ - { - "attrs": { - "textAlignment": "center", - }, - "content": [ - { - "text": "Plain ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - ], - "text": "Red Text ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Blue Background ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Mixed Colors", - "type": "text", - }, - ], - "type": "simpleReactCustomParagraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react inline content schema > Convert mention/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "I enjoy working with ", - "type": "text", - }, - { - "attrs": { - "user": "Matthew", - }, - "type": "mention", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react inline content schema > Convert tag/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "I love ", - "type": "text", - }, - { - "content": [ - { - "text": "BlockNote", - "type": "text", - }, - ], - "type": "tag", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react style schema > Convert fontSize/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "attrs": { - "stringValue": "18px", - }, - "type": "fontSize", - }, - ], - "text": "This is text with a custom fontSize", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; - -exports[`Test React BlockNote-Prosemirror conversion > Case: custom react style schema > Convert small/basic to/from prosemirror 1`] = ` -{ - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "type": "small", - }, - ], - "text": "This is a small text", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", -} -`; diff --git a/packages/react/src/test/__snapshots__/reactContextParagraph/basic/internal.html b/packages/react/src/test/__snapshots__/reactContextParagraph/basic/internal.html deleted file mode 100644 index 91fe557415..0000000000 --- a/packages/react/src/test/__snapshots__/reactContextParagraph/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -
React Context Paragraph
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactCustomParagraph/basic/internal.html b/packages/react/src/test/__snapshots__/reactCustomParagraph/basic/internal.html deleted file mode 100644 index c9e89afa27..0000000000 --- a/packages/react/src/test/__snapshots__/reactCustomParagraph/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

React Custom Paragraph

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactCustomParagraph/lineBreaks/internal.html b/packages/react/src/test/__snapshots__/reactCustomParagraph/lineBreaks/internal.html deleted file mode 100644 index c824a4f200..0000000000 --- a/packages/react/src/test/__snapshots__/reactCustomParagraph/lineBreaks/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Line 1
Line 2

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactCustomParagraph/nested/external.html b/packages/react/src/test/__snapshots__/reactCustomParagraph/nested/external.html deleted file mode 100644 index bc678da1a8..0000000000 --- a/packages/react/src/test/__snapshots__/reactCustomParagraph/nested/external.html +++ /dev/null @@ -1 +0,0 @@ -

Hello World

Hello World

Hello World

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactCustomParagraph/nested/internal.html b/packages/react/src/test/__snapshots__/reactCustomParagraph/nested/internal.html deleted file mode 100644 index a1c64daac7..0000000000 --- a/packages/react/src/test/__snapshots__/reactCustomParagraph/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -

React Custom Paragraph

Nested React Custom Paragraph 1

Nested React Custom Paragraph 2

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactCustomParagraph/styled/external.html b/packages/react/src/test/__snapshots__/reactCustomParagraph/styled/external.html deleted file mode 100644 index bf4097c8e1..0000000000 --- a/packages/react/src/test/__snapshots__/reactCustomParagraph/styled/external.html +++ /dev/null @@ -1 +0,0 @@ -

Hello World

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactCustomParagraph/styled/internal.html b/packages/react/src/test/__snapshots__/reactCustomParagraph/styled/internal.html deleted file mode 100644 index eebeaab1cb..0000000000 --- a/packages/react/src/test/__snapshots__/reactCustomParagraph/styled/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactFile/basic/external.html b/packages/react/src/test/__snapshots__/reactFile/basic/external.html deleted file mode 100644 index 2fef8bae04..0000000000 --- a/packages/react/src/test/__snapshots__/reactFile/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -
example

Caption

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactFile/basic/internal.html b/packages/react/src/test/__snapshots__/reactFile/basic/internal.html deleted file mode 100644 index ea52dffd75..0000000000 --- a/packages/react/src/test/__snapshots__/reactFile/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

example

Caption

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactFile/button/internal.html b/packages/react/src/test/__snapshots__/reactFile/button/internal.html deleted file mode 100644 index 907517c5c2..0000000000 --- a/packages/react/src/test/__snapshots__/reactFile/button/internal.html +++ /dev/null @@ -1 +0,0 @@ -
Add file
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactFile/nested/external.html b/packages/react/src/test/__snapshots__/reactFile/nested/external.html deleted file mode 100644 index 76ff9df2a3..0000000000 --- a/packages/react/src/test/__snapshots__/reactFile/nested/external.html +++ /dev/null @@ -1 +0,0 @@ -
example

Caption

example

Caption

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactFile/nested/internal.html b/packages/react/src/test/__snapshots__/reactFile/nested/internal.html deleted file mode 100644 index c387803036..0000000000 --- a/packages/react/src/test/__snapshots__/reactFile/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -

example

Caption

example

Caption

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactFile/noCaption/internal.html b/packages/react/src/test/__snapshots__/reactFile/noCaption/internal.html deleted file mode 100644 index 25dd7ea3ae..0000000000 --- a/packages/react/src/test/__snapshots__/reactFile/noCaption/internal.html +++ /dev/null @@ -1 +0,0 @@ -

example

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactFile/noName/external.html b/packages/react/src/test/__snapshots__/reactFile/noName/external.html deleted file mode 100644 index b29226235b..0000000000 --- a/packages/react/src/test/__snapshots__/reactFile/noName/external.html +++ /dev/null @@ -1 +0,0 @@ -
exampleURL

Caption

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactFile/noName/internal.html b/packages/react/src/test/__snapshots__/reactFile/noName/internal.html deleted file mode 100644 index 05f6bbbb63..0000000000 --- a/packages/react/src/test/__snapshots__/reactFile/noName/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Caption

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/basic/external.html b/packages/react/src/test/__snapshots__/reactImage/basic/external.html deleted file mode 100644 index 9295cf8f38..0000000000 --- a/packages/react/src/test/__snapshots__/reactImage/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -
example
Caption
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/basic/internal.html b/packages/react/src/test/__snapshots__/reactImage/basic/internal.html deleted file mode 100644 index 326340c0c2..0000000000 --- a/packages/react/src/test/__snapshots__/reactImage/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -
Caption

Caption

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/button/internal.html b/packages/react/src/test/__snapshots__/reactImage/button/internal.html deleted file mode 100644 index 9b2a2f447f..0000000000 --- a/packages/react/src/test/__snapshots__/reactImage/button/internal.html +++ /dev/null @@ -1 +0,0 @@ -
Add image
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/nested/external.html b/packages/react/src/test/__snapshots__/reactImage/nested/external.html deleted file mode 100644 index 18ff318b71..0000000000 --- a/packages/react/src/test/__snapshots__/reactImage/nested/external.html +++ /dev/null @@ -1 +0,0 @@ -
example
Caption
example
Caption
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/nested/internal.html b/packages/react/src/test/__snapshots__/reactImage/nested/internal.html deleted file mode 100644 index 0e44c4e14a..0000000000 --- a/packages/react/src/test/__snapshots__/reactImage/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -
Caption

Caption

Caption

Caption

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/noCaption/external.html b/packages/react/src/test/__snapshots__/reactImage/noCaption/external.html deleted file mode 100644 index 22408bfc12..0000000000 --- a/packages/react/src/test/__snapshots__/reactImage/noCaption/external.html +++ /dev/null @@ -1 +0,0 @@ -example \ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/noCaption/internal.html b/packages/react/src/test/__snapshots__/reactImage/noCaption/internal.html deleted file mode 100644 index ea8c668159..0000000000 --- a/packages/react/src/test/__snapshots__/reactImage/noCaption/internal.html +++ /dev/null @@ -1 +0,0 @@ -
BlockNote image
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/noName/external.html b/packages/react/src/test/__snapshots__/reactImage/noName/external.html deleted file mode 100644 index df180bf54e..0000000000 --- a/packages/react/src/test/__snapshots__/reactImage/noName/external.html +++ /dev/null @@ -1 +0,0 @@ -
Caption
Caption
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/noName/internal.html b/packages/react/src/test/__snapshots__/reactImage/noName/internal.html deleted file mode 100644 index e06868f523..0000000000 --- a/packages/react/src/test/__snapshots__/reactImage/noName/internal.html +++ /dev/null @@ -1 +0,0 @@ -
Caption

Caption

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/noPreview/external.html b/packages/react/src/test/__snapshots__/reactImage/noPreview/external.html deleted file mode 100644 index 591a3abb43..0000000000 --- a/packages/react/src/test/__snapshots__/reactImage/noPreview/external.html +++ /dev/null @@ -1 +0,0 @@ -
example

Caption

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/noPreview/internal.html b/packages/react/src/test/__snapshots__/reactImage/noPreview/internal.html deleted file mode 100644 index e465f950ad..0000000000 --- a/packages/react/src/test/__snapshots__/reactImage/noPreview/internal.html +++ /dev/null @@ -1 +0,0 @@ -

example

Caption

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/internal.html b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/internal.html deleted file mode 100644 index 10e606f71a..0000000000 --- a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

React Custom Paragraph

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/external.html b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/external.html deleted file mode 100644 index a8354335ca..0000000000 --- a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/external.html +++ /dev/null @@ -1 +0,0 @@ -

Custom React Paragraph

Nested React Custom Paragraph 1

Nested React Custom Paragraph 2

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/internal.html b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/internal.html deleted file mode 100644 index 17437945b5..0000000000 --- a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Custom React Paragraph

Nested React Custom Paragraph 1

Nested React Custom Paragraph 2

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/external.html b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/external.html deleted file mode 100644 index 9312451d94..0000000000 --- a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/external.html +++ /dev/null @@ -1 +0,0 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/internal.html b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/internal.html deleted file mode 100644 index 4d9598bcca..0000000000 --- a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/internal.html +++ /dev/null @@ -1 +0,0 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/small/basic/external.html b/packages/react/src/test/__snapshots__/small/basic/external.html deleted file mode 100644 index 8bfcd2ed1d..0000000000 --- a/packages/react/src/test/__snapshots__/small/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -

This is a small text

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/small/basic/internal.html b/packages/react/src/test/__snapshots__/small/basic/internal.html deleted file mode 100644 index 2c4b0446df..0000000000 --- a/packages/react/src/test/__snapshots__/small/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

This is a small text

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/tag/basic/external.html b/packages/react/src/test/__snapshots__/tag/basic/external.html deleted file mode 100644 index d6e63c9cec..0000000000 --- a/packages/react/src/test/__snapshots__/tag/basic/external.html +++ /dev/null @@ -1 +0,0 @@ -

I love #BlockNote

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/tag/basic/internal.html b/packages/react/src/test/__snapshots__/tag/basic/internal.html deleted file mode 100644 index dcb80c2f33..0000000000 --- a/packages/react/src/test/__snapshots__/tag/basic/internal.html +++ /dev/null @@ -1 +0,0 @@ -

I love #BlockNote

\ No newline at end of file diff --git a/packages/react/src/test/htmlConversion.test.tsx b/packages/react/src/test/htmlConversion.test.tsx deleted file mode 100644 index 2c3c15633d..0000000000 --- a/packages/react/src/test/htmlConversion.test.tsx +++ /dev/null @@ -1,123 +0,0 @@ -// @vitest-environment jsdom - -import { - BlockNoteEditor, - BlockSchema, - InlineContentSchema, - PartialBlock, - StyleSchema, - addIdsToBlocks, - createExternalHTMLExporter, - createInternalHTMLSerializer, - partialBlocksToBlocksForTesting, -} from "@blocknote/core"; - -import { flushSync } from "react-dom"; -import { Root, createRoot } from "react-dom/client"; -import { afterEach, beforeEach, describe, expect, it } from "vitest"; -import { BlockNoteViewRaw } from "../editor/BlockNoteView.js"; -import { - TestContext, - customReactBlockSchemaTestCases, -} from "./testCases/customReactBlocks.js"; -import { customReactInlineContentTestCases } from "./testCases/customReactInlineContent.js"; -import { customReactStylesTestCases } from "./testCases/customReactStyles.js"; - -// TODO: code same from @blocknote/core, maybe create separate test util package -async function convertToHTMLAndCompareSnapshots< - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - editor: BlockNoteEditor, - blocks: PartialBlock[], - snapshotDirectory: string, - snapshotName: string -) { - addIdsToBlocks(blocks); - const serializer = createInternalHTMLSerializer(editor.pmSchema, editor); - const internalHTML = serializer.serializeBlocks(blocks, {}); - const internalHTMLSnapshotPath = - "./__snapshots__/" + - snapshotDirectory + - "/" + - snapshotName + - "/internal.html"; - await expect(internalHTML).toMatchFileSnapshot(internalHTMLSnapshotPath); - - // turn the internalHTML back into blocks, and make sure no data was lost - const fullBlocks = partialBlocksToBlocksForTesting(editor.schema, blocks); - const parsed = await editor.tryParseHTMLToBlocks(internalHTML); - - expect(parsed).toStrictEqual(fullBlocks); - - // Create the "external" HTML, which is a cleaned up HTML representation, but lossy - const exporter = createExternalHTMLExporter(editor.pmSchema, editor); - const externalHTML = exporter.exportBlocks(blocks, {}); - const externalHTMLSnapshotPath = - "./__snapshots__/" + - snapshotDirectory + - "/" + - snapshotName + - "/external.html"; - await expect(externalHTML).toMatchFileSnapshot(externalHTMLSnapshotPath); -} - -const testCases = [ - customReactBlockSchemaTestCases, - customReactStylesTestCases, - customReactInlineContentTestCases, -]; - -describe("Test React HTML conversion", () => { - for (const testCase of testCases) { - describe("Case: " + testCase.name, () => { - let editor: BlockNoteEditor; - // Note that we don't necessarily need to mount a root (unless we need a React Context) - // Currently, we do mount to a root so that it reflects the "production" use-case more closely. - - // However, it would be nice to increased converage and share the same set of tests for these cases: - // - does render to a root - // - does not render to a root - // - runs in server (jsdom) environment using server-util - let root: Root; - const div = document.createElement("div"); - - beforeEach(() => { - editor = testCase.createEditor(); - - const el = ( - - - - ); - root = createRoot(div); - flushSync(() => { - // eslint-disable-next-line testing-library/no-render-in-setup - root.render(el); - }); - }); - - afterEach(() => { - root.unmount(); - editor._tiptapEditor.destroy(); - editor = undefined as any; - - delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS; - }); - - for (const document of testCase.documents) { - // eslint-disable-next-line no-loop-func - it("Convert " + document.name + " to HTML", async () => { - const nameSplit = document.name.split("/"); - await convertToHTMLAndCompareSnapshots( - editor, - document.blocks, - nameSplit[0], - nameSplit[1] - ); - }); - } - }); - } -}); diff --git a/packages/react/src/test/nodeConversion.test.tsx b/packages/react/src/test/nodeConversion.test.tsx deleted file mode 100644 index 290d773ea6..0000000000 --- a/packages/react/src/test/nodeConversion.test.tsx +++ /dev/null @@ -1,99 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it } from "vitest"; - -import { - BlockNoteEditor, - PartialBlock, - UniqueID, - blockToNode, - nodeToBlock, - partialBlockToBlockForTesting, -} from "@blocknote/core"; -import { flushSync } from "react-dom"; -import { Root, createRoot } from "react-dom/client"; -import { BlockNoteViewRaw } from "../editor/BlockNoteView.js"; -import { customReactBlockSchemaTestCases } from "./testCases/customReactBlocks.js"; -import { customReactInlineContentTestCases } from "./testCases/customReactInlineContent.js"; -import { customReactStylesTestCases } from "./testCases/customReactStyles.js"; - -function addIdsToBlock(block: PartialBlock) { - if (!block.id) { - block.id = UniqueID.options.generateID(); - } - for (const child of block.children || []) { - addIdsToBlock(child); - } -} - -function validateConversion( - block: PartialBlock, - editor: BlockNoteEditor -) { - addIdsToBlock(block); - const node = blockToNode(block, editor.pmSchema, editor.schema.styleSchema); - - expect(node).toMatchSnapshot(); - - const outputBlock = nodeToBlock( - node, - editor.schema.blockSchema, - editor.schema.inlineContentSchema, - editor.schema.styleSchema - ); - - const fullOriginalBlock = partialBlockToBlockForTesting( - editor.schema.blockSchema, - block - ); - - expect(outputBlock).toStrictEqual(fullOriginalBlock); -} - -const testCases = [ - customReactBlockSchemaTestCases, - customReactStylesTestCases, - customReactInlineContentTestCases, -]; - -describe("Test React BlockNote-Prosemirror conversion", () => { - for (const testCase of testCases) { - describe("Case: " + testCase.name, () => { - let editor: BlockNoteEditor; - // Note that we don't necessarily need to mount a root (unless we need a React Context) - // Currently, we do mount to a root so that it reflects the "production" use-case more closely. - - // However, it would be nice to increased converage and share the same set of tests for these cases: - // - does render to a root - // - does not render to a root - // - runs in server (jsdom) environment using server-util - let root: Root; - const div = document.createElement("div"); - - beforeEach(() => { - editor = testCase.createEditor(); - - const el = ; - root = createRoot(div); - flushSync(() => { - // eslint-disable-next-line testing-library/no-render-in-setup - root.render(el); - }); - }); - - afterEach(() => { - root.unmount(); - editor._tiptapEditor.destroy(); - editor = undefined as any; - - delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS; - }); - - for (const document of testCase.documents) { - // eslint-disable-next-line no-loop-func - it("Convert " + document.name + " to/from prosemirror", () => { - // NOTE: only converts first block - validateConversion(document.blocks[0], editor); - }); - } - }); - } -}); diff --git a/packages/react/src/test/testCases/customReactBlocks.tsx b/packages/react/src/test/testCases/customReactBlocks.tsx deleted file mode 100644 index e1bdd8c7c3..0000000000 --- a/packages/react/src/test/testCases/customReactBlocks.tsx +++ /dev/null @@ -1,404 +0,0 @@ -import { - BlockNoteEditor, - BlockNoteSchema, - defaultBlockSpecs, - defaultProps, - uploadToTmpFilesDotOrg_DEV_ONLY, -} from "@blocknote/core"; -import { createContext, useContext } from "react"; - -import { ReactFileBlock } from "../../blocks/FileBlockContent/FileBlockContent.js"; -import { ReactImageBlock } from "../../blocks/ImageBlockContent/ImageBlockContent.js"; -import { createReactBlockSpec } from "../../schema/ReactBlockSpec.js"; - -const ReactCustomParagraph = createReactBlockSpec( - { - type: "reactCustomParagraph", - propSchema: defaultProps, - content: "inline", - }, - { - render: (props) => ( -

- ), - toExternalHTML: () => ( -

Hello World

- ), - } -); - -const SimpleReactCustomParagraph = createReactBlockSpec( - { - type: "simpleReactCustomParagraph", - propSchema: defaultProps, - content: "inline", - }, - { - render: (props) => ( -

- ), - } -); - -export const TestContext = createContext(undefined); - -const ReactContextParagraphComponent = (props: any) => { - const testData = useContext(TestContext); - if (testData === undefined) { - throw Error(); - } - - return

; -}; - -const ReactContextParagraph = createReactBlockSpec( - { - type: "reactContextParagraph", - propSchema: defaultProps, - content: "inline", - }, - { - render: ReactContextParagraphComponent, - } -); - -const schema = BlockNoteSchema.create({ - blockSpecs: { - ...defaultBlockSpecs, - file: ReactFileBlock, - image: ReactImageBlock, - reactCustomParagraph: ReactCustomParagraph, - simpleReactCustomParagraph: SimpleReactCustomParagraph, - reactContextParagraph: ReactContextParagraph, - }, -}); - -// TODO -export const customReactBlockSchemaTestCases: any = { - name: "custom react block schema", - createEditor: () => { - return BlockNoteEditor.create({ - schema, - uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY, - }); - }, - documents: [ - { - name: "reactFile/button", - blocks: [ - { - type: "file", - }, - ], - }, - { - name: "reactFile/basic", - blocks: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - { - name: "reactFile/noName", - blocks: [ - { - type: "file", - props: { - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - { - name: "reactFile/noCaption", - blocks: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - }, - }, - ], - }, - { - name: "reactFile/nested", - blocks: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - children: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - ], - }, - // Because images need to fetch the download URL async, their internal HTML - // is initially rendered without a `src` attribute, which is reflected in - // the tests. - { - name: "reactImage/button", - blocks: [ - { - type: "image", - }, - ], - }, - { - name: "reactImage/basic", - blocks: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - { - name: "reactImage/noName", - blocks: [ - { - type: "image", - props: { - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - { - name: "reactImage/noCaption", - blocks: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - previewWidth: 256, - }, - }, - ], - }, - { - name: "reactImage/noPreview", - blocks: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - showPreview: false, - previewWidth: 256, - }, - }, - ], - }, - { - name: "reactImage/nested", - blocks: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - children: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - ], - }, - { - name: "reactCustomParagraph/basic", - blocks: [ - { - type: "reactCustomParagraph", - content: "React Custom Paragraph", - }, - ], - }, - { - name: "reactCustomParagraph/styled", - blocks: [ - { - type: "reactCustomParagraph", - props: { - textAlignment: "center", - textColor: "orange", - backgroundColor: "pink", - }, - content: [ - { - type: "text", - styles: {}, - text: "Plain ", - }, - { - type: "text", - styles: { - textColor: "red", - }, - text: "Red Text ", - }, - { - type: "text", - styles: { - backgroundColor: "blue", - }, - text: "Blue Background ", - }, - { - type: "text", - styles: { - textColor: "red", - backgroundColor: "blue", - }, - text: "Mixed Colors", - }, - ], - }, - ], - }, - { - name: "reactCustomParagraph/nested", - blocks: [ - { - type: "reactCustomParagraph", - content: "React Custom Paragraph", - children: [ - { - type: "reactCustomParagraph", - content: "Nested React Custom Paragraph 1", - }, - { - type: "reactCustomParagraph", - content: "Nested React Custom Paragraph 2", - }, - ], - }, - ], - }, - { - name: "reactCustomParagraph/lineBreaks", - blocks: [ - { - type: "reactCustomParagraph", - content: "Line 1\nLine 2", - }, - ], - }, - { - name: "simpleReactCustomParagraph/basic", - blocks: [ - { - type: "simpleReactCustomParagraph", - content: "React Custom Paragraph", - }, - ], - }, - { - name: "simpleReactCustomParagraph/styled", - blocks: [ - { - type: "simpleReactCustomParagraph", - props: { - textAlignment: "center", - textColor: "orange", - backgroundColor: "pink", - }, - content: [ - { - type: "text", - styles: {}, - text: "Plain ", - }, - { - type: "text", - styles: { - textColor: "red", - }, - text: "Red Text ", - }, - { - type: "text", - styles: { - backgroundColor: "blue", - }, - text: "Blue Background ", - }, - { - type: "text", - styles: { - textColor: "red", - backgroundColor: "blue", - }, - text: "Mixed Colors", - }, - ], - }, - ], - }, - { - name: "simpleReactCustomParagraph/nested", - blocks: [ - { - type: "simpleReactCustomParagraph", - content: "Custom React Paragraph", - children: [ - { - type: "simpleReactCustomParagraph", - content: "Nested React Custom Paragraph 1", - }, - { - type: "simpleReactCustomParagraph", - content: "Nested React Custom Paragraph 2", - }, - ], - }, - ], - }, - { - name: "reactContextParagraph/basic", - blocks: [ - { - type: "reactContextParagraph", - content: "React Context Paragraph", - }, - ], - }, - ], -}; diff --git a/packages/react/src/test/testCases/customReactInlineContent.tsx b/packages/react/src/test/testCases/customReactInlineContent.tsx deleted file mode 100644 index 1f285432fd..0000000000 --- a/packages/react/src/test/testCases/customReactInlineContent.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import { - BlockNoteEditor, - BlockNoteSchema, - defaultInlineContentSpecs, - uploadToTmpFilesDotOrg_DEV_ONLY, -} from "@blocknote/core"; -import { createReactInlineContentSpec } from "../../schema/ReactInlineContentSpec.js"; - -const mention = createReactInlineContentSpec( - { - type: "mention", - propSchema: { - user: { - default: "", - }, - }, - content: "none", - }, - { - render: (props) => { - return @{props.inlineContent.props.user}; - }, - } -); - -const tag = createReactInlineContentSpec( - { - type: "tag", - propSchema: {}, - content: "styled", - }, - { - render: (props) => { - return ( - - # - - ); - }, - } -); - -const schema = BlockNoteSchema.create({ - inlineContentSpecs: { - ...defaultInlineContentSpecs, - tag, - mention, - }, -}); - -// TODO -export const customReactInlineContentTestCases: any = { - name: "custom react inline content schema", - createEditor: () => { - return BlockNoteEditor.create({ - uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY, - schema, - }); - }, - documents: [ - { - name: "mention/basic", - blocks: [ - { - type: "paragraph", - content: [ - "I enjoy working with ", - { - type: "mention", - props: { - user: "Matthew", - }, - content: undefined, - } as const, - ], - }, - ], - }, - { - name: "tag/basic", - blocks: [ - { - type: "paragraph", - content: [ - "I love ", - { - type: "tag", - // props: {}, - content: "BlockNote", - } as const, - ], - }, - ], - }, - ], -}; diff --git a/packages/react/src/test/testCases/customReactStyles.tsx b/packages/react/src/test/testCases/customReactStyles.tsx deleted file mode 100644 index 021c3945d0..0000000000 --- a/packages/react/src/test/testCases/customReactStyles.tsx +++ /dev/null @@ -1,88 +0,0 @@ -import { - BlockNoteEditor, - BlockNoteSchema, - defaultStyleSpecs, - uploadToTmpFilesDotOrg_DEV_ONLY, -} from "@blocknote/core"; -import { createReactStyleSpec } from "../../schema/ReactStyleSpec.js"; - -const small = createReactStyleSpec( - { - type: "small", - propSchema: "boolean", - }, - { - render: (props) => { - return ; - }, - } -); - -const fontSize = createReactStyleSpec( - { - type: "fontSize", - propSchema: "string", - }, - { - render: (props) => { - return ( - - ); - }, - } -); - -const schema = BlockNoteSchema.create({ - styleSpecs: { - ...defaultStyleSpecs, - small, - fontSize, - }, -}); - -// TODO -export const customReactStylesTestCases: any = { - name: "custom react style schema", - createEditor: () => { - return BlockNoteEditor.create({ - uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY, - schema, - }); - }, - documents: [ - { - name: "small/basic", - blocks: [ - { - type: "paragraph", - content: [ - { - type: "text", - text: "This is a small text", - styles: { - small: true, - }, - }, - ], - }, - ], - }, - { - name: "fontSize/basic", - blocks: [ - { - type: "paragraph", - content: [ - { - type: "text", - text: "This is text with a custom fontSize", - styles: { - fontSize: "18px", - }, - }, - ], - }, - ], - }, - ], -}; diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html new file mode 100644 index 0000000000..32e032f09d --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html @@ -0,0 +1,11 @@ +
+
+
+
+
+          const hello ='world';console.log(hello);
+        
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html new file mode 100644 index 0000000000..a8fb6870f0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html @@ -0,0 +1,11 @@ +
+
+
+
+
+          console.log('Hello, world!');
+        
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html new file mode 100644 index 0000000000..7df4533925 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html @@ -0,0 +1,11 @@ +
+
+
+
+
+          
+        
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html new file mode 100644 index 0000000000..232edd4914 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html @@ -0,0 +1,11 @@ +
+
+
+
+
+          print('Hello, world!')
+        
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html new file mode 100644 index 0000000000..7587f35366 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html @@ -0,0 +1,59 @@ +
+
+
+
+

+ + Heading + + + 2 + +

+
+
+
+
+
+

Paragraph

+
+
+
+
+
+
+

+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/contextParagraph/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/contextParagraph/basic.html new file mode 100644 index 0000000000..be4542743b --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/contextParagraph/basic.html @@ -0,0 +1,14 @@ +
+
+
+
+
React Context Paragraph
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/basic.html new file mode 100644 index 0000000000..150ceb1216 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/basic.html @@ -0,0 +1,14 @@ +
+
+
+
+

React Custom Paragraph

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/lineBreaks.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/lineBreaks.html new file mode 100644 index 0000000000..52a1aa140a --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/lineBreaks.html @@ -0,0 +1,18 @@ +
+
+
+
+

+ Line 1 +
+ Line 2 +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/nested.html new file mode 100644 index 0000000000..d839341713 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/nested.html @@ -0,0 +1,40 @@ +
+
+
+
+

React Custom Paragraph

+
+
+
+
+
+

Nested React Custom Paragraph 1

+
+
+
+
+
+
+

Nested React Custom Paragraph 2

+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/styled.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/styled.html new file mode 100644 index 0000000000..29d66a7d8e --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/styled.html @@ -0,0 +1,34 @@ +
+
+
+
+

+ Plain + Red Text + Blue Background + + Mixed Colors + +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html new file mode 100644 index 0000000000..9974d8d975 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html @@ -0,0 +1,28 @@ +
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html new file mode 100644 index 0000000000..db235fd792 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html @@ -0,0 +1,20 @@ +
+
+
+
+
+
+
+ + + +
+

Add file

+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html new file mode 100644 index 0000000000..6553a5c4a8 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html @@ -0,0 +1,56 @@ +
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html new file mode 100644 index 0000000000..48340682e8 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html @@ -0,0 +1,26 @@ +
+
+
+
+
+
+
+ + + +
+

example

+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html new file mode 100644 index 0000000000..47ae5b3bf9 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html @@ -0,0 +1,27 @@ +
+
+
+
+
+
+
+ + + +
+

+
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/fontSize/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/fontSize/basic.html new file mode 100644 index 0000000000..601e2af9c0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/fontSize/basic.html @@ -0,0 +1,16 @@ +
+
+
+
+

+ This is text with a custom fontSize +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html new file mode 100644 index 0000000000..ca0de5979f --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html @@ -0,0 +1,13 @@ +
+
+
+
+

+ Text1 +
+ Text2 +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html new file mode 100644 index 0000000000..9e4b427c62 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html @@ -0,0 +1,21 @@ +
+
+
+
+

+ Link1 +
+ Link2 +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html new file mode 100644 index 0000000000..cc08190f01 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html @@ -0,0 +1,12 @@ +
+
+
+
+

+ Text1 +
+

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html new file mode 100644 index 0000000000..4cae02d67b --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html @@ -0,0 +1,21 @@ +
+
+
+
+

+ Link1 +
+ Link1 +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html new file mode 100644 index 0000000000..06a2a6a7e5 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html @@ -0,0 +1,15 @@ +
+
+
+
+

+ Text1 +
+ Text2 +
+ Text3 +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html new file mode 100644 index 0000000000..030fa48828 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html @@ -0,0 +1,11 @@ +
+
+
+
+

+
+

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html new file mode 100644 index 0000000000..29e2b8ece4 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html @@ -0,0 +1,12 @@ +
+
+
+
+

+
+ Text1 +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html new file mode 100644 index 0000000000..b6b8eadb30 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html @@ -0,0 +1,13 @@ +
+
+
+
+

+ Text1 +
+ Text2 +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html new file mode 100644 index 0000000000..fe9509a5e3 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html @@ -0,0 +1,22 @@ +
+
+
+
+
+
+ example +
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html new file mode 100644 index 0000000000..250700bb22 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html @@ -0,0 +1,20 @@ +
+
+
+
+
+
+
+ + + +
+

Add image

+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html new file mode 100644 index 0000000000..90e46213fe --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html @@ -0,0 +1,42 @@ +
+
+
+
+
+
+ Caption +
+

Caption

+
+
+
+
+
+
+
+
+ Caption +
+

Caption

+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html new file mode 100644 index 0000000000..2daf51143b --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html @@ -0,0 +1,20 @@ +
+
+
+
+
+
+ example +
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html new file mode 100644 index 0000000000..05bc98c060 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html @@ -0,0 +1,21 @@ +
+
+
+
+
+
+ Caption +
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html new file mode 100644 index 0000000000..84f2dbfc76 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html @@ -0,0 +1,30 @@ +
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html new file mode 100644 index 0000000000..2408c611ac --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html @@ -0,0 +1,20 @@ +
+
+
+
+

+ Website + Website2 +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html new file mode 100644 index 0000000000..3daea90831 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html @@ -0,0 +1,15 @@ +
+
+
+
+

+ Website +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html new file mode 100644 index 0000000000..2b9d4cb574 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html @@ -0,0 +1,22 @@ +
+
+
+
+

+ + Web + + site +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html new file mode 100644 index 0000000000..3cb5ed5e94 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html @@ -0,0 +1,58 @@ +
+
+
+
+

Bullet List Item 1

+
+
+
+
+
+
+

Bullet List Item 2

+
+
+
+
+
+
+

Numbered List Item 1

+
+
+
+
+
+
+

Numbered List Item 2

+
+
+
+
+
+
+ +

Check List Item 1

+
+
+
+
+
+
+ +

Check List Item 2

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html new file mode 100644 index 0000000000..f9aaf463f8 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html @@ -0,0 +1,62 @@ +
+
+
+
+

Bullet List Item 1

+
+
+
+
+
+
+

Bullet List Item 2

+
+
+
+
+
+

Numbered List Item 1

+
+
+
+
+
+
+

Numbered List Item 2

+
+
+
+
+
+ +

Check List Item 1

+
+
+
+
+
+
+ +

Check List Item 2

+
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/mention/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/mention/basic.html new file mode 100644 index 0000000000..a4b3e6a87e --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/mention/basic.html @@ -0,0 +1,12 @@ +
+
+
+
+

+ I enjoy working with + @Matthew +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html new file mode 100644 index 0000000000..545ab1bbac --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html @@ -0,0 +1,9 @@ +
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html new file mode 100644 index 0000000000..326c6a037b --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html @@ -0,0 +1,9 @@ +
+
+
+
+

Paragraph

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html new file mode 100644 index 0000000000..8c0240ae7c --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html @@ -0,0 +1,9 @@ +
+
+
+
+

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html new file mode 100644 index 0000000000..0aa8dffa67 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html @@ -0,0 +1,13 @@ +
+
+
+
+

+ Line 1 +
+ Line 2 +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html new file mode 100644 index 0000000000..7d99f8188d --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html @@ -0,0 +1,25 @@ +
+
+
+
+

Paragraph

+
+
+
+
+
+

Nested Paragraph 1

+
+
+
+
+
+
+

Nested Paragraph 2

+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html new file mode 100644 index 0000000000..5ae4c7b95c --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html @@ -0,0 +1,32 @@ +
+
+
+
+

+ Plain + Red Text + Blue Background + + Mixed Colors + +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/basic.html new file mode 100644 index 0000000000..9974d8d975 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/basic.html @@ -0,0 +1,28 @@ +
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/button.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/button.html new file mode 100644 index 0000000000..db235fd792 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/button.html @@ -0,0 +1,20 @@ +
+
+
+
+
+
+
+ + + +
+

Add file

+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/nested.html new file mode 100644 index 0000000000..6553a5c4a8 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/nested.html @@ -0,0 +1,56 @@ +
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noCaption.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noCaption.html new file mode 100644 index 0000000000..48340682e8 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noCaption.html @@ -0,0 +1,26 @@ +
+
+
+
+
+
+
+ + + +
+

example

+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noName.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noName.html new file mode 100644 index 0000000000..47ae5b3bf9 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noName.html @@ -0,0 +1,27 @@ +
+
+
+
+
+
+
+ + + +
+

+
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/basic.html new file mode 100644 index 0000000000..fe9509a5e3 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/basic.html @@ -0,0 +1,22 @@ +
+
+
+
+
+
+ example +
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/button.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/button.html new file mode 100644 index 0000000000..250700bb22 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/button.html @@ -0,0 +1,20 @@ +
+
+
+
+
+
+
+ + + +
+

Add image

+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/nested.html new file mode 100644 index 0000000000..59718524c9 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/nested.html @@ -0,0 +1,44 @@ +
+
+
+
+
+
+ example +
+

Caption

+
+
+
+
+
+
+
+
+ example +
+

Caption

+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noCaption.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noCaption.html new file mode 100644 index 0000000000..2daf51143b --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noCaption.html @@ -0,0 +1,20 @@ +
+
+
+
+
+
+ example +
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noName.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noName.html new file mode 100644 index 0000000000..05bc98c060 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noName.html @@ -0,0 +1,21 @@ +
+
+
+
+
+
+ Caption +
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noPreview.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noPreview.html new file mode 100644 index 0000000000..84f2dbfc76 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noPreview.html @@ -0,0 +1,30 @@ +
+
+
+
+
+
+
+ + + +
+

example

+
+

Caption

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/basic.html new file mode 100644 index 0000000000..1b1d65bad0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/basic.html @@ -0,0 +1,14 @@ +
+
+
+
+

React Custom Paragraph

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/nested.html new file mode 100644 index 0000000000..a393455366 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/nested.html @@ -0,0 +1,40 @@ +
+
+
+
+

Custom React Paragraph

+
+
+
+
+
+

Nested React Custom Paragraph 1

+
+
+
+
+
+
+

Nested React Custom Paragraph 2

+
+
+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/styled.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/styled.html new file mode 100644 index 0000000000..077d8d0898 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/styled.html @@ -0,0 +1,34 @@ +
+
+
+
+

+ Plain + Red Text + Blue Background + + Mixed Colors + +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/small/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/small/basic.html new file mode 100644 index 0000000000..33dcb60c92 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/small/basic.html @@ -0,0 +1,11 @@ +
+
+
+
+

+ This is a small text +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html new file mode 100644 index 0000000000..778749b580 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html @@ -0,0 +1,43 @@ +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html new file mode 100644 index 0000000000..a9e249effe --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html @@ -0,0 +1,43 @@ +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html new file mode 100644 index 0000000000..6f5dcb8982 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html @@ -0,0 +1,43 @@ +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html new file mode 100644 index 0000000000..2ce617f949 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html @@ -0,0 +1,43 @@ +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html new file mode 100644 index 0000000000..8cafca0c72 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html @@ -0,0 +1,55 @@ +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html new file mode 100644 index 0000000000..a5e5bdf3b4 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html @@ -0,0 +1,43 @@ +
+
+
+
+ + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html new file mode 100644 index 0000000000..eb7dd2ce02 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html @@ -0,0 +1,46 @@ +
+
+
+
+ + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/tag/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/tag/basic.html new file mode 100644 index 0000000000..f17714232a --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/tag/basic.html @@ -0,0 +1,15 @@ +
+
+
+
+

+ I love + + # + BlockNote + +

+
+
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/basicBlockTypes.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/basicBlockTypes.json new file mode 100644 index 0000000000..1a9bd562f2 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/basicBlockTypes.json @@ -0,0 +1,143 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 1", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "level": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 2", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "level": 2, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 3", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "level": 3, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": undefined, + "id": "5", + "props": { + "backgroundColor": "default", + "caption": "Image Caption", + "name": "", + "previewWidth": 512, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "None ", + "type": "text", + }, + { + "styles": { + "bold": true, + }, + "text": "Bold ", + "type": "text", + }, + { + "styles": { + "italic": true, + }, + "text": "Italic ", + "type": "text", + }, + { + "styles": { + "underline": true, + }, + "text": "Underline ", + "type": "text", + }, + { + "styles": { + "strike": true, + }, + "text": "Strikethrough ", + "type": "text", + }, + { + "styles": { + "bold": true, + "italic": true, + "strike": true, + "underline": true, + }, + "text": "All", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html new file mode 100644 index 0000000000..1b766eb380 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html @@ -0,0 +1,8 @@ +
+  
+    const hello ='world';
+    
+ console.log(hello); +
+
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html new file mode 100644 index 0000000000..c5939c1b5e --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html @@ -0,0 +1,3 @@ +
+  console.log('Hello, world!');
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html new file mode 100644 index 0000000000..9bbe62c374 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html @@ -0,0 +1,3 @@ +
+  
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html new file mode 100644 index 0000000000..2d95c0d45d --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html @@ -0,0 +1,3 @@ +
+  print('Hello, world!')
+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlocks.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlocks.json new file mode 100644 index 0000000000..f9bd791440 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlocks.json @@ -0,0 +1,62 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "console.log("Should default to JS")", + "type": "text", + }, + ], + "id": "1", + "props": { + "language": "text", + }, + "type": "codeBlock", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "console.log("Should parse TS from data-language")", + "type": "text", + }, + ], + "id": "2", + "props": { + "language": "typescript", + }, + "type": "codeBlock", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "print("Should parse Python from language- class")", + "type": "text", + }, + ], + "id": "3", + "props": { + "language": "python", + }, + "type": "codeBlock", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "console.log("Should prioritize TS from data-language over language- class")", + "type": "text", + }, + ], + "id": "4", + "props": { + "language": "typescript", + }, + "type": "codeBlock", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/complex/misc.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/complex/misc.html new file mode 100644 index 0000000000..0df8a18343 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/complex/misc.html @@ -0,0 +1,14 @@ +

+ + Heading + + + 2 + +

+

Paragraph

+
    +
  • +

    +
  • +
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactContextParagraph/basic/external.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/contextParagraph/basic.html similarity index 100% rename from packages/react/src/test/__snapshots__/reactContextParagraph/basic/external.html rename to packages/react/src/tests/formatConversion/export/__snapshots__/html/contextParagraph/basic.html diff --git a/packages/react/src/test/__snapshots__/reactCustomParagraph/basic/external.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/basic.html similarity index 100% rename from packages/react/src/test/__snapshots__/reactCustomParagraph/basic/external.html rename to packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/basic.html diff --git a/packages/react/src/test/__snapshots__/reactCustomParagraph/lineBreaks/external.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/lineBreaks.html similarity index 100% rename from packages/react/src/test/__snapshots__/reactCustomParagraph/lineBreaks/external.html rename to packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/lineBreaks.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/nested.html new file mode 100644 index 0000000000..6b2e1554cf --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/nested.html @@ -0,0 +1,3 @@ +

Hello World

+

Hello World

+

Hello World

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/styled.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/styled.html new file mode 100644 index 0000000000..77e2409a54 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/styled.html @@ -0,0 +1,6 @@ +

Hello World

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/deepNestedContent.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/deepNestedContent.json new file mode 100644 index 0000000000..959dbbcd5a --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/deepNestedContent.json @@ -0,0 +1,243 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Outer 1 Div Before", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Outer 2 Div Before", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Outer 3 Div Before", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Outer 4 Div Before", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 1", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "level": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 2", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "level": 2, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 3", + "type": "text", + }, + ], + "id": "7", + "props": { + "backgroundColor": "default", + "level": 3, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "8", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": undefined, + "id": "9", + "props": { + "backgroundColor": "default", + "caption": "Image Caption", + "name": "", + "previewWidth": 512, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Bold", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "italic": true, + }, + "text": "Italic", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "underline": true, + }, + "text": "Underline", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "strike": true, + }, + "text": "Strikethrough", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "bold": true, + "italic": true, + "strike": true, + "underline": true, + }, + "text": "All", + "type": "text", + }, + ], + "id": "10", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Outer 4 Div After Outer 3 Div After Outer 2 Div After Outer 1 Div After", + "type": "text", + }, + ], + "id": "11", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/divs.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/divs.json new file mode 100644 index 0000000000..1e08669f16 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/divs.json @@ -0,0 +1,121 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Single Div", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Div", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Div", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Div", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Single Div 2", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Div", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Div", + "type": "text", + }, + ], + "id": "7", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/fakeImageCaption.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/fakeImageCaption.json new file mode 100644 index 0000000000..3964251638 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/fakeImageCaption.json @@ -0,0 +1,34 @@ +[ + { + "children": [], + "content": undefined, + "id": "1", + "props": { + "backgroundColor": "default", + "caption": "", + "name": "", + "previewWidth": 512, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Image Caption", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/basic.html new file mode 100644 index 0000000000..22fe1c373a --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/basic.html @@ -0,0 +1,4 @@ +
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactFile/button/external.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/button.html similarity index 100% rename from packages/react/src/test/__snapshots__/reactFile/button/external.html rename to packages/react/src/tests/formatConversion/export/__snapshots__/html/file/button.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/nested.html new file mode 100644 index 0000000000..226ee83250 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/nested.html @@ -0,0 +1,8 @@ +
+ example +

Caption

+
+
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactFile/noCaption/external.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/noCaption.html similarity index 100% rename from packages/react/src/test/__snapshots__/reactFile/noCaption/external.html rename to packages/react/src/tests/formatConversion/export/__snapshots__/html/file/noCaption.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/noName.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/noName.html new file mode 100644 index 0000000000..f0ac923a66 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/noName.html @@ -0,0 +1,4 @@ +
+ exampleURL +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/fontSize/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/fontSize/basic.html new file mode 100644 index 0000000000..b8842df250 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/fontSize/basic.html @@ -0,0 +1,8 @@ +

+ This is text with a custom fontSize +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/googleDocs.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/googleDocs.json new file mode 100644 index 0000000000..5a7912dcd1 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/googleDocs.json @@ -0,0 +1,579 @@ +[ + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Heading 1", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "level": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Heading 2", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "level": 2, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Heading 3", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "level": 3, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 1", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 2", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 3", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph With +Hard Break", + "type": "text", + }, + ], + "id": "7", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Bold", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "italic": true, + }, + "text": "Italic", + "type": "text", + }, + { + "styles": {}, + "text": " Underline ", + "type": "text", + }, + { + "styles": { + "strike": true, + }, + "text": "Strikethrough", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "bold": true, + "italic": true, + "strike": true, + }, + "text": "All", + "type": "text", + }, + ], + "id": "8", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Nested Numbered List Item 1", + "type": "text", + }, + ], + "id": "11", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Nested Numbered List Item 2", + "type": "text", + }, + ], + "id": "12", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": " Nested Bullet List Item 1", + "type": "text", + }, + ], + "id": "10", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Nested Bullet List Item 2", + "type": "text", + }, + ], + "id": "13", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": " Bullet List Item 1", + "type": "text", + }, + ], + "id": "9", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Bullet List Item 2", + "type": "text", + }, + ], + "id": "14", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Numbered List Item 1", + "type": "text", + }, + ], + "id": "15", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " Numbered List Item 2", + "type": "text", + }, + ], + "id": "16", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": undefined, + "id": "17", + "props": { + "backgroundColor": "default", + "caption": "", + "name": "", + "previewWidth": 447, + "showPreview": true, + "textAlignment": "left", + "url": "https://lh7-us.googleusercontent.com/SGyYp6hfLvNkli62NKFJB6NQz-fNa2Sjy8QxfUuqipW--qCCXmCz-dJmeZUGaDXIF9TEZHzbhNJsw4_w-B09eaFOn0oUChKsrSt3cwAIFu6d4SoSjHTR_DRTPr415_P7an7Lue-EwlUcVBk1WCzcoVQ", + }, + "type": "image", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " +", + "type": "text", + }, + ], + "id": "18", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": { + "columnWidths": [ + undefined, + undefined, + undefined, + ], + "headerCols": undefined, + "headerRows": undefined, + "rows": [ + { + "cells": [ + { + "content": [ + { + "styles": {}, + "text": "Cell 1", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 2", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 3", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + { + "cells": [ + { + "content": [ + { + "styles": {}, + "text": "Cell 4", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 5", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 6", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + { + "cells": [ + { + "content": [ + { + "styles": {}, + "text": "Cell 7", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 8", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 9", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + ], + "type": "tableContent", + }, + "id": "19", + "props": { + "textColor": "default", + }, + "type": "table", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "20", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": " +", + "type": "text", + }, + ], + "id": "21", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html new file mode 100644 index 0000000000..d0444869cc --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html @@ -0,0 +1,5 @@ +

+ Text1 +
+ Text2 +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html new file mode 100644 index 0000000000..701b5d4213 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html @@ -0,0 +1,13 @@ +

+ Link1 +
+ Link2 +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html new file mode 100644 index 0000000000..1f7bcf996b --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html @@ -0,0 +1,4 @@ +

+ Text1 +
+

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html new file mode 100644 index 0000000000..2c762aedc5 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html @@ -0,0 +1,13 @@ +

+ Link1 +
+ Link1 +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html new file mode 100644 index 0000000000..5d957daa62 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html @@ -0,0 +1,7 @@ +

+ Text1 +
+ Text2 +
+ Text3 +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html new file mode 100644 index 0000000000..b96f89d7a0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html @@ -0,0 +1,3 @@ +

+
+

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html new file mode 100644 index 0000000000..f0370a6c68 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html @@ -0,0 +1,4 @@ +

+
+ Text1 +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html new file mode 100644 index 0000000000..7a49318b49 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html @@ -0,0 +1,5 @@ +

+ Text1 +
+ Text2 +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/basic.html new file mode 100644 index 0000000000..59f782dbb1 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/basic.html @@ -0,0 +1,9 @@ +
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactImage/button/external.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/button.html similarity index 100% rename from packages/react/src/test/__snapshots__/reactImage/button/external.html rename to packages/react/src/tests/formatConversion/export/__snapshots__/html/image/button.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/nested.html new file mode 100644 index 0000000000..8cc825084e --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/nested.html @@ -0,0 +1,8 @@ +
+ exampleURL +

Caption

+
+
+ exampleURL +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noCaption.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noCaption.html new file mode 100644 index 0000000000..269bdeca7e --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noCaption.html @@ -0,0 +1,6 @@ +example \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noName.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noName.html new file mode 100644 index 0000000000..decd178fbe --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noName.html @@ -0,0 +1,4 @@ +
+ exampleURL +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noPreview.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noPreview.html new file mode 100644 index 0000000000..21bf2faaf1 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noPreview.html @@ -0,0 +1,10 @@ +
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/imageInParagraph.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/imageInParagraph.json new file mode 100644 index 0000000000..28369c981f --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/imageInParagraph.json @@ -0,0 +1,17 @@ +[ + { + "children": [], + "content": undefined, + "id": "1", + "props": { + "backgroundColor": "default", + "caption": "", + "name": "", + "previewWidth": 512, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/inlineContentAndNestedBlocks.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/inlineContentAndNestedBlocks.json new file mode 100644 index 0000000000..b21c97408c --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/inlineContentAndNestedBlocks.json @@ -0,0 +1,91 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "None ", + "type": "text", + }, + { + "styles": { + "bold": true, + }, + "text": "Bold ", + "type": "text", + }, + { + "styles": { + "italic": true, + }, + "text": "Italic ", + "type": "text", + }, + { + "styles": { + "underline": true, + }, + "text": "Underline ", + "type": "text", + }, + { + "styles": { + "strike": true, + }, + "text": "Strikethrough ", + "type": "text", + }, + { + "styles": { + "bold": true, + "italic": true, + "strike": true, + "underline": true, + }, + "text": "All", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Div", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Paragraph", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/adjacent.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/adjacent.html new file mode 100644 index 0000000000..db99691d33 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/adjacent.html @@ -0,0 +1,12 @@ +

+ Website + Website2 +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/basic.html new file mode 100644 index 0000000000..4b61e8c582 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/basic.html @@ -0,0 +1,7 @@ +

+ Website +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/styled.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/styled.html new file mode 100644 index 0000000000..fb7737f7f8 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/styled.html @@ -0,0 +1,14 @@ +

+ + Web + + site +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists.json new file mode 100644 index 0000000000..cdd50b6d47 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists.json @@ -0,0 +1,177 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "First", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Second", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Third", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Fourth", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Fifth", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Child 1", + "type": "text", + }, + ], + "id": "7", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Child 2", + "type": "text", + }, + ], + "id": "8", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Child 3", + "type": "text", + }, + ], + "id": "9", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Child 4", + "type": "text", + }, + ], + "id": "10", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Five Parent", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/basic.html new file mode 100644 index 0000000000..aee1048a87 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/basic.html @@ -0,0 +1,26 @@ +
    +
  • +

    Bullet List Item 1

    +
  • +
  • +

    Bullet List Item 2

    +
  • +
+
    +
  1. +

    Numbered List Item 1

    +
  2. +
  3. +

    Numbered List Item 2

    +
  4. +
+
    +
  • + +

    Check List Item 1

    +
  • +
  • + +

    Check List Item 2

    +
  • +
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/nested.html new file mode 100644 index 0000000000..b2497ae937 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/nested.html @@ -0,0 +1,26 @@ +
    +
  • +

    Bullet List Item 1

    +
  • +
  • +

    Bullet List Item 2

    +
      +
    1. +

      Numbered List Item 1

      +
    2. +
    3. +

      Numbered List Item 2

      +
        +
      • + +

        Check List Item 1

        +
      • +
      • + +

        Check List Item 2

        +
      • +
      +
    4. +
    +
  • +
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/mention/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/mention/basic.html new file mode 100644 index 0000000000..dba0d5cf95 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/mention/basic.html @@ -0,0 +1,4 @@ +

+ I enjoy working with + @Matthew +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/mixedNestedLists.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/mixedNestedLists.json new file mode 100644 index 0000000000..5b79ba865f --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/mixedNestedLists.json @@ -0,0 +1,265 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Check List Item", + "type": "text", + }, + ], + "id": "8", + "props": { + "backgroundColor": "default", + "checked": true, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Check List Item", + "type": "text", + }, + ], + "id": "9", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "7", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "10", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Check List Item", + "type": "text", + }, + ], + "id": "11", + "props": { + "backgroundColor": "default", + "checked": true, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item", + "type": "text", + }, + ], + "id": "13", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item", + "type": "text", + }, + ], + "id": "14", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Check List Item", + "type": "text", + }, + ], + "id": "12", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Check List Item", + "type": "text", + }, + ], + "id": "15", + "props": { + "backgroundColor": "default", + "checked": true, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedLists.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedLists.json new file mode 100644 index 0000000000..061ca1c5bc --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedLists.json @@ -0,0 +1,265 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item", + "type": "text", + }, + ], + "id": "8", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item", + "type": "text", + }, + ], + "id": "9", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "7", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "10", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Check List Item", + "type": "text", + }, + ], + "id": "11", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Check List Item", + "type": "text", + }, + ], + "id": "13", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Check List Item", + "type": "text", + }, + ], + "id": "14", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Check List Item", + "type": "text", + }, + ], + "id": "12", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Check List Item", + "type": "text", + }, + ], + "id": "15", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedListsWithParagraphs.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedListsWithParagraphs.json new file mode 100644 index 0000000000..055d8f7d31 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedListsWithParagraphs.json @@ -0,0 +1,265 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item", + "type": "text", + }, + ], + "id": "8", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item", + "type": "text", + }, + ], + "id": "9", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "7", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "10", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Checked List Item", + "type": "text", + }, + ], + "id": "11", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Checked List Item", + "type": "text", + }, + ], + "id": "13", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Checked List Item", + "type": "text", + }, + ], + "id": "14", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Checked List Item", + "type": "text", + }, + ], + "id": "12", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Checked List Item", + "type": "text", + }, + ], + "id": "15", + "props": { + "backgroundColor": "default", + "checked": false, + "textAlignment": "left", + "textColor": "default", + }, + "type": "checkListItem", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/notion.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/notion.json new file mode 100644 index 0000000000..b1eb97dd2d --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/notion.json @@ -0,0 +1,566 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 1", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "level": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 2", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "level": 2, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 3", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "level": 3, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 1", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Paragraph 1", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Paragraph 2", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph With Hard Break", + "type": "text", + }, + ], + "id": "7", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Bold", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "italic": true, + }, + "text": "Italic", + "type": "text", + }, + { + "styles": {}, + "text": " Underline ", + "type": "text", + }, + { + "styles": { + "strike": true, + }, + "text": "Strikethrough", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "bold": true, + "italic": true, + "strike": true, + }, + "text": "All", + "type": "text", + }, + ], + "id": "8", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item 1", + "type": "text", + }, + ], + "id": "11", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Numbered List Item 2", + "type": "text", + }, + ], + "id": "12", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item 1", + "type": "text", + }, + ], + "id": "10", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Nested Bullet List Item 2", + "type": "text", + }, + ], + "id": "13", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Bullet List Item 1", + "type": "text", + }, + ], + "id": "9", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item 2", + "type": "text", + }, + ], + "id": "14", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item 1", + "type": "text", + }, + ], + "id": "15", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item 2", + "type": "text", + }, + ], + "id": "16", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Background Color Paragraph", + "type": "text", + }, + ], + "id": "17", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "!", + "type": "text", + }, + { + "content": [ + { + "styles": {}, + "text": "https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg", + "type": "text", + }, + ], + "href": "https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg", + "type": "link", + }, + ], + "id": "18", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": { + "columnWidths": [ + undefined, + undefined, + undefined, + ], + "headerCols": undefined, + "headerRows": 1, + "rows": [ + { + "cells": [ + { + "content": [ + { + "styles": {}, + "text": "Cell 1", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 2", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 3", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + { + "cells": [ + { + "content": [ + { + "styles": {}, + "text": "Cell 4", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 5", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 6", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + { + "cells": [ + { + "content": [ + { + "styles": {}, + "text": "Cell 7", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 8", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + { + "content": [ + { + "styles": {}, + "text": "Cell 9", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + ], + "type": "tableContent", + }, + "id": "19", + "props": { + "textColor": "default", + }, + "type": "table", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "20", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html new file mode 100644 index 0000000000..ba65bb0620 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/basic.html new file mode 100644 index 0000000000..38addeaada --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/basic.html @@ -0,0 +1 @@ +

Paragraph

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/empty.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/empty.html new file mode 100644 index 0000000000..540135ad6a --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/empty.html @@ -0,0 +1 @@ +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html new file mode 100644 index 0000000000..7dafa23c42 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html @@ -0,0 +1,5 @@ +

+ Line 1 +
+ Line 2 +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html new file mode 100644 index 0000000000..5e80eb83e2 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html @@ -0,0 +1,3 @@ +

Paragraph

+

Nested Paragraph 1

+

Nested Paragraph 2

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html new file mode 100644 index 0000000000..65e55c08bf --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html @@ -0,0 +1,12 @@ +

+ Plain + Red Text + Blue Background + + Mixed Colors + +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/basic.html new file mode 100644 index 0000000000..22fe1c373a --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/basic.html @@ -0,0 +1,4 @@ +
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/button.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/button.html new file mode 100644 index 0000000000..cc675c57a7 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/button.html @@ -0,0 +1 @@ +

Add file

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/nested.html new file mode 100644 index 0000000000..226ee83250 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/nested.html @@ -0,0 +1,8 @@ +
+ example +

Caption

+
+
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noCaption.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noCaption.html new file mode 100644 index 0000000000..e1c8211b39 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noCaption.html @@ -0,0 +1 @@ +example \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noName.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noName.html new file mode 100644 index 0000000000..f0ac923a66 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noName.html @@ -0,0 +1,4 @@ +
+ exampleURL +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/basic.html new file mode 100644 index 0000000000..59f782dbb1 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/basic.html @@ -0,0 +1,9 @@ +
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/button.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/button.html new file mode 100644 index 0000000000..8553433aff --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/button.html @@ -0,0 +1 @@ +

Add image

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/nested.html new file mode 100644 index 0000000000..39c365984d --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/nested.html @@ -0,0 +1,18 @@ +
+ example +

Caption

+
+
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noCaption.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noCaption.html new file mode 100644 index 0000000000..269bdeca7e --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noCaption.html @@ -0,0 +1,6 @@ +example \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noName.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noName.html new file mode 100644 index 0000000000..decd178fbe --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noName.html @@ -0,0 +1,4 @@ +
+ exampleURL +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noPreview.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noPreview.html new file mode 100644 index 0000000000..21bf2faaf1 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noPreview.html @@ -0,0 +1,10 @@ +
+ example +

Caption

+
\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/external.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/basic.html similarity index 100% rename from packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/external.html rename to packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/nested.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/nested.html new file mode 100644 index 0000000000..68e209191a --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/nested.html @@ -0,0 +1,3 @@ +

Custom React Paragraph

+

Nested React Custom Paragraph 1

+

Nested React Custom Paragraph 2

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/styled.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/styled.html new file mode 100644 index 0000000000..d50c890bfb --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/styled.html @@ -0,0 +1,14 @@ +

+ Plain + Red Text + Blue Background + + Mixed Colors + +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/small/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/small/basic.html new file mode 100644 index 0000000000..91b799b7b0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/small/basic.html @@ -0,0 +1,3 @@ +

+ This is a small text +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html new file mode 100644 index 0000000000..9ce9e3e5c6 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/basic.html new file mode 100644 index 0000000000..00f73d172c --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/basic.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerCols.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerCols.html new file mode 100644 index 0000000000..eeebae59df --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerCols.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerRows.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerRows.html new file mode 100644 index 0000000000..008f208fdc --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerRows.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html new file mode 100644 index 0000000000..05bcfd2bfc --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html new file mode 100644 index 0000000000..72d863ebea --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html new file mode 100644 index 0000000000..9ec43c73e7 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + +
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
+

Table Cell

+
\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/tag/basic.html b/packages/react/src/tests/formatConversion/export/__snapshots__/html/tag/basic.html new file mode 100644 index 0000000000..28d8392094 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/tag/basic.html @@ -0,0 +1,7 @@ +

+ I love + + # + BlockNote + +

\ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/twoDivs.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/twoDivs.json new file mode 100644 index 0000000000..e91570e36b --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/twoDivs.json @@ -0,0 +1,36 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Single Div", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "second Div", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/twoTables.json b/packages/react/src/tests/formatConversion/export/__snapshots__/html/twoTables.json new file mode 100644 index 0000000000..3ffbb3ead1 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/html/twoTables.json @@ -0,0 +1,136 @@ +[ + { + "children": [], + "content": { + "columnWidths": [ + undefined, + ], + "headerCols": undefined, + "headerRows": undefined, + "rows": [ + { + "cells": [ + { + "content": [ + { + "styles": { + "underline": true, + }, + "text": "Company", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + { + "cells": [ + { + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Example Company Inc.", + "type": "text", + }, + { + "styles": {}, + "text": " + +Name: [Company Representative] +Title: Chief Executive Officer", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + ], + "type": "tableContent", + }, + "id": "1", + "props": { + "textColor": "default", + }, + "type": "table", + }, + { + "children": [], + "content": { + "columnWidths": [ + undefined, + ], + "headerCols": undefined, + "headerRows": undefined, + "rows": [ + { + "cells": [ + { + "content": [ + { + "styles": { + "underline": true, + }, + "text": "Advisor", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + { + "cells": [ + { + "content": [ + { + "styles": {}, + "text": "[Advisor Name]", + "type": "text", + }, + ], + "props": { + "backgroundColor": "default", + "colspan": 1, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "tableCell", + }, + ], + }, + ], + "type": "tableContent", + }, + "id": "2", + "props": { + "textColor": "default", + }, + "type": "table", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/basic.json new file mode 100644 index 0000000000..632e74dcb7 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/basic.json @@ -0,0 +1,71 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "level": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/boldWithWhitespace.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/boldWithWhitespace.json new file mode 100644 index 0000000000..3331f6218a --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/boldWithWhitespace.json @@ -0,0 +1,19 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "hello **beautiful ** world", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md new file mode 100644 index 0000000000..3e6b363013 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md @@ -0,0 +1,4 @@ +```javascript +const hello = 'world'; +console.log(hello); +``` diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md new file mode 100644 index 0000000000..f5b118ae95 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md @@ -0,0 +1,3 @@ +```text +console.log('Hello, world!'); +``` diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md new file mode 100644 index 0000000000..b5c9416ec5 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md @@ -0,0 +1,2 @@ +```text +``` diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md new file mode 100644 index 0000000000..c1908c03b2 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md @@ -0,0 +1,3 @@ +```python +print('Hello, world!') +``` diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex.json new file mode 100644 index 0000000000..81ac21d79a --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex.json @@ -0,0 +1,353 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 1", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "level": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 2", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "level": 2, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 3", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "level": 3, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "P", + "type": "text", + }, + { + "styles": { + "bold": true, + }, + "text": "ara", + "type": "text", + }, + { + "styles": { + "italic": true, + }, + "text": "grap", + "type": "text", + }, + { + "styles": {}, + "text": "h", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "P", + "type": "text", + }, + { + "styles": { + "italic": true, + }, + "text": "ara", + "type": "text", + }, + { + "styles": { + "strike": true, + }, + "text": "grap", + "type": "text", + }, + { + "styles": {}, + "text": "h", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "7", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "10", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "9", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "12", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "13", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "15", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "14", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "16", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "11", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "17", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "8", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "18", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md new file mode 100644 index 0000000000..4a2de0a7fc --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md @@ -0,0 +1,5 @@ +## **Heading ***~~2~~* + +Paragraph + +* diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/basic.md new file mode 100644 index 0000000000..3acd9e1ad0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/basic.md @@ -0,0 +1,3 @@ +[example](exampleURL) + +Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/button.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/button.md new file mode 100644 index 0000000000..8d3fa6a207 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/button.md @@ -0,0 +1 @@ +Add file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/nested.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/nested.md new file mode 100644 index 0000000000..93a61da7b4 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/nested.md @@ -0,0 +1,7 @@ +[example](exampleURL) + +Caption + +[example](exampleURL) + +Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md new file mode 100644 index 0000000000..f525eb2143 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md @@ -0,0 +1 @@ +[example](exampleURL) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noName.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noName.md new file mode 100644 index 0000000000..c7fefc547f --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noName.md @@ -0,0 +1,3 @@ +[exampleURL](exampleURL) + +Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md new file mode 100644 index 0000000000..0fe906b288 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md @@ -0,0 +1,2 @@ +Text1\ +Text2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md new file mode 100644 index 0000000000..3f74feb726 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md @@ -0,0 +1,2 @@ +[Link1](https://www.website.com)\ +[Link2](https://www.website2.com) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md new file mode 100644 index 0000000000..9d80a6ba66 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md @@ -0,0 +1 @@ +Text1 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md new file mode 100644 index 0000000000..95a590abea --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md @@ -0,0 +1,2 @@ +[Link1](https://www.website.com)\ +[Link1](https://www.website.com) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md new file mode 100644 index 0000000000..f7e9c54f1f --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md @@ -0,0 +1,3 @@ +Text1\ +Text2\ +Text3 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/only.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/only.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md new file mode 100644 index 0000000000..9d80a6ba66 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md @@ -0,0 +1 @@ +Text1 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md new file mode 100644 index 0000000000..f92fc1d40e --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md @@ -0,0 +1,2 @@ +Text1\ +**Text2** diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/basic.md new file mode 100644 index 0000000000..3acd9e1ad0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/basic.md @@ -0,0 +1,3 @@ +[example](exampleURL) + +Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/button.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/button.md new file mode 100644 index 0000000000..02184caf8a --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/button.md @@ -0,0 +1 @@ +Add image diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/nested.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/nested.md new file mode 100644 index 0000000000..83c6df00ed --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/nested.md @@ -0,0 +1,7 @@ +[exampleURL](exampleURL) + +Caption + +[exampleURL](exampleURL) + +Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md new file mode 100644 index 0000000000..f525eb2143 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md @@ -0,0 +1 @@ +[example](exampleURL) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noName.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noName.md new file mode 100644 index 0000000000..c7fefc547f --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noName.md @@ -0,0 +1,3 @@ +[exampleURL](exampleURL) + +Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md new file mode 100644 index 0000000000..3acd9e1ad0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md @@ -0,0 +1,3 @@ +[example](exampleURL) + +Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case1.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case1.json new file mode 100644 index 0000000000..8ca8b088a3 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case1.json @@ -0,0 +1,71 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "📝 item1", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "⚙️ item2", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "🔗 item3", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "h1", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "level": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case2.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case2.json new file mode 100644 index 0000000000..e0939c1645 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case2.json @@ -0,0 +1,144 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "a", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "b", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "c", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "d", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "anything", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "content": [ + { + "styles": {}, + "text": "a link", + "type": "text", + }, + ], + "href": "http://example.com", + "type": "link", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "another", + "type": "text", + }, + ], + "id": "7", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "list", + "type": "text", + }, + ], + "id": "8", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md new file mode 100644 index 0000000000..4fe44186fa --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md @@ -0,0 +1 @@ +[Website](https://www.website.com)[Website2](https://www.website2.com) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/basic.md new file mode 100644 index 0000000000..bc9d83b3da --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/basic.md @@ -0,0 +1 @@ +[Website](https://www.website.com) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/styled.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/styled.md new file mode 100644 index 0000000000..ad7b143e27 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/styled.md @@ -0,0 +1 @@ +**[Web](https://www.website.com)**[site](https://www.website.com) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md new file mode 100644 index 0000000000..ae6392a26d --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md @@ -0,0 +1,10 @@ +* Bullet List Item 1 + +* Bullet List Item 2 + +1. Numbered List Item 1 + +2. Numbered List Item 2 + +* [ ] Check List Item 1 +* [x] Check List Item 2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md new file mode 100644 index 0000000000..bb6af59913 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md @@ -0,0 +1,10 @@ +* Bullet List Item 1 + +* Bullet List Item 2 + + 1. Numbered List Item 1 + + 2. Numbered List Item 2 + + * [ ] Check List Item 1 + * [x] Check List Item 2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/nested.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/nested.json new file mode 100644 index 0000000000..df04f955b6 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/nested.json @@ -0,0 +1,72 @@ +[ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "level": 1, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "2", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, + { + "children": [ + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Numbered List Item", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "numberedListItem", + }, + ], + "content": [ + { + "styles": {}, + "text": "Bullet List Item", + "type": "text", + }, + ], + "id": "3", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "bulletListItem", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md new file mode 100644 index 0000000000..07e18e6d30 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md @@ -0,0 +1 @@ +Paragraph diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/empty.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/empty.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md new file mode 100644 index 0000000000..c1cd81690f --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md @@ -0,0 +1,2 @@ +Line 1\ +Line 2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md new file mode 100644 index 0000000000..af7d1348ad --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md @@ -0,0 +1,5 @@ +Paragraph + +Nested Paragraph 1 + +Nested Paragraph 2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md new file mode 100644 index 0000000000..4f45e63c5c --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md @@ -0,0 +1 @@ +Plain Red Text Blue Background Mixed Colors diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/styled.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/styled.json new file mode 100644 index 0000000000..a2c32954d5 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/styled.json @@ -0,0 +1,58 @@ +[ + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Bold", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "italic": true, + }, + "text": "Italic", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "strike": true, + }, + "text": "Strikethrough", + "type": "text", + }, + { + "styles": {}, + "text": " ", + "type": "text", + }, + { + "styles": { + "bold": true, + "italic": true, + }, + "text": "Multiple", + "type": "text", + }, + ], + "id": "1", + "props": { + "backgroundColor": "default", + "textAlignment": "left", + "textColor": "default", + }, + "type": "paragraph", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md new file mode 100644 index 0000000000..3e52272fe0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md @@ -0,0 +1,5 @@ +| | | | +| ---------- | ---------- | ---------- | +| Table Cell | Table Cell | Table Cell | +| Table Cell | Table Cell | Table Cell | +| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/basic.md new file mode 100644 index 0000000000..3e52272fe0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/basic.md @@ -0,0 +1,5 @@ +| | | | +| ---------- | ---------- | ---------- | +| Table Cell | Table Cell | Table Cell | +| Table Cell | Table Cell | Table Cell | +| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md new file mode 100644 index 0000000000..812aac2d02 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md @@ -0,0 +1,4 @@ +| Table Cell | Table Cell | Table Cell | +| ---------- | ---------- | ---------- | +| Table Cell | Table Cell | Table Cell | +| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md new file mode 100644 index 0000000000..812aac2d02 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md @@ -0,0 +1,4 @@ +| Table Cell | Table Cell | Table Cell | +| ---------- | ---------- | ---------- | +| Table Cell | Table Cell | Table Cell | +| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md new file mode 100644 index 0000000000..3e52272fe0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md @@ -0,0 +1,5 @@ +| | | | +| ---------- | ---------- | ---------- | +| Table Cell | Table Cell | Table Cell | +| Table Cell | Table Cell | Table Cell | +| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md new file mode 100644 index 0000000000..3e52272fe0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md @@ -0,0 +1,5 @@ +| | | | +| ---------- | ---------- | ---------- | +| Table Cell | Table Cell | Table Cell | +| Table Cell | Table Cell | Table Cell | +| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md new file mode 100644 index 0000000000..5f817e4d91 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md @@ -0,0 +1,5 @@ +| | | | +| ---------- | ---------- | ---------- | +| Table Cell | | Table Cell | +| Table Cell | Table Cell | | +| | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json new file mode 100644 index 0000000000..da4c135551 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json @@ -0,0 +1,26 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "language": "javascript", + }, + "content": [ + { + "text": "const hello = 'world'; +console.log(hello); +", + "type": "text", + }, + ], + "type": "codeBlock", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json new file mode 100644 index 0000000000..97b0374bfb --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json @@ -0,0 +1,24 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "language": "text", + }, + "content": [ + { + "text": "console.log('Hello, world!');", + "type": "text", + }, + ], + "type": "codeBlock", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json new file mode 100644 index 0000000000..4fd34ff835 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json @@ -0,0 +1,18 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "language": "text", + }, + "type": "codeBlock", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json new file mode 100644 index 0000000000..01b6f86580 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json @@ -0,0 +1,24 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "language": "python", + }, + "content": [ + { + "text": "print('Hello, world!')", + "type": "text", + }, + ], + "type": "codeBlock", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json new file mode 100644 index 0000000000..85f484ec68 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json @@ -0,0 +1,88 @@ +[ + { + "attrs": { + "backgroundColor": "blue", + "id": "1", + "textColor": "yellow", + }, + "content": [ + { + "attrs": { + "level": 2, + "textAlignment": "right", + }, + "content": [ + { + "marks": [ + { + "type": "bold", + }, + { + "type": "underline", + }, + ], + "text": "Heading ", + "type": "text", + }, + { + "marks": [ + { + "type": "italic", + }, + { + "type": "strike", + }, + ], + "text": "2", + "type": "text", + }, + ], + "type": "heading", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "red", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Paragraph", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "3", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "type": "bulletListItem", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/basic.json new file mode 100644 index 0000000000..0de31316e1 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/basic.json @@ -0,0 +1,20 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "example", + "url": "exampleURL", + }, + "type": "file", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/button.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/button.json new file mode 100644 index 0000000000..42be1c0985 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/button.json @@ -0,0 +1,20 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "", + "name": "", + "url": "", + }, + "type": "file", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/nested.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/nested.json new file mode 100644 index 0000000000..f122b855d8 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/nested.json @@ -0,0 +1,43 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "example", + "url": "exampleURL", + }, + "type": "file", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "example", + "url": "exampleURL", + }, + "type": "file", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json new file mode 100644 index 0000000000..7b9cd6f1c4 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json @@ -0,0 +1,20 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "", + "name": "example", + "url": "exampleURL", + }, + "type": "file", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noName.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noName.json new file mode 100644 index 0000000000..393aff6af8 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noName.json @@ -0,0 +1,20 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "", + "url": "exampleURL", + }, + "type": "file", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json new file mode 100644 index 0000000000..8f3e362113 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json @@ -0,0 +1,31 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Text1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "text": "Text2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json new file mode 100644 index 0000000000..93e7571b21 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json @@ -0,0 +1,53 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Link1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website2.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Link2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json new file mode 100644 index 0000000000..781e539991 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json @@ -0,0 +1,27 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Text1", + "type": "text", + }, + { + "type": "hardBreak", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json new file mode 100644 index 0000000000..aee93b47d3 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json @@ -0,0 +1,53 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Link1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Link1", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json new file mode 100644 index 0000000000..b8cd0f19ec --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json @@ -0,0 +1,38 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Text1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "text": "Text2", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "text": "Text3", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json new file mode 100644 index 0000000000..6a1a4d2554 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "type": "hardBreak", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json new file mode 100644 index 0000000000..dc2396df1f --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json @@ -0,0 +1,27 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "type": "hardBreak", + }, + { + "text": "Text1", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json new file mode 100644 index 0000000000..034bf8b726 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json @@ -0,0 +1,36 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Text1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "marks": [ + { + "type": "bold", + }, + ], + "text": "Text2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/basic.json new file mode 100644 index 0000000000..ad2d0f7a69 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/basic.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "example", + "previewWidth": 256, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/button.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/button.json new file mode 100644 index 0000000000..e0aef86d8e --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/button.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "", + "name": "", + "previewWidth": 512, + "showPreview": true, + "textAlignment": "left", + "url": "", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/nested.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/nested.json new file mode 100644 index 0000000000..db8fee4b1d --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/nested.json @@ -0,0 +1,49 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "", + "previewWidth": 256, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "", + "previewWidth": 256, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json new file mode 100644 index 0000000000..aaa57c857a --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "", + "name": "example", + "previewWidth": 256, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noName.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noName.json new file mode 100644 index 0000000000..10a9c03a69 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noName.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "", + "previewWidth": 256, + "showPreview": true, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json new file mode 100644 index 0000000000..946ca5f86e --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json @@ -0,0 +1,23 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "caption": "Caption", + "name": "example", + "previewWidth": 256, + "showPreview": false, + "textAlignment": "left", + "url": "exampleURL", + }, + "type": "image", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json new file mode 100644 index 0000000000..13f609f82e --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json @@ -0,0 +1,50 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Website", + "type": "text", + }, + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website2.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Website2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/basic.json new file mode 100644 index 0000000000..a760a4ad4f --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/basic.json @@ -0,0 +1,35 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Website", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/styled.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/styled.json new file mode 100644 index 0000000000..2d4dc02bec --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/styled.json @@ -0,0 +1,53 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "marks": [ + { + "type": "bold", + }, + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "Web", + "type": "text", + }, + { + "marks": [ + { + "attrs": { + "class": null, + "href": "https://www.website.com", + "rel": "noopener noreferrer nofollow", + "target": "_blank", + }, + "type": "link", + }, + ], + "text": "site", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json new file mode 100644 index 0000000000..70a1a0aaa4 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json @@ -0,0 +1,140 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Bullet List Item 1", + "type": "text", + }, + ], + "type": "bulletListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Bullet List Item 2", + "type": "text", + }, + ], + "type": "bulletListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "3", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "index": null, + "start": undefined, + "textAlignment": "left", + }, + "content": [ + { + "text": "Numbered List Item 1", + "type": "text", + }, + ], + "type": "numberedListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "4", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "index": null, + "start": undefined, + "textAlignment": "left", + }, + "content": [ + { + "text": "Numbered List Item 2", + "type": "text", + }, + ], + "type": "numberedListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "5", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "checked": false, + "textAlignment": "left", + }, + "content": [ + { + "text": "Check List Item 1", + "type": "text", + }, + ], + "type": "checkListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "6", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "checked": true, + "textAlignment": "left", + }, + "content": [ + { + "text": "Check List Item 2", + "type": "text", + }, + ], + "type": "checkListItem", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json new file mode 100644 index 0000000000..b0f224fec8 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json @@ -0,0 +1,150 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Bullet List Item 1", + "type": "text", + }, + ], + "type": "bulletListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Bullet List Item 2", + "type": "text", + }, + ], + "type": "bulletListItem", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "id": "3", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "index": null, + "start": undefined, + "textAlignment": "left", + }, + "content": [ + { + "text": "Numbered List Item 1", + "type": "text", + }, + ], + "type": "numberedListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "4", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "index": null, + "start": undefined, + "textAlignment": "left", + }, + "content": [ + { + "text": "Numbered List Item 2", + "type": "text", + }, + ], + "type": "numberedListItem", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "id": "5", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "checked": false, + "textAlignment": "left", + }, + "content": [ + { + "text": "Check List Item 1", + "type": "text", + }, + ], + "type": "checkListItem", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "6", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "checked": true, + "textAlignment": "left", + }, + "content": [ + { + "text": "Check List Item 2", + "type": "text", + }, + ], + "type": "checkListItem", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json new file mode 100644 index 0000000000..f054006323 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json @@ -0,0 +1,15 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "type": "pageBreak", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json new file mode 100644 index 0000000000..03c5eb0a1b --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json @@ -0,0 +1,24 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Paragraph", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json new file mode 100644 index 0000000000..34dcd51ce9 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json @@ -0,0 +1,18 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json new file mode 100644 index 0000000000..14d1230246 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json @@ -0,0 +1,31 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Line 1", + "type": "text", + }, + { + "type": "hardBreak", + }, + { + "text": "Line 2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json new file mode 100644 index 0000000000..8b7532615d --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json @@ -0,0 +1,73 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Paragraph", + "type": "text", + }, + ], + "type": "paragraph", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "id": "2", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Nested Paragraph 1", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, + { + "attrs": { + "backgroundColor": "default", + "id": "3", + "textColor": "default", + }, + "content": [ + { + "attrs": { + "textAlignment": "left", + }, + "content": [ + { + "text": "Nested Paragraph 2", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, + ], + "type": "blockGroup", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json new file mode 100644 index 0000000000..debf389327 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json @@ -0,0 +1,66 @@ +[ + { + "attrs": { + "backgroundColor": "pink", + "id": "1", + "textColor": "orange", + }, + "content": [ + { + "attrs": { + "textAlignment": "center", + }, + "content": [ + { + "text": "Plain ", + "type": "text", + }, + { + "marks": [ + { + "attrs": { + "stringValue": "red", + }, + "type": "textColor", + }, + ], + "text": "Red Text ", + "type": "text", + }, + { + "marks": [ + { + "attrs": { + "stringValue": "blue", + }, + "type": "backgroundColor", + }, + ], + "text": "Blue Background ", + "type": "text", + }, + { + "marks": [ + { + "attrs": { + "stringValue": "red", + }, + "type": "textColor", + }, + { + "attrs": { + "stringValue": "blue", + }, + "type": "backgroundColor", + }, + ], + "text": "Mixed Colors", + "type": "text", + }, + ], + "type": "paragraph", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json new file mode 100644 index 0000000000..519391c98f --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json @@ -0,0 +1,248 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 200, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 200, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 200, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/basic.json new file mode 100644 index 0000000000..8fd5f7f2d3 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/basic.json @@ -0,0 +1,230 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json new file mode 100644 index 0000000000..3933a56ca3 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json @@ -0,0 +1,230 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json new file mode 100644 index 0000000000..dc9ee26a35 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json @@ -0,0 +1,230 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableHeader", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json new file mode 100644 index 0000000000..69b25e9bfa --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json @@ -0,0 +1,242 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "red", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "blue", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "blue", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "yellow", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "red", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json new file mode 100644 index 0000000000..60600bb04e --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json @@ -0,0 +1,242 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": null, + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json new file mode 100644 index 0000000000..11fb672923 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json @@ -0,0 +1,178 @@ +[ + { + "attrs": { + "backgroundColor": "default", + "id": "1", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "content": [ + { + "attrs": { + "backgroundColor": "red", + "colspan": 2, + "colwidth": [ + 100, + 200, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "blue", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "yellow", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "red", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 100, + ], + "rowspan": 2, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 2, + "colwidth": [ + 200, + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + { + "content": [ + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 200, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + { + "attrs": { + "backgroundColor": "default", + "colspan": 1, + "colwidth": [ + 300, + ], + "rowspan": 1, + "textAlignment": "left", + "textColor": "default", + }, + "content": [ + { + "content": [ + { + "text": "Table Cell", + "type": "text", + }, + ], + "type": "tableParagraph", + }, + ], + "type": "tableCell", + }, + ], + "type": "tableRow", + }, + ], + "type": "table", + }, + ], + "type": "blockContainer", + }, +] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/getExportTestCases.ts b/packages/react/src/tests/formatConversion/export/getExportTestCases.ts new file mode 100644 index 0000000000..a672fed500 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/getExportTestCases.ts @@ -0,0 +1,428 @@ +import { ExportTestCase } from "@blocknote/core"; + +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; + +export const getExportTestCases = ( + conversionType: ExportTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >["conversionType"] +): ExportTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => [ + { + name: "reactFile/button", + conversionType, + content: [ + { + type: "file", + }, + ], + }, + { + name: "reactFile/basic", + conversionType, + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + { + name: "reactFile/noName", + conversionType, + content: [ + { + type: "file", + props: { + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + { + name: "reactFile/noCaption", + conversionType, + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + }, + }, + ], + }, + { + name: "reactFile/nested", + conversionType, + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + children: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + ], + }, + // Because images need to fetch the download URL async, their internal HTML + // is initially rendered without a `src` attribute, which is reflected in + // the tests. + { + name: "reactImage/button", + conversionType, + content: [ + { + type: "image", + }, + ], + }, + { + name: "reactImage/basic", + conversionType, + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + { + name: "reactImage/noName", + conversionType, + content: [ + { + type: "image", + props: { + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + { + name: "reactImage/noCaption", + conversionType, + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + previewWidth: 256, + }, + }, + ], + }, + { + name: "reactImage/noPreview", + conversionType, + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + showPreview: false, + previewWidth: 256, + }, + }, + ], + }, + { + name: "reactImage/nested", + conversionType, + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + children: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + ], + }, + { + name: "customParagraph/basic", + conversionType, + content: [ + { + type: "customParagraph", + content: "React Custom Paragraph", + }, + ], + }, + { + name: "customParagraph/styled", + conversionType, + content: [ + { + type: "customParagraph", + props: { + textAlignment: "center", + textColor: "orange", + backgroundColor: "pink", + }, + content: [ + { + type: "text", + styles: {}, + text: "Plain ", + }, + { + type: "text", + styles: { + textColor: "red", + }, + text: "Red Text ", + }, + { + type: "text", + styles: { + backgroundColor: "blue", + }, + text: "Blue Background ", + }, + { + type: "text", + styles: { + textColor: "red", + backgroundColor: "blue", + }, + text: "Mixed Colors", + }, + ], + }, + ], + }, + { + name: "customParagraph/nested", + conversionType, + content: [ + { + type: "customParagraph", + content: "React Custom Paragraph", + children: [ + { + type: "customParagraph", + content: "Nested React Custom Paragraph 1", + }, + { + type: "customParagraph", + content: "Nested React Custom Paragraph 2", + }, + ], + }, + ], + }, + { + name: "customParagraph/lineBreaks", + conversionType, + content: [ + { + type: "customParagraph", + content: "Line 1\nLine 2", + }, + ], + }, + { + name: "simpleCustomParagraph/basic", + conversionType, + content: [ + { + type: "simpleCustomParagraph", + content: "React Custom Paragraph", + }, + ], + }, + { + name: "simpleCustomParagraph/styled", + conversionType, + content: [ + { + type: "simpleCustomParagraph", + props: { + textAlignment: "center", + textColor: "orange", + backgroundColor: "pink", + }, + content: [ + { + type: "text", + styles: {}, + text: "Plain ", + }, + { + type: "text", + styles: { + textColor: "red", + }, + text: "Red Text ", + }, + { + type: "text", + styles: { + backgroundColor: "blue", + }, + text: "Blue Background ", + }, + { + type: "text", + styles: { + textColor: "red", + backgroundColor: "blue", + }, + text: "Mixed Colors", + }, + ], + }, + ], + }, + { + name: "simpleCustomParagraph/nested", + conversionType, + content: [ + { + type: "simpleCustomParagraph", + content: "Custom React Paragraph", + children: [ + { + type: "simpleCustomParagraph", + content: "Nested React Custom Paragraph 1", + }, + { + type: "simpleCustomParagraph", + content: "Nested React Custom Paragraph 2", + }, + ], + }, + ], + }, + { + name: "contextParagraph/basic", + conversionType, + content: [ + { + type: "contextParagraph", + content: "React Context Paragraph", + }, + ], + }, + { + name: "mention/basic", + conversionType, + content: [ + { + type: "paragraph", + content: [ + "I enjoy working with ", + { + type: "mention", + props: { + user: "Matthew", + }, + content: undefined, + } as const, + ], + }, + ], + }, + { + name: "tag/basic", + conversionType, + content: [ + { + type: "paragraph", + content: [ + "I love ", + { + type: "tag", + // props: {}, + content: "BlockNote", + } as const, + ], + }, + ], + }, + { + name: "small/basic", + conversionType, + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "This is a small text", + styles: { + small: true, + }, + }, + ], + }, + ], + }, + { + name: "fontSize/basic", + conversionType, + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "This is text with a custom fontSize", + styles: { + fontSize: "18px", + }, + }, + ], + }, + ], + }, +]; diff --git a/packages/react/src/tests/formatConversion/export/testExport.test.ts b/packages/react/src/tests/formatConversion/export/testExport.test.ts new file mode 100644 index 0000000000..e7c28ea18f --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/testExport.test.ts @@ -0,0 +1,19 @@ +import { testExport } from "@blocknote/core"; +import { describe, it } from "vitest"; + +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; +import { getExportTestCases } from "./getExportTestCases.js"; + +describe("Export tests", () => { + const getEditor = setupTestEditor(testSchema); + + for (const testCase of [ + ...getExportTestCases("blocknoteHTML"), + ...getExportTestCases("html"), + ]) { + it(`${testCase.name}`, async () => { + await testExport(getEditor(), testCase); + }); + } +}); diff --git a/packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts b/packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts new file mode 100644 index 0000000000..d544631d21 --- /dev/null +++ b/packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts @@ -0,0 +1,25 @@ +import { ExportParseEqualityTestCase } from "@blocknote/core"; + +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { getExportTestCases } from "../export/getExportTestCases.js"; + +export const getExportParseEqualityTestCases = ( + conversionType: ExportParseEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >["conversionType"] +): ExportParseEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => + getExportTestCases(conversionType).map(({ name, content }) => ({ + name, + conversionType, + content, + })); diff --git a/packages/react/src/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts b/packages/react/src/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts new file mode 100644 index 0000000000..a67b816041 --- /dev/null +++ b/packages/react/src/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts @@ -0,0 +1,19 @@ +import { testExportParseEquality } from "@blocknote/core"; +import { describe, it } from "vitest"; + +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; +import { getExportParseEqualityTestCases } from "./getExportParseEqualityTestCases.js"; + +describe("Export/parse equality tests", () => { + const getEditor = setupTestEditor(testSchema); + + for (const testCase of [ + ...getExportParseEqualityTestCases("blocknoteHTML"), + ...getExportParseEqualityTestCases("nodes"), + ]) { + it(`${testCase.name}`, async () => { + await testExportParseEquality(getEditor(), testCase); + }); + } +}); diff --git a/packages/react/src/tests/setupTestEditor.tsx b/packages/react/src/tests/setupTestEditor.tsx new file mode 100644 index 0000000000..dda19195a2 --- /dev/null +++ b/packages/react/src/tests/setupTestEditor.tsx @@ -0,0 +1,66 @@ +import { + BlockNoteEditor, + BlockNoteSchema, + BlockSchema, + initializeESMDependencies, + InlineContentSchema, + StyleSchema, +} from "@blocknote/core"; +import { flushSync } from "react-dom"; +import { createRoot, Root } from "react-dom/client"; +import { afterAll, beforeAll } from "vitest"; + +import { BlockNoteViewRaw } from "../editor/BlockNoteView.js"; +import { TestContext } from "./testSchema.js"; + +export const setupTestEditor = < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + schema: BlockNoteSchema +): (() => BlockNoteEditor) => { + let editor: BlockNoteEditor; + const div = document.createElement("div"); + + // Note that we don't necessarily need to mount a root (unless we need a React Context) + // Currently, we do mount to a root so that it reflects the "production" use-case more closely. + + // However, it would be nice to increased converage and share the same set of tests for these cases: + // - does render to a root + // - does not render to a root + // - runs in server (jsdom) environment using server-util + let root: Root; + + beforeAll(async () => { + (window as any).__TEST_OPTIONS = (window as any).__TEST_OPTIONS || {}; + + editor = BlockNoteEditor.create({ + schema, + trailingBlock: false, + }); + + const el = ( + + + + ); + root = createRoot(div); + flushSync(() => { + // eslint-disable-next-line testing-library/no-render-in-setup + root.render(el); + }); + + await initializeESMDependencies(); + }); + + afterAll(() => { + root.unmount(); + editor._tiptapEditor.destroy(); + editor = undefined as any; + + delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS; + }); + + return () => editor; +}; diff --git a/packages/react/src/tests/testSchema.tsx b/packages/react/src/tests/testSchema.tsx new file mode 100644 index 0000000000..e430ec6644 --- /dev/null +++ b/packages/react/src/tests/testSchema.tsx @@ -0,0 +1,156 @@ +import { + BlockNoteSchema, + defaultBlockSpecs, + defaultInlineContentSpecs, + defaultProps, + defaultStyleSpecs, + PageBreak, +} from "@blocknote/core"; +import { createContext, useContext } from "react"; + +import { createReactBlockSpec } from "../schema/ReactBlockSpec.js"; +import { createReactInlineContentSpec } from "../schema/ReactInlineContentSpec.js"; +import { createReactStyleSpec } from "../schema/ReactStyleSpec.js"; + +// BLOCKS ---------------------------------------------------------------------- + +const CustomParagraph = createReactBlockSpec( + { + type: "customParagraph", + propSchema: defaultProps, + content: "inline", + }, + { + render: (props) => ( +

+ ), + toExternalHTML: () => ( +

Hello World

+ ), + } +); + +const SimpleCustomParagraph = createReactBlockSpec( + { + type: "simpleCustomParagraph", + propSchema: defaultProps, + content: "inline", + }, + { + render: (props) => ( +

+ ), + } +); + +export const TestContext = createContext(undefined); + +const ContextParagraphComponent = (props: any) => { + const testData = useContext(TestContext); + if (testData === undefined) { + throw Error(); + } + + return

; +}; + +const ContextParagraph = createReactBlockSpec( + { + type: "contextParagraph", + propSchema: defaultProps, + content: "inline", + }, + { + render: ContextParagraphComponent, + } +); + +// INLINE CONTENT -------------------------------------------------------------- + +const Mention = createReactInlineContentSpec( + { + type: "mention", + propSchema: { + user: { + default: "", + }, + }, + content: "none", + }, + { + render: (props) => { + return @{props.inlineContent.props.user}; + }, + } +); + +const Tag = createReactInlineContentSpec( + { + type: "tag", + propSchema: {}, + content: "styled", + }, + { + render: (props) => { + return ( + + # + + ); + }, + } +); + +// STYLES ---------------------------------------------------------------------- + +const Small = createReactStyleSpec( + { + type: "small", + propSchema: "boolean", + }, + { + render: (props) => { + return ; + }, + } +); + +const FontSize = createReactStyleSpec( + { + type: "fontSize", + propSchema: "string", + }, + { + render: (props) => { + return ( + + ); + }, + } +); + +// SCHEMA ---------------------------------------------------------------------- + +export const testSchema = BlockNoteSchema.create({ + blockSpecs: { + ...defaultBlockSpecs, + pageBreak: PageBreak, + customParagraph: CustomParagraph, + simpleCustomParagraph: SimpleCustomParagraph, + contextParagraph: ContextParagraph, + }, + inlineContentSpecs: { + ...defaultInlineContentSpecs, + mention: Mention, + tag: Tag, + }, + styleSpecs: { + ...defaultStyleSpecs, + small: Small, + fontSize: FontSize, + }, +}); + +export type TestBlockSchema = typeof testSchema.blockSchema; +export type TestInlineContentSchema = typeof testSchema.inlineContentSchema; +export type TestStyleSchema = typeof testSchema.styleSchema; From 96d202b6bf644a7e0652fe976ff370ee24fe3326 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Wed, 9 Apr 2025 20:54:26 +0200 Subject: [PATCH 05/12] Made test functions pluggable for test cases --- .../api/tests/clipboard/clipboardTestUtil.ts | 33 + .../api/tests/clipboard/copy/copyTestCase.ts | 19 + .../tests/clipboard/copy/copyTestExecutors.ts | 69 + .../tests/clipboard/copy/getCopyTestCases.ts | 619 ------- .../clipboard/copy/getCopyTestInstances.ts | 636 +++++++ .../api/tests/clipboard/copy/runTests.test.ts | 18 + .../api/tests/clipboard/copy/testCopy.test.ts | 74 - .../clipboard/copyPaste/copyPasteTestCase.ts | 20 + .../copyPaste/copyPasteTestExecutors.ts | 45 + .../copyPaste/getCopyPasteTestCases.ts | 58 - .../copyPaste/getCopyPasteTestInstances.ts | 47 + .../clipboard/copyPaste/runTests.test.ts | 17 + .../clipboard/copyPaste/testCopyPaste.test.ts | 73 - ...tCases.ts => copyPasteEqualityTestCase.ts} | 17 - .../copyPasteEqualityTestExecutors.ts | 43 + .../getCopyPasteEqualityTestInstances.ts | 28 + .../copyPasteEquality/runTests.test.ts | 18 + .../testCopyPasteEquality.test.ts | 68 - .../clipboard/paste/getPasteTestCases.ts | 158 -- .../clipboard/paste/getPasteTestInstances.ts | 155 ++ .../tests/clipboard/paste/pasteTestCase.ts | 20 + .../clipboard/paste/pasteTestExecutors.ts | 56 + .../tests/clipboard/paste/runTests.test.ts | 19 + .../tests/clipboard/paste/testPaste.test.ts | 60 - .../formatConversion/export/exportTestCase.ts | 15 + .../export/exportTestExecutors.ts | 86 + .../export/getExportTestCases.ts | 1527 ---------------- .../export/getExportTestInstances.ts | 1597 +++++++++++++++++ .../formatConversion/export/runTests.test.ts | 29 + .../export/testExport.test.ts | 80 - .../exportParseEqualityTestCase.ts | 15 + .../exportParseEqualityTestExecutors.ts | 64 + .../getExportParseEqualityTestCases.ts | 42 - .../getExportParseEqualityTestInstances.ts | 31 + .../exportParseEquality/runTests.test.ts | 27 + .../testExportParseEquality.test.ts | 77 - .../formatConversion/parse/parseTestCase.ts | 4 + .../parse/parseTestExecutors.ts | 39 + ...arseTestCases.ts => parseTestInstances.ts} | 197 +- .../formatConversion/parse/runTests.test.ts | 19 + .../formatConversion/parse/testParse.test.ts | 52 - packages/core/src/api/tests/types.ts | 23 + packages/core/src/index.ts | 33 +- .../export/__snapshots__/markdown/basic.json | 71 - .../markdown/boldWithWhitespace.json | 19 - .../markdown/codeBlock/contains-newlines.md | 4 - .../markdown/codeBlock/defaultLanguage.md | 3 - .../__snapshots__/markdown/codeBlock/empty.md | 2 - .../markdown/codeBlock/python.md | 3 - .../__snapshots__/markdown/complex.json | 353 ---- .../__snapshots__/markdown/complex/misc.md | 5 - .../__snapshots__/markdown/file/basic.md | 3 - .../__snapshots__/markdown/file/button.md | 1 - .../__snapshots__/markdown/file/nested.md | 7 - .../__snapshots__/markdown/file/noCaption.md | 1 - .../__snapshots__/markdown/file/noName.md | 3 - .../__snapshots__/markdown/hardbreak/basic.md | 2 - .../markdown/hardbreak/between-links.md | 2 - .../__snapshots__/markdown/hardbreak/end.md | 1 - .../__snapshots__/markdown/hardbreak/link.md | 2 - .../markdown/hardbreak/multiple.md | 3 - .../__snapshots__/markdown/hardbreak/only.md | 0 .../__snapshots__/markdown/hardbreak/start.md | 1 - .../markdown/hardbreak/styles.md | 2 - .../__snapshots__/markdown/image/basic.md | 3 - .../__snapshots__/markdown/image/button.md | 1 - .../__snapshots__/markdown/image/nested.md | 7 - .../__snapshots__/markdown/image/noCaption.md | 1 - .../__snapshots__/markdown/image/noName.md | 3 - .../__snapshots__/markdown/image/noPreview.md | 3 - .../__snapshots__/markdown/issue226case1.json | 71 - .../__snapshots__/markdown/issue226case2.json | 144 -- .../__snapshots__/markdown/link/adjacent.md | 1 - .../__snapshots__/markdown/link/basic.md | 1 - .../__snapshots__/markdown/link/styled.md | 1 - .../__snapshots__/markdown/lists/basic.md | 10 - .../__snapshots__/markdown/lists/nested.md | 10 - .../export/__snapshots__/markdown/nested.json | 72 - .../__snapshots__/markdown/pageBreak/basic.md | 0 .../__snapshots__/markdown/paragraph/basic.md | 1 - .../__snapshots__/markdown/paragraph/empty.md | 0 .../markdown/paragraph/lineBreaks.md | 2 - .../markdown/paragraph/nested.md | 5 - .../markdown/paragraph/styled.md | 1 - .../export/__snapshots__/markdown/styled.json | 58 - .../markdown/table/allColWidths.md | 5 - .../__snapshots__/markdown/table/basic.md | 5 - .../markdown/table/headerCols.md | 4 - .../markdown/table/headerRows.md | 4 - .../markdown/table/mixedCellColors.md | 5 - .../markdown/table/mixedColWidths.md | 5 - .../table/mixedRowspansAndColspans.md | 5 - .../nodes/codeBlock/contains-newlines.json | 26 - .../nodes/codeBlock/defaultLanguage.json | 24 - .../__snapshots__/nodes/codeBlock/empty.json | 18 - .../__snapshots__/nodes/codeBlock/python.json | 24 - .../__snapshots__/nodes/complex/misc.json | 88 - .../__snapshots__/nodes/file/basic.json | 20 - .../__snapshots__/nodes/file/button.json | 20 - .../__snapshots__/nodes/file/nested.json | 43 - .../__snapshots__/nodes/file/noCaption.json | 20 - .../__snapshots__/nodes/file/noName.json | 20 - .../__snapshots__/nodes/hardbreak/basic.json | 31 - .../nodes/hardbreak/between-links.json | 53 - .../__snapshots__/nodes/hardbreak/end.json | 27 - .../__snapshots__/nodes/hardbreak/link.json | 53 - .../nodes/hardbreak/multiple.json | 38 - .../__snapshots__/nodes/hardbreak/only.json | 23 - .../__snapshots__/nodes/hardbreak/start.json | 27 - .../__snapshots__/nodes/hardbreak/styles.json | 36 - .../__snapshots__/nodes/image/basic.json | 23 - .../__snapshots__/nodes/image/button.json | 23 - .../__snapshots__/nodes/image/nested.json | 49 - .../__snapshots__/nodes/image/noCaption.json | 23 - .../__snapshots__/nodes/image/noName.json | 23 - .../__snapshots__/nodes/image/noPreview.json | 23 - .../__snapshots__/nodes/link/adjacent.json | 50 - .../__snapshots__/nodes/link/basic.json | 35 - .../__snapshots__/nodes/link/styled.json | 53 - .../__snapshots__/nodes/lists/basic.json | 140 -- .../__snapshots__/nodes/lists/nested.json | 150 -- .../__snapshots__/nodes/pageBreak/basic.json | 15 - .../__snapshots__/nodes/paragraph/basic.json | 24 - .../__snapshots__/nodes/paragraph/empty.json | 18 - .../nodes/paragraph/lineBreaks.json | 31 - .../__snapshots__/nodes/paragraph/nested.json | 73 - .../__snapshots__/nodes/paragraph/styled.json | 66 - .../nodes/table/allColWidths.json | 248 --- .../__snapshots__/nodes/table/basic.json | 230 --- .../__snapshots__/nodes/table/headerCols.json | 230 --- .../__snapshots__/nodes/table/headerRows.json | 230 --- .../nodes/table/mixedCellColors.json | 242 --- .../nodes/table/mixedColWidths.json | 242 --- .../nodes/table/mixedRowspansAndColspans.json | 178 -- .../export/getExportTestCases.ts | 428 ----- .../export/getExportTestInstances.ts | 476 +++++ .../export/testExport.test.ts | 14 +- .../getExportParseEqualityTestCases.ts | 25 - .../getExportParseEqualityTestInstances.ts | 34 + .../exportParseEquality/runTests.test.ts | 24 + .../testExportParseEquality.test.ts | 19 - 141 files changed, 3875 insertions(+), 7398 deletions(-) create mode 100644 packages/core/src/api/tests/clipboard/copy/copyTestCase.ts create mode 100644 packages/core/src/api/tests/clipboard/copy/copyTestExecutors.ts delete mode 100644 packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts create mode 100644 packages/core/src/api/tests/clipboard/copy/getCopyTestInstances.ts create mode 100644 packages/core/src/api/tests/clipboard/copy/runTests.test.ts delete mode 100644 packages/core/src/api/tests/clipboard/copy/testCopy.test.ts create mode 100644 packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestCase.ts create mode 100644 packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestExecutors.ts delete mode 100644 packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts create mode 100644 packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestInstances.ts create mode 100644 packages/core/src/api/tests/clipboard/copyPaste/runTests.test.ts delete mode 100644 packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts rename packages/core/src/api/tests/clipboard/copyPasteEquality/{getCopyPasteEqualityTestCases.ts => copyPasteEqualityTestCase.ts} (51%) create mode 100644 packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.ts create mode 100644 packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts create mode 100644 packages/core/src/api/tests/clipboard/copyPasteEquality/runTests.test.ts delete mode 100644 packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts delete mode 100644 packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts create mode 100644 packages/core/src/api/tests/clipboard/paste/getPasteTestInstances.ts create mode 100644 packages/core/src/api/tests/clipboard/paste/pasteTestCase.ts create mode 100644 packages/core/src/api/tests/clipboard/paste/pasteTestExecutors.ts create mode 100644 packages/core/src/api/tests/clipboard/paste/runTests.test.ts delete mode 100644 packages/core/src/api/tests/clipboard/paste/testPaste.test.ts create mode 100644 packages/core/src/api/tests/formatConversion/export/exportTestCase.ts create mode 100644 packages/core/src/api/tests/formatConversion/export/exportTestExecutors.ts delete mode 100644 packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts create mode 100644 packages/core/src/api/tests/formatConversion/export/getExportTestInstances.ts create mode 100644 packages/core/src/api/tests/formatConversion/export/runTests.test.ts delete mode 100644 packages/core/src/api/tests/formatConversion/export/testExport.test.ts create mode 100644 packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestCase.ts create mode 100644 packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.ts delete mode 100644 packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts create mode 100644 packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts create mode 100644 packages/core/src/api/tests/formatConversion/exportParseEquality/runTests.test.ts delete mode 100644 packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts create mode 100644 packages/core/src/api/tests/formatConversion/parse/parseTestCase.ts create mode 100644 packages/core/src/api/tests/formatConversion/parse/parseTestExecutors.ts rename packages/core/src/api/tests/formatConversion/parse/{getParseTestCases.ts => parseTestInstances.ts} (88%) create mode 100644 packages/core/src/api/tests/formatConversion/parse/runTests.test.ts delete mode 100644 packages/core/src/api/tests/formatConversion/parse/testParse.test.ts create mode 100644 packages/core/src/api/tests/types.ts delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/basic.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/boldWithWhitespace.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/basic.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/button.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/nested.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noName.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/only.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/basic.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/button.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/nested.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noName.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case1.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case2.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/basic.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/styled.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/nested.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/empty.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/styled.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/basic.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/basic.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/button.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/nested.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noName.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/basic.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/button.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/nested.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noName.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/basic.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/styled.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/basic.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json delete mode 100644 packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json delete mode 100644 packages/react/src/tests/formatConversion/export/getExportTestCases.ts create mode 100644 packages/react/src/tests/formatConversion/export/getExportTestInstances.ts delete mode 100644 packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts create mode 100644 packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts create mode 100644 packages/react/src/tests/formatConversion/exportParseEquality/runTests.test.ts delete mode 100644 packages/react/src/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts diff --git a/packages/core/src/api/tests/clipboard/clipboardTestUtil.ts b/packages/core/src/api/tests/clipboard/clipboardTestUtil.ts index b7a54db524..3523150840 100644 --- a/packages/core/src/api/tests/clipboard/clipboardTestUtil.ts +++ b/packages/core/src/api/tests/clipboard/clipboardTestUtil.ts @@ -1,7 +1,16 @@ import { Node, Slice } from "@tiptap/pm/model"; +import { Selection } from "@tiptap/pm/state"; import { EditorView } from "@tiptap/pm/view"; import * as pmView from "@tiptap/pm/view"; +import { PartialBlock } from "../../../blocks/defaultBlocks.js"; +import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../schema/index.js"; + // Helper function to get the position of a text node with given text content. // By default, returns the position just before the node, but can be just after // instead if `after` is set to true. @@ -49,6 +58,30 @@ export const getPosOfTableCellNode = (doc: Node, textContent: string) => { return ret; }; +export const setupClipboardTest = < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + document: PartialBlock[], + getSelection: (pmDoc: Node) => Selection +) => { + if (!editor.prosemirrorView) { + throw new Error("Editor view not initialized."); + } + + (window as any).__TEST_OPTIONS.mockID = 0; + + editor.replaceBlocks(editor.document, document); + + editor.dispatch( + editor._tiptapEditor.state.tr.setSelection( + getSelection(editor.prosemirrorView.state.doc) + ) + ); +}; + function sliceSingleNode(slice: Slice) { return slice.openStart === 0 && slice.openEnd === 0 && diff --git a/packages/core/src/api/tests/clipboard/copy/copyTestCase.ts b/packages/core/src/api/tests/clipboard/copy/copyTestCase.ts new file mode 100644 index 0000000000..71f8970576 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/copyTestCase.ts @@ -0,0 +1,19 @@ +import { Node } from "@tiptap/pm/model"; +import { Selection } from "@tiptap/pm/state"; + +import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; + +export type CopyTestCase< + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = { + name: string; + document: PartialBlock[]; + getCopySelection: (pmDoc: Node) => Selection; +}; diff --git a/packages/core/src/api/tests/clipboard/copy/copyTestExecutors.ts b/packages/core/src/api/tests/clipboard/copy/copyTestExecutors.ts new file mode 100644 index 0000000000..1981088ccf --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/copyTestExecutors.ts @@ -0,0 +1,69 @@ +import { prettify } from "htmlfy"; +import { expect } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; +import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; +import { setupClipboardTest } from "../clipboardTestUtil.js"; +import { CopyTestCase } from "./copyTestCase.js"; + +export const testCopyBlockNoteHTML = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: CopyTestCase +) => { + setupClipboardTest(editor, testCase.document, testCase.getCopySelection); + + const { clipboardHTML } = selectedFragmentToHTML( + editor.prosemirrorView!, + editor + ); + + await expect(prettify(clipboardHTML, { tag_wrap: true })).toMatchFileSnapshot( + `./__snapshots__/blocknote/html/${testCase.name}.html` + ); +}; + +export const testCopyHTML = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: CopyTestCase +) => { + setupClipboardTest(editor, testCase.document, testCase.getCopySelection); + + const { externalHTML } = selectedFragmentToHTML( + editor.prosemirrorView!, + editor + ); + + await expect(prettify(externalHTML, { tag_wrap: true })).toMatchFileSnapshot( + `./__snapshots__/text/html/${testCase.name}.html` + ); +}; + +export const testCopyMarkdown = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: CopyTestCase +) => { + setupClipboardTest(editor, testCase.document, testCase.getCopySelection); + + const { markdown } = selectedFragmentToHTML(editor.prosemirrorView!, editor); + + await expect(markdown).toMatchFileSnapshot( + `./__snapshots__/text/plain/${testCase.name}.md` + ); +}; diff --git a/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts b/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts deleted file mode 100644 index f9b2b1dedc..0000000000 --- a/packages/core/src/api/tests/clipboard/copy/getCopyTestCases.ts +++ /dev/null @@ -1,619 +0,0 @@ -import { Node } from "@tiptap/pm/model"; -import { NodeSelection, Selection, TextSelection } from "@tiptap/pm/state"; -import { CellSelection } from "@tiptap/pm/tables"; - -import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; -import { - getPosOfTableCellNode, - getPosOfTextNode, -} from "../clipboardTestUtil.js"; - -export type CopyTestCase< - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema -> = { - name: string; - // At some point we probably want to only have one HTML format that is both - // lossless when converting to/from blocks, in which case we will only need - // "html" test cases and can remove "blockNoteHTML". - clipboardDataType: "blocknote/html" | "text/html" | "text/plain"; - document: PartialBlock[]; - getCopySelection: (pmDoc: Node) => Selection; -}; - -export const getCopyTestCases = (): CopyTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema ->[] => [ - { - name: "multipleChildren", - clipboardDataType: "text/html", - document: [ - { - type: "paragraph", - content: "Paragraph 1", - children: [ - { - type: "paragraph", - content: "Nested Paragraph 1", - }, - { - type: "paragraph", - content: "Nested Paragraph 2", - }, - { - type: "paragraph", - content: "Nested Paragraph 3", - }, - ], - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Nested Paragraph 1"); - const endPos = getPosOfTextNode(doc, "Nested Paragraph 3", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, - { - name: "childToParent", - clipboardDataType: "text/html", - document: [ - { - type: "paragraph", - content: "Paragraph 1", - children: [ - { - type: "paragraph", - content: "Nested Paragraph 1", - }, - { - type: "paragraph", - content: "Nested Paragraph 2", - }, - { - type: "paragraph", - content: "Nested Paragraph 3", - }, - ], - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Paragraph 1"); - const endPos = getPosOfTextNode(doc, "Nested Paragraph 1", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, - { - name: "partialChildToParent", - clipboardDataType: "text/html", - document: [ - { - type: "paragraph", - content: "Paragraph 1", - children: [ - { - type: "paragraph", - content: "Nested Paragraph 1", - }, - { - type: "paragraph", - content: "Nested Paragraph 2", - }, - { - type: "paragraph", - content: "Nested Paragraph 3", - }, - ], - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Paragraph 1") + 1; - const endPos = getPosOfTextNode(doc, "Nested Paragraph 1") + 1; - - return TextSelection.create(doc, startPos, endPos); - }, - }, - { - name: "childrenToNextParent", - clipboardDataType: "text/html", - document: [ - { - type: "paragraph", - content: "Paragraph 1", - children: [ - { - type: "paragraph", - content: "Nested Paragraph 1", - }, - { - type: "paragraph", - content: "Nested Paragraph 2", - }, - { - type: "paragraph", - content: "Nested Paragraph 3", - }, - ], - }, - { - type: "paragraph", - content: "Paragraph 2", - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Nested Paragraph 1"); - const endPos = getPosOfTextNode(doc, "Paragraph 2", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, - { - name: "childrenToNextParentsChildren", - clipboardDataType: "text/html", - document: [ - { - type: "paragraph", - content: "Paragraph 1", - children: [ - { - type: "paragraph", - content: "Nested Paragraph 1", - }, - { - type: "paragraph", - content: "Nested Paragraph 2", - }, - { - type: "paragraph", - content: "Nested Paragraph 3", - }, - ], - }, - { - type: "paragraph", - content: "Paragraph 2", - children: [ - { - type: "paragraph", - content: "Nested Paragraph 4", - }, - { - type: "paragraph", - content: "Nested Paragraph 5", - }, - { - type: "paragraph", - content: "Nested Paragraph 6", - }, - ], - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Nested Paragraph 1"); - const endPos = getPosOfTextNode(doc, "Nested Paragraph 6", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, - { - name: "unstyledText", - clipboardDataType: "text/html", - document: [ - { - type: "heading", - content: "Unstyled Text", - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Unstyled Text"); - const endPos = getPosOfTextNode(doc, "Unstyled Text", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, - { - name: "styledText", - clipboardDataType: "text/html", - document: [ - { - type: "paragraph", - content: [ - { - type: "text", - text: "Unstyled Text", - styles: {}, - }, - { - type: "text", - text: "Italic Text", - styles: { - italic: true, - }, - }, - ], - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Italic Text"); - const endPos = getPosOfTextNode(doc, "Italic Text", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, - { - name: "multipleStyledText", - clipboardDataType: "text/html", - document: [ - { - type: "paragraph", - content: [ - { - type: "text", - text: "Unstyled Text", - styles: {}, - }, - { - type: "text", - text: "Italic Text", - styles: { - italic: true, - }, - }, - { - type: "text", - text: "Bold Text", - styles: { - bold: true, - }, - }, - ], - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Unstyled Text"); - const endPos = getPosOfTextNode(doc, "Bold Text", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, - { - name: "image", - clipboardDataType: "text/html", - document: [ - { - type: "image", - props: { - url: "https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg", - }, - }, - ], - getCopySelection: (doc) => { - let startPos: number | undefined = undefined; - - doc.descendants((node, pos) => { - if (node.type.name === "image") { - startPos = pos; - } - }); - - if (startPos === undefined) { - throw new Error("Image node not found."); - } - - return NodeSelection.create(doc, startPos); - }, - }, - { - name: "nestedImage", - clipboardDataType: "text/html", - document: [ - { - type: "paragraph", - content: "Paragraph 1", - children: [ - { - type: "image", - props: { - url: "https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg", - }, - children: [ - { - type: "paragraph", - content: "Nested Paragraph 1", - }, - ], - }, - ], - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Paragraph 1"); - const endPos = getPosOfTextNode(doc, "Nested Paragraph 1", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, - { - name: "tableCellText", - clipboardDataType: "text/html", - document: [ - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [["Table Cell 1"], ["Table Cell 2"]], - }, - { - cells: [["Table Cell 3"], ["Table Cell 4"]], - }, - ], - }, - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Table Cell 1"); - const endPos = getPosOfTextNode(doc, "Table Cell 1", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, - { - name: "tableCell", - clipboardDataType: "text/html", - document: [ - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [["Table Cell 1"], ["Table Cell 2"]], - }, - { - cells: [["Table Cell 3"], ["Table Cell 4"]], - }, - ], - }, - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); - - return CellSelection.create(doc, startPos); - }, - }, - { - name: "tableRow", - clipboardDataType: "text/html", - document: [ - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [["Table Cell 1"], ["Table Cell 2"]], - }, - { - cells: [["Table Cell 3"], ["Table Cell 4"]], - }, - ], - }, - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); - const endPos = getPosOfTableCellNode(doc, "Table Cell 2"); - - return CellSelection.create(doc, startPos, endPos); - }, - }, - { - name: "tableCol", - clipboardDataType: "text/html", - document: [ - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [["Table Cell 1"], ["Table Cell 2"]], - }, - { - cells: [["Table Cell 3"], ["Table Cell 4"]], - }, - ], - }, - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); - const endPos = getPosOfTableCellNode(doc, "Table Cell 3"); - - return CellSelection.create(doc, startPos, endPos); - }, - }, - { - name: "tableAllCells", - clipboardDataType: "text/html", - document: [ - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [["Table Cell 1"], ["Table Cell 2"]], - }, - { - cells: [["Table Cell 3"], ["Table Cell 4"]], - }, - ], - }, - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); - const endPos = getPosOfTableCellNode(doc, "Table Cell 4"); - - return CellSelection.create(doc, startPos, endPos); - }, - }, - // TODO: 2 tests below necessary? - { - name: "basicBlocks", - clipboardDataType: "text/html", - document: [ - { - type: "paragraph", - content: "Paragraph 1", - }, - { - type: "heading", - content: "Heading 1", - }, - { - type: "numberedListItem", - content: "Numbered List Item 1", - }, - { - type: "bulletListItem", - content: "Bullet List Item 1", - }, - { - type: "checkListItem", - content: "Check List Item 1", - }, - { - type: "codeBlock", - content: 'console.log("Hello World");', - }, - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [["Table Cell 1"], ["Table Cell 2"]], - }, - { - cells: [["Table Cell 3"], ["Table Cell 4"]], - }, - ], - }, - }, - { - type: "image", - }, - { - type: "paragraph", - content: "Paragraph 2", - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Paragraph 1"); - const endPos = getPosOfTextNode(doc, "Paragraph 2", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, - { - name: "basicBlocksWithProps", - clipboardDataType: "text/html", - document: [ - { - type: "paragraph", - props: { - textColor: "red", - }, - content: "Paragraph 1", - }, - { - type: "heading", - props: { - level: 2, - }, - content: "Heading 1", - }, - { - type: "numberedListItem", - props: { - start: 2, - }, - content: "Numbered List Item 1", - }, - { - type: "bulletListItem", - props: { - backgroundColor: "red", - }, - content: "Bullet List Item 1", - }, - { - type: "checkListItem", - props: { - checked: true, - }, - content: "Check List Item 1", - }, - { - type: "codeBlock", - props: { - language: "typescript", - }, - content: 'console.log("Hello World");', - }, - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [["Table Cell 1"], ["Table Cell 2"]], - }, - { - cells: [["Table Cell 3"], ["Table Cell 4"]], - }, - ], - }, - }, - { - type: "image", - props: { - name: "1280px-Placeholder_view_vector.svg.png", - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/Placeholder_view_vector.svg/1280px-Placeholder_view_vector.svg.png", - caption: "Placeholder", - showPreview: true, - previewWidth: 256, - }, - }, - { - type: "paragraph", - content: "Paragraph 2", - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Paragraph 1"); - const endPos = getPosOfTextNode(doc, "Paragraph 2", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, -]; diff --git a/packages/core/src/api/tests/clipboard/copy/getCopyTestInstances.ts b/packages/core/src/api/tests/clipboard/copy/getCopyTestInstances.ts new file mode 100644 index 0000000000..9a347dc01c --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/getCopyTestInstances.ts @@ -0,0 +1,636 @@ +import { NodeSelection, TextSelection } from "@tiptap/pm/state"; +import { CellSelection } from "@tiptap/pm/tables"; + +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { TestInstance } from "../../types.js"; +import { + getPosOfTableCellNode, + getPosOfTextNode, +} from "../clipboardTestUtil.js"; +import { CopyTestCase } from "./copyTestCase.js"; +import { testCopyHTML } from "./copyTestExecutors.js"; + +export const getCopyTestInstances = (): TestInstance< + CopyTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => [ + { + testCase: { + name: "multipleChildren", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + { + type: "paragraph", + content: "Nested Paragraph 3", + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Nested Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Nested Paragraph 3", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "childToParent", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + { + type: "paragraph", + content: "Nested Paragraph 3", + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Nested Paragraph 1", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "partialChildToParent", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + { + type: "paragraph", + content: "Nested Paragraph 3", + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1") + 1; + const endPos = getPosOfTextNode(doc, "Nested Paragraph 1") + 1; + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "childrenToNextParent", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + { + type: "paragraph", + content: "Nested Paragraph 3", + }, + ], + }, + { + type: "paragraph", + content: "Paragraph 2", + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Nested Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Paragraph 2", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "childrenToNextParentsChildren", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + { + type: "paragraph", + content: "Nested Paragraph 3", + }, + ], + }, + { + type: "paragraph", + content: "Paragraph 2", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 4", + }, + { + type: "paragraph", + content: "Nested Paragraph 5", + }, + { + type: "paragraph", + content: "Nested Paragraph 6", + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Nested Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Nested Paragraph 6", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "unstyledText", + document: [ + { + type: "heading", + content: "Unstyled Text", + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Unstyled Text"); + const endPos = getPosOfTextNode(doc, "Unstyled Text", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "styledText", + document: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "Unstyled Text", + styles: {}, + }, + { + type: "text", + text: "Italic Text", + styles: { + italic: true, + }, + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Italic Text"); + const endPos = getPosOfTextNode(doc, "Italic Text", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "multipleStyledText", + document: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "Unstyled Text", + styles: {}, + }, + { + type: "text", + text: "Italic Text", + styles: { + italic: true, + }, + }, + { + type: "text", + text: "Bold Text", + styles: { + bold: true, + }, + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Unstyled Text"); + const endPos = getPosOfTextNode(doc, "Bold Text", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "image", + document: [ + { + type: "image", + props: { + url: "https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg", + }, + }, + ], + getCopySelection: (doc) => { + let startPos: number | undefined = undefined; + + doc.descendants((node, pos) => { + if (node.type.name === "image") { + startPos = pos; + } + }); + + if (startPos === undefined) { + throw new Error("Image node not found."); + } + + return NodeSelection.create(doc, startPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "nestedImage", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + children: [ + { + type: "image", + props: { + url: "https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg", + }, + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + ], + }, + ], + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Nested Paragraph 1", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "tableCellText", + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Table Cell 1"); + const endPos = getPosOfTextNode(doc, "Table Cell 1", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "tableCell", + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); + + return CellSelection.create(doc, startPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "tableRow", + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); + const endPos = getPosOfTableCellNode(doc, "Table Cell 2"); + + return CellSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "tableCol", + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); + const endPos = getPosOfTableCellNode(doc, "Table Cell 3"); + + return CellSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "tableAllCells", + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTableCellNode(doc, "Table Cell 1"); + const endPos = getPosOfTableCellNode(doc, "Table Cell 4"); + + return CellSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + // TODO: 2 tests below necessary? + { + testCase: { + name: "basicBlocks", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + { + type: "heading", + content: "Heading 1", + }, + { + type: "numberedListItem", + content: "Numbered List Item 1", + }, + { + type: "bulletListItem", + content: "Bullet List Item 1", + }, + { + type: "checkListItem", + content: "Check List Item 1", + }, + { + type: "codeBlock", + content: 'console.log("Hello World");', + }, + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + { + type: "image", + }, + { + type: "paragraph", + content: "Paragraph 2", + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Paragraph 2", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, + { + testCase: { + name: "basicBlocksWithProps", + document: [ + { + type: "paragraph", + props: { + textColor: "red", + }, + content: "Paragraph 1", + }, + { + type: "heading", + props: { + level: 2, + }, + content: "Heading 1", + }, + { + type: "numberedListItem", + props: { + start: 2, + }, + content: "Numbered List Item 1", + }, + { + type: "bulletListItem", + props: { + backgroundColor: "red", + }, + content: "Bullet List Item 1", + }, + { + type: "checkListItem", + props: { + checked: true, + }, + content: "Check List Item 1", + }, + { + type: "codeBlock", + props: { + language: "typescript", + }, + content: 'console.log("Hello World");', + }, + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + { + type: "image", + props: { + name: "1280px-Placeholder_view_vector.svg.png", + url: "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/Placeholder_view_vector.svg/1280px-Placeholder_view_vector.svg.png", + caption: "Placeholder", + showPreview: true, + previewWidth: 256, + }, + }, + { + type: "paragraph", + content: "Paragraph 2", + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Paragraph 2", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyHTML, + }, +]; diff --git a/packages/core/src/api/tests/clipboard/copy/runTests.test.ts b/packages/core/src/api/tests/clipboard/copy/runTests.test.ts new file mode 100644 index 0000000000..5ca32b57c9 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copy/runTests.test.ts @@ -0,0 +1,18 @@ +import { describe, it } from "vitest"; + +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; +import { getCopyTestInstances } from "./getCopyTestInstances.js"; + +// Tests for verifying content that gets put on the clipboard when copying +// within the editor. Used broadly to ensure each block or set of blocks is correctly +// converted into different types of clipboard data. +describe("Copy tests", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of getCopyTestInstances()) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts b/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts deleted file mode 100644 index d58355d199..0000000000 --- a/packages/core/src/api/tests/clipboard/copy/testCopy.test.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { prettify } from "htmlfy"; -import { describe, expect, it } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { UnreachableCaseError } from "../../../../util/typescript.js"; -import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; -import { setupTestEditor } from "../../setupTestEditor.js"; -import { testSchema } from "../../testSchema.js"; -import { CopyTestCase, getCopyTestCases } from "./getCopyTestCases.js"; - -// Test for verifying content that gets put on the clipboard when copying within -// the editor. Used broadly to ensure each block or set of blocks is correctly -// converted into different types of clipboard data. -export const testCopy = async < - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - editor: BlockNoteEditor, - testCase: CopyTestCase -) => { - (window as any).__TEST_OPTIONS.mockID = 0; - editor.replaceBlocks(editor.document, testCase.document); - - if (!editor.prosemirrorView) { - throw new Error("Editor view not initialized."); - } - - editor.dispatch( - editor._tiptapEditor.state.tr.setSelection( - testCase.getCopySelection(editor.prosemirrorView.state.doc) - ) - ); - - const { clipboardHTML, externalHTML, markdown } = selectedFragmentToHTML( - editor.prosemirrorView, - editor - ); - - if (testCase.clipboardDataType === "blocknote/html") { - await expect( - prettify(clipboardHTML, { tag_wrap: true }) - ).toMatchFileSnapshot( - `./__snapshots__/${testCase.clipboardDataType}/${testCase.name}.html` - ); - } else if (testCase.clipboardDataType === "text/html") { - await expect( - prettify(externalHTML, { tag_wrap: true }) - ).toMatchFileSnapshot( - `./__snapshots__/${testCase.clipboardDataType}/${testCase.name}.html` - ); - } else if (testCase.clipboardDataType === "text/plain") { - await expect(markdown).toMatchFileSnapshot( - `./__snapshots__/${testCase.clipboardDataType}/${testCase.name}.md` - ); - } else { - throw new UnreachableCaseError(testCase.clipboardDataType); - } -}; - -describe("Copy tests", () => { - const getEditor = setupTestEditor(testSchema); - - for (const testCase of getCopyTestCases()) { - it(`${testCase.name}`, async () => { - await testCopy(getEditor(), testCase); - }); - } -}); diff --git a/packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestCase.ts b/packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestCase.ts new file mode 100644 index 0000000000..8c1e1d2db2 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestCase.ts @@ -0,0 +1,20 @@ +import { Node } from "@tiptap/pm/model"; +import { Selection } from "@tiptap/pm/state"; + +import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; + +export type CopyPasteTestCase< + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = { + name: string; + document: PartialBlock[]; + getCopySelection: (pmDoc: Node) => Selection; + getPasteSelection: (pmDoc: Node) => Selection; +}; diff --git a/packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestExecutors.ts b/packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestExecutors.ts new file mode 100644 index 0000000000..78aa4b033e --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestExecutors.ts @@ -0,0 +1,45 @@ +import { expect } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; +import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; +import { doPaste, setupClipboardTest } from "../clipboardTestUtil.js"; +import { CopyPasteTestCase } from "./copyPasteTestCase.js"; + +export const testCopyPaste = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: CopyPasteTestCase +) => { + setupClipboardTest(editor, testCase.document, testCase.getCopySelection); + + const { clipboardHTML } = selectedFragmentToHTML( + editor.prosemirrorView!, + editor + ); + + editor.dispatch( + editor._tiptapEditor.state.tr.setSelection( + testCase.getPasteSelection(editor.prosemirrorView!.state.doc) + ) + ); + + doPaste( + editor.prosemirrorView!, + "text", + clipboardHTML, + false, + new ClipboardEvent("paste") + ); + + await expect(editor.document).toMatchFileSnapshot( + `./__snapshots__/${testCase.name}.json` + ); +}; diff --git a/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts b/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts deleted file mode 100644 index b5b9f73b16..0000000000 --- a/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestCases.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Node } from "@tiptap/pm/model"; -import { Selection, TextSelection } from "@tiptap/pm/state"; - -import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; -import { getPosOfTextNode } from "../clipboardTestUtil.js"; - -export type CopyPasteTestCase< - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema -> = { - name: string; - document: PartialBlock[]; - getCopySelection: (pmDoc: Node) => Selection; - getPasteSelection: (pmDoc: Node) => Selection; -}; - -export const getCopyPasteTestCases = (): CopyPasteTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema ->[] => [ - { - name: "paragraphInCustomBlock", - document: [ - { - type: "paragraph", - content: "Paragraph 1", - }, - { - type: "customParagraph", - content: "Custom Paragraph 1", - }, - ], - getCopySelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Paragraph 1"); - const endPos = getPosOfTextNode(doc, "Paragraph 1", true); - - return TextSelection.create(doc, startPos, endPos); - }, - getPasteSelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Custom Paragraph 1"); - const endPos = getPosOfTextNode(doc, "Custom Paragraph 1", true); - - return TextSelection.create(doc, startPos, endPos); - }, - }, -]; diff --git a/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestInstances.ts b/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestInstances.ts new file mode 100644 index 0000000000..93f26a9ffc --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestInstances.ts @@ -0,0 +1,47 @@ +import { TextSelection } from "@tiptap/pm/state"; + +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { TestInstance } from "../../types.js"; +import { getPosOfTextNode } from "../clipboardTestUtil.js"; +import { CopyPasteTestCase } from "./copyPasteTestCase.js"; +import { testCopyPaste } from "./copyPasteTestExecutors.js"; + +export const getCopyPasteTestInstances = (): TestInstance< + CopyPasteTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => [ + { + testCase: { + name: "paragraphInCustomBlock", + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + { + type: "customParagraph", + content: "Custom Paragraph 1", + }, + ], + getCopySelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Paragraph 1", true); + + return TextSelection.create(doc, startPos, endPos); + }, + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Custom Paragraph 1"); + const endPos = getPosOfTextNode(doc, "Custom Paragraph 1", true); + + return TextSelection.create(doc, startPos, endPos); + }, + }, + executeTest: testCopyPaste, + }, +]; diff --git a/packages/core/src/api/tests/clipboard/copyPaste/runTests.test.ts b/packages/core/src/api/tests/clipboard/copyPaste/runTests.test.ts new file mode 100644 index 0000000000..204fdcca5c --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPaste/runTests.test.ts @@ -0,0 +1,17 @@ +import { describe, it } from "vitest"; + +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; +import { getCopyPasteTestInstances } from "./getCopyPasteTestInstances.js"; + +// Tests for verifying that copying and pasting content within the editor works +// as expected. Used for specific cases where unexpected behaviour was noticed. +describe("Copy/paste tests", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of getCopyPasteTestInstances()) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts b/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts deleted file mode 100644 index 3d63c718a3..0000000000 --- a/packages/core/src/api/tests/clipboard/copyPaste/testCopyPaste.test.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { describe, expect, it } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; -import { setupTestEditor } from "../../setupTestEditor.js"; -import { testSchema } from "../../testSchema.js"; -import { doPaste } from "../clipboardTestUtil.js"; -import { - CopyPasteTestCase, - getCopyPasteTestCases, -} from "./getCopyPasteTestCases.js"; - -// Test for verifying that copying and pasting content within the editor works -// as expected. Used for specific cases where unexpected behaviour was noticed. -export const testCopyPaste = async < - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - editor: BlockNoteEditor, - testCase: CopyPasteTestCase -) => { - (window as any).__TEST_OPTIONS.mockID = 0; - editor.replaceBlocks(editor.document, testCase.document); - - if (!editor.prosemirrorView) { - throw new Error("Editor view not initialized."); - } - - editor.dispatch( - editor._tiptapEditor.state.tr.setSelection( - testCase.getCopySelection(editor.prosemirrorView.state.doc) - ) - ); - - const { clipboardHTML } = selectedFragmentToHTML( - editor.prosemirrorView, - editor - ); - - editor.dispatch( - editor._tiptapEditor.state.tr.setSelection( - testCase.getPasteSelection(editor.prosemirrorView.state.doc) - ) - ); - - doPaste( - editor.prosemirrorView, - "text", - clipboardHTML, - false, - new ClipboardEvent("paste") - ); - - await expect(editor.document).toMatchFileSnapshot( - `./__snapshots__/${testCase.name}.json` - ); -}; - -describe("Copy/paste tests", () => { - const getEditor = setupTestEditor(testSchema); - - for (const testCase of getCopyPasteTestCases()) { - it(`${testCase.name}`, async () => { - await testCopyPaste(getEditor(), testCase); - }); - } -}); diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.ts b/packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestCase.ts similarity index 51% rename from packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.ts rename to packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestCase.ts index 742a793e39..e5fae48b26 100644 --- a/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.ts +++ b/packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestCase.ts @@ -7,12 +7,6 @@ import { InlineContentSchema, StyleSchema, } from "../../../../schema/index.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; -import { getCopyTestCases } from "../copy/getCopyTestCases.js"; export type CopyPasteEqualityTestCase< B extends BlockSchema, @@ -23,14 +17,3 @@ export type CopyPasteEqualityTestCase< document: PartialBlock[]; getCopyAndPasteSelection: (pmDoc: Node) => Selection; }; - -export const getCopyPasteEqualityTestCases = (): CopyPasteEqualityTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema ->[] => - getCopyTestCases().map(({ name, document, getCopySelection }) => ({ - name, - document, - getCopyAndPasteSelection: getCopySelection, - })); diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.ts b/packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.ts new file mode 100644 index 0000000000..590f6a603f --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.ts @@ -0,0 +1,43 @@ +import { expect } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; +import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; +import { doPaste, setupClipboardTest } from "../clipboardTestUtil.js"; +import { CopyPasteEqualityTestCase } from "./copyPasteEqualityTestCase.js"; + +export const testCopyPasteEquality = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: CopyPasteEqualityTestCase +) => { + setupClipboardTest( + editor, + testCase.document, + testCase.getCopyAndPasteSelection + ); + + const { clipboardHTML } = selectedFragmentToHTML( + editor.prosemirrorView!, + editor + ); + + const originalDocument = editor.document; + doPaste( + editor.prosemirrorView!, + "text", + clipboardHTML, + false, + new ClipboardEvent("paste") + ); + const newDocument = editor.document; + + expect(newDocument).toStrictEqual(originalDocument); +}; diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts b/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts new file mode 100644 index 0000000000..46b8e0cd34 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts @@ -0,0 +1,28 @@ +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { TestInstance } from "../../types.js"; +import { getCopyTestInstances } from "../copy/getCopyTestInstances.js"; +import { CopyPasteEqualityTestCase } from "./copyPasteEqualityTestCase.js"; +import { testCopyPasteEquality } from "./copyPasteEqualityTestExecutors.js"; + +export const getCopyPasteEqualityTestInstances = (): TestInstance< + CopyPasteEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => + getCopyTestInstances().map(({ testCase }) => ({ + testCase: { + name: testCase.name, + document: testCase.document, + getCopyAndPasteSelection: testCase.getCopySelection, + }, + executeTest: testCopyPasteEquality, + })); diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/runTests.test.ts b/packages/core/src/api/tests/clipboard/copyPasteEquality/runTests.test.ts new file mode 100644 index 0000000000..1151361365 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/copyPasteEquality/runTests.test.ts @@ -0,0 +1,18 @@ +import { describe, it } from "vitest"; + +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; +import { getCopyPasteEqualityTestInstances } from "./getCopyPasteEqualityTestInstances.js"; + +// Tests for verifying that copying and pasting content in place within the +// editor results in the same document as the original. Used broadly to ensure +// that converting to and from clipboard data does not result in any data loss. +describe("Copy/paste equality tests", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of getCopyPasteEqualityTestInstances()) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts b/packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts deleted file mode 100644 index 763b54c644..0000000000 --- a/packages/core/src/api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { describe, expect, it } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; -import { setupTestEditor } from "../../setupTestEditor.js"; -import { testSchema } from "../../testSchema.js"; -import { - CopyPasteEqualityTestCase, - getCopyPasteEqualityTestCases, -} from "./getCopyPasteEqualityTestCases.js"; -import { doPaste } from "../clipboardTestUtil.js"; - -// Test for verifying that copying and pasting content in place within the -// editor results in the same document as the original. Used broadly to ensure -// that converting to and from clipboard data does not result in any data loss. -export const testCopyPasteEquality = < - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - editor: BlockNoteEditor, - testCase: CopyPasteEqualityTestCase -) => { - (window as any).__TEST_OPTIONS.mockID = 0; - editor.replaceBlocks(editor.document, testCase.document); - - if (!editor.prosemirrorView) { - throw new Error("Editor view not initialized."); - } - - editor.dispatch( - editor._tiptapEditor.state.tr.setSelection( - testCase.getCopyAndPasteSelection(editor.prosemirrorView.state.doc) - ) - ); - - const { clipboardHTML } = selectedFragmentToHTML( - editor.prosemirrorView, - editor - ); - - const originalDocument = editor.document; - doPaste( - editor.prosemirrorView, - "text", - clipboardHTML, - false, - new ClipboardEvent("paste") - ); - const newDocument = editor.document; - - expect(newDocument).toStrictEqual(originalDocument); -}; - -describe("Copy/paste equality tests", () => { - const getEditor = setupTestEditor(testSchema); - - for (const testCase of getCopyPasteEqualityTestCases()) { - it(`${testCase.name}`, async () => { - testCopyPasteEquality(getEditor(), testCase); - }); - } -}); diff --git a/packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts b/packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts deleted file mode 100644 index 1ab365a829..0000000000 --- a/packages/core/src/api/tests/clipboard/paste/getPasteTestCases.ts +++ /dev/null @@ -1,158 +0,0 @@ -import { Node } from "@tiptap/pm/model"; -import { Selection, TextSelection } from "@tiptap/pm/state"; - -import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; -import { getPosOfTextNode } from "../clipboardTestUtil.js"; - -export type PasteTestCase< - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema -> = { - name: string; - clipboardDataType: "text/html" | "text/markdown" | "text/plain"; - content: string; - document: PartialBlock[]; - getPasteSelection: (pmDoc: Node) => Selection; -}; - -export const getPasteTestCases = (): PasteTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema ->[] => [ - { - name: "pasteEndOfParagraph", - clipboardDataType: "text/html", - content: `

Paragraph

`, - document: [ - { - type: "paragraph", - content: "Paragraph 1", - }, - ], - getPasteSelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Paragraph 1", true); - - return TextSelection.create(doc, startPos); - }, - }, - { - name: "pasteEndOfParagraphText", - clipboardDataType: "text/plain", - content: `Paragraph`, - document: [ - { - type: "paragraph", - content: "Paragraph 1", - }, - ], - getPasteSelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Paragraph 1", true); - - return TextSelection.create(doc, startPos); - }, - }, - { - name: "pasteImage", - clipboardDataType: "text/html", - content: ``, - document: [ - { - type: "paragraph", - content: "Paragraph 1", - }, - ], - getPasteSelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Paragraph 1", true); - - return TextSelection.create(doc, startPos); - }, - }, - { - name: "pasteTable", - clipboardDataType: "text/html", - content: ` - - - - - - - - -
Cell 1Cell 2
Cell 3Cell 4
`, - document: [ - { - type: "paragraph", - content: "Paragraph 1", - }, - ], - getPasteSelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Paragraph 1", true); - - return TextSelection.create(doc, startPos); - }, - }, - { - name: "pasteTableInExistingTable", - clipboardDataType: "text/html", - content: ` - - - - - - - - -
Cell 1Cell 2
Cell 3Cell 4
`, - document: [ - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [["Table Cell 1"], ["Table Cell 2"]], - }, - { - cells: [["Table Cell 3"], ["Table Cell 4"]], - }, - ], - }, - }, - ], - getPasteSelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Table Cell 4", true); - - return TextSelection.create(doc, startPos); - }, - }, - { - name: "pasteParagraphInCustomBlock", - clipboardDataType: "text/html", - content: `

Paragraph

`, - document: [ - { - type: "customParagraph", - content: "Custom Paragraph 1", - }, - ], - getPasteSelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Custom Paragraph 1", true); - - return TextSelection.create(doc, startPos); - }, - }, -]; diff --git a/packages/core/src/api/tests/clipboard/paste/getPasteTestInstances.ts b/packages/core/src/api/tests/clipboard/paste/getPasteTestInstances.ts new file mode 100644 index 0000000000..c51a13f475 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/paste/getPasteTestInstances.ts @@ -0,0 +1,155 @@ +import { TextSelection } from "@tiptap/pm/state"; + +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { TestInstance } from "../../types.js"; +import { getPosOfTextNode } from "../clipboardTestUtil.js"; +import { PasteTestCase } from "./pasteTestCase.js"; +import { testPasteHTML, testPasteMarkdown } from "./pasteTestExecutors.js"; + +export const getPasteTestInstances = (): TestInstance< + PasteTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => [ + { + testCase: { + name: "pasteEndOfParagraph", + content: `

Paragraph

`, + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1", true); + + return TextSelection.create(doc, startPos); + }, + }, + executeTest: testPasteHTML, + }, + { + testCase: { + name: "pasteEndOfParagraphText", + content: `Paragraph`, + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1", true); + + return TextSelection.create(doc, startPos); + }, + }, + executeTest: testPasteMarkdown, + }, + { + testCase: { + name: "pasteImage", + content: ``, + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1", true); + + return TextSelection.create(doc, startPos); + }, + }, + executeTest: testPasteHTML, + }, + { + testCase: { + name: "pasteTable", + content: ` + + + + + + + + +
Cell 1Cell 2
Cell 3Cell 4
`, + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1", true); + + return TextSelection.create(doc, startPos); + }, + }, + executeTest: testPasteHTML, + }, + { + testCase: { + name: "pasteTableInExistingTable", + content: ` + + + + + + + + +
Cell 1Cell 2
Cell 3Cell 4
`, + document: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [["Table Cell 1"], ["Table Cell 2"]], + }, + { + cells: [["Table Cell 3"], ["Table Cell 4"]], + }, + ], + }, + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Table Cell 4", true); + + return TextSelection.create(doc, startPos); + }, + }, + executeTest: testPasteHTML, + }, + { + testCase: { + name: "pasteParagraphInCustomBlock", + content: `

Paragraph

`, + document: [ + { + type: "customParagraph", + content: "Custom Paragraph 1", + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Custom Paragraph 1", true); + + return TextSelection.create(doc, startPos); + }, + }, + executeTest: testPasteHTML, + }, +]; diff --git a/packages/core/src/api/tests/clipboard/paste/pasteTestCase.ts b/packages/core/src/api/tests/clipboard/paste/pasteTestCase.ts new file mode 100644 index 0000000000..2129be7f56 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/paste/pasteTestCase.ts @@ -0,0 +1,20 @@ +import { Node } from "@tiptap/pm/model"; +import { Selection } from "@tiptap/pm/state"; + +import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; + +export type PasteTestCase< + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = { + name: string; + content: string; + document: PartialBlock[]; + getPasteSelection: (pmDoc: Node) => Selection; +}; diff --git a/packages/core/src/api/tests/clipboard/paste/pasteTestExecutors.ts b/packages/core/src/api/tests/clipboard/paste/pasteTestExecutors.ts new file mode 100644 index 0000000000..e1000b6190 --- /dev/null +++ b/packages/core/src/api/tests/clipboard/paste/pasteTestExecutors.ts @@ -0,0 +1,56 @@ +import { expect } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; +import { doPaste, setupClipboardTest } from "../clipboardTestUtil.js"; +import { PasteTestCase } from "./pasteTestCase.js"; + +export const testPasteHTML = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: PasteTestCase +) => { + setupClipboardTest(editor, testCase.document, testCase.getPasteSelection); + + doPaste( + editor.prosemirrorView!, + "", + testCase.content, + false, + new ClipboardEvent("paste") + ); + + await expect(editor.document).toMatchFileSnapshot( + `./__snapshots__/text/html/${testCase.name}.json` + ); +}; + +export const testPasteMarkdown = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: PasteTestCase +) => { + setupClipboardTest(editor, testCase.document, testCase.getPasteSelection); + + doPaste( + editor.prosemirrorView!, + testCase.content, + "", + true, + new ClipboardEvent("paste") + ); + + await expect(editor.document).toMatchFileSnapshot( + `./__snapshots__/text/plain/${testCase.name}.json` + ); +}; diff --git a/packages/core/src/api/tests/clipboard/paste/runTests.test.ts b/packages/core/src/api/tests/clipboard/paste/runTests.test.ts new file mode 100644 index 0000000000..b3c90a16fe --- /dev/null +++ b/packages/core/src/api/tests/clipboard/paste/runTests.test.ts @@ -0,0 +1,19 @@ +import { describe, it } from "vitest"; + +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; +import { getPasteTestInstances } from "./getPasteTestInstances.js"; + +// Tests for verifying that clipboard data gets pasted into the editor properly. +// Used for specific cases for when content from outside the editor is pasted +// into it. This includes content from other editors, as well as content from +// the web that has produced bugs in the past. +describe("Paste tests", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of getPasteTestInstances()) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/clipboard/paste/testPaste.test.ts b/packages/core/src/api/tests/clipboard/paste/testPaste.test.ts deleted file mode 100644 index a79dd62a46..0000000000 --- a/packages/core/src/api/tests/clipboard/paste/testPaste.test.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { describe, expect, it } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { setupTestEditor } from "../../setupTestEditor.js"; -import { testSchema } from "../../testSchema.js"; -import { doPaste } from "../clipboardTestUtil.js"; -import { getPasteTestCases, PasteTestCase } from "./getPasteTestCases.js"; - -// Test for verifying that clipboard data gets pasted into the editor properly. -// Used for specific cases for when content from outside the editor is pasted -// into it. This includes content from other editors, as well as content from -// the web that has produced bugs in the past. -export const testPaste = async < - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - editor: BlockNoteEditor, - testCase: PasteTestCase -) => { - (window as any).__TEST_OPTIONS.mockID = 0; - editor.replaceBlocks(editor.document, testCase.document); - - if (!editor.prosemirrorView) { - throw new Error("Editor view not initialized."); - } - - editor.dispatch( - editor._tiptapEditor.state.tr.setSelection( - testCase.getPasteSelection(editor.prosemirrorView.state.doc) - ) - ); - - doPaste( - editor.prosemirrorView, - testCase.content, - testCase.content, - testCase.clipboardDataType !== "text/html", - new ClipboardEvent("paste") - ); - - await expect(editor.document).toMatchFileSnapshot( - `./__snapshots__/${testCase.clipboardDataType}/${testCase.name}.json` - ); -}; - -describe("Paste tests", () => { - const getEditor = setupTestEditor(testSchema); - - for (const testCase of getPasteTestCases()) { - it(`${testCase.name}`, async () => { - await testPaste(getEditor(), testCase); - }); - } -}); diff --git a/packages/core/src/api/tests/formatConversion/export/exportTestCase.ts b/packages/core/src/api/tests/formatConversion/export/exportTestCase.ts new file mode 100644 index 0000000000..57e7a461f8 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/exportTestCase.ts @@ -0,0 +1,15 @@ +import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; + +export type ExportTestCase< + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = { + name: string; + content: PartialBlock[]; +}; diff --git a/packages/core/src/api/tests/formatConversion/export/exportTestExecutors.ts b/packages/core/src/api/tests/formatConversion/export/exportTestExecutors.ts new file mode 100644 index 0000000000..a778121270 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/exportTestExecutors.ts @@ -0,0 +1,86 @@ +import { prettify } from "htmlfy"; +import { expect } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; +import { blockToNode } from "../../../nodeConversions/blockToNode.js"; +import { addIdsToBlocks } from "../formatConversionTestUtil.js"; +import { ExportTestCase } from "./exportTestCase.js"; + +export const testExportBlockNoteHTML = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: ExportTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + + addIdsToBlocks(testCase.content); + + await expect( + prettify(await editor.blocksToFullHTML(testCase.content), { + tag_wrap: true, + }) + ).toMatchFileSnapshot(`./__snapshots__/blocknoteHTML/${testCase.name}.html`); +}; + +export const testExportHTML = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: ExportTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + + addIdsToBlocks(testCase.content); + + await expect( + prettify(await editor.blocksToHTMLLossy(testCase.content), { + tag_wrap: true, + }) + ).toMatchFileSnapshot(`./__snapshots__/html/${testCase.name}.html`); +}; + +export const testExportMarkdown = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: ExportTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + + addIdsToBlocks(testCase.content); + + await expect( + await editor.blocksToMarkdownLossy(testCase.content) + ).toMatchFileSnapshot(`./__snapshots__/markdown/${testCase.name}.md`); +}; + +export const testExportNodes = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: ExportTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + + addIdsToBlocks(testCase.content); + + await expect( + testCase.content.map((block) => + blockToNode(block, editor.pmSchema, editor.schema.styleSchema) + ) + ).toMatchFileSnapshot(`./__snapshots__/nodes/${testCase.name}.json`); +}; diff --git a/packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts b/packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts deleted file mode 100644 index fc9c12e1f3..0000000000 --- a/packages/core/src/api/tests/formatConversion/export/getExportTestCases.ts +++ /dev/null @@ -1,1527 +0,0 @@ -import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; - -export type ExportTestCase< - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema -> = { - name: string; - conversionType: "blocknoteHTML" | "html" | "markdown" | "nodes"; - content: PartialBlock[]; -}; - -export const getExportTestCases = ( - conversionType: ExportTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >["conversionType"] -): ExportTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema ->[] => [ - { - name: "paragraph/empty", - conversionType, - content: [ - { - type: "paragraph", - }, - ], - }, - { - name: "paragraph/basic", - conversionType, - content: [ - { - type: "paragraph", - content: "Paragraph", - }, - ], - }, - { - name: "paragraph/styled", - conversionType, - content: [ - { - type: "paragraph", - props: { - textAlignment: "center", - textColor: "orange", - backgroundColor: "pink", - }, - content: [ - { - type: "text", - styles: {}, - text: "Plain ", - }, - { - type: "text", - styles: { - textColor: "red", - }, - text: "Red Text ", - }, - { - type: "text", - styles: { - backgroundColor: "blue", - }, - text: "Blue Background ", - }, - { - type: "text", - styles: { - textColor: "red", - backgroundColor: "blue", - }, - text: "Mixed Colors", - }, - ], - }, - ], - }, - { - name: "paragraph/nested", - conversionType, - content: [ - { - type: "paragraph", - content: "Paragraph", - children: [ - { - type: "paragraph", - content: "Nested Paragraph 1", - }, - { - type: "paragraph", - content: "Nested Paragraph 2", - }, - ], - }, - ], - }, - { - name: "paragraph/lineBreaks", - conversionType, - content: [ - { - type: "paragraph", - content: "Line 1\nLine 2", - }, - ], - }, - { - name: "lists/basic", - conversionType, - content: [ - { - type: "bulletListItem", - content: "Bullet List Item 1", - }, - { - type: "bulletListItem", - content: "Bullet List Item 2", - }, - { - type: "numberedListItem", - content: "Numbered List Item 1", - }, - { - type: "numberedListItem", - content: "Numbered List Item 2", - }, - { - type: "checkListItem", - content: "Check List Item 1", - }, - { - type: "checkListItem", - props: { - checked: true, - }, - content: "Check List Item 2", - }, - ], - }, - { - name: "lists/nested", - conversionType, - content: [ - { - type: "bulletListItem", - content: "Bullet List Item 1", - }, - { - type: "bulletListItem", - content: "Bullet List Item 2", - children: [ - { - type: "numberedListItem", - content: "Numbered List Item 1", - }, - { - type: "numberedListItem", - content: "Numbered List Item 2", - children: [ - { - type: "checkListItem", - content: "Check List Item 1", - }, - { - type: "checkListItem", - props: { - checked: true, - }, - content: "Check List Item 2", - }, - ], - }, - ], - }, - ], - }, - { - name: "codeBlock/empty", - conversionType, - content: [ - { - type: "codeBlock", - }, - ], - }, - { - name: "codeBlock/defaultLanguage", - conversionType, - content: [ - { - type: "codeBlock", - content: "console.log('Hello, world!');", - }, - ], - }, - { - name: "codeBlock/python", - conversionType, - content: [ - { - type: "codeBlock", - props: { language: "python" }, - content: "print('Hello, world!')", - }, - ], - }, - { - name: "codeBlock/contains-newlines", - conversionType, - content: [ - { - type: "codeBlock", - props: { language: "javascript" }, - content: "const hello = 'world';\nconsole.log(hello);\n", - }, - ], - }, - { - name: "pageBreak/basic", - conversionType, - content: [ - { - type: "pageBreak", - }, - ], - }, - { - name: "file/button", - conversionType, - content: [ - { - type: "file", - }, - ], - }, - { - name: "file/basic", - conversionType, - content: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - { - name: "file/noName", - conversionType, - content: [ - { - type: "file", - props: { - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - { - name: "file/noCaption", - conversionType, - content: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - }, - }, - ], - }, - { - name: "file/nested", - conversionType, - content: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - children: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - ], - }, - // Because images need to fetch the download URL async, their internal HTML - // is initially rendered without a `src` attribute, which is reflected in - // the tests. - { - name: "image/button", - conversionType, - content: [ - { - type: "image", - }, - ], - }, - { - name: "image/basic", - conversionType, - content: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - { - name: "image/noName", - conversionType, - content: [ - { - type: "image", - props: { - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - { - name: "image/noCaption", - conversionType, - content: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - previewWidth: 256, - }, - }, - ], - }, - { - name: "image/noPreview", - conversionType, - content: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - showPreview: false, - previewWidth: 256, - }, - }, - ], - }, - { - name: "image/nested", - conversionType, - content: [ - { - type: "image", - props: { - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - children: [ - { - type: "image", - props: { - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - ], - }, - { - name: "table/basic", - conversionType, - content: [ - { - type: "table", - content: { - type: "tableContent", - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/allColWidths", - conversionType, - content: [ - { - type: "table", - content: { - type: "tableContent", - columnWidths: [100, 200, 300], - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/mixedColWidths", - conversionType, - content: [ - { - type: "table", - content: { - type: "tableContent", - columnWidths: [100, undefined, 300], - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/mixedCellColors", - conversionType, - content: [ - { - type: "table", - content: { - type: "tableContent", - columnWidths: [100, undefined, 300], - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "red", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "blue", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "blue", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "yellow", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "red", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/mixedRowspansAndColspans", - conversionType, - content: [ - { - type: "table", - content: { - type: "tableContent", - columnWidths: [100, 200, 300], - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "red", - colspan: 2, - rowspan: 1, - textAlignment: "left", - textColor: "blue", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "yellow", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "red", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 2, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 2, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/headerRows", - conversionType, - content: [ - { - type: "table", - content: { - headerRows: 1, - type: "tableContent", - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "table/headerCols", - conversionType, - content: [ - { - type: "table", - content: { - headerCols: 1, - type: "tableContent", - rows: [ - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - { - cells: [ - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - { - type: "tableCell", - content: ["Table Cell"], - props: { - backgroundColor: "default", - colspan: 1, - rowspan: 1, - textAlignment: "left", - textColor: "default", - }, - }, - ], - }, - ], - }, - }, - ], - }, - { - name: "link/basic", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "link", - href: "https://www.website.com", - content: "Website", - }, - ], - }, - ], - }, - { - name: "link/styled", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "link", - href: "https://www.website.com", - content: [ - { - type: "text", - text: "Web", - styles: { - bold: true, - }, - }, - { - type: "text", - text: "site", - styles: {}, - }, - ], - }, - ], - }, - ], - }, - { - name: "link/adjacent", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "link", - href: "https://www.website.com", - content: "Website", - }, - { - type: "link", - href: "https://www.website2.com", - content: "Website2", - }, - ], - }, - ], - }, - { - name: "hardbreak/basic", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "Text1\nText2", - styles: {}, - }, - ], - }, - ], - }, - { - name: "hardbreak/multiple", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "Text1\nText2\nText3", - styles: {}, - }, - ], - }, - ], - }, - { - name: "hardbreak/start", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "\nText1", - styles: {}, - }, - ], - }, - ], - }, - { - name: "hardbreak/end", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "Text1\n", - styles: {}, - }, - ], - }, - ], - }, - { - name: "hardbreak/only", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "\n", - styles: {}, - }, - ], - }, - ], - }, - { - name: "hardbreak/styles", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "text", - text: "Text1\n", - styles: {}, - }, - { - type: "text", - text: "Text2", - styles: { bold: true }, - }, - ], - }, - ], - }, - { - name: "hardbreak/link", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "link", - href: "https://www.website.com", - content: "Link1\nLink1", - }, - ], - }, - ], - }, - { - name: "hardbreak/between-links", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - content: [ - { - type: "link", - href: "https://www.website.com", - content: "Link1\n", - }, - { - type: "link", - href: "https://www.website2.com", - content: "Link2", - }, - ], - }, - ], - }, - { - name: "complex/misc", - conversionType, - content: [ - { - // id: UniqueID.options.generateID(), - type: "heading", - props: { - backgroundColor: "blue", - textColor: "yellow", - textAlignment: "right", - level: 2, - }, - content: [ - { - type: "text", - text: "Heading ", - styles: { - bold: true, - underline: true, - }, - }, - { - type: "text", - text: "2", - styles: { - italic: true, - strike: true, - }, - }, - ], - children: [ - { - // id: UniqueID.options.generateID(), - type: "paragraph", - props: { - backgroundColor: "red", - }, - content: "Paragraph", - children: [], - }, - { - // id: UniqueID.options.generateID(), - type: "bulletListItem", - props: {}, - }, - ], - }, - ], - }, -]; diff --git a/packages/core/src/api/tests/formatConversion/export/getExportTestInstances.ts b/packages/core/src/api/tests/formatConversion/export/getExportTestInstances.ts new file mode 100644 index 0000000000..d44c520bcb --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/getExportTestInstances.ts @@ -0,0 +1,1597 @@ +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { TestExecutor, TestInstance } from "../../types.js"; + +import { ExportTestCase } from "./exportTestCase.js"; + +export const getExportTestInstances = ( + executeTest: TestExecutor< + ExportTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + > +): TestInstance< + ExportTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => [ + { + testCase: { + name: "paragraph/empty", + content: [ + { + type: "paragraph", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "paragraph/basic", + content: [ + { + type: "paragraph", + content: "Paragraph", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "paragraph/styled", + content: [ + { + type: "paragraph", + props: { + textAlignment: "center", + textColor: "orange", + backgroundColor: "pink", + }, + content: [ + { + type: "text", + styles: {}, + text: "Plain ", + }, + { + type: "text", + styles: { + textColor: "red", + }, + text: "Red Text ", + }, + { + type: "text", + styles: { + backgroundColor: "blue", + }, + text: "Blue Background ", + }, + { + type: "text", + styles: { + textColor: "red", + backgroundColor: "blue", + }, + text: "Mixed Colors", + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "paragraph/nested", + content: [ + { + type: "paragraph", + content: "Paragraph", + children: [ + { + type: "paragraph", + content: "Nested Paragraph 1", + }, + { + type: "paragraph", + content: "Nested Paragraph 2", + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "paragraph/lineBreaks", + content: [ + { + type: "paragraph", + content: "Line 1\nLine 2", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "lists/basic", + content: [ + { + type: "bulletListItem", + content: "Bullet List Item 1", + }, + { + type: "bulletListItem", + content: "Bullet List Item 2", + }, + { + type: "numberedListItem", + content: "Numbered List Item 1", + }, + { + type: "numberedListItem", + content: "Numbered List Item 2", + }, + { + type: "checkListItem", + content: "Check List Item 1", + }, + { + type: "checkListItem", + props: { + checked: true, + }, + content: "Check List Item 2", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "lists/nested", + content: [ + { + type: "bulletListItem", + content: "Bullet List Item 1", + }, + { + type: "bulletListItem", + content: "Bullet List Item 2", + children: [ + { + type: "numberedListItem", + content: "Numbered List Item 1", + }, + { + type: "numberedListItem", + content: "Numbered List Item 2", + children: [ + { + type: "checkListItem", + content: "Check List Item 1", + }, + { + type: "checkListItem", + props: { + checked: true, + }, + content: "Check List Item 2", + }, + ], + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "codeBlock/empty", + content: [ + { + type: "codeBlock", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "codeBlock/defaultLanguage", + content: [ + { + type: "codeBlock", + content: "console.log('Hello, world!');", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "codeBlock/python", + content: [ + { + type: "codeBlock", + props: { language: "python" }, + content: "print('Hello, world!')", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "codeBlock/contains-newlines", + content: [ + { + type: "codeBlock", + props: { language: "javascript" }, + content: "const hello = 'world';\nconsole.log(hello);\n", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "pageBreak/basic", + content: [ + { + type: "pageBreak", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "file/button", + content: [ + { + type: "file", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "file/basic", + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "file/noName", + content: [ + { + type: "file", + props: { + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "file/noCaption", + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "file/nested", + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + children: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "image/button", + content: [ + { + type: "image", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "image/basic", + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "image/noName", + content: [ + { + type: "image", + props: { + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "image/noCaption", + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + previewWidth: 256, + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "image/noPreview", + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + showPreview: false, + previewWidth: 256, + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "image/nested", + content: [ + { + type: "image", + props: { + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + children: [ + { + type: "image", + props: { + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "table/basic", + content: [ + { + type: "table", + content: { + type: "tableContent", + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "table/allColWidths", + content: [ + { + type: "table", + content: { + type: "tableContent", + columnWidths: [100, 200, 300], + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "table/mixedColWidths", + content: [ + { + type: "table", + content: { + type: "tableContent", + columnWidths: [100, undefined, 300], + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "table/mixedCellColors", + content: [ + { + type: "table", + content: { + type: "tableContent", + columnWidths: [100, undefined, 300], + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "red", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "blue", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "blue", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "yellow", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "red", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "table/mixedRowspansAndColspans", + content: [ + { + type: "table", + content: { + type: "tableContent", + columnWidths: [100, 200, 300], + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "red", + colspan: 2, + rowspan: 1, + textAlignment: "left", + textColor: "blue", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "yellow", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "red", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 2, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 2, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "table/headerRows", + content: [ + { + type: "table", + content: { + headerRows: 1, + type: "tableContent", + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "table/headerCols", + content: [ + { + type: "table", + content: { + headerCols: 1, + type: "tableContent", + rows: [ + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + { + cells: [ + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + { + type: "tableCell", + content: ["Table Cell"], + props: { + backgroundColor: "default", + colspan: 1, + rowspan: 1, + textAlignment: "left", + textColor: "default", + }, + }, + ], + }, + ], + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "link/basic", + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "link", + href: "https://www.website.com", + content: "Website", + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "link/styled", + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "link", + href: "https://www.website.com", + content: [ + { + type: "text", + text: "Web", + styles: { + bold: true, + }, + }, + { + type: "text", + text: "site", + styles: {}, + }, + ], + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "link/adjacent", + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "link", + href: "https://www.website.com", + content: "Website", + }, + { + type: "link", + href: "https://www.website2.com", + content: "Website2", + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "hardbreak/basic", + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "Text1\nText2", + styles: {}, + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "hardbreak/multiple", + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "Text1\nText2\nText3", + styles: {}, + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "hardbreak/start", + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "\nText1", + styles: {}, + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "hardbreak/end", + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "Text1\n", + styles: {}, + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "hardbreak/only", + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "\n", + styles: {}, + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "hardbreak/styles", + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "text", + text: "Text1\n", + styles: {}, + }, + { + type: "text", + text: "Text2", + styles: { bold: true }, + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "hardbreak/link", + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "link", + href: "https://www.website.com", + content: "Link1\nLink1", + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "hardbreak/between-links", + content: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + content: [ + { + type: "link", + href: "https://www.website.com", + content: "Link1\n", + }, + { + type: "link", + href: "https://www.website2.com", + content: "Link2", + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "complex/misc", + content: [ + { + // id: UniqueID.options.generateID(), + type: "heading", + props: { + backgroundColor: "blue", + textColor: "yellow", + textAlignment: "right", + level: 2, + }, + content: [ + { + type: "text", + text: "Heading ", + styles: { + bold: true, + underline: true, + }, + }, + { + type: "text", + text: "2", + styles: { + italic: true, + strike: true, + }, + }, + ], + children: [ + { + // id: UniqueID.options.generateID(), + type: "paragraph", + props: { + backgroundColor: "red", + }, + content: "Paragraph", + children: [], + }, + { + // id: UniqueID.options.generateID(), + type: "bulletListItem", + props: {}, + }, + ], + }, + ], + }, + executeTest, + }, +]; diff --git a/packages/core/src/api/tests/formatConversion/export/runTests.test.ts b/packages/core/src/api/tests/formatConversion/export/runTests.test.ts new file mode 100644 index 0000000000..f830667637 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/export/runTests.test.ts @@ -0,0 +1,29 @@ +import { describe, it } from "vitest"; + +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; +import { + testExportBlockNoteHTML, + testExportHTML, + testExportMarkdown, + testExportNodes, +} from "./exportTestExecutors.js"; +import { getExportTestInstances } from "./getExportTestInstances.js"; + +// Tests for verifying that exporting blocks to other formats works as expected. +// Used broadly to ensure each block or set of blocks is correctly converted +// into different formats. +describe("Export tests", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of [ + ...getExportTestInstances(testExportBlockNoteHTML), + ...getExportTestInstances(testExportHTML), + ...getExportTestInstances(testExportMarkdown), + ...getExportTestInstances(testExportNodes), + ]) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/formatConversion/export/testExport.test.ts b/packages/core/src/api/tests/formatConversion/export/testExport.test.ts deleted file mode 100644 index 22e1ceadb5..0000000000 --- a/packages/core/src/api/tests/formatConversion/export/testExport.test.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { prettify } from "htmlfy"; -import { describe, expect, it } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { UnreachableCaseError } from "../../../../util/typescript.js"; -import { blockToNode } from "../../../nodeConversions/blockToNode.js"; -import { setupTestEditor } from "../../setupTestEditor.js"; -import { testSchema } from "../../testSchema.js"; -import { addIdsToBlocks } from "../formatConversionTestUtil.js"; -import { ExportTestCase, getExportTestCases } from "./getExportTestCases.js"; - -// Test for verifying that exporting blocks to other formats works as expected. -// Used broadly to ensure each block or set of blocks is correctly converted -// into different formats. -export const testExport = async < - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - editor: BlockNoteEditor, - testCase: ExportTestCase -) => { - (window as any).__TEST_OPTIONS.mockID = 0; - - addIdsToBlocks(testCase.content); - - if (testCase.conversionType === "blocknoteHTML") { - await expect( - prettify(await editor.blocksToFullHTML(testCase.content), { - tag_wrap: true, - }) - ).toMatchFileSnapshot( - `./__snapshots__/${testCase.conversionType}/${testCase.name}.html` - ); - } else if (testCase.conversionType === "html") { - await expect( - prettify(await editor.blocksToHTMLLossy(testCase.content), { - tag_wrap: true, - }) - ).toMatchFileSnapshot( - `./__snapshots__/${testCase.conversionType}/${testCase.name}.html` - ); - } else if (testCase.conversionType === "markdown") { - await expect( - await editor.blocksToMarkdownLossy(testCase.content) - ).toMatchFileSnapshot( - `./__snapshots__/${testCase.conversionType}/${testCase.name}.md` - ); - } else if (testCase.conversionType === "nodes") { - await expect( - testCase.content.map((block) => - blockToNode(block, editor.pmSchema, editor.schema.styleSchema) - ) - ).toMatchFileSnapshot( - `./__snapshots__/${testCase.conversionType}/${testCase.name}.json` - ); - } else { - throw new UnreachableCaseError(testCase.conversionType); - } -}; - -describe("Export tests", () => { - const getEditor = setupTestEditor(testSchema); - - for (const testCase of [ - ...getExportTestCases("blocknoteHTML"), - ...getExportTestCases("html"), - ...getExportTestCases("markdown"), - ...getExportTestCases("nodes"), - ]) { - it(`${testCase.name}`, async () => { - await testExport(getEditor(), testCase); - }); - } -}); diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestCase.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestCase.ts new file mode 100644 index 0000000000..40087f35ba --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestCase.ts @@ -0,0 +1,15 @@ +import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; + +export type ExportParseEqualityTestCase< + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = { + name: string; + content: PartialBlock[]; +}; diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.ts new file mode 100644 index 0000000000..30c3c485fa --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.ts @@ -0,0 +1,64 @@ +import { expect } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; +import { blockToNode } from "../../../nodeConversions/blockToNode.js"; +import { nodeToBlock } from "../../../nodeConversions/nodeToBlock.js"; +import { + addIdsToBlocks, + partialBlocksToBlocksForTesting, +} from "../formatConversionTestUtil.js"; +import { ExportParseEqualityTestCase } from "./exportParseEqualityTestCase.js"; + +export const testExportParseEqualityBlockNoteHTML = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: ExportParseEqualityTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + + addIdsToBlocks(testCase.content); + + const exported = await editor.blocksToFullHTML(testCase.content); + + expect(await editor.tryParseHTMLToBlocks(exported)).toStrictEqual( + partialBlocksToBlocksForTesting(editor.schema, testCase.content) + ); +}; + +export const testExportParseEqualityNodes = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: ExportParseEqualityTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + + addIdsToBlocks(testCase.content); + + const exported = testCase.content.map((block) => + blockToNode(block, editor.pmSchema, editor.schema.styleSchema) + ); + + expect( + exported.map((node) => + nodeToBlock( + node, + editor.schema.blockSchema, + editor.schema.inlineContentSchema, + editor.schema.styleSchema + ) + ) + ).toStrictEqual( + partialBlocksToBlocksForTesting(editor.schema, testCase.content) + ); +}; diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts deleted file mode 100644 index 5252080053..0000000000 --- a/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; -import { getExportTestCases } from "../export/getExportTestCases.js"; - -export type ExportParseEqualityTestCase< - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema -> = { - name: string; - // At some point we probably want to only have one HTML format that is both - // lossless when converting to/from blocks, in which case we will only need - // "html" test cases and can remove "blockNoteHTML". - conversionType: "blocknoteHTML" | "nodes"; - content: PartialBlock[]; -}; - -export const getExportParseEqualityTestCases = ( - conversionType: ExportParseEqualityTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >["conversionType"] -): ExportParseEqualityTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema ->[] => - getExportTestCases(conversionType).map(({ name, content }) => ({ - name, - conversionType, - content, - })); diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts new file mode 100644 index 0000000000..c2f035da5d --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts @@ -0,0 +1,31 @@ +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { TestExecutor, TestInstance } from "../../types.js"; + +import { ExportParseEqualityTestCase } from "./exportParseEqualityTestCase.js"; +import { getExportTestInstances } from "../export/getExportTestInstances.js"; + +export const getExportParseEqualityTestInstances = ( + executeTest: TestExecutor< + ExportParseEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + > +): TestInstance< + ExportParseEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => getExportTestInstances(executeTest); diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/runTests.test.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/runTests.test.ts new file mode 100644 index 0000000000..1c22c4e222 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/exportParseEquality/runTests.test.ts @@ -0,0 +1,27 @@ +import { describe, it } from "vitest"; + +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; +import { + testExportParseEqualityBlockNoteHTML, + testExportParseEqualityNodes, +} from "./exportParseEqualityTestExecutors.js"; +import { getExportParseEqualityTestInstances } from "./getExportParseEqualityTestInstances.js"; + +// Tests for verifying that exporting blocks to another format, then importing +// them back results in the same blocks as the original. Used broadly to ensure +// that exporting and importing blocks does not result in any data loss. +describe("Export/parse equality tests", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of [ + ...getExportParseEqualityTestInstances( + testExportParseEqualityBlockNoteHTML + ), + ...getExportParseEqualityTestInstances(testExportParseEqualityNodes), + ]) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts b/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts deleted file mode 100644 index 4f421cc849..0000000000 --- a/packages/core/src/api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { describe, expect, it } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { UnreachableCaseError } from "../../../../util/typescript.js"; -import { blockToNode } from "../../../nodeConversions/blockToNode.js"; -import { nodeToBlock } from "../../../nodeConversions/nodeToBlock.js"; -import { setupTestEditor } from "../../setupTestEditor.js"; -import { testSchema } from "../../testSchema.js"; -import { - addIdsToBlocks, - partialBlocksToBlocksForTesting, -} from "../formatConversionTestUtil.js"; -import { - ExportParseEqualityTestCase, - getExportParseEqualityTestCases, -} from "./getExportParseEqualityTestCases.js"; - -// Test for verifying that exporting blocks to another format, then importing -// them back results in the same blocks as the original. Used broadly to ensure -// that exporting and importing blocks does not result in any data loss. -export const testExportParseEquality = async < - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - editor: BlockNoteEditor, - testCase: ExportParseEqualityTestCase -) => { - (window as any).__TEST_OPTIONS.mockID = 0; - - addIdsToBlocks(testCase.content); - - if (testCase.conversionType === "blocknoteHTML") { - const exported = await editor.blocksToFullHTML(testCase.content); - - expect(await editor.tryParseHTMLToBlocks(exported)).toStrictEqual( - partialBlocksToBlocksForTesting(editor.schema, testCase.content) - ); - } else if (testCase.conversionType === "nodes") { - const exported = testCase.content.map((block) => - blockToNode(block, editor.pmSchema, editor.schema.styleSchema) - ); - - expect( - exported.map((node) => - nodeToBlock( - node, - editor.schema.blockSchema, - editor.schema.inlineContentSchema, - editor.schema.styleSchema - ) - ) - ).toStrictEqual( - partialBlocksToBlocksForTesting(editor.schema, testCase.content) - ); - } else { - throw new UnreachableCaseError(testCase.conversionType); - } -}; - -describe("Export/parse equality tests", () => { - const getEditor = setupTestEditor(testSchema); - - for (const testCase of [ - ...getExportParseEqualityTestCases("blocknoteHTML"), - ...getExportParseEqualityTestCases("nodes"), - ]) { - it(`${testCase.name}`, async () => { - await testExportParseEquality(getEditor(), testCase); - }); - } -}); diff --git a/packages/core/src/api/tests/formatConversion/parse/parseTestCase.ts b/packages/core/src/api/tests/formatConversion/parse/parseTestCase.ts new file mode 100644 index 0000000000..da457e3bc0 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/parse/parseTestCase.ts @@ -0,0 +1,4 @@ +export type ParseTestCase = { + name: string; + content: string; +}; diff --git a/packages/core/src/api/tests/formatConversion/parse/parseTestExecutors.ts b/packages/core/src/api/tests/formatConversion/parse/parseTestExecutors.ts new file mode 100644 index 0000000000..8558f38576 --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/parse/parseTestExecutors.ts @@ -0,0 +1,39 @@ +import { expect } from "vitest"; + +import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../../../schema/index.js"; +import { ParseTestCase } from "./parseTestCase.js"; + +export const testParseHTML = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: ParseTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + + await expect( + await editor.tryParseHTMLToBlocks(testCase.content) + ).toMatchFileSnapshot(`./__snapshots__/html/${testCase.name}.json`); +}; + +export const testParseMarkdown = async < + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + editor: BlockNoteEditor, + testCase: ParseTestCase +) => { + (window as any).__TEST_OPTIONS.mockID = 0; + + await expect( + await editor.tryParseMarkdownToBlocks(testCase.content) + ).toMatchFileSnapshot(`./__snapshots__/markdown/${testCase.name}.json`); +}; diff --git a/packages/core/src/api/tests/formatConversion/parse/getParseTestCases.ts b/packages/core/src/api/tests/formatConversion/parse/parseTestInstances.ts similarity index 88% rename from packages/core/src/api/tests/formatConversion/parse/getParseTestCases.ts rename to packages/core/src/api/tests/formatConversion/parse/parseTestInstances.ts index 8ab3e404f5..1844af8151 100644 --- a/packages/core/src/api/tests/formatConversion/parse/getParseTestCases.ts +++ b/packages/core/src/api/tests/formatConversion/parse/parseTestInstances.ts @@ -1,24 +1,35 @@ -export type ParseTestCase = { - name: string; - conversionType: "html" | "markdown"; - content: string; -}; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { TestInstance } from "../../types.js"; -export const getParseTestCases = (): ParseTestCase[] => [ +import { ParseTestCase } from "./parseTestCase.js"; +import { testParseHTML, testParseMarkdown } from "./parseTestExecutors.js"; + +export const parseTestInstances = (): TestInstance< + ParseTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => [ { - name: "basicBlockTypes", - conversionType: "html", - content: `

Heading 1

+ testCase: { + name: "basicBlockTypes", + content: `

Heading 1

Heading 2

Heading 3

Paragraph

Image Caption

None Bold Italic Underline Strikethrough All

`, + }, + executeTest: testParseHTML, }, { - name: "lists", - conversionType: "html", - content: `
    + testCase: { + name: "lists", + content: `
    • First
    • Second
    • Third
    • @@ -45,11 +56,13 @@ export const getParseTestCases = (): ParseTestCase[] => [
`, + }, + executeTest: testParseHTML, }, { - name: "nestedLists", - conversionType: "html", - content: `
    + testCase: { + name: "nestedLists", + content: `
    • Bullet List Item
    • Bullet List Item
        @@ -93,11 +106,13 @@ export const getParseTestCases = (): ParseTestCase[] => [ Nested Check List Item
      `, + }, + executeTest: testParseHTML, }, { - name: "nestedListsWithParagraphs", - conversionType: "html", - content: `
        + testCase: { + name: "nestedListsWithParagraphs", + content: `
        • Bullet List Item

        • @@ -159,11 +174,13 @@ export const getParseTestCases = (): ParseTestCase[] => [

          Checked List Item

        `, + }, + executeTest: testParseHTML, }, { - name: "mixedNestedLists", - conversionType: "html", - content: `
          + testCase: { + name: "mixedNestedLists", + content: `
          • Bullet List Item
          • Bullet List Item
              @@ -207,11 +224,13 @@ export const getParseTestCases = (): ParseTestCase[] => [ Nested Check List Item
          `, + }, + executeTest: testParseHTML, }, { - name: "divs", - conversionType: "html", - content: `
          Single Div
          + testCase: { + name: "divs", + content: `
          Single Div
          Div
          Nested Div
          @@ -222,31 +241,39 @@ export const getParseTestCases = (): ParseTestCase[] => [
          Nested Div
          Nested Div
          `, + }, + executeTest: testParseHTML, }, { - name: "twoDivs", - conversionType: "html", - content: `
          Single Div
          second Div
          `, + testCase: { + name: "twoDivs", + content: `
          Single Div
          second Div
          `, + }, + executeTest: testParseHTML, }, { - name: "imageInParagraph", - conversionType: "html", - content: `

          + testCase: { + name: "imageInParagraph", + content: `

          `, + }, + executeTest: testParseHTML, }, { - name: "fakeImageCaption", - conversionType: "html", - content: `
          + testCase: { + name: "fakeImageCaption", + content: `

          Image Caption

          `, + }, + executeTest: testParseHTML, }, { - name: "deepNestedContent", - conversionType: "html", - content: `
          + testCase: { + name: "deepNestedContent", + content: `
          Outer 1 Div Before
          Outer 2 Div Before @@ -268,20 +295,24 @@ export const getParseTestCases = (): ParseTestCase[] => [
          Outer 1 Div After
          `, + }, + executeTest: testParseHTML, }, { - name: "inlineContentAndNestedBlocks", - conversionType: "html", - content: `
          + testCase: { + name: "inlineContentAndNestedBlocks", + content: `
          None Bold Italic Underline Strikethrough All
          Nested Div

          Nested Paragraph

          `, + }, + executeTest: testParseHTML, }, { - name: "twoTables", - conversionType: "html", - content: ` + testCase: { + name: "twoTables", + content: `

          Company

          @@ -310,11 +341,13 @@ export const getParseTestCases = (): ParseTestCase[] => [
          `, + }, + executeTest: testParseHTML, }, { - name: "notion", - conversionType: "html", - content: `

          Heading 1

          + testCase: { + name: "notion", + content: `

          Heading 1

          Heading 2

          Heading 3

          Paragraph 1

          @@ -366,11 +399,13 @@ With Hard Break

          Paragraph

          `, + }, + executeTest: testParseHTML, }, { - name: "googleDocs", - conversionType: "html", - content: ` + testCase: { + name: "googleDocs", + content: `

          Heading 1

          @@ -462,19 +497,23 @@ With Hard Break

          Paragraph


          `, + }, + executeTest: testParseHTML, }, { - name: "codeBlocks", - conversionType: "html", - content: `
          console.log("Should default to JS")
          + testCase: { + name: "codeBlocks", + content: `
          console.log("Should default to JS")
          console.log("Should parse TS from data-language")
          print("Should parse Python from language- class")
          console.log("Should prioritize TS from data-language over language- class")
          `, + }, + executeTest: testParseHTML, }, { - name: "basic", - conversionType: "markdown", - content: `# Heading + testCase: { + name: "basic", + content: `# Heading Paragraph @@ -482,11 +521,13 @@ Paragraph 1. Numbered List Item `, + }, + executeTest: testParseMarkdown, }, { - name: "nested", - conversionType: "markdown", - content: `# Heading + testCase: { + name: "nested", + content: `# Heading Paragraph @@ -494,16 +535,20 @@ Paragraph 1. Numbered List Item `, + }, + executeTest: testParseMarkdown, }, { - name: "styled", - conversionType: "markdown", - content: `**Bold** *Italic* ~~Strikethrough~~ ***Multiple***`, + testCase: { + name: "styled", + content: `**Bold** *Italic* ~~Strikethrough~~ ***Multiple***`, + }, + executeTest: testParseMarkdown, }, { - name: "complex", - conversionType: "markdown", - content: `# Heading 1 + testCase: { + name: "complex", + content: `# Heading 1 ## Heading 2 @@ -538,27 +583,33 @@ P*ara*~~grap~~h * Bullet List Item * Bullet List Item`, + }, + executeTest: testParseMarkdown, }, { - name: "boldWithWhitespace", - conversionType: "markdown", - content: `hello **beautiful ** world`, + testCase: { + name: "boldWithWhitespace", + content: `hello **beautiful ** world`, + }, + executeTest: testParseMarkdown, }, { - name: "issue226case1", - conversionType: "markdown", - content: ` + testCase: { + name: "issue226case1", + content: ` - 📝 item1 - ⚙️ item2 - 🔗 item3 # h1 `, + }, + executeTest: testParseMarkdown, }, { - name: "issue226case2", - conversionType: "markdown", - content: `* a + testCase: { + name: "issue226case2", + content: `* a * b * c * d @@ -569,5 +620,7 @@ anything * another * list`, + }, + executeTest: testParseMarkdown, }, ]; diff --git a/packages/core/src/api/tests/formatConversion/parse/runTests.test.ts b/packages/core/src/api/tests/formatConversion/parse/runTests.test.ts new file mode 100644 index 0000000000..2e95d8008a --- /dev/null +++ b/packages/core/src/api/tests/formatConversion/parse/runTests.test.ts @@ -0,0 +1,19 @@ +import { describe, it } from "vitest"; + +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; +import { parseTestInstances } from "./parseTestInstances.js"; + +// Tests for verifying that importing blocks from other formats works as +// expected. Used for specific cases for when content from outside the editor is +// imported as blocks. This includes content from other editors, as well as +// content from the web that has produced bugs in the past. +describe("Parse tests", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of parseTestInstances()) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts b/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts deleted file mode 100644 index d854a146a5..0000000000 --- a/packages/core/src/api/tests/formatConversion/parse/testParse.test.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { describe, expect, it } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; -import { - BlockSchema, - InlineContentSchema, - StyleSchema, -} from "../../../../schema/index.js"; -import { UnreachableCaseError } from "../../../../util/typescript.js"; -import { setupTestEditor } from "../../setupTestEditor.js"; -import { testSchema } from "../../testSchema.js"; -import { getParseTestCases, ParseTestCase } from "./getParseTestCases.js"; - -// Test for verifying that importing blocks from other formats works as -// expected. Used for specific cases for when content from outside the editor is -// imported as blocks. This includes content from other editors, as well as -// content from the web that has produced bugs in the past. -export const testParse = async < - B extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - editor: BlockNoteEditor, - testCase: ParseTestCase -) => { - (window as any).__TEST_OPTIONS.mockID = 0; - if (testCase.conversionType === "html") { - await expect( - await editor.tryParseHTMLToBlocks(testCase.content) - ).toMatchFileSnapshot( - `./__snapshots__/${testCase.conversionType}/${testCase.name}.json` - ); - } else if (testCase.conversionType === "markdown") { - await expect( - await editor.tryParseMarkdownToBlocks(testCase.content) - ).toMatchFileSnapshot( - `./__snapshots__/${testCase.conversionType}/${testCase.name}.json` - ); - } else { - throw new UnreachableCaseError(testCase.conversionType); - } -}; - -describe("Export tests", () => { - const getEditor = setupTestEditor(testSchema); - - for (const testCase of getParseTestCases()) { - it(`${testCase.name}`, async () => { - await testParse(getEditor(), testCase); - }); - } -}); diff --git a/packages/core/src/api/tests/types.ts b/packages/core/src/api/tests/types.ts new file mode 100644 index 0000000000..29c72b22cb --- /dev/null +++ b/packages/core/src/api/tests/types.ts @@ -0,0 +1,23 @@ +import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js"; +import { + BlockSchema, + InlineContentSchema, + StyleSchema, +} from "../../schema/index.js"; + +export type TestExecutor< + TestCase, + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = (editor: BlockNoteEditor, testCase: TestCase) => Promise; + +export type TestInstance< + TestCase, + B extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +> = { + testCase: TestCase; + executeTest: TestExecutor; +}; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 5424d53064..5f61be162c 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -59,24 +59,25 @@ export type { CodeBlockOptions } from "./blocks/CodeBlockContent/CodeBlockConten export { UnreachableCaseError, assertEmpty } from "./util/typescript.js"; // Unit testing -export { setupTestEditor } from "./api/tests/setupTestEditor.js"; -export { testSchema } from "./api/tests/testSchema.js"; +export * from "./api/tests/setupTestEditor.js"; +export * from "./api/tests/testSchema.js"; +export * from "./api/tests/types.js"; export * from "./api/tests/clipboard/clipboardTestUtil.js"; -export type { CopyTestCase } from "./api/tests/clipboard/copy/getCopyTestCases.js"; -export { testCopy } from "./api/tests/clipboard/copy/testCopy.test.js"; -export type { CopyPasteTestCase } from "./api/tests/clipboard/copyPaste/getCopyPasteTestCases.js"; -export { testCopyPaste } from "./api/tests/clipboard/copyPaste/testCopyPaste.test.js"; -export type { CopyPasteEqualityTestCase } from "./api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestCases.js"; -export { testCopyPasteEquality } from "./api/tests/clipboard/copyPasteEquality/testCopyPasteEquality.test.js"; -export type { PasteTestCase } from "./api/tests/clipboard/paste/getPasteTestCases.js"; -export { testPaste } from "./api/tests/clipboard/paste/testPaste.test.js"; +export * from "./api/tests/clipboard/copy/copyTestCase.js"; +export * from "./api/tests/clipboard/copy/copyTestExecutors.js"; +export * from "./api/tests/clipboard/copyPaste/copyPasteTestCase.js"; +export * from "./api/tests/clipboard/copyPaste/copyPasteTestExecutors.js"; +export * from "./api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestCase.js"; +export * from "./api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.js"; +export * from "./api/tests/clipboard/paste/pasteTestCase.js"; +export * from "./api/tests/clipboard/paste/pasteTestExecutors.js"; export * from "./api/tests/formatConversion/formatConversionTestUtil.js"; -export type { ExportTestCase } from "./api/tests/formatConversion/export/getExportTestCases.js"; -export { testExport } from "./api/tests/formatConversion/export/testExport.test.js"; -export type { ExportParseEqualityTestCase } from "./api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.js"; -export { testExportParseEquality } from "./api/tests/formatConversion/exportParseEquality/testExportParseEquality.test.js"; -export type { ParseTestCase } from "./api/tests/formatConversion/parse/getParseTestCases.js"; -export { testParse } from "./api/tests/formatConversion/parse/testParse.test.js"; +export * from "./api/tests/formatConversion/export/exportTestCase.js"; +export * from "./api/tests/formatConversion/export/exportTestExecutors.js"; +export * from "./api/tests/formatConversion/exportParseEquality/exportParseEqualityTestCase.js"; +export * from "./api/tests/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.js"; +export * from "./api/tests/formatConversion/parse/parseTestCase.js"; +export * from "./api/tests/formatConversion/parse/parseTestExecutors.js"; // Node conversions export * from "./api/nodeConversions/blockToNode.js"; diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/basic.json deleted file mode 100644 index 632e74dcb7..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/basic.json +++ /dev/null @@ -1,71 +0,0 @@ -[ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Heading", - "type": "text", - }, - ], - "id": "1", - "props": { - "backgroundColor": "default", - "level": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "heading", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Paragraph", - "type": "text", - }, - ], - "id": "2", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Bullet List Item", - "type": "text", - }, - ], - "id": "3", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Numbered List Item", - "type": "text", - }, - ], - "id": "4", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "numberedListItem", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/boldWithWhitespace.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/boldWithWhitespace.json deleted file mode 100644 index 3331f6218a..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/boldWithWhitespace.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "hello **beautiful ** world", - "type": "text", - }, - ], - "id": "1", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md deleted file mode 100644 index 3e6b363013..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md +++ /dev/null @@ -1,4 +0,0 @@ -```javascript -const hello = 'world'; -console.log(hello); -``` diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md deleted file mode 100644 index f5b118ae95..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md +++ /dev/null @@ -1,3 +0,0 @@ -```text -console.log('Hello, world!'); -``` diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md deleted file mode 100644 index b5c9416ec5..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md +++ /dev/null @@ -1,2 +0,0 @@ -```text -``` diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md deleted file mode 100644 index c1908c03b2..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md +++ /dev/null @@ -1,3 +0,0 @@ -```python -print('Hello, world!') -``` diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex.json deleted file mode 100644 index 81ac21d79a..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex.json +++ /dev/null @@ -1,353 +0,0 @@ -[ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Heading 1", - "type": "text", - }, - ], - "id": "1", - "props": { - "backgroundColor": "default", - "level": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "heading", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Heading 2", - "type": "text", - }, - ], - "id": "2", - "props": { - "backgroundColor": "default", - "level": 2, - "textAlignment": "left", - "textColor": "default", - }, - "type": "heading", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Heading 3", - "type": "text", - }, - ], - "id": "3", - "props": { - "backgroundColor": "default", - "level": 3, - "textAlignment": "left", - "textColor": "default", - }, - "type": "heading", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Paragraph", - "type": "text", - }, - ], - "id": "4", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "P", - "type": "text", - }, - { - "styles": { - "bold": true, - }, - "text": "ara", - "type": "text", - }, - { - "styles": { - "italic": true, - }, - "text": "grap", - "type": "text", - }, - { - "styles": {}, - "text": "h", - "type": "text", - }, - ], - "id": "5", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "P", - "type": "text", - }, - { - "styles": { - "italic": true, - }, - "text": "ara", - "type": "text", - }, - { - "styles": { - "strike": true, - }, - "text": "grap", - "type": "text", - }, - { - "styles": {}, - "text": "h", - "type": "text", - }, - ], - "id": "6", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Bullet List Item", - "type": "text", - }, - ], - "id": "7", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [ - { - "children": [ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Bullet List Item", - "type": "text", - }, - ], - "id": "10", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - ], - "content": [ - { - "styles": {}, - "text": "Bullet List Item", - "type": "text", - }, - ], - "id": "9", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Numbered List Item", - "type": "text", - }, - ], - "id": "12", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "numberedListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Numbered List Item", - "type": "text", - }, - ], - "id": "13", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "numberedListItem", - }, - { - "children": [ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Numbered List Item", - "type": "text", - }, - ], - "id": "15", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "numberedListItem", - }, - ], - "content": [ - { - "styles": {}, - "text": "Numbered List Item", - "type": "text", - }, - ], - "id": "14", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "numberedListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Bullet List Item", - "type": "text", - }, - ], - "id": "16", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - ], - "content": [ - { - "styles": {}, - "text": "Paragraph", - "type": "text", - }, - ], - "id": "11", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Bullet List Item", - "type": "text", - }, - ], - "id": "17", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - ], - "content": [ - { - "styles": {}, - "text": "Bullet List Item", - "type": "text", - }, - ], - "id": "8", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Bullet List Item", - "type": "text", - }, - ], - "id": "18", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md deleted file mode 100644 index 4a2de0a7fc..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md +++ /dev/null @@ -1,5 +0,0 @@ -## **Heading ***~~2~~* - -Paragraph - -* diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/basic.md deleted file mode 100644 index 3acd9e1ad0..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/basic.md +++ /dev/null @@ -1,3 +0,0 @@ -[example](exampleURL) - -Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/button.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/button.md deleted file mode 100644 index 8d3fa6a207..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/button.md +++ /dev/null @@ -1 +0,0 @@ -Add file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/nested.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/nested.md deleted file mode 100644 index 93a61da7b4..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/nested.md +++ /dev/null @@ -1,7 +0,0 @@ -[example](exampleURL) - -Caption - -[example](exampleURL) - -Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md deleted file mode 100644 index f525eb2143..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md +++ /dev/null @@ -1 +0,0 @@ -[example](exampleURL) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noName.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noName.md deleted file mode 100644 index c7fefc547f..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/file/noName.md +++ /dev/null @@ -1,3 +0,0 @@ -[exampleURL](exampleURL) - -Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md deleted file mode 100644 index 0fe906b288..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md +++ /dev/null @@ -1,2 +0,0 @@ -Text1\ -Text2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md deleted file mode 100644 index 3f74feb726..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md +++ /dev/null @@ -1,2 +0,0 @@ -[Link1](https://www.website.com)\ -[Link2](https://www.website2.com) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md deleted file mode 100644 index 9d80a6ba66..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md +++ /dev/null @@ -1 +0,0 @@ -Text1 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md deleted file mode 100644 index 95a590abea..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md +++ /dev/null @@ -1,2 +0,0 @@ -[Link1](https://www.website.com)\ -[Link1](https://www.website.com) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md deleted file mode 100644 index f7e9c54f1f..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md +++ /dev/null @@ -1,3 +0,0 @@ -Text1\ -Text2\ -Text3 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/only.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/only.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md deleted file mode 100644 index 9d80a6ba66..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md +++ /dev/null @@ -1 +0,0 @@ -Text1 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md deleted file mode 100644 index f92fc1d40e..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md +++ /dev/null @@ -1,2 +0,0 @@ -Text1\ -**Text2** diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/basic.md deleted file mode 100644 index 3acd9e1ad0..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/basic.md +++ /dev/null @@ -1,3 +0,0 @@ -[example](exampleURL) - -Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/button.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/button.md deleted file mode 100644 index 02184caf8a..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/button.md +++ /dev/null @@ -1 +0,0 @@ -Add image diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/nested.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/nested.md deleted file mode 100644 index 83c6df00ed..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/nested.md +++ /dev/null @@ -1,7 +0,0 @@ -[exampleURL](exampleURL) - -Caption - -[exampleURL](exampleURL) - -Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md deleted file mode 100644 index f525eb2143..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md +++ /dev/null @@ -1 +0,0 @@ -[example](exampleURL) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noName.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noName.md deleted file mode 100644 index c7fefc547f..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noName.md +++ /dev/null @@ -1,3 +0,0 @@ -[exampleURL](exampleURL) - -Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md deleted file mode 100644 index 3acd9e1ad0..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md +++ /dev/null @@ -1,3 +0,0 @@ -[example](exampleURL) - -Caption diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case1.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case1.json deleted file mode 100644 index 8ca8b088a3..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case1.json +++ /dev/null @@ -1,71 +0,0 @@ -[ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "📝 item1", - "type": "text", - }, - ], - "id": "1", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "⚙️ item2", - "type": "text", - }, - ], - "id": "2", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "🔗 item3", - "type": "text", - }, - ], - "id": "3", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "h1", - "type": "text", - }, - ], - "id": "4", - "props": { - "backgroundColor": "default", - "level": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "heading", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case2.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case2.json deleted file mode 100644 index e0939c1645..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/issue226case2.json +++ /dev/null @@ -1,144 +0,0 @@ -[ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "a", - "type": "text", - }, - ], - "id": "1", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "b", - "type": "text", - }, - ], - "id": "2", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "c", - "type": "text", - }, - ], - "id": "3", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "d", - "type": "text", - }, - ], - "id": "4", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "anything", - "type": "text", - }, - ], - "id": "5", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, - { - "children": [], - "content": [ - { - "content": [ - { - "styles": {}, - "text": "a link", - "type": "text", - }, - ], - "href": "http://example.com", - "type": "link", - }, - ], - "id": "6", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "another", - "type": "text", - }, - ], - "id": "7", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "list", - "type": "text", - }, - ], - "id": "8", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md deleted file mode 100644 index 4fe44186fa..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md +++ /dev/null @@ -1 +0,0 @@ -[Website](https://www.website.com)[Website2](https://www.website2.com) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/basic.md deleted file mode 100644 index bc9d83b3da..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/basic.md +++ /dev/null @@ -1 +0,0 @@ -[Website](https://www.website.com) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/styled.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/styled.md deleted file mode 100644 index ad7b143e27..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/link/styled.md +++ /dev/null @@ -1 +0,0 @@ -**[Web](https://www.website.com)**[site](https://www.website.com) diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md deleted file mode 100644 index ae6392a26d..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md +++ /dev/null @@ -1,10 +0,0 @@ -* Bullet List Item 1 - -* Bullet List Item 2 - -1. Numbered List Item 1 - -2. Numbered List Item 2 - -* [ ] Check List Item 1 -* [x] Check List Item 2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md deleted file mode 100644 index bb6af59913..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md +++ /dev/null @@ -1,10 +0,0 @@ -* Bullet List Item 1 - -* Bullet List Item 2 - - 1. Numbered List Item 1 - - 2. Numbered List Item 2 - - * [ ] Check List Item 1 - * [x] Check List Item 2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/nested.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/nested.json deleted file mode 100644 index df04f955b6..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/nested.json +++ /dev/null @@ -1,72 +0,0 @@ -[ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Heading", - "type": "text", - }, - ], - "id": "1", - "props": { - "backgroundColor": "default", - "level": 1, - "textAlignment": "left", - "textColor": "default", - }, - "type": "heading", - }, - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Paragraph", - "type": "text", - }, - ], - "id": "2", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, - { - "children": [ - { - "children": [], - "content": [ - { - "styles": {}, - "text": "Numbered List Item", - "type": "text", - }, - ], - "id": "4", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "numberedListItem", - }, - ], - "content": [ - { - "styles": {}, - "text": "Bullet List Item", - "type": "text", - }, - ], - "id": "3", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "bulletListItem", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md deleted file mode 100644 index 07e18e6d30..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md +++ /dev/null @@ -1 +0,0 @@ -Paragraph diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/empty.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/empty.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md deleted file mode 100644 index c1cd81690f..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md +++ /dev/null @@ -1,2 +0,0 @@ -Line 1\ -Line 2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md deleted file mode 100644 index af7d1348ad..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md +++ /dev/null @@ -1,5 +0,0 @@ -Paragraph - -Nested Paragraph 1 - -Nested Paragraph 2 diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md deleted file mode 100644 index 4f45e63c5c..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md +++ /dev/null @@ -1 +0,0 @@ -Plain Red Text Blue Background Mixed Colors diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/styled.json b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/styled.json deleted file mode 100644 index a2c32954d5..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/styled.json +++ /dev/null @@ -1,58 +0,0 @@ -[ - { - "children": [], - "content": [ - { - "styles": { - "bold": true, - }, - "text": "Bold", - "type": "text", - }, - { - "styles": {}, - "text": " ", - "type": "text", - }, - { - "styles": { - "italic": true, - }, - "text": "Italic", - "type": "text", - }, - { - "styles": {}, - "text": " ", - "type": "text", - }, - { - "styles": { - "strike": true, - }, - "text": "Strikethrough", - "type": "text", - }, - { - "styles": {}, - "text": " ", - "type": "text", - }, - { - "styles": { - "bold": true, - "italic": true, - }, - "text": "Multiple", - "type": "text", - }, - ], - "id": "1", - "props": { - "backgroundColor": "default", - "textAlignment": "left", - "textColor": "default", - }, - "type": "paragraph", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md deleted file mode 100644 index 3e52272fe0..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md +++ /dev/null @@ -1,5 +0,0 @@ -| | | | -| ---------- | ---------- | ---------- | -| Table Cell | Table Cell | Table Cell | -| Table Cell | Table Cell | Table Cell | -| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/basic.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/basic.md deleted file mode 100644 index 3e52272fe0..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/basic.md +++ /dev/null @@ -1,5 +0,0 @@ -| | | | -| ---------- | ---------- | ---------- | -| Table Cell | Table Cell | Table Cell | -| Table Cell | Table Cell | Table Cell | -| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md deleted file mode 100644 index 812aac2d02..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md +++ /dev/null @@ -1,4 +0,0 @@ -| Table Cell | Table Cell | Table Cell | -| ---------- | ---------- | ---------- | -| Table Cell | Table Cell | Table Cell | -| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md deleted file mode 100644 index 812aac2d02..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md +++ /dev/null @@ -1,4 +0,0 @@ -| Table Cell | Table Cell | Table Cell | -| ---------- | ---------- | ---------- | -| Table Cell | Table Cell | Table Cell | -| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md deleted file mode 100644 index 3e52272fe0..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md +++ /dev/null @@ -1,5 +0,0 @@ -| | | | -| ---------- | ---------- | ---------- | -| Table Cell | Table Cell | Table Cell | -| Table Cell | Table Cell | Table Cell | -| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md deleted file mode 100644 index 3e52272fe0..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md +++ /dev/null @@ -1,5 +0,0 @@ -| | | | -| ---------- | ---------- | ---------- | -| Table Cell | Table Cell | Table Cell | -| Table Cell | Table Cell | Table Cell | -| Table Cell | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md b/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md deleted file mode 100644 index 5f817e4d91..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md +++ /dev/null @@ -1,5 +0,0 @@ -| | | | -| ---------- | ---------- | ---------- | -| Table Cell | | Table Cell | -| Table Cell | Table Cell | | -| | Table Cell | Table Cell | diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json deleted file mode 100644 index da4c135551..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "language": "javascript", - }, - "content": [ - { - "text": "const hello = 'world'; -console.log(hello); -", - "type": "text", - }, - ], - "type": "codeBlock", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json deleted file mode 100644 index 97b0374bfb..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json +++ /dev/null @@ -1,24 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "language": "text", - }, - "content": [ - { - "text": "console.log('Hello, world!');", - "type": "text", - }, - ], - "type": "codeBlock", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json deleted file mode 100644 index 4fd34ff835..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "language": "text", - }, - "type": "codeBlock", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json deleted file mode 100644 index 01b6f86580..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json +++ /dev/null @@ -1,24 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "language": "python", - }, - "content": [ - { - "text": "print('Hello, world!')", - "type": "text", - }, - ], - "type": "codeBlock", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json deleted file mode 100644 index 85f484ec68..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json +++ /dev/null @@ -1,88 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "blue", - "id": "1", - "textColor": "yellow", - }, - "content": [ - { - "attrs": { - "level": 2, - "textAlignment": "right", - }, - "content": [ - { - "marks": [ - { - "type": "bold", - }, - { - "type": "underline", - }, - ], - "text": "Heading ", - "type": "text", - }, - { - "marks": [ - { - "type": "italic", - }, - { - "type": "strike", - }, - ], - "text": "2", - "type": "text", - }, - ], - "type": "heading", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "red", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Paragraph", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "3", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "type": "bulletListItem", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/basic.json deleted file mode 100644 index 0de31316e1..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/basic.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/button.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/button.json deleted file mode 100644 index 42be1c0985..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/button.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "", - "url": "", - }, - "type": "file", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/nested.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/nested.json deleted file mode 100644 index f122b855d8..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/nested.json +++ /dev/null @@ -1,43 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json deleted file mode 100644 index 7b9cd6f1c4..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "example", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noName.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noName.json deleted file mode 100644 index 393aff6af8..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/file/noName.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "", - "url": "exampleURL", - }, - "type": "file", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json deleted file mode 100644 index 8f3e362113..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json +++ /dev/null @@ -1,31 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Text1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "text": "Text2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json deleted file mode 100644 index 93e7571b21..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json +++ /dev/null @@ -1,53 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Link1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website2.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Link2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json deleted file mode 100644 index 781e539991..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Text1", - "type": "text", - }, - { - "type": "hardBreak", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json deleted file mode 100644 index aee93b47d3..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json +++ /dev/null @@ -1,53 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Link1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Link1", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json deleted file mode 100644 index b8cd0f19ec..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Text1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "text": "Text2", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "text": "Text3", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json deleted file mode 100644 index 6a1a4d2554..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "type": "hardBreak", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json deleted file mode 100644 index dc2396df1f..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "type": "hardBreak", - }, - { - "text": "Text1", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json deleted file mode 100644 index 034bf8b726..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Text1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "marks": [ - { - "type": "bold", - }, - ], - "text": "Text2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/basic.json deleted file mode 100644 index ad2d0f7a69..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/basic.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/button.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/button.json deleted file mode 100644 index e0aef86d8e..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/button.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "", - "previewWidth": 512, - "showPreview": true, - "textAlignment": "left", - "url": "", - }, - "type": "image", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/nested.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/nested.json deleted file mode 100644 index db8fee4b1d..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/nested.json +++ /dev/null @@ -1,49 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json deleted file mode 100644 index aaa57c857a..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "", - "name": "example", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noName.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noName.json deleted file mode 100644 index 10a9c03a69..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noName.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "", - "previewWidth": 256, - "showPreview": true, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json deleted file mode 100644 index 946ca5f86e..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "caption": "Caption", - "name": "example", - "previewWidth": 256, - "showPreview": false, - "textAlignment": "left", - "url": "exampleURL", - }, - "type": "image", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json deleted file mode 100644 index 13f609f82e..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json +++ /dev/null @@ -1,50 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Website", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website2.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Website2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/basic.json deleted file mode 100644 index a760a4ad4f..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/basic.json +++ /dev/null @@ -1,35 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Website", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/styled.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/styled.json deleted file mode 100644 index 2d4dc02bec..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/link/styled.json +++ /dev/null @@ -1,53 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "marks": [ - { - "type": "bold", - }, - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "Web", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://www.website.com", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "site", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json deleted file mode 100644 index 70a1a0aaa4..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json +++ /dev/null @@ -1,140 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Bullet List Item 1", - "type": "text", - }, - ], - "type": "bulletListItem", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Bullet List Item 2", - "type": "text", - }, - ], - "type": "bulletListItem", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "3", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "index": null, - "start": undefined, - "textAlignment": "left", - }, - "content": [ - { - "text": "Numbered List Item 1", - "type": "text", - }, - ], - "type": "numberedListItem", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "4", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "index": null, - "start": undefined, - "textAlignment": "left", - }, - "content": [ - { - "text": "Numbered List Item 2", - "type": "text", - }, - ], - "type": "numberedListItem", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "5", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "checked": false, - "textAlignment": "left", - }, - "content": [ - { - "text": "Check List Item 1", - "type": "text", - }, - ], - "type": "checkListItem", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "6", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "checked": true, - "textAlignment": "left", - }, - "content": [ - { - "text": "Check List Item 2", - "type": "text", - }, - ], - "type": "checkListItem", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json deleted file mode 100644 index b0f224fec8..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json +++ /dev/null @@ -1,150 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Bullet List Item 1", - "type": "text", - }, - ], - "type": "bulletListItem", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Bullet List Item 2", - "type": "text", - }, - ], - "type": "bulletListItem", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "3", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "index": null, - "start": undefined, - "textAlignment": "left", - }, - "content": [ - { - "text": "Numbered List Item 1", - "type": "text", - }, - ], - "type": "numberedListItem", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "4", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "index": null, - "start": undefined, - "textAlignment": "left", - }, - "content": [ - { - "text": "Numbered List Item 2", - "type": "text", - }, - ], - "type": "numberedListItem", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "5", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "checked": false, - "textAlignment": "left", - }, - "content": [ - { - "text": "Check List Item 1", - "type": "text", - }, - ], - "type": "checkListItem", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "6", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "checked": true, - "textAlignment": "left", - }, - "content": [ - { - "text": "Check List Item 2", - "type": "text", - }, - ], - "type": "checkListItem", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json deleted file mode 100644 index f054006323..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "type": "pageBreak", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json deleted file mode 100644 index 03c5eb0a1b..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json +++ /dev/null @@ -1,24 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Paragraph", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json deleted file mode 100644 index 34dcd51ce9..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json deleted file mode 100644 index 14d1230246..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json +++ /dev/null @@ -1,31 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Line 1", - "type": "text", - }, - { - "type": "hardBreak", - }, - { - "text": "Line 2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json deleted file mode 100644 index 8b7532615d..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json +++ /dev/null @@ -1,73 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Paragraph", - "type": "text", - }, - ], - "type": "paragraph", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "id": "2", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested Paragraph 1", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, - { - "attrs": { - "backgroundColor": "default", - "id": "3", - "textColor": "default", - }, - "content": [ - { - "attrs": { - "textAlignment": "left", - }, - "content": [ - { - "text": "Nested Paragraph 2", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, - ], - "type": "blockGroup", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json deleted file mode 100644 index debf389327..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json +++ /dev/null @@ -1,66 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "pink", - "id": "1", - "textColor": "orange", - }, - "content": [ - { - "attrs": { - "textAlignment": "center", - }, - "content": [ - { - "text": "Plain ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - ], - "text": "Red Text ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Blue Background ", - "type": "text", - }, - { - "marks": [ - { - "attrs": { - "stringValue": "red", - }, - "type": "textColor", - }, - { - "attrs": { - "stringValue": "blue", - }, - "type": "backgroundColor", - }, - ], - "text": "Mixed Colors", - "type": "text", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json deleted file mode 100644 index 519391c98f..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json +++ /dev/null @@ -1,248 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 200, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 200, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 200, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/basic.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/basic.json deleted file mode 100644 index 8fd5f7f2d3..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/basic.json +++ /dev/null @@ -1,230 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json deleted file mode 100644 index 3933a56ca3..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json +++ /dev/null @@ -1,230 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json deleted file mode 100644 index dc9ee26a35..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json +++ /dev/null @@ -1,230 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableHeader", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json deleted file mode 100644 index 69b25e9bfa..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json +++ /dev/null @@ -1,242 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "red", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "blue", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "blue", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "yellow", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "red", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json deleted file mode 100644 index 60600bb04e..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json +++ /dev/null @@ -1,242 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": null, - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json b/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json deleted file mode 100644 index 11fb672923..0000000000 --- a/packages/react/src/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json +++ /dev/null @@ -1,178 +0,0 @@ -[ - { - "attrs": { - "backgroundColor": "default", - "id": "1", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "content": [ - { - "attrs": { - "backgroundColor": "red", - "colspan": 2, - "colwidth": [ - 100, - 200, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "blue", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "yellow", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "red", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 100, - ], - "rowspan": 2, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 2, - "colwidth": [ - 200, - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "content": [ - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 200, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - { - "attrs": { - "backgroundColor": "default", - "colspan": 1, - "colwidth": [ - 300, - ], - "rowspan": 1, - "textAlignment": "left", - "textColor": "default", - }, - "content": [ - { - "content": [ - { - "text": "Table Cell", - "type": "text", - }, - ], - "type": "tableParagraph", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - ], - "type": "blockContainer", - }, -] \ No newline at end of file diff --git a/packages/react/src/tests/formatConversion/export/getExportTestCases.ts b/packages/react/src/tests/formatConversion/export/getExportTestCases.ts deleted file mode 100644 index a672fed500..0000000000 --- a/packages/react/src/tests/formatConversion/export/getExportTestCases.ts +++ /dev/null @@ -1,428 +0,0 @@ -import { ExportTestCase } from "@blocknote/core"; - -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; - -export const getExportTestCases = ( - conversionType: ExportTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >["conversionType"] -): ExportTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema ->[] => [ - { - name: "reactFile/button", - conversionType, - content: [ - { - type: "file", - }, - ], - }, - { - name: "reactFile/basic", - conversionType, - content: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - { - name: "reactFile/noName", - conversionType, - content: [ - { - type: "file", - props: { - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - { - name: "reactFile/noCaption", - conversionType, - content: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - }, - }, - ], - }, - { - name: "reactFile/nested", - conversionType, - content: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - children: [ - { - type: "file", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - }, - }, - ], - }, - ], - }, - // Because images need to fetch the download URL async, their internal HTML - // is initially rendered without a `src` attribute, which is reflected in - // the tests. - { - name: "reactImage/button", - conversionType, - content: [ - { - type: "image", - }, - ], - }, - { - name: "reactImage/basic", - conversionType, - content: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - { - name: "reactImage/noName", - conversionType, - content: [ - { - type: "image", - props: { - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - { - name: "reactImage/noCaption", - conversionType, - content: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - previewWidth: 256, - }, - }, - ], - }, - { - name: "reactImage/noPreview", - conversionType, - content: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - showPreview: false, - previewWidth: 256, - }, - }, - ], - }, - { - name: "reactImage/nested", - conversionType, - content: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - children: [ - { - type: "image", - props: { - name: "example", - url: "exampleURL", - caption: "Caption", - previewWidth: 256, - }, - }, - ], - }, - ], - }, - { - name: "customParagraph/basic", - conversionType, - content: [ - { - type: "customParagraph", - content: "React Custom Paragraph", - }, - ], - }, - { - name: "customParagraph/styled", - conversionType, - content: [ - { - type: "customParagraph", - props: { - textAlignment: "center", - textColor: "orange", - backgroundColor: "pink", - }, - content: [ - { - type: "text", - styles: {}, - text: "Plain ", - }, - { - type: "text", - styles: { - textColor: "red", - }, - text: "Red Text ", - }, - { - type: "text", - styles: { - backgroundColor: "blue", - }, - text: "Blue Background ", - }, - { - type: "text", - styles: { - textColor: "red", - backgroundColor: "blue", - }, - text: "Mixed Colors", - }, - ], - }, - ], - }, - { - name: "customParagraph/nested", - conversionType, - content: [ - { - type: "customParagraph", - content: "React Custom Paragraph", - children: [ - { - type: "customParagraph", - content: "Nested React Custom Paragraph 1", - }, - { - type: "customParagraph", - content: "Nested React Custom Paragraph 2", - }, - ], - }, - ], - }, - { - name: "customParagraph/lineBreaks", - conversionType, - content: [ - { - type: "customParagraph", - content: "Line 1\nLine 2", - }, - ], - }, - { - name: "simpleCustomParagraph/basic", - conversionType, - content: [ - { - type: "simpleCustomParagraph", - content: "React Custom Paragraph", - }, - ], - }, - { - name: "simpleCustomParagraph/styled", - conversionType, - content: [ - { - type: "simpleCustomParagraph", - props: { - textAlignment: "center", - textColor: "orange", - backgroundColor: "pink", - }, - content: [ - { - type: "text", - styles: {}, - text: "Plain ", - }, - { - type: "text", - styles: { - textColor: "red", - }, - text: "Red Text ", - }, - { - type: "text", - styles: { - backgroundColor: "blue", - }, - text: "Blue Background ", - }, - { - type: "text", - styles: { - textColor: "red", - backgroundColor: "blue", - }, - text: "Mixed Colors", - }, - ], - }, - ], - }, - { - name: "simpleCustomParagraph/nested", - conversionType, - content: [ - { - type: "simpleCustomParagraph", - content: "Custom React Paragraph", - children: [ - { - type: "simpleCustomParagraph", - content: "Nested React Custom Paragraph 1", - }, - { - type: "simpleCustomParagraph", - content: "Nested React Custom Paragraph 2", - }, - ], - }, - ], - }, - { - name: "contextParagraph/basic", - conversionType, - content: [ - { - type: "contextParagraph", - content: "React Context Paragraph", - }, - ], - }, - { - name: "mention/basic", - conversionType, - content: [ - { - type: "paragraph", - content: [ - "I enjoy working with ", - { - type: "mention", - props: { - user: "Matthew", - }, - content: undefined, - } as const, - ], - }, - ], - }, - { - name: "tag/basic", - conversionType, - content: [ - { - type: "paragraph", - content: [ - "I love ", - { - type: "tag", - // props: {}, - content: "BlockNote", - } as const, - ], - }, - ], - }, - { - name: "small/basic", - conversionType, - content: [ - { - type: "paragraph", - content: [ - { - type: "text", - text: "This is a small text", - styles: { - small: true, - }, - }, - ], - }, - ], - }, - { - name: "fontSize/basic", - conversionType, - content: [ - { - type: "paragraph", - content: [ - { - type: "text", - text: "This is text with a custom fontSize", - styles: { - fontSize: "18px", - }, - }, - ], - }, - ], - }, -]; diff --git a/packages/react/src/tests/formatConversion/export/getExportTestInstances.ts b/packages/react/src/tests/formatConversion/export/getExportTestInstances.ts new file mode 100644 index 0000000000..2db0a49741 --- /dev/null +++ b/packages/react/src/tests/formatConversion/export/getExportTestInstances.ts @@ -0,0 +1,476 @@ +import { ExportTestCase, TestExecutor, TestInstance } from "@blocknote/core"; + +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; + +export const getExportTestInstances = ( + executeTest: TestExecutor< + ExportTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + > +): TestInstance< + ExportTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => [ + { + testCase: { + name: "reactFile/button", + content: [ + { + type: "file", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "reactFile/basic", + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "reactFile/noName", + content: [ + { + type: "file", + props: { + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "reactFile/noCaption", + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "reactFile/nested", + content: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + children: [ + { + type: "file", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + }, + }, + ], + }, + ], + }, + executeTest, + }, + // Because images need to fetch the download URL async, their internal HTML + // is initially rendered without a `src` attribute, which is reflected in + // the tests. + { + testCase: { + name: "reactImage/button", + content: [ + { + type: "image", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "reactImage/basic", + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "reactImage/noName", + content: [ + { + type: "image", + props: { + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "reactImage/noCaption", + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + previewWidth: 256, + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "reactImage/noPreview", + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + showPreview: false, + previewWidth: 256, + }, + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "reactImage/nested", + content: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + children: [ + { + type: "image", + props: { + name: "example", + url: "exampleURL", + caption: "Caption", + previewWidth: 256, + }, + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "customParagraph/basic", + content: [ + { + type: "customParagraph", + content: "React Custom Paragraph", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "customParagraph/styled", + content: [ + { + type: "customParagraph", + props: { + textAlignment: "center", + textColor: "orange", + backgroundColor: "pink", + }, + content: [ + { + type: "text", + styles: {}, + text: "Plain ", + }, + { + type: "text", + styles: { + textColor: "red", + }, + text: "Red Text ", + }, + { + type: "text", + styles: { + backgroundColor: "blue", + }, + text: "Blue Background ", + }, + { + type: "text", + styles: { + textColor: "red", + backgroundColor: "blue", + }, + text: "Mixed Colors", + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "customParagraph/nested", + content: [ + { + type: "customParagraph", + content: "React Custom Paragraph", + children: [ + { + type: "customParagraph", + content: "Nested React Custom Paragraph 1", + }, + { + type: "customParagraph", + content: "Nested React Custom Paragraph 2", + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "customParagraph/lineBreaks", + content: [ + { + type: "customParagraph", + content: "Line 1\nLine 2", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "simpleCustomParagraph/basic", + content: [ + { + type: "simpleCustomParagraph", + content: "React Custom Paragraph", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "simpleCustomParagraph/styled", + content: [ + { + type: "simpleCustomParagraph", + props: { + textAlignment: "center", + textColor: "orange", + backgroundColor: "pink", + }, + content: [ + { + type: "text", + styles: {}, + text: "Plain ", + }, + { + type: "text", + styles: { + textColor: "red", + }, + text: "Red Text ", + }, + { + type: "text", + styles: { + backgroundColor: "blue", + }, + text: "Blue Background ", + }, + { + type: "text", + styles: { + textColor: "red", + backgroundColor: "blue", + }, + text: "Mixed Colors", + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "simpleCustomParagraph/nested", + content: [ + { + type: "simpleCustomParagraph", + content: "Custom React Paragraph", + children: [ + { + type: "simpleCustomParagraph", + content: "Nested React Custom Paragraph 1", + }, + { + type: "simpleCustomParagraph", + content: "Nested React Custom Paragraph 2", + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "contextParagraph/basic", + content: [ + { + type: "contextParagraph", + content: "React Context Paragraph", + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "mention/basic", + content: [ + { + type: "paragraph", + content: [ + "I enjoy working with ", + { + type: "mention", + props: { + user: "Matthew", + }, + content: undefined, + } as const, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "tag/basic", + content: [ + { + type: "paragraph", + content: [ + "I love ", + { + type: "tag", + // props: {}, + content: "BlockNote", + } as const, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "small/basic", + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "This is a small text", + styles: { + small: true, + }, + }, + ], + }, + ], + }, + executeTest, + }, + { + testCase: { + name: "fontSize/basic", + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "This is text with a custom fontSize", + styles: { + fontSize: "18px", + }, + }, + ], + }, + ], + }, + executeTest, + }, +]; diff --git a/packages/react/src/tests/formatConversion/export/testExport.test.ts b/packages/react/src/tests/formatConversion/export/testExport.test.ts index e7c28ea18f..43bf3a6781 100644 --- a/packages/react/src/tests/formatConversion/export/testExport.test.ts +++ b/packages/react/src/tests/formatConversion/export/testExport.test.ts @@ -1,19 +1,19 @@ -import { testExport } from "@blocknote/core"; +import { testExportBlockNoteHTML, testExportHTML } from "@blocknote/core"; import { describe, it } from "vitest"; import { setupTestEditor } from "../../setupTestEditor.js"; import { testSchema } from "../../testSchema.js"; -import { getExportTestCases } from "./getExportTestCases.js"; +import { getExportTestInstances } from "./getExportTestInstances.js"; -describe("Export tests", () => { +describe("React export tests", () => { const getEditor = setupTestEditor(testSchema); - for (const testCase of [ - ...getExportTestCases("blocknoteHTML"), - ...getExportTestCases("html"), + for (const { testCase, executeTest } of [ + ...getExportTestInstances(testExportBlockNoteHTML), + ...getExportTestInstances(testExportHTML), ]) { it(`${testCase.name}`, async () => { - await testExport(getEditor(), testCase); + await executeTest(getEditor(), testCase); }); } }); diff --git a/packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts b/packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts deleted file mode 100644 index d544631d21..0000000000 --- a/packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestCases.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ExportParseEqualityTestCase } from "@blocknote/core"; - -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; -import { getExportTestCases } from "../export/getExportTestCases.js"; - -export const getExportParseEqualityTestCases = ( - conversionType: ExportParseEqualityTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >["conversionType"] -): ExportParseEqualityTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema ->[] => - getExportTestCases(conversionType).map(({ name, content }) => ({ - name, - conversionType, - content, - })); diff --git a/packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts b/packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts new file mode 100644 index 0000000000..46992730a2 --- /dev/null +++ b/packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts @@ -0,0 +1,34 @@ +import { + ExportParseEqualityTestCase, + TestExecutor, + TestInstance, +} from "@blocknote/core"; + +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { getExportTestInstances } from "../export/getExportTestInstances.js"; + +export const getExportParseEqualityTestInstances = ( + executeTest: TestExecutor< + ExportParseEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + > +): TestInstance< + ExportParseEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] => getExportTestInstances(executeTest); diff --git a/packages/react/src/tests/formatConversion/exportParseEquality/runTests.test.ts b/packages/react/src/tests/formatConversion/exportParseEquality/runTests.test.ts new file mode 100644 index 0000000000..9a4d1f9eb0 --- /dev/null +++ b/packages/react/src/tests/formatConversion/exportParseEquality/runTests.test.ts @@ -0,0 +1,24 @@ +import { + testExportParseEqualityBlockNoteHTML, + testExportParseEqualityNodes, +} from "@blocknote/core"; +import { describe, it } from "vitest"; + +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; +import { getExportParseEqualityTestInstances } from "./getExportParseEqualityTestInstances.js"; + +describe("Export/parse equality tests", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of [ + ...getExportParseEqualityTestInstances( + testExportParseEqualityBlockNoteHTML + ), + ...getExportParseEqualityTestInstances(testExportParseEqualityNodes), + ]) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); diff --git a/packages/react/src/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts b/packages/react/src/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts deleted file mode 100644 index a67b816041..0000000000 --- a/packages/react/src/tests/formatConversion/exportParseEquality/testExportParseEquality.test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { testExportParseEquality } from "@blocknote/core"; -import { describe, it } from "vitest"; - -import { setupTestEditor } from "../../setupTestEditor.js"; -import { testSchema } from "../../testSchema.js"; -import { getExportParseEqualityTestCases } from "./getExportParseEqualityTestCases.js"; - -describe("Export/parse equality tests", () => { - const getEditor = setupTestEditor(testSchema); - - for (const testCase of [ - ...getExportParseEqualityTestCases("blocknoteHTML"), - ...getExportParseEqualityTestCases("nodes"), - ]) { - it(`${testCase.name}`, async () => { - await testExportParseEquality(getEditor(), testCase); - }); - } -}); From 5d84e9904695c5c5a50efc26939562d1a43cce82 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Thu, 10 Apr 2025 11:22:20 +0200 Subject: [PATCH 06/12] Removed accidentally added snapshots --- .../headings-json-chromium-darwin.json | 180 ------------------ .../paragraphs-json-chromium-darwin.json | 174 ----------------- .../dragdropsingle-chromium-darwin.json | 95 --------- 3 files changed, 449 deletions(-) delete mode 100644 tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-darwin.json delete mode 100644 tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-darwin.json delete mode 100644 tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-darwin.json diff --git a/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-darwin.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-darwin.json deleted file mode 100644 index efc45cfa6f..0000000000 --- a/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-darwin.json +++ /dev/null @@ -1,180 +0,0 @@ -{ - "type": "doc", - "content": [ - { - "type": "blockGroup", - "content": [ - { - "type": "blockContainer", - "attrs": { - "id": "0", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "heading", - "attrs": { - "textAlignment": "left", - "level": 1 - }, - "content": [ - { - "type": "text", - "text": "Heading" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "1", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "heading", - "attrs": { - "textAlignment": "left", - "level": 2 - }, - "content": [ - { - "type": "text", - "text": "Heading" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "2", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "heading", - "attrs": { - "textAlignment": "left", - "level": 3 - }, - "content": [ - { - "type": "text", - "text": "Heading" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "3", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "paragraph", - "attrs": { - "textAlignment": "left" - } - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "5", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "heading", - "attrs": { - "textAlignment": "left", - "level": 1 - }, - "content": [ - { - "type": "text", - "text": "Heading" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "6", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "heading", - "attrs": { - "textAlignment": "left", - "level": 2 - }, - "content": [ - { - "type": "text", - "text": "Heading" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "7", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "heading", - "attrs": { - "textAlignment": "left", - "level": 3 - }, - "content": [ - { - "type": "text", - "text": "Heading" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "8", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "paragraph", - "attrs": { - "textAlignment": "left" - } - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-darwin.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-darwin.json deleted file mode 100644 index 9c6d0d2406..0000000000 --- a/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-darwin.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "type": "doc", - "content": [ - { - "type": "blockGroup", - "content": [ - { - "type": "blockContainer", - "attrs": { - "id": "0", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "paragraph", - "attrs": { - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Paragraph" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "1", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "paragraph", - "attrs": { - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Paragraph" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "2", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "paragraph", - "attrs": { - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Paragraph" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "3", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "paragraph", - "attrs": { - "textAlignment": "left" - } - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "5", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "paragraph", - "attrs": { - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Paragraph" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "6", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "paragraph", - "attrs": { - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Paragraph" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "7", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "paragraph", - "attrs": { - "textAlignment": "left" - }, - "content": [ - { - "type": "text", - "text": "Paragraph" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "8", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "paragraph", - "attrs": { - "textAlignment": "left" - } - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-darwin.json b/tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-darwin.json deleted file mode 100644 index ed1986da9f..0000000000 --- a/tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-darwin.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "type": "doc", - "content": [ - { - "type": "blockGroup", - "content": [ - { - "type": "blockContainer", - "attrs": { - "id": "1", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "heading", - "attrs": { - "textAlignment": "left", - "level": 2 - }, - "content": [ - { - "type": "text", - "text": "Heading" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "0", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "heading", - "attrs": { - "textAlignment": "left", - "level": 1 - }, - "content": [ - { - "type": "text", - "text": "Heading" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "2", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "heading", - "attrs": { - "textAlignment": "left", - "level": 3 - }, - "content": [ - { - "type": "text", - "text": "Heading" - } - ] - } - ] - }, - { - "type": "blockContainer", - "attrs": { - "id": "3", - "textColor": "default", - "backgroundColor": "default" - }, - "content": [ - { - "type": "paragraph", - "attrs": { - "textAlignment": "left" - } - } - ] - } - ] - } - ] -} \ No newline at end of file From d25e65ee1b7c63226a9a647684f1d2af7fcca4b2 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Thu, 10 Apr 2025 14:07:30 +0200 Subject: [PATCH 07/12] Moved unit tests to `tests` package --- packages/core/package.json | 1 - packages/core/src/index.ts | 20 +- .../conversions/formatConversionTestUtil.ts | 197 +++++ .../test/conversions/htmlConversion.test.ts | 6 +- .../test/conversions/nodeConversion.test.ts | 2 +- pnpm-lock.yaml | 712 +++--------------- shared/formatConversionTestUtil.ts | 197 +++++ shared/package.json | 2 +- shared/testDocument.ts | 9 +- tests/package.json | 18 +- .../unit/core}/clipboard/clipboardTestUtil.ts | 15 +- .../__snapshots__/text/html/basicBlocks.html | 0 .../text/html/basicBlocksWithProps.html | 0 .../text/html/childToParent.html | 0 .../text/html/childrenToNextParent.html | 0 .../html/childrenToNextParentsChildren.html | 0 .../copy/__snapshots__/text/html/image.html | 0 .../text/html/multipleChildren.html | 0 .../text/html/multipleStyledText.html | 0 .../__snapshots__/text/html/nestedImage.html | 0 .../text/html/partialChildToParent.html | 0 .../__snapshots__/text/html/styledText.html | 0 .../text/html/tableAllCells.html | 0 .../__snapshots__/text/html/tableCell.html | 0 .../text/html/tableCellText.html | 0 .../__snapshots__/text/html/tableCol.html | 0 .../__snapshots__/text/html/tableRow.html | 0 .../__snapshots__/text/html/unstyledText.html | 0 .../clipboard/copy/getCopyTestInstances.ts | 6 +- .../core}/clipboard/copy/runTests.test.ts | 0 .../__snapshots__/paragraphInCustomBlock.json | 0 .../copyPaste/getCopyPasteTestInstances.ts | 6 +- .../clipboard/copyPaste/runTests.test.ts | 0 .../getCopyPasteEqualityTestInstances.ts | 6 +- .../copyPasteEquality/runTests.test.ts | 0 .../text/html/pasteEndOfParagraph.json | 0 .../__snapshots__/text/html/pasteImage.json | 0 .../html/pasteParagraphInCustomBlock.json | 0 .../__snapshots__/text/html/pasteTable.json | 0 .../text/html/pasteTableInExistingTable.json | 0 .../text/plain/pasteEndOfParagraphText.json | 0 .../clipboard/paste/getPasteTestInstances.ts | 9 +- .../core}/clipboard/paste/runTests.test.ts | 0 .../codeBlock/contains-newlines.html | 0 .../codeBlock/defaultLanguage.html | 0 .../blocknoteHTML/codeBlock/empty.html | 0 .../blocknoteHTML/codeBlock/python.html | 0 .../blocknoteHTML/complex/misc.html | 0 .../blocknoteHTML/file/basic.html | 0 .../blocknoteHTML/file/button.html | 0 .../blocknoteHTML/file/nested.html | 0 .../blocknoteHTML/file/noCaption.html | 0 .../blocknoteHTML/file/noName.html | 0 .../blocknoteHTML/hardbreak/basic.html | 0 .../hardbreak/between-links.html | 0 .../blocknoteHTML/hardbreak/end.html | 0 .../blocknoteHTML/hardbreak/link.html | 0 .../blocknoteHTML/hardbreak/multiple.html | 0 .../blocknoteHTML/hardbreak/only.html | 0 .../blocknoteHTML/hardbreak/start.html | 0 .../blocknoteHTML/hardbreak/styles.html | 0 .../blocknoteHTML/image/basic.html | 0 .../blocknoteHTML/image/button.html | 0 .../blocknoteHTML/image/nested.html | 0 .../blocknoteHTML/image/noCaption.html | 0 .../blocknoteHTML/image/noName.html | 0 .../blocknoteHTML/image/noPreview.html | 0 .../blocknoteHTML/link/adjacent.html | 0 .../blocknoteHTML/link/basic.html | 0 .../blocknoteHTML/link/styled.html | 0 .../blocknoteHTML/lists/basic.html | 0 .../blocknoteHTML/lists/nested.html | 0 .../blocknoteHTML/pageBreak/basic.html | 0 .../blocknoteHTML/paragraph/basic.html | 0 .../blocknoteHTML/paragraph/empty.html | 0 .../blocknoteHTML/paragraph/lineBreaks.html | 0 .../blocknoteHTML/paragraph/nested.html | 0 .../blocknoteHTML/paragraph/styled.html | 0 .../blocknoteHTML/table/allColWidths.html | 0 .../blocknoteHTML/table/basic.html | 0 .../blocknoteHTML/table/headerCols.html | 0 .../blocknoteHTML/table/headerRows.html | 0 .../blocknoteHTML/table/mixedCellColors.html | 0 .../blocknoteHTML/table/mixedColWidths.html | 0 .../table/mixedRowspansAndColspans.html | 0 .../html/codeBlock/contains-newlines.html | 0 .../html/codeBlock/defaultLanguage.html | 0 .../__snapshots__/html/codeBlock/empty.html | 0 .../__snapshots__/html/codeBlock/python.html | 0 .../__snapshots__/html/complex/misc.html | 0 .../export/__snapshots__/html/file/basic.html | 0 .../__snapshots__/html/file/button.html | 0 .../__snapshots__/html/file/nested.html | 0 .../__snapshots__/html/file/noCaption.html | 0 .../__snapshots__/html/file/noName.html | 0 .../__snapshots__/html/hardbreak/basic.html | 0 .../html/hardbreak/between-links.html | 0 .../__snapshots__/html/hardbreak/end.html | 0 .../__snapshots__/html/hardbreak/link.html | 0 .../html/hardbreak/multiple.html | 0 .../__snapshots__/html/hardbreak/only.html | 0 .../__snapshots__/html/hardbreak/start.html | 0 .../__snapshots__/html/hardbreak/styles.html | 0 .../__snapshots__/html/image/basic.html | 0 .../__snapshots__/html/image/button.html | 0 .../__snapshots__/html/image/nested.html | 0 .../__snapshots__/html/image/noCaption.html | 0 .../__snapshots__/html/image/noName.html | 0 .../__snapshots__/html/image/noPreview.html | 0 .../__snapshots__/html/link/adjacent.html | 0 .../export/__snapshots__/html/link/basic.html | 0 .../__snapshots__/html/link/styled.html | 0 .../__snapshots__/html/lists/basic.html | 0 .../__snapshots__/html/lists/nested.html | 0 .../__snapshots__/html/pageBreak/basic.html | 0 .../__snapshots__/html/paragraph/basic.html | 0 .../__snapshots__/html/paragraph/empty.html | 0 .../html/paragraph/lineBreaks.html | 0 .../__snapshots__/html/paragraph/nested.html | 0 .../__snapshots__/html/paragraph/styled.html | 0 .../html/table/allColWidths.html | 0 .../__snapshots__/html/table/basic.html | 0 .../__snapshots__/html/table/headerCols.html | 0 .../__snapshots__/html/table/headerRows.html | 0 .../html/table/mixedCellColors.html | 0 .../html/table/mixedColWidths.html | 0 .../html/table/mixedRowspansAndColspans.html | 0 .../markdown/codeBlock/contains-newlines.md | 0 .../markdown/codeBlock/defaultLanguage.md | 0 .../__snapshots__/markdown/codeBlock/empty.md | 0 .../markdown/codeBlock/python.md | 0 .../__snapshots__/markdown/complex/misc.md | 0 .../__snapshots__/markdown/file/basic.md | 0 .../__snapshots__/markdown/file/button.md | 0 .../__snapshots__/markdown/file/nested.md | 0 .../__snapshots__/markdown/file/noCaption.md | 0 .../__snapshots__/markdown/file/noName.md | 0 .../__snapshots__/markdown/hardbreak/basic.md | 0 .../markdown/hardbreak/between-links.md | 0 .../__snapshots__/markdown/hardbreak/end.md | 0 .../__snapshots__/markdown/hardbreak/link.md | 0 .../markdown/hardbreak/multiple.md | 0 .../__snapshots__/markdown/hardbreak/only.md | 0 .../__snapshots__/markdown/hardbreak/start.md | 0 .../markdown/hardbreak/styles.md | 0 .../__snapshots__/markdown/image/basic.md | 0 .../__snapshots__/markdown/image/button.md | 0 .../__snapshots__/markdown/image/nested.md | 0 .../__snapshots__/markdown/image/noCaption.md | 0 .../__snapshots__/markdown/image/noName.md | 0 .../__snapshots__/markdown/image/noPreview.md | 0 .../__snapshots__/markdown/link/adjacent.md | 0 .../__snapshots__/markdown/link/basic.md | 0 .../__snapshots__/markdown/link/styled.md | 0 .../__snapshots__/markdown/lists/basic.md | 0 .../__snapshots__/markdown/lists/nested.md | 0 .../__snapshots__/markdown/pageBreak/basic.md | 0 .../__snapshots__/markdown/paragraph/basic.md | 0 .../__snapshots__/markdown/paragraph/empty.md | 0 .../markdown/paragraph/lineBreaks.md | 0 .../markdown/paragraph/nested.md | 0 .../markdown/paragraph/styled.md | 0 .../markdown/table/allColWidths.md | 0 .../__snapshots__/markdown/table/basic.md | 0 .../markdown/table/headerCols.md | 0 .../markdown/table/headerRows.md | 0 .../markdown/table/mixedCellColors.md | 0 .../markdown/table/mixedColWidths.md | 0 .../table/mixedRowspansAndColspans.md | 0 .../nodes/codeBlock/contains-newlines.json | 0 .../nodes/codeBlock/defaultLanguage.json | 0 .../__snapshots__/nodes/codeBlock/empty.json | 0 .../__snapshots__/nodes/codeBlock/python.json | 0 .../__snapshots__/nodes/complex/misc.json | 0 .../__snapshots__/nodes/file/basic.json | 0 .../__snapshots__/nodes/file/button.json | 0 .../__snapshots__/nodes/file/nested.json | 0 .../__snapshots__/nodes/file/noCaption.json | 0 .../__snapshots__/nodes/file/noName.json | 0 .../__snapshots__/nodes/hardbreak/basic.json | 0 .../nodes/hardbreak/between-links.json | 0 .../__snapshots__/nodes/hardbreak/end.json | 0 .../__snapshots__/nodes/hardbreak/link.json | 0 .../nodes/hardbreak/multiple.json | 0 .../__snapshots__/nodes/hardbreak/only.json | 0 .../__snapshots__/nodes/hardbreak/start.json | 0 .../__snapshots__/nodes/hardbreak/styles.json | 0 .../__snapshots__/nodes/image/basic.json | 0 .../__snapshots__/nodes/image/button.json | 0 .../__snapshots__/nodes/image/nested.json | 0 .../__snapshots__/nodes/image/noCaption.json | 0 .../__snapshots__/nodes/image/noName.json | 0 .../__snapshots__/nodes/image/noPreview.json | 0 .../__snapshots__/nodes/link/adjacent.json | 0 .../__snapshots__/nodes/link/basic.json | 0 .../__snapshots__/nodes/link/styled.json | 0 .../__snapshots__/nodes/lists/basic.json | 0 .../__snapshots__/nodes/lists/nested.json | 0 .../__snapshots__/nodes/pageBreak/basic.json | 0 .../__snapshots__/nodes/paragraph/basic.json | 0 .../__snapshots__/nodes/paragraph/empty.json | 0 .../nodes/paragraph/lineBreaks.json | 0 .../__snapshots__/nodes/paragraph/nested.json | 0 .../__snapshots__/nodes/paragraph/styled.json | 0 .../nodes/table/allColWidths.json | 0 .../__snapshots__/nodes/table/basic.json | 0 .../__snapshots__/nodes/table/headerCols.json | 0 .../__snapshots__/nodes/table/headerRows.json | 0 .../nodes/table/mixedCellColors.json | 0 .../nodes/table/mixedColWidths.json | 0 .../nodes/table/mixedRowspansAndColspans.json | 0 .../export/getExportTestInstances.ts | 5 +- .../formatConversion/export/runTests.test.ts | 6 +- .../getExportParseEqualityTestInstances.ts | 5 +- .../exportParseEquality/runTests.test.ts | 2 +- .../formatConversionTestUtil.ts | 197 +++++ .../__snapshots__/html/basicBlockTypes.json | 0 .../parse/__snapshots__/html/codeBlocks.json | 0 .../__snapshots__/html/deepNestedContent.json | 0 .../parse/__snapshots__/html/divs.json | 0 .../__snapshots__/html/fakeImageCaption.json | 0 .../parse/__snapshots__/html/googleDocs.json | 0 .../__snapshots__/html/imageInParagraph.json | 0 .../html/inlineContentAndNestedBlocks.json | 0 .../parse/__snapshots__/html/lists.json | 0 .../__snapshots__/html/mixedNestedLists.json | 0 .../parse/__snapshots__/html/nestedLists.json | 0 .../html/nestedListsWithParagraphs.json | 0 .../parse/__snapshots__/html/notion.json | 0 .../parse/__snapshots__/html/twoDivs.json | 0 .../parse/__snapshots__/html/twoTables.json | 0 .../parse/__snapshots__/markdown/basic.json | 0 .../markdown/boldWithWhitespace.json | 0 .../parse/__snapshots__/markdown/complex.json | 0 .../__snapshots__/markdown/issue226case1.json | 0 .../__snapshots__/markdown/issue226case2.json | 0 .../parse/__snapshots__/markdown/nested.json | 0 .../parse/__snapshots__/markdown/styled.json | 0 .../parse/parseTestInstances.ts | 10 +- .../formatConversion/parse/runTests.test.ts | 0 .../src/unit/core}/setupTestEditor.ts | 13 +- .../src/unit/core}/testSchema.ts | 18 +- .../codeBlock/contains-newlines.html | 0 .../codeBlock/defaultLanguage.html | 0 .../blocknoteHTML/codeBlock/empty.html | 0 .../blocknoteHTML/codeBlock/python.html | 0 .../blocknoteHTML/complex/misc.html | 0 .../blocknoteHTML/contextParagraph/basic.html | 0 .../blocknoteHTML/customParagraph/basic.html | 0 .../customParagraph/lineBreaks.html | 0 .../blocknoteHTML/customParagraph/nested.html | 0 .../blocknoteHTML/customParagraph/styled.html | 0 .../blocknoteHTML/file/basic.html | 0 .../blocknoteHTML/file/button.html | 0 .../blocknoteHTML/file/nested.html | 0 .../blocknoteHTML/file/noCaption.html | 0 .../blocknoteHTML/file/noName.html | 0 .../blocknoteHTML/fontSize/basic.html | 0 .../blocknoteHTML/hardbreak/basic.html | 0 .../hardbreak/between-links.html | 0 .../blocknoteHTML/hardbreak/end.html | 0 .../blocknoteHTML/hardbreak/link.html | 0 .../blocknoteHTML/hardbreak/multiple.html | 0 .../blocknoteHTML/hardbreak/only.html | 0 .../blocknoteHTML/hardbreak/start.html | 0 .../blocknoteHTML/hardbreak/styles.html | 0 .../blocknoteHTML/image/basic.html | 0 .../blocknoteHTML/image/button.html | 0 .../blocknoteHTML/image/nested.html | 0 .../blocknoteHTML/image/noCaption.html | 0 .../blocknoteHTML/image/noName.html | 0 .../blocknoteHTML/image/noPreview.html | 0 .../blocknoteHTML/link/adjacent.html | 0 .../blocknoteHTML/link/basic.html | 0 .../blocknoteHTML/link/styled.html | 0 .../blocknoteHTML/lists/basic.html | 0 .../blocknoteHTML/lists/nested.html | 0 .../blocknoteHTML/mention/basic.html | 0 .../blocknoteHTML/pageBreak/basic.html | 0 .../blocknoteHTML/paragraph/basic.html | 0 .../blocknoteHTML/paragraph/empty.html | 0 .../blocknoteHTML/paragraph/lineBreaks.html | 0 .../blocknoteHTML/paragraph/nested.html | 0 .../blocknoteHTML/paragraph/styled.html | 0 .../blocknoteHTML/reactFile/basic.html | 0 .../blocknoteHTML/reactFile/button.html | 0 .../blocknoteHTML/reactFile/nested.html | 0 .../blocknoteHTML/reactFile/noCaption.html | 0 .../blocknoteHTML/reactFile/noName.html | 0 .../blocknoteHTML/reactImage/basic.html | 0 .../blocknoteHTML/reactImage/button.html | 0 .../blocknoteHTML/reactImage/nested.html | 0 .../blocknoteHTML/reactImage/noCaption.html | 0 .../blocknoteHTML/reactImage/noName.html | 0 .../blocknoteHTML/reactImage/noPreview.html | 0 .../simpleCustomParagraph/basic.html | 0 .../simpleCustomParagraph/nested.html | 0 .../simpleCustomParagraph/styled.html | 0 .../blocknoteHTML/small/basic.html | 0 .../blocknoteHTML/table/allColWidths.html | 0 .../blocknoteHTML/table/basic.html | 0 .../blocknoteHTML/table/headerCols.html | 0 .../blocknoteHTML/table/headerRows.html | 0 .../blocknoteHTML/table/mixedCellColors.html | 0 .../blocknoteHTML/table/mixedColWidths.html | 0 .../table/mixedRowspansAndColspans.html | 0 .../blocknoteHTML/tag/basic.html | 0 .../__snapshots__/html/basicBlockTypes.json | 0 .../html/codeBlock/contains-newlines.html | 0 .../html/codeBlock/defaultLanguage.html | 0 .../__snapshots__/html/codeBlock/empty.html | 0 .../__snapshots__/html/codeBlock/python.html | 0 .../export/__snapshots__/html/codeBlocks.json | 0 .../__snapshots__/html/complex/misc.html | 0 .../html/contextParagraph/basic.html | 0 .../html/customParagraph/basic.html | 0 .../html/customParagraph/lineBreaks.html | 0 .../html/customParagraph/nested.html | 0 .../html/customParagraph/styled.html | 0 .../__snapshots__/html/deepNestedContent.json | 0 .../export/__snapshots__/html/divs.json | 0 .../__snapshots__/html/fakeImageCaption.json | 0 .../export/__snapshots__/html/file/basic.html | 0 .../__snapshots__/html/file/button.html | 0 .../__snapshots__/html/file/nested.html | 0 .../__snapshots__/html/file/noCaption.html | 0 .../__snapshots__/html/file/noName.html | 0 .../__snapshots__/html/fontSize/basic.html | 0 .../export/__snapshots__/html/googleDocs.json | 0 .../__snapshots__/html/hardbreak/basic.html | 0 .../html/hardbreak/between-links.html | 0 .../__snapshots__/html/hardbreak/end.html | 0 .../__snapshots__/html/hardbreak/link.html | 0 .../html/hardbreak/multiple.html | 0 .../__snapshots__/html/hardbreak/only.html | 0 .../__snapshots__/html/hardbreak/start.html | 0 .../__snapshots__/html/hardbreak/styles.html | 0 .../__snapshots__/html/image/basic.html | 0 .../__snapshots__/html/image/button.html | 0 .../__snapshots__/html/image/nested.html | 0 .../__snapshots__/html/image/noCaption.html | 0 .../__snapshots__/html/image/noName.html | 0 .../__snapshots__/html/image/noPreview.html | 0 .../__snapshots__/html/imageInParagraph.json | 0 .../html/inlineContentAndNestedBlocks.json | 0 .../__snapshots__/html/link/adjacent.html | 0 .../export/__snapshots__/html/link/basic.html | 0 .../__snapshots__/html/link/styled.html | 0 .../export/__snapshots__/html/lists.json | 0 .../__snapshots__/html/lists/basic.html | 0 .../__snapshots__/html/lists/nested.html | 0 .../__snapshots__/html/mention/basic.html | 0 .../__snapshots__/html/mixedNestedLists.json | 0 .../__snapshots__/html/nestedLists.json | 0 .../html/nestedListsWithParagraphs.json | 0 .../export/__snapshots__/html/notion.json | 0 .../__snapshots__/html/pageBreak/basic.html | 0 .../__snapshots__/html/paragraph/basic.html | 0 .../__snapshots__/html/paragraph/empty.html | 0 .../html/paragraph/lineBreaks.html | 0 .../__snapshots__/html/paragraph/nested.html | 0 .../__snapshots__/html/paragraph/styled.html | 0 .../__snapshots__/html/reactFile/basic.html | 0 .../__snapshots__/html/reactFile/button.html | 0 .../__snapshots__/html/reactFile/nested.html | 0 .../html/reactFile/noCaption.html | 0 .../__snapshots__/html/reactFile/noName.html | 0 .../__snapshots__/html/reactImage/basic.html | 0 .../__snapshots__/html/reactImage/button.html | 0 .../__snapshots__/html/reactImage/nested.html | 0 .../html/reactImage/noCaption.html | 0 .../__snapshots__/html/reactImage/noName.html | 0 .../html/reactImage/noPreview.html | 0 .../html/simpleCustomParagraph/basic.html | 0 .../html/simpleCustomParagraph/nested.html | 0 .../html/simpleCustomParagraph/styled.html | 0 .../__snapshots__/html/small/basic.html | 0 .../html/table/allColWidths.html | 0 .../__snapshots__/html/table/basic.html | 0 .../__snapshots__/html/table/headerCols.html | 0 .../__snapshots__/html/table/headerRows.html | 0 .../html/table/mixedCellColors.html | 0 .../html/table/mixedColWidths.html | 0 .../html/table/mixedRowspansAndColspans.html | 0 .../export/__snapshots__/html/tag/basic.html | 0 .../export/__snapshots__/html/twoDivs.json | 0 .../export/__snapshots__/html/twoTables.json | 0 .../export/getExportTestInstances.ts | 4 +- .../export/testExport.test.ts | 5 +- .../getExportParseEqualityTestInstances.ts | 8 +- .../exportParseEquality/runTests.test.ts | 6 +- .../src/unit/react}/setupTestEditor.tsx | 2 +- .../src/unit/react}/testSchema.tsx | 9 +- .../shared}/clipboard/copy/copyTestCase.ts | 9 +- .../clipboard/copy/copyTestExecutors.ts | 10 +- .../clipboard/copyPaste/copyPasteTestCase.ts | 9 +- .../copyPaste/copyPasteTestExecutors.ts | 15 +- .../copyPasteEqualityTestCase.ts | 9 +- .../copyPasteEqualityTestExecutors.ts | 15 +- .../shared}/clipboard/paste/pasteTestCase.ts | 9 +- .../clipboard/paste/pasteTestExecutors.ts | 13 +- .../formatConversion/export/exportTestCase.ts | 4 +- .../export/exportTestExecutors.ts | 14 +- .../exportParseEqualityTestCase.ts | 4 +- .../exportParseEqualityTestExecutors.ts | 14 +- .../formatConversion/parse/parseTestCase.ts | 0 .../parse/parseTestExecutors.ts | 8 +- .../src/api/tests => tests/src/unit}/types.ts | 4 +- tests/vite.config.ts | 25 + tests/vitestSetup.ts | 35 + 410 files changed, 905 insertions(+), 788 deletions(-) create mode 100644 packages/xl-multi-column/src/test/conversions/formatConversionTestUtil.ts create mode 100644 shared/formatConversionTestUtil.ts rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/clipboardTestUtil.ts (94%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/basicBlocks.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/childToParent.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/image.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/multipleChildren.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/multipleStyledText.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/nestedImage.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/partialChildToParent.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/styledText.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/tableAllCells.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/tableCell.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/tableCellText.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/tableCol.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/tableRow.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/__snapshots__/text/html/unstyledText.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/getCopyTestInstances.ts (98%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copy/runTests.test.ts (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copyPaste/__snapshots__/paragraphInCustomBlock.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copyPaste/getCopyPasteTestInstances.ts (83%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copyPaste/runTests.test.ts (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts (69%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/copyPasteEquality/runTests.test.ts (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/paste/__snapshots__/text/html/pasteEndOfParagraph.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/paste/__snapshots__/text/html/pasteImage.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/paste/__snapshots__/text/html/pasteParagraphInCustomBlock.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/paste/__snapshots__/text/html/pasteTable.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/paste/__snapshots__/text/html/pasteTableInExistingTable.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/paste/__snapshots__/text/plain/pasteEndOfParagraphText.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/paste/getPasteTestInstances.ts (93%) rename {packages/core/src/api/tests => tests/src/unit/core}/clipboard/paste/runTests.test.ts (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/codeBlock/empty.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/codeBlock/python.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/complex/misc.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/file/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/file/button.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/file/nested.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/file/noCaption.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/file/noName.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/hardbreak/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/hardbreak/between-links.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/hardbreak/end.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/hardbreak/link.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/hardbreak/multiple.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/hardbreak/only.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/hardbreak/start.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/hardbreak/styles.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/image/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/image/button.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/image/nested.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/image/noCaption.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/image/noName.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/image/noPreview.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/link/adjacent.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/link/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/link/styled.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/lists/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/lists/nested.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/pageBreak/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/paragraph/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/paragraph/empty.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/paragraph/nested.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/paragraph/styled.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/table/allColWidths.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/table/basic.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/table/headerCols.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/table/headerRows.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/table/mixedCellColors.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/table/mixedColWidths.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/codeBlock/python.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/complex/misc.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/file/basic.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/file/button.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/file/nested.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/file/noCaption.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/file/noName.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/hardbreak/end.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/hardbreak/link.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/hardbreak/only.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/hardbreak/start.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/image/basic.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/image/button.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/image/nested.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/image/noCaption.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/image/noName.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/image/noPreview.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/link/adjacent.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/link/basic.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/link/styled.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/lists/basic.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/lists/nested.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/paragraph/basic.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/paragraph/empty.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/paragraph/nested.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/paragraph/styled.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/table/allColWidths.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/table/basic.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/table/headerCols.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/table/headerRows.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/codeBlock/python.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/complex/misc.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/file/basic.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/file/button.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/file/nested.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/file/noCaption.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/file/noName.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/hardbreak/end.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/hardbreak/link.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/hardbreak/only.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/hardbreak/start.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/image/basic.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/image/button.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/image/nested.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/image/noCaption.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/image/noName.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/image/noPreview.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/link/adjacent.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/link/basic.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/link/styled.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/lists/basic.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/lists/nested.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/paragraph/basic.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/paragraph/empty.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/paragraph/nested.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/paragraph/styled.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/table/allColWidths.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/table/basic.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/table/headerCols.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/table/headerRows.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/getExportTestInstances.ts (99%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/export/runTests.test.ts (92%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts (77%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/exportParseEquality/runTests.test.ts (91%) create mode 100644 tests/src/unit/core/formatConversion/formatConversionTestUtil.ts rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/basicBlockTypes.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/codeBlocks.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/deepNestedContent.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/divs.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/fakeImageCaption.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/googleDocs.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/imageInParagraph.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/inlineContentAndNestedBlocks.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/lists.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/mixedNestedLists.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/nestedLists.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/nestedListsWithParagraphs.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/notion.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/twoDivs.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/html/twoTables.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/markdown/basic.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/markdown/boldWithWhitespace.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/markdown/complex.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/markdown/issue226case1.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/markdown/issue226case2.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/markdown/nested.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/__snapshots__/markdown/styled.json (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/parseTestInstances.ts (99%) rename {packages/core/src/api/tests => tests/src/unit/core}/formatConversion/parse/runTests.test.ts (100%) rename {packages/core/src/api/tests => tests/src/unit/core}/setupTestEditor.ts (76%) rename {packages/core/src/api/tests => tests/src/unit/core}/testSchema.ts (91%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/contextParagraph/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/lineBreaks.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/styled.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/fontSize/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/mention/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/button.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noCaption.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noName.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/button.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noCaption.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noName.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noPreview.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/styled.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/small/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/blocknoteHTML/tag/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/basicBlockTypes.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/codeBlock/empty.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/codeBlock/python.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/codeBlocks.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/complex/misc.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/contextParagraph/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/customParagraph/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/customParagraph/lineBreaks.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/customParagraph/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/customParagraph/styled.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/deepNestedContent.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/divs.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/fakeImageCaption.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/file/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/file/button.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/file/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/file/noCaption.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/file/noName.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/fontSize/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/googleDocs.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/hardbreak/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/hardbreak/between-links.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/hardbreak/end.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/hardbreak/link.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/hardbreak/multiple.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/hardbreak/only.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/hardbreak/start.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/hardbreak/styles.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/image/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/image/button.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/image/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/image/noCaption.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/image/noName.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/image/noPreview.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/imageInParagraph.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/inlineContentAndNestedBlocks.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/link/adjacent.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/link/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/link/styled.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/lists.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/lists/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/lists/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/mention/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/mixedNestedLists.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/nestedLists.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/nestedListsWithParagraphs.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/notion.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/pageBreak/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/paragraph/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/paragraph/empty.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/paragraph/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/paragraph/styled.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/reactFile/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/reactFile/button.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/reactFile/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/reactFile/noCaption.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/reactFile/noName.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/reactImage/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/reactImage/button.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/reactImage/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/reactImage/noCaption.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/reactImage/noName.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/reactImage/noPreview.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/simpleCustomParagraph/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/simpleCustomParagraph/nested.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/simpleCustomParagraph/styled.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/small/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/table/allColWidths.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/table/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/table/headerCols.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/table/headerRows.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/table/mixedCellColors.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/table/mixedColWidths.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/tag/basic.html (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/twoDivs.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/__snapshots__/html/twoTables.json (100%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/getExportTestInstances.ts (98%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/export/testExport.test.ts (81%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts (77%) rename {packages/react/src/tests => tests/src/unit/react}/formatConversion/exportParseEquality/runTests.test.ts (88%) rename {packages/react/src/tests => tests/src/unit/react}/setupTestEditor.tsx (96%) rename {packages/react/src/tests => tests/src/unit/react}/testSchema.tsx (93%) rename {packages/core/src/api/tests => tests/src/unit/shared}/clipboard/copy/copyTestCase.ts (77%) rename {packages/core/src/api/tests => tests/src/unit/shared}/clipboard/copy/copyTestExecutors.ts (86%) rename {packages/core/src/api/tests => tests/src/unit/shared}/clipboard/copyPaste/copyPasteTestCase.ts (79%) rename {packages/core/src/api/tests => tests/src/unit/shared}/clipboard/copyPaste/copyPasteTestExecutors.ts (76%) rename {packages/core/src/api/tests => tests/src/unit/shared}/clipboard/copyPasteEquality/copyPasteEqualityTestCase.ts (78%) rename {packages/core/src/api/tests => tests/src/unit/shared}/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.ts (75%) rename {packages/core/src/api/tests => tests/src/unit/shared}/clipboard/paste/pasteTestCase.ts (78%) rename {packages/core/src/api/tests => tests/src/unit/shared}/clipboard/paste/pasteTestExecutors.ts (86%) rename {packages/core/src/api/tests => tests/src/unit/shared}/formatConversion/export/exportTestCase.ts (68%) rename {packages/core/src/api/tests => tests/src/unit/shared}/formatConversion/export/exportTestExecutors.ts (89%) rename {packages/core/src/api/tests => tests/src/unit/shared}/formatConversion/exportParseEquality/exportParseEqualityTestCase.ts (69%) rename {packages/core/src/api/tests => tests/src/unit/shared}/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.ts (83%) rename {packages/core/src/api/tests => tests/src/unit/shared}/formatConversion/parse/parseTestCase.ts (100%) rename {packages/core/src/api/tests => tests/src/unit/shared}/formatConversion/parse/parseTestExecutors.ts (89%) rename {packages/core/src/api/tests => tests/src/unit}/types.ts (82%) create mode 100644 tests/vite.config.ts create mode 100644 tests/vitestSetup.ts diff --git a/packages/core/package.json b/packages/core/package.json index 3ea4572574..c4bc6193f8 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -94,7 +94,6 @@ "@tiptap/pm": "^2.11.5", "emoji-mart": "^5.6.0", "hast-util-from-dom": "^5.0.1", - "htmlfy": "^0.6.7", "prosemirror-dropcursor": "^1.8.1", "prosemirror-highlight": "^0.13.0", "prosemirror-model": "^1.24.1", diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 5f61be162c..be7060c85d 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -59,25 +59,7 @@ export type { CodeBlockOptions } from "./blocks/CodeBlockContent/CodeBlockConten export { UnreachableCaseError, assertEmpty } from "./util/typescript.js"; // Unit testing -export * from "./api/tests/setupTestEditor.js"; -export * from "./api/tests/testSchema.js"; -export * from "./api/tests/types.js"; -export * from "./api/tests/clipboard/clipboardTestUtil.js"; -export * from "./api/tests/clipboard/copy/copyTestCase.js"; -export * from "./api/tests/clipboard/copy/copyTestExecutors.js"; -export * from "./api/tests/clipboard/copyPaste/copyPasteTestCase.js"; -export * from "./api/tests/clipboard/copyPaste/copyPasteTestExecutors.js"; -export * from "./api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestCase.js"; -export * from "./api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.js"; -export * from "./api/tests/clipboard/paste/pasteTestCase.js"; -export * from "./api/tests/clipboard/paste/pasteTestExecutors.js"; -export * from "./api/tests/formatConversion/formatConversionTestUtil.js"; -export * from "./api/tests/formatConversion/export/exportTestCase.js"; -export * from "./api/tests/formatConversion/export/exportTestExecutors.js"; -export * from "./api/tests/formatConversion/exportParseEquality/exportParseEqualityTestCase.js"; -export * from "./api/tests/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.js"; -export * from "./api/tests/formatConversion/parse/parseTestCase.js"; -export * from "./api/tests/formatConversion/parse/parseTestExecutors.js"; +export { selectedFragmentToHTML } from "./api/clipboard/toClipboard/copyExtension.js"; // Node conversions export * from "./api/nodeConversions/blockToNode.js"; diff --git a/packages/xl-multi-column/src/test/conversions/formatConversionTestUtil.ts b/packages/xl-multi-column/src/test/conversions/formatConversionTestUtil.ts new file mode 100644 index 0000000000..a71cdbda08 --- /dev/null +++ b/packages/xl-multi-column/src/test/conversions/formatConversionTestUtil.ts @@ -0,0 +1,197 @@ +import { + Block, + BlockNoteSchema, + BlockSchema, + InlineContent, + InlineContentSchema, + isPartialLinkInlineContent, + isStyledTextInlineContent, + PartialBlock, + PartialInlineContent, + PartialTableCell, + StyledText, + StyleSchema, + TableCell, + TableContent, + UniqueID, +} from "@blocknote/core"; + +function textShorthandToStyledText( + content: string | StyledText[] = "" +): StyledText[] { + if (typeof content === "string") { + return [ + { + type: "text", + text: content, + styles: {}, + }, + ]; + } + return content; +} + +function partialContentToInlineContent( + content: + | PartialInlineContent + | PartialTableCell + | TableContent + | undefined +): + | InlineContent[] + | TableContent + | TableCell + | undefined { + if (typeof content === "string") { + return textShorthandToStyledText(content); + } + + if (Array.isArray(content)) { + return content.flatMap((partialContent) => { + if (typeof partialContent === "string") { + return textShorthandToStyledText(partialContent); + } else if (isPartialLinkInlineContent(partialContent)) { + return { + ...partialContent, + content: textShorthandToStyledText(partialContent.content), + }; + } else if (isStyledTextInlineContent(partialContent)) { + return partialContent; + } else { + // custom inline content + + return { + props: {}, + ...partialContent, + content: partialContentToInlineContent(partialContent.content), + } as any; + } + }); + } else if (content?.type === "tableContent") { + return { + type: "tableContent", + columnWidths: content.columnWidths, + headerRows: content.headerRows, + headerCols: content.headerCols, + rows: content.rows.map((row) => ({ + ...row, + cells: row.cells.map( + (cell) => partialContentToInlineContent(cell) as any + ), + })), + }; + } else if (content?.type === "tableCell") { + return { + type: "tableCell", + content: partialContentToInlineContent(content.content) as any[], + props: { + backgroundColor: content.props?.backgroundColor ?? "default", + textColor: content.props?.textColor ?? "default", + textAlignment: content.props?.textAlignment ?? "left", + colspan: content.props?.colspan ?? 1, + rowspan: content.props?.rowspan ?? 1, + }, + } satisfies TableCell; + } + + return content; +} + +export function partialBlocksToBlocksForTesting< + BSchema extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + schema: BlockNoteSchema, + partialBlocks: Array, NoInfer, NoInfer>> +): Array> { + return partialBlocks.map((partialBlock) => + partialBlockToBlockForTesting(schema.blockSchema, partialBlock) + ); +} + +export function partialBlockToBlockForTesting< + BSchema extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + schema: BSchema, + partialBlock: PartialBlock +): Block { + const contentType: "inline" | "table" | "none" = + schema[partialBlock.type!].content; + + const withDefaults: Block = { + id: "", + type: partialBlock.type!, + props: {} as any, + content: + contentType === "inline" + ? [] + : contentType === "table" + ? { + type: "tableContent", + columnWidths: undefined, + headerRows: undefined, + headerCols: undefined, + rows: [], + } + : (undefined as any), + children: [] as any, + ...partialBlock, + }; + + Object.entries(schema[partialBlock.type!].propSchema).forEach( + ([propKey, propValue]) => { + if ( + withDefaults.props[propKey] === undefined && + propValue.default !== undefined + ) { + (withDefaults.props as any)[propKey] = propValue.default; + } + } + ); + + if (contentType === "inline") { + const content = withDefaults.content as InlineContent[] | undefined; + withDefaults.content = partialContentToInlineContent(content) as any; + } else if (contentType === "table") { + const content = withDefaults.content as TableContent | undefined; + withDefaults.content = { + type: "tableContent", + columnWidths: + content?.columnWidths || + content?.rows[0]?.cells.map(() => undefined) || + [], + headerRows: content?.headerRows || undefined, + headerCols: content?.headerCols || undefined, + rows: + content?.rows.map((row) => ({ + cells: row.cells.map((cell) => partialContentToInlineContent(cell)), + })) || [], + } as any; + } + + return { + ...withDefaults, + content: partialContentToInlineContent(withDefaults.content), + children: withDefaults.children.map((c) => { + return partialBlockToBlockForTesting(schema, c); + }), + } as any; +} + +export function addIdsToBlock(block: PartialBlock) { + if (!block.id) { + block.id = UniqueID.options.generateID(); + } + if (block.children) { + addIdsToBlocks(block.children); + } +} + +export function addIdsToBlocks(blocks: PartialBlock[]) { + for (const block of blocks) { + addIdsToBlock(block); + } +} diff --git a/packages/xl-multi-column/src/test/conversions/htmlConversion.test.ts b/packages/xl-multi-column/src/test/conversions/htmlConversion.test.ts index dcb75d2c35..a72bd83a24 100644 --- a/packages/xl-multi-column/src/test/conversions/htmlConversion.test.ts +++ b/packages/xl-multi-column/src/test/conversions/htmlConversion.test.ts @@ -6,13 +6,15 @@ import { InlineContentSchema, PartialBlock, StyleSchema, - addIdsToBlocks, createExternalHTMLExporter, createInternalHTMLSerializer, - partialBlocksToBlocksForTesting, } from "@blocknote/core"; import { afterEach, beforeEach, describe, expect, it } from "vitest"; +import { + addIdsToBlocks, + partialBlocksToBlocksForTesting, +} from "./formatConversionTestUtil.js"; import { multiColumnSchemaTestCases } from "./testCases.js"; // TODO: code same from @blocknote/core, maybe create separate test util package diff --git a/packages/xl-multi-column/src/test/conversions/nodeConversion.test.ts b/packages/xl-multi-column/src/test/conversions/nodeConversion.test.ts index cd82664962..a8b5a4d13f 100644 --- a/packages/xl-multi-column/src/test/conversions/nodeConversion.test.ts +++ b/packages/xl-multi-column/src/test/conversions/nodeConversion.test.ts @@ -6,9 +6,9 @@ import { UniqueID, blockToNode, nodeToBlock, - partialBlockToBlockForTesting, } from "@blocknote/core"; +import { partialBlockToBlockForTesting } from "./formatConversionTestUtil.js"; import { multiColumnSchemaTestCases } from "./testCases.js"; function addIdsToBlock(block: PartialBlock) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e86d2346d2..852f3510a0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2917,9 +2917,6 @@ importers: hast-util-from-dom: specifier: ^5.0.1 version: 5.0.1 - htmlfy: - specifier: ^0.6.7 - version: 0.6.7 prosemirror-dropcursor: specifier: ^1.8.1 version: 1.8.1 @@ -3786,8 +3783,8 @@ importers: shared: dependencies: '@blocknote/core': - specifier: ^0.26.0 - version: 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4) + specifier: workspace:* + version: link:../packages/core image-meta: specifier: ^0.2.1 version: 0.2.1 @@ -3802,26 +3799,29 @@ importers: tests: devDependencies: '@blocknote/ariakit': - specifier: ^0.26.0 - version: 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: workspace:* + version: link:../packages/ariakit '@blocknote/core': - specifier: ^0.26.0 - version: 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4) + specifier: workspace:* + version: link:../packages/core '@blocknote/mantine': - specifier: ^0.26.0 - version: 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: workspace:* + version: link:../packages/mantine '@blocknote/react': - specifier: ^0.26.0 - version: 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: workspace:* + version: link:../packages/react '@blocknote/shadcn': - specifier: ^0.26.0 - version: 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: workspace:* + version: link:../packages/shadcn '@playwright/experimental-ct-react': specifier: 1.51.1 version: 1.51.1(@types/node@20.17.28)(terser@5.39.0)(vite@5.4.15(@types/node@20.17.28)(terser@5.39.0)) '@playwright/test': specifier: 1.51.1 version: 1.51.1 + '@tiptap/pm': + specifier: ^2.11.5 + version: 2.11.5 '@types/node': specifier: ^20.11.18 version: 20.17.28 @@ -3834,6 +3834,9 @@ importers: eslint: specifier: ^8.10.0 version: 8.57.1 + htmlfy: + specifier: ^0.6.7 + version: 0.6.7 react: specifier: ^18.3.1 version: 18.3.1 @@ -3846,6 +3849,15 @@ importers: rimraf: specifier: ^5.0.5 version: 5.0.10 + vite: + specifier: ^5.3.4 + version: 5.4.15(@types/node@20.17.28)(terser@5.39.0) + vite-plugin-eslint: + specifier: ^1.8.1 + version: 1.8.1(eslint@8.57.1)(vite@5.4.15(@types/node@20.17.28)(terser@5.39.0)) + vitest: + specifier: ^2.0.3 + version: 2.1.9(@types/node@20.17.28)(@vitest/ui@2.1.9)(jsdom@25.0.1(canvas@2.11.2(encoding@0.1.13)))(terser@5.39.0) packages: @@ -4702,38 +4714,6 @@ packages: '@base2/pretty-print-object@1.0.1': resolution: {integrity: sha512-4iri8i1AqYHJE2DstZYkyEprg6Pq6sKx3xn5FpySk9sNhH7qN2LLlHJCfDTZRILNwQNPD7mATWM0TBui7uC1pA==} - '@blocknote/ariakit@0.26.0': - resolution: {integrity: sha512-QmHcl3Kvwg+TxYJC04S6JcX4LaGytUg4fwmhVv/IhuQ+wt5dDK57Ay7wP3TFrPyDxEiSqmN4XsGhmH4GyXc9Hw==} - peerDependencies: - react: ^18.0 || ^19.0 || >= 19.0.0-rc - react-dom: ^18.0 || ^19.0 || >= 19.0.0-rc - - '@blocknote/core@0.26.0': - resolution: {integrity: sha512-IcG53FYFEn2IwwCZOMyczrRe4WH7HqPB4J0DW9LeUefTg78uVj/iuo0lXKJarHpIrED4yqvkYUzL76h0wH3fxQ==} - peerDependencies: - '@hocuspocus/provider': ^2.15.2 - peerDependenciesMeta: - '@hocuspocus/provider': - optional: true - - '@blocknote/mantine@0.26.0': - resolution: {integrity: sha512-LaIlpR/Ce0zCxojURLS9ok78GG921V9zv0e/NQDGQM+rd2ZkMY7zbVMFjJSVKXs6voHQhBy5ZIiH/7ig3lbLCw==} - peerDependencies: - react: ^18.0 || ^19.0 || >= 19.0.0-rc - react-dom: ^18.0 || ^19.0 || >= 19.0.0-rc - - '@blocknote/react@0.26.0': - resolution: {integrity: sha512-D6/ZexM53jStW9bFRF7469teYXJUN6HFS6apgO8TujflI/PITXtuVL39WxNkZUwN0I0dbum+1qNxV9GWXQXakA==} - peerDependencies: - react: ^18.0 || ^19.0 || >= 19.0.0-rc - react-dom: ^18.0 || ^19.0 || >= 19.0.0-rc - - '@blocknote/shadcn@0.26.0': - resolution: {integrity: sha512-EykTjGTHbGPWLEeHrEzlzEVuxwSxbXknNyBDHDakygPAX7qYaEWn3lsGYdmoXUy+M0pcfhxD0TWs7FYsxrzwOg==} - peerDependencies: - react: ^18.0 || ^19.0 || >= 19.0.0-rc - react-dom: ^18.0 || ^19.0 || >= 19.0.0-rc - '@braintree/sanitize-url@6.0.4': resolution: {integrity: sha512-s3jaWicZd0pkP0jf5ysyHUI/RE7MHos6qlToFcGWXVp+ykHOy77OUMrfbgJ9it2C5bow7OIQwYYaHjk9XlBQ2A==} @@ -6862,40 +6842,22 @@ packages: peerDependencies: webpack: '>=4.40.0' - '@shikijs/core@1.29.2': - resolution: {integrity: sha512-vju0lY9r27jJfOY4Z7+Rt/nIOjzJpZ3y+nYpqtUZInVoXQ/TJZcfGnNOGnKjFdVZb8qexiCuSlZRKcGfhhTTZQ==} - '@shikijs/core@3.2.1': resolution: {integrity: sha512-FhsdxMWYu/C11sFisEp7FMGBtX/OSSbnXZDMBhGuUDBNTdsoZlMSgQv5f90rwvzWAdWIW6VobD+G3IrazxA6dQ==} - '@shikijs/engine-javascript@1.29.2': - resolution: {integrity: sha512-iNEZv4IrLYPv64Q6k7EPpOCE/nuvGiKl7zxdq0WFuRPF5PAE9PRo2JGq/d8crLusM59BRemJ4eOqrFrC4wiQ+A==} - '@shikijs/engine-javascript@3.2.1': resolution: {integrity: sha512-eMdcUzN3FMQYxOmRf2rmU8frikzoSHbQDFH2hIuXsrMO+IBOCI9BeeRkCiBkcLDHeRKbOCtYMJK3D6U32ooU9Q==} - '@shikijs/engine-oniguruma@1.29.2': - resolution: {integrity: sha512-7iiOx3SG8+g1MnlzZVDYiaeHe7Ez2Kf2HrJzdmGwkRisT7r4rak0e655AcM/tF9JG/kg5fMNYlLLKglbN7gBqA==} - '@shikijs/langs-precompiled@3.2.1': resolution: {integrity: sha512-M8AQBjYRVk6seMMwlz7FNIWolAE0bZalBLOwFUPNuM8g8LL7o+GjD/2vKmV7/vxaJ79P0XyZ3I1tFAbWS1wCHQ==} engines: {node: '>=20'} - '@shikijs/langs@1.29.2': - resolution: {integrity: sha512-FIBA7N3LZ+223U7cJDUYd5shmciFQlYkFXlkKVaHsCPgfVLiO+e12FmQE6Tf9vuyEsFe3dIl8qGWKXgEHL9wmQ==} - '@shikijs/langs@3.2.1': resolution: {integrity: sha512-If0iDHYRSGbihiA8+7uRsgb1er1Yj11pwpX1c6HLYnizDsKAw5iaT3JXj5ZpaimXSWky/IhxTm7C6nkiYVym+A==} - '@shikijs/themes@1.29.2': - resolution: {integrity: sha512-i9TNZlsq4uoyqSbluIcZkmPL9Bfi3djVxRnofUHwvx/h6SRW3cwgBC5SML7vsDcWyukY0eCzVN980rqP6qNl9g==} - '@shikijs/themes@3.2.1': resolution: {integrity: sha512-k5DKJUT8IldBvAm8WcrDT5+7GA7se6lLksR+2E3SvyqGTyFMzU2F9Gb7rmD+t+Pga1MKrYFxDIeyWjMZWM6uBQ==} - '@shikijs/types@1.29.2': - resolution: {integrity: sha512-VJjK0eIijTZf0QSTODEXCqinjBn0joAHQ+aPSBzrv4O2d/QSbsMw+ZeSRx03kV34Hy7NzUvV/7NqfYGRLrASmw==} - '@shikijs/types@3.2.1': resolution: {integrity: sha512-/NTWAk4KE2M8uac0RhOsIhYQf4pdU0OywQuYDGIGAJ6Mjunxl2cGiuLkvu4HLCMn+OTTLRWkjZITp+aYJv60yA==} @@ -7219,11 +7181,6 @@ packages: '@tiptap/core': ^2.7.0 '@tiptap/pm': ^2.7.0 - '@tiptap/extension-hard-break@2.11.7': - resolution: {integrity: sha512-zTkZSA6q+F5sLOdCkiC2+RqJQN0zdsJqvFIOVFL/IDVOnq6PZO5THzwRRLvOSnJJl3edRQCl/hUgS0L5sTInGQ==} - peerDependencies: - '@tiptap/core': ^2.7.0 - '@tiptap/extension-history@2.11.5': resolution: {integrity: sha512-b+wOS33Dz1azw6F1i9LFTEIJ/gUui0Jwz5ZvmVDpL2ZHBhq1Ui0/spTT+tuZOXq7Y/uCbKL8Liu4WoedIvhboQ==} peerDependencies: @@ -7366,9 +7323,6 @@ packages: '@types/estree@1.0.7': resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==} - '@types/extend@3.0.4': - resolution: {integrity: sha512-ArMouDUTJEz1SQRpFsT2rIw7DeqICFv5aaVzLSIYMYQSLcwcGOfT3VyglQs/p7K3F7fT4zxr0NWxYZIdifD6dA==} - '@types/hast@2.3.10': resolution: {integrity: sha512-McWspRw8xx8J9HurkVBfYj0xKoE25tOFlHGdx4MJ5xORQrMGZNqJhVQWaIbm6Oyla5kYOXtDiopzKRJzEOkwJw==} @@ -7450,9 +7404,6 @@ packages: '@types/parse-json@4.0.2': resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==} - '@types/parse5@6.0.3': - resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==} - '@types/pg-pool@2.0.6': resolution: {integrity: sha512-TaAUE5rq2VQYxab5Ts7WZhKNmuN78Q6PiFonTDdpbx8a1H0M1vhy3rhiMjl+e2iHmogyMw7jZF4FrE6eJUy5HQ==} @@ -9628,18 +9579,12 @@ packages: resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} engines: {node: '>= 0.4'} - hast-util-embedded@2.0.1: - resolution: {integrity: sha512-QUdSOP1/o+/TxXtpPFXR2mUg2P+ySrmlX7QjwHZCXqMFyYk7YmcGSvqRW+4XgXAoHifdE1t2PwFaQK33TqVjSw==} - hast-util-embedded@3.0.0: resolution: {integrity: sha512-naH8sld4Pe2ep03qqULEtvYr7EjrLK2QHY8KJR6RJkTUjPGObe1vnx585uzem2hGra+s1q08DZZpfgDVYRbaXA==} hast-util-format@1.1.0: resolution: {integrity: sha512-yY1UDz6bC9rDvCWHpx12aIBGRG7krurX0p0Fm6pT547LwDIZZiNr8a+IHDogorAdreULSEzP82Nlv5SZkHZcjA==} - hast-util-from-dom@4.2.0: - resolution: {integrity: sha512-t1RJW/OpJbCAJQeKi3Qrj1cAOLA0+av/iPFori112+0X7R3wng+jxLA+kXec8K4szqPRGI8vPxbbpEYvvpwaeQ==} - hast-util-from-dom@5.0.1: resolution: {integrity: sha512-N+LqofjR2zuzTjCPzyDUdSshy4Ma6li7p/c3pA78uTwzFgENbgbUrm2ugwsOdcjI1muO+o6Dgzp9p8WHtn/39Q==} @@ -9649,75 +9594,42 @@ packages: hast-util-from-html@2.0.3: resolution: {integrity: sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw==} - hast-util-from-parse5@7.1.2: - resolution: {integrity: sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw==} - hast-util-from-parse5@8.0.3: resolution: {integrity: sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg==} - hast-util-has-property@2.0.1: - resolution: {integrity: sha512-X2+RwZIMTMKpXUzlotatPzWj8bspCymtXH3cfG3iQKV+wPF53Vgaqxi/eLqGck0wKq1kS9nvoB1wchbCPEL8sg==} - hast-util-has-property@3.0.0: resolution: {integrity: sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA==} - hast-util-is-body-ok-link@2.0.0: - resolution: {integrity: sha512-S58hCexyKdD31vMsErvgLfflW6vYWo/ixRLPJTtkOvLld24vyI8vmYmkgLA5LG3la2ME7nm7dLGdm48gfLRBfw==} - hast-util-is-body-ok-link@3.0.1: resolution: {integrity: sha512-0qpnzOBLztXHbHQenVB8uNuxTnm/QBFUOmdOSsEn7GnBtyY07+ENTWVFBAnXd/zEgd9/SUG3lRY7hSIBWRgGpQ==} - hast-util-is-element@2.1.3: - resolution: {integrity: sha512-O1bKah6mhgEq2WtVMk+Ta5K7pPMqsBBlmzysLdcwKVrqzZQ0CHqUPiIVspNhAG1rvxpvJjtGee17XfauZYKqVA==} - hast-util-is-element@3.0.0: resolution: {integrity: sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==} hast-util-minify-whitespace@1.0.1: resolution: {integrity: sha512-L96fPOVpnclQE0xzdWb/D12VT5FabA7SnZOUMtL1DbXmYiHJMXZvFkIZfiMmTCNJHUeO2K9UYNXoVyfz+QHuOw==} - hast-util-parse-selector@3.1.1: - resolution: {integrity: sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==} - hast-util-parse-selector@4.0.0: resolution: {integrity: sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==} - hast-util-phrasing@2.0.2: - resolution: {integrity: sha512-yGkCfPkkfCyiLfK6KEl/orMDr/zgCnq/NaO9HfULx6/Zga5fso5eqQA5Ov/JZVqACygvw9shRYWgXNcG2ilo7w==} - hast-util-phrasing@3.0.1: resolution: {integrity: sha512-6h60VfI3uBQUxHqTyMymMZnEbNl1XmEGtOxxKYL7stY2o601COo62AWAYBQR9lZbYXYSBoxag8UpPRXK+9fqSQ==} - hast-util-raw@7.2.3: - resolution: {integrity: sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==} - hast-util-raw@9.1.0: resolution: {integrity: sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw==} hast-util-to-estree@2.3.3: resolution: {integrity: sha512-ihhPIUPxN0v0w6M5+IiAZZrn0LH2uZomeWwhn7uP7avZC6TE7lIiEh2yBMPr5+zi1aUCXq6VoYRgs2Bw9xmycQ==} - hast-util-to-html@8.0.4: - resolution: {integrity: sha512-4tpQTUOr9BMjtYyNlt0P50mH7xj0Ks2xpo8M943Vykljf99HW6EzulIoJP1N3eKOSScEHzyzi9dm7/cn0RfGwA==} - hast-util-to-html@9.0.5: resolution: {integrity: sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==} hast-util-to-mdast@10.1.2: resolution: {integrity: sha512-FiCRI7NmOvM4y+f5w32jPRzcxDIz+PUqDwEqn1A+1q2cdp3B8Gx7aVrXORdOKjMNDQsD1ogOr896+0jJHW1EFQ==} - hast-util-to-mdast@8.4.1: - resolution: {integrity: sha512-tfmBLASuCgyhCzpkTXM5kU8xeuS5jkMZ17BYm2YftGT5wvgc7uHXTZ/X8WfNd6F5NV/IGmrLsuahZ+jXQir4zQ==} - - hast-util-to-parse5@7.1.0: - resolution: {integrity: sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==} - hast-util-to-parse5@8.0.0: resolution: {integrity: sha512-3KKrV5ZVI8if87DVSi1vDeByYrkGzg4mEfeu4alwgmmIeARiBLKCZS2uw5Gb6nU9x9Yufyj3iudm6i7nl52PFw==} - hast-util-to-text@3.1.2: - resolution: {integrity: sha512-tcllLfp23dJJ+ju5wCCZHVpzsQQ43+moJbqVX3jNWPB7z/KFC4FyZD6R7y94cHL6MQ33YtMZL8Z0aIXXI4XFTw==} - hast-util-to-text@4.0.2: resolution: {integrity: sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==} @@ -9727,9 +9639,6 @@ packages: hast-util-whitespace@3.0.0: resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==} - hastscript@7.2.0: - resolution: {integrity: sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==} - hastscript@9.0.1: resolution: {integrity: sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==} @@ -9761,9 +9670,6 @@ packages: html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} - html-void-elements@2.0.1: - resolution: {integrity: sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==} - html-void-elements@3.0.0: resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==} @@ -11062,9 +10968,6 @@ packages: oniguruma-parser@0.5.4: resolution: {integrity: sha512-yNxcQ8sKvURiTwP0mV6bLQCYE7NKfKRRWunhbZnXgxSmB1OXa1lHrN3o4DZd+0Si0kU5blidK7BcROO8qv5TZA==} - oniguruma-to-es@2.3.0: - resolution: {integrity: sha512-bwALDxriqfKGfUufKGGepCzu9x7nJQuoRoAFp4AnwehhC2crqrDIAP/uN2qdlsAvSMpeRC3+Yzhqc7hLmle5+g==} - oniguruma-to-es@4.1.0: resolution: {integrity: sha512-SNwG909cSLo4vPyyPbU/VJkEc9WOXqu2ycBlfd1UCXLqk1IijcQktSBb2yRQ2UFPsDhpkaf+C1dtT3PkLK/yWA==} @@ -11150,9 +11053,6 @@ packages: parse-url@8.1.0: resolution: {integrity: sha512-xDvOoLU5XRrcOZvnI6b8zA6n9O9ejNk/GExuz1yBuWUGn9KA97GI6HTs6u02wKara1CeVmZhH+0TZFdWScR89w==} - parse5@6.0.1: - resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} - parse5@7.2.1: resolution: {integrity: sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==} @@ -11498,41 +11398,6 @@ packages: sugar-high: optional: true - prosemirror-highlight@0.9.0: - resolution: {integrity: sha512-ujJ1M4JgHop8xZ1uyjFDDg8DkOfXC87tJMQAVDTgR9dQOsIv9MoSA6jGcP7xM84P0ecbu1bqVVe9fqbY2zJDSQ==} - peerDependencies: - '@types/hast': ^3.0.0 - highlight.js: ^11.9.0 - lowlight: ^3.1.0 - prosemirror-model: ^1.19.3 - prosemirror-state: ^1.4.3 - prosemirror-transform: ^1.8.0 - prosemirror-view: ^1.32.4 - refractor: ^4.8.1 - shiki: ^1.9.0 - sugar-high: ^0.6.1 - peerDependenciesMeta: - '@types/hast': - optional: true - highlight.js: - optional: true - lowlight: - optional: true - prosemirror-model: - optional: true - prosemirror-state: - optional: true - prosemirror-transform: - optional: true - prosemirror-view: - optional: true - refractor: - optional: true - shiki: - optional: true - sugar-high: - optional: true - prosemirror-history@1.4.1: resolution: {integrity: sha512-2JZD8z2JviJrboD9cPuX/Sv/1ChFng+xh2tChQ2X4bB2HeK+rra/bmJ3xGntCcjhOqIzSDG6Id7e8RJ9QPXLEQ==} @@ -11782,18 +11647,12 @@ packages: regenerator-transform@0.15.2: resolution: {integrity: sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==} - regex-recursion@5.1.1: - resolution: {integrity: sha512-ae7SBCbzVNrIjgSbh7wMznPcQel1DNlDtzensnFxpiNpXt1U2ju/bHugH422r+4LAVS1FpW1YCwilmnNsjum9w==} - regex-recursion@6.0.2: resolution: {integrity: sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==} regex-utilities@2.3.0: resolution: {integrity: sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==} - regex@5.1.1: - resolution: {integrity: sha512-dN5I359AVGPnwzJm2jN1k0W9LPZ+ePvoOeVMMfqIMFz53sSwXkxaJoxr50ptnsC771lK95BnTrVSZxq0b9yCGw==} - regex@6.0.1: resolution: {integrity: sha512-uorlqlzAKjKQZ5P+kTJr3eeJGSVroLKoHmquUj4zHWuR+hEyNqlXsSKlYYF5F4NI6nl7tWCs0apKJ0lmfsXAPA==} @@ -11825,15 +11684,9 @@ packages: rehype-katex@7.0.1: resolution: {integrity: sha512-OiM2wrZ/wuhKkigASodFoo8wimG3H12LWQaH8qSPVJn9apWKFSH3YOCtbKpBorTVw/eI7cuT21XBbvwEswbIOA==} - rehype-minify-whitespace@5.0.1: - resolution: {integrity: sha512-PPp4lWJiBPlePI/dv1BeYktbwkfgXkrK59MUa+tYbMPgleod+4DvFK2PLU0O0O60/xuhHfiR9GUIUlXTU8sRIQ==} - rehype-minify-whitespace@6.0.2: resolution: {integrity: sha512-Zk0pyQ06A3Lyxhe9vGtOtzz3Z0+qZ5+7icZ/PL/2x1SHPbKao5oB/g/rlc6BCTajqBb33JcOe71Ye1oFsuYbnw==} - rehype-parse@8.0.5: - resolution: {integrity: sha512-Ds3RglaY/+clEX2U2mHflt7NlMA72KspZ0JLUJgBBLpRddBcEw3H8uYZQliQriku22NZpYMfjDdSgHcjxue24A==} - rehype-parse@9.0.1: resolution: {integrity: sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag==} @@ -11849,15 +11702,9 @@ packages: rehype-remark@10.0.0: resolution: {integrity: sha512-+aDXY/icqMFOafJQomVjxe3BAP7aR3lIsQ3GV6VIwpbCD2nvNFOXjGvotMe5p0Ny+Gt6L13DhEf/FjOOpTuUbQ==} - rehype-remark@9.1.2: - resolution: {integrity: sha512-c0fG3/CrJ95zAQ07xqHSkdpZybwdsY7X5dNWvgL2XqLKZuqmG3+vk6kP/4miCnp+R+x/0uKKRSpfXb9aGR8Z5w==} - rehype-stringify@10.0.1: resolution: {integrity: sha512-k9ecfXHmIPuFVI61B9DeLPN0qFHfawM6RsuX48hoqlaKSF61RskNjSm1lI8PhBEM0MRdLxVVm4WmTqJQccH9mA==} - rehype-stringify@9.0.4: - resolution: {integrity: sha512-Uk5xu1YKdqobe5XpSskwPvo1XeHUUucWEQSl8hTrXt5selvca1e8K1EZ37E6YoZ4BT8BCqCdVfQW7OfHfthtVQ==} - remark-gfm@3.0.1: resolution: {integrity: sha512-lEFDoi2PICJyNrACFOfDD3JlLkuSbOa5Wd8EPt06HUdptv8Gn0bxYTdbU/XXQ3swAPkEaGxxPN9cbnMHvVu1Ig==} @@ -11885,9 +11732,6 @@ packages: remark-rehype@11.1.1: resolution: {integrity: sha512-g/osARvjkBXb6Wo0XvAeXQohVta8i84ACbenPpoSsxTOQH/Ae0/RGP4WZgnMH5pMLpsj4FG7OHmcIcXxpza8eQ==} - remark-stringify@10.0.3: - resolution: {integrity: sha512-koyOzCMYoUHudypbj4XpnAKFbkddRMYZHwghnxd7ue5210WzGw6kOBwauJTRUMq16jsovXx8dYNvSSWP89kZ3A==} - remark-stringify@11.0.0: resolution: {integrity: sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==} @@ -12132,9 +11976,6 @@ packages: shiki@0.14.7: resolution: {integrity: sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==} - shiki@1.29.2: - resolution: {integrity: sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg==} - shimmer@1.2.1: resolution: {integrity: sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw==} @@ -12688,9 +12529,6 @@ packages: unified@11.0.5: resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==} - unist-util-find-after@4.0.1: - resolution: {integrity: sha512-QO/PuPMm2ERxC6vFXEPtmAutOopy5PknD+Oq64gGwxKtk4xwo9Z97t9Av1obPmGU0IyTa6EKYUfTrK2QJS3Ozw==} - unist-util-find-after@5.0.0: resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==} @@ -12846,9 +12684,6 @@ packages: resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} engines: {node: '>= 0.8'} - vfile-location@4.1.0: - resolution: {integrity: sha512-YF23YMyASIIJXpktBa4vIGLJ5Gs88UB/XePgqPmTa7cDA+JeO3yclbpheQYCHjVHBn/yePzrXuygIL+xbvRYHw==} - vfile-location@5.0.3: resolution: {integrity: sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==} @@ -13160,16 +12995,6 @@ packages: y-partykit@0.0.25: resolution: {integrity: sha512-/EIL73TuYX6lYnxM4mb/kTTKllS1vNjBXk9KJXFwTXFrUqMo8hbJMqnE+glvBG2EDejEI06rk3jR50lpDB8Dqg==} - y-prosemirror@1.2.17: - resolution: {integrity: sha512-9bmO5Vl6E3AH5JRQhJPWOmX4x0dwDZvfM86qd+w38G0j23VSV+ZvrKYBbKc1l44Tnyd7j7TWEuqBpzfOfbc4fw==} - engines: {node: '>=16.0.0', npm: '>=8.0.0'} - peerDependencies: - prosemirror-model: ^1.7.1 - prosemirror-state: ^1.2.3 - prosemirror-view: ^1.9.10 - y-protocols: ^1.0.1 - yjs: ^13.5.38 - y-prosemirror@1.3.0: resolution: {integrity: sha512-KOCwxdn+tHXauZxgbTWI5RtdL+c1ByzQ4pls6P5tKk+G1UfMqIMXByRYp4fDp23RSWsjbbkWeM5esyN8lN81xg==} engines: {node: '>=16.0.0', npm: '>=8.0.0'} @@ -14594,157 +14419,6 @@ snapshots: '@base2/pretty-print-object@1.0.1': {} - '@blocknote/ariakit@0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': - dependencies: - '@ariakit/react': 0.4.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@blocknote/core': 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4) - '@blocknote/react': 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - transitivePeerDependencies: - - '@hocuspocus/provider' - - '@types/hast' - - highlight.js - - lowlight - - refractor - - sugar-high - - supports-color - - '@blocknote/core@0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)': - dependencies: - '@emoji-mart/data': 1.2.1 - '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) - '@tiptap/extension-bold': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) - '@tiptap/extension-code': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) - '@tiptap/extension-collaboration': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.2.17(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)) - '@tiptap/extension-collaboration-cursor': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.2.17(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)) - '@tiptap/extension-gapcursor': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5) - '@tiptap/extension-hard-break': 2.11.7(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) - '@tiptap/extension-history': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5) - '@tiptap/extension-horizontal-rule': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5) - '@tiptap/extension-italic': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) - '@tiptap/extension-link': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5) - '@tiptap/extension-paragraph': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) - '@tiptap/extension-strike': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) - '@tiptap/extension-table-cell': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) - '@tiptap/extension-table-header': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) - '@tiptap/extension-table-row': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) - '@tiptap/extension-text': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) - '@tiptap/extension-underline': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) - '@tiptap/pm': 2.11.5 - emoji-mart: 5.6.0 - hast-util-from-dom: 4.2.0 - prosemirror-dropcursor: 1.8.1 - prosemirror-highlight: 0.9.0(@types/hast@3.0.4)(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-transform@1.10.3)(prosemirror-view@1.38.1)(shiki@1.29.2) - prosemirror-model: 1.25.0 - prosemirror-state: 1.4.3 - prosemirror-tables: 1.6.4 - prosemirror-transform: 1.10.3 - prosemirror-view: 1.38.1 - rehype-format: 5.0.1 - rehype-parse: 8.0.5 - rehype-remark: 9.1.2 - rehype-stringify: 9.0.4 - remark-gfm: 3.0.1 - remark-parse: 10.0.2 - remark-rehype: 10.1.0 - remark-stringify: 10.0.3 - shiki: 1.29.2 - unified: 10.1.2 - uuid: 8.3.2 - y-prosemirror: 1.2.17(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) - y-protocols: 1.0.6(yjs@13.6.24) - yjs: 13.6.24 - optionalDependencies: - '@hocuspocus/provider': 2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) - transitivePeerDependencies: - - '@types/hast' - - highlight.js - - lowlight - - refractor - - sugar-high - - supports-color - - '@blocknote/mantine@0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': - dependencies: - '@blocknote/core': 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4) - '@blocknote/react': 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@mantine/core': 7.17.3(@mantine/hooks@7.17.3(react@18.3.1))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@mantine/hooks': 7.17.3(react@18.3.1) - '@mantine/utils': 6.0.22(react@18.3.1) - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - react-icons: 5.5.0(react@18.3.1) - transitivePeerDependencies: - - '@hocuspocus/provider' - - '@types/hast' - - '@types/react' - - highlight.js - - lowlight - - refractor - - sugar-high - - supports-color - - '@blocknote/react@0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': - dependencies: - '@blocknote/core': 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4) - '@emoji-mart/data': 1.2.1 - '@floating-ui/react': 0.26.28(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) - '@tiptap/pm': 2.11.5 - '@tiptap/react': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - emoji-mart: 5.6.0 - lodash.merge: 4.6.2 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - react-icons: 5.5.0(react@18.3.1) - transitivePeerDependencies: - - '@hocuspocus/provider' - - '@types/hast' - - highlight.js - - lowlight - - refractor - - sugar-high - - supports-color - - '@blocknote/shadcn@0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': - dependencies: - '@blocknote/core': 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4) - '@blocknote/react': 0.26.0(@hocuspocus/provider@2.15.2(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))(@types/hast@3.0.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@hookform/resolvers': 3.10.0(react-hook-form@7.54.2(react@18.3.1)) - '@radix-ui/react-avatar': 1.1.3(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-dropdown-menu': 2.1.6(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-label': 2.1.2(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-popover': 1.1.6(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-select': 2.1.6(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-slot': 1.1.2(@types/react@18.3.20)(react@18.3.1) - '@radix-ui/react-tabs': 1.1.3(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-toggle': 1.1.2(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-tooltip': 1.1.8(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - autoprefixer: 10.4.21(postcss@8.5.3) - class-variance-authority: 0.7.1 - clsx: 2.1.1 - lucide-react: 0.362.0(react@18.3.1) - postcss: 8.5.3 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - react-hook-form: 7.54.2(react@18.3.1) - tailwind-merge: 2.6.0 - tailwindcss: 3.4.17 - tailwindcss-animate: 1.0.7(tailwindcss@3.4.17) - zod: 3.24.2 - transitivePeerDependencies: - - '@hocuspocus/provider' - - '@types/hast' - - '@types/react' - - '@types/react-dom' - - highlight.js - - lowlight - - refractor - - sugar-high - - supports-color - - ts-node - '@braintree/sanitize-url@6.0.4': {} '@cloudflare/workerd-darwin-64@1.20240129.0': @@ -16887,15 +16561,6 @@ snapshots: - encoding - supports-color - '@shikijs/core@1.29.2': - dependencies: - '@shikijs/engine-javascript': 1.29.2 - '@shikijs/engine-oniguruma': 1.29.2 - '@shikijs/types': 1.29.2 - '@shikijs/vscode-textmate': 10.0.2 - '@types/hast': 3.0.4 - hast-util-to-html: 9.0.5 - '@shikijs/core@3.2.1': dependencies: '@shikijs/types': 3.2.1 @@ -16903,49 +16568,25 @@ snapshots: '@types/hast': 3.0.4 hast-util-to-html: 9.0.5 - '@shikijs/engine-javascript@1.29.2': - dependencies: - '@shikijs/types': 1.29.2 - '@shikijs/vscode-textmate': 10.0.2 - oniguruma-to-es: 2.3.0 - '@shikijs/engine-javascript@3.2.1': dependencies: '@shikijs/types': 3.2.1 '@shikijs/vscode-textmate': 10.0.2 oniguruma-to-es: 4.1.0 - '@shikijs/engine-oniguruma@1.29.2': - dependencies: - '@shikijs/types': 1.29.2 - '@shikijs/vscode-textmate': 10.0.2 - '@shikijs/langs-precompiled@3.2.1': dependencies: '@shikijs/types': 3.2.1 oniguruma-to-es: 4.1.0 - '@shikijs/langs@1.29.2': - dependencies: - '@shikijs/types': 1.29.2 - '@shikijs/langs@3.2.1': dependencies: '@shikijs/types': 3.2.1 - '@shikijs/themes@1.29.2': - dependencies: - '@shikijs/types': 1.29.2 - '@shikijs/themes@3.2.1': dependencies: '@shikijs/types': 3.2.1 - '@shikijs/types@1.29.2': - dependencies: - '@shikijs/vscode-textmate': 10.0.2 - '@types/hast': 3.0.4 - '@shikijs/types@3.2.1': dependencies: '@shikijs/vscode-textmate': 10.0.2 @@ -17365,22 +17006,11 @@ snapshots: dependencies: '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) - '@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.2.17(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))': - dependencies: - '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) - y-prosemirror: 1.2.17(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) - '@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))': dependencies: '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) y-prosemirror: 1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) - '@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.2.17(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))': - dependencies: - '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) - '@tiptap/pm': 2.11.5 - y-prosemirror: 1.2.17(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) - '@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))': dependencies: '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) @@ -17398,10 +17028,6 @@ snapshots: '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) '@tiptap/pm': 2.11.5 - '@tiptap/extension-hard-break@2.11.7(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))': - dependencies: - '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) - '@tiptap/extension-history@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)': dependencies: '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) @@ -17568,8 +17194,6 @@ snapshots: '@types/estree@1.0.7': {} - '@types/extend@3.0.4': {} - '@types/hast@2.3.10': dependencies: '@types/unist': 2.0.11 @@ -17662,8 +17286,6 @@ snapshots: '@types/parse-json@4.0.2': {} - '@types/parse5@6.0.3': {} - '@types/pg-pool@2.0.6': dependencies: '@types/pg': 8.6.1 @@ -18037,6 +17659,14 @@ snapshots: chai: 5.2.0 tinyrainbow: 1.2.0 + '@vitest/mocker@2.1.9(vite@5.4.15(@types/node@20.17.28)(terser@5.39.0))': + dependencies: + '@vitest/spy': 2.1.9 + estree-walker: 3.0.3 + magic-string: 0.30.17 + optionalDependencies: + vite: 5.4.15(@types/node@20.17.28)(terser@5.39.0) + '@vitest/mocker@2.1.9(vite@5.4.15(@types/node@22.13.13)(terser@5.39.0))': dependencies: '@vitest/spy': 2.1.9 @@ -19527,7 +19157,7 @@ snapshots: '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.8.2) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1))(eslint@8.57.1) + eslint-import-resolver-typescript: 3.10.0(eslint-plugin-import@2.31.0)(eslint@8.57.1) eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-typescript@3.10.0)(eslint@8.57.1) eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.1) eslint-plugin-react: 7.37.4(eslint@8.57.1) @@ -19574,7 +19204,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.10.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1))(eslint@8.57.1): + eslint-import-resolver-typescript@3.10.0(eslint-plugin-import@2.31.0)(eslint@8.57.1): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.4.0 @@ -19589,14 +19219,14 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0)(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.8.2) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1))(eslint@8.57.1) + eslint-import-resolver-typescript: 3.10.0(eslint-plugin-import@2.31.0)(eslint@8.57.1) transitivePeerDependencies: - supports-color @@ -19619,7 +19249,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0)(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -20222,10 +19852,6 @@ snapshots: dependencies: function-bind: 1.1.2 - hast-util-embedded@2.0.1: - dependencies: - hast-util-is-element: 2.1.3 - hast-util-embedded@3.0.0: dependencies: '@types/hast': 3.0.4 @@ -20241,11 +19867,6 @@ snapshots: html-whitespace-sensitive-tag-names: 3.0.1 unist-util-visit-parents: 6.0.1 - hast-util-from-dom@4.2.0: - dependencies: - hastscript: 7.2.0 - web-namespaces: 2.0.1 - hast-util-from-dom@5.0.1: dependencies: '@types/hast': 3.0.4 @@ -20268,16 +19889,6 @@ snapshots: vfile: 6.0.3 vfile-message: 4.0.2 - hast-util-from-parse5@7.1.2: - dependencies: - '@types/hast': 2.3.10 - '@types/unist': 2.0.11 - hastscript: 7.2.0 - property-information: 6.5.0 - vfile: 5.3.7 - vfile-location: 4.1.0 - web-namespaces: 2.0.1 - hast-util-from-parse5@8.0.3: dependencies: '@types/hast': 3.0.4 @@ -20289,27 +19900,14 @@ snapshots: vfile-location: 5.0.3 web-namespaces: 2.0.1 - hast-util-has-property@2.0.1: {} - hast-util-has-property@3.0.0: dependencies: '@types/hast': 3.0.4 - hast-util-is-body-ok-link@2.0.0: - dependencies: - '@types/hast': 2.3.10 - hast-util-has-property: 2.0.1 - hast-util-is-element: 2.1.3 - hast-util-is-body-ok-link@3.0.1: dependencies: '@types/hast': 3.0.4 - hast-util-is-element@2.1.3: - dependencies: - '@types/hast': 2.3.10 - '@types/unist': 2.0.11 - hast-util-is-element@3.0.0: dependencies: '@types/hast': 3.0.4 @@ -20322,22 +19920,10 @@ snapshots: hast-util-whitespace: 3.0.0 unist-util-is: 6.0.0 - hast-util-parse-selector@3.1.1: - dependencies: - '@types/hast': 2.3.10 - hast-util-parse-selector@4.0.0: dependencies: '@types/hast': 3.0.4 - hast-util-phrasing@2.0.2: - dependencies: - '@types/hast': 2.3.10 - hast-util-embedded: 2.0.1 - hast-util-has-property: 2.0.1 - hast-util-is-body-ok-link: 2.0.0 - hast-util-is-element: 2.1.3 - hast-util-phrasing@3.0.1: dependencies: '@types/hast': 3.0.4 @@ -20346,20 +19932,6 @@ snapshots: hast-util-is-body-ok-link: 3.0.1 hast-util-is-element: 3.0.0 - hast-util-raw@7.2.3: - dependencies: - '@types/hast': 2.3.10 - '@types/parse5': 6.0.3 - hast-util-from-parse5: 7.1.2 - hast-util-to-parse5: 7.1.0 - html-void-elements: 2.0.1 - parse5: 6.0.1 - unist-util-position: 4.0.4 - unist-util-visit: 4.1.2 - vfile: 5.3.7 - web-namespaces: 2.0.1 - zwitch: 2.0.4 - hast-util-raw@9.1.0: dependencies: '@types/hast': 3.0.4 @@ -20396,20 +19968,6 @@ snapshots: transitivePeerDependencies: - supports-color - hast-util-to-html@8.0.4: - dependencies: - '@types/hast': 2.3.10 - '@types/unist': 2.0.11 - ccount: 2.0.1 - comma-separated-tokens: 2.0.3 - hast-util-raw: 7.2.3 - hast-util-whitespace: 2.0.1 - html-void-elements: 2.0.1 - property-information: 6.5.0 - space-separated-tokens: 2.0.2 - stringify-entities: 4.0.4 - zwitch: 2.0.4 - hast-util-to-html@9.0.5: dependencies: '@types/hast': 3.0.4 @@ -20441,33 +19999,6 @@ snapshots: unist-util-position: 5.0.0 unist-util-visit: 5.0.0 - hast-util-to-mdast@8.4.1: - dependencies: - '@types/extend': 3.0.4 - '@types/hast': 2.3.10 - '@types/mdast': 3.0.15 - '@types/unist': 2.0.11 - extend: 3.0.2 - hast-util-has-property: 2.0.1 - hast-util-is-element: 2.1.3 - hast-util-phrasing: 2.0.2 - hast-util-to-text: 3.1.2 - mdast-util-phrasing: 3.0.1 - mdast-util-to-string: 3.2.0 - rehype-minify-whitespace: 5.0.1 - trim-trailing-lines: 2.1.0 - unist-util-is: 5.2.1 - unist-util-visit: 4.1.2 - - hast-util-to-parse5@7.1.0: - dependencies: - '@types/hast': 2.3.10 - comma-separated-tokens: 2.0.3 - property-information: 6.5.0 - space-separated-tokens: 2.0.2 - web-namespaces: 2.0.1 - zwitch: 2.0.4 - hast-util-to-parse5@8.0.0: dependencies: '@types/hast': 3.0.4 @@ -20478,13 +20009,6 @@ snapshots: web-namespaces: 2.0.1 zwitch: 2.0.4 - hast-util-to-text@3.1.2: - dependencies: - '@types/hast': 2.3.10 - '@types/unist': 2.0.11 - hast-util-is-element: 2.1.3 - unist-util-find-after: 4.0.1 - hast-util-to-text@4.0.2: dependencies: '@types/hast': 3.0.4 @@ -20498,14 +20022,6 @@ snapshots: dependencies: '@types/hast': 3.0.4 - hastscript@7.2.0: - dependencies: - '@types/hast': 2.3.10 - comma-separated-tokens: 2.0.3 - hast-util-parse-selector: 3.1.1 - property-information: 6.5.0 - space-separated-tokens: 2.0.2 - hastscript@9.0.1: dependencies: '@types/hast': 3.0.4 @@ -20540,8 +20056,6 @@ snapshots: html-escaper@2.0.2: {} - html-void-elements@2.0.1: {} - html-void-elements@3.0.0: {} html-whitespace-sensitive-tag-names@3.0.1: {} @@ -22384,12 +21898,6 @@ snapshots: oniguruma-parser@0.5.4: {} - oniguruma-to-es@2.3.0: - dependencies: - emoji-regex-xs: 1.0.0 - regex: 5.1.1 - regex-recursion: 5.1.1 - oniguruma-to-es@4.1.0: dependencies: emoji-regex-xs: 1.0.0 @@ -22500,8 +22008,6 @@ snapshots: dependencies: parse-path: 7.0.1 - parse5@6.0.1: {} - parse5@7.2.1: dependencies: entities: 4.5.0 @@ -22765,15 +22271,6 @@ snapshots: prosemirror-transform: 1.10.3 prosemirror-view: 1.38.1 - prosemirror-highlight@0.9.0(@types/hast@3.0.4)(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-transform@1.10.3)(prosemirror-view@1.38.1)(shiki@1.29.2): - optionalDependencies: - '@types/hast': 3.0.4 - prosemirror-model: 1.25.0 - prosemirror-state: 1.4.3 - prosemirror-transform: 1.10.3 - prosemirror-view: 1.38.1 - shiki: 1.29.2 - prosemirror-history@1.4.1: dependencies: prosemirror-state: 1.4.3 @@ -23069,21 +22566,12 @@ snapshots: dependencies: '@babel/runtime': 7.27.0 - regex-recursion@5.1.1: - dependencies: - regex: 5.1.1 - regex-utilities: 2.3.0 - regex-recursion@6.0.2: dependencies: regex-utilities: 2.3.0 regex-utilities@2.3.0: {} - regex@5.1.1: - dependencies: - regex-utilities: 2.3.0 - regex@6.0.1: dependencies: regex-utilities: 2.3.0 @@ -23136,27 +22624,11 @@ snapshots: unist-util-visit-parents: 6.0.1 vfile: 6.0.3 - rehype-minify-whitespace@5.0.1: - dependencies: - '@types/hast': 2.3.10 - hast-util-embedded: 2.0.1 - hast-util-is-element: 2.1.3 - hast-util-whitespace: 2.0.1 - unified: 10.1.2 - unist-util-is: 5.2.1 - rehype-minify-whitespace@6.0.2: dependencies: '@types/hast': 3.0.4 hast-util-minify-whitespace: 1.0.1 - rehype-parse@8.0.5: - dependencies: - '@types/hast': 2.3.10 - hast-util-from-parse5: 7.1.2 - parse5: 6.0.1 - unified: 10.1.2 - rehype-parse@9.0.1: dependencies: '@types/hast': 3.0.4 @@ -23184,25 +22656,12 @@ snapshots: unified: 11.0.5 vfile: 6.0.3 - rehype-remark@9.1.2: - dependencies: - '@types/hast': 2.3.10 - '@types/mdast': 3.0.15 - hast-util-to-mdast: 8.4.1 - unified: 10.1.2 - rehype-stringify@10.0.1: dependencies: '@types/hast': 3.0.4 hast-util-to-html: 9.0.5 unified: 11.0.5 - rehype-stringify@9.0.4: - dependencies: - '@types/hast': 2.3.10 - hast-util-to-html: 8.0.4 - unified: 10.1.2 - remark-gfm@3.0.1: dependencies: '@types/mdast': 3.0.15 @@ -23276,12 +22735,6 @@ snapshots: unified: 11.0.5 vfile: 6.0.3 - remark-stringify@10.0.3: - dependencies: - '@types/mdast': 3.0.15 - mdast-util-to-markdown: 1.5.0 - unified: 10.1.2 - remark-stringify@11.0.0: dependencies: '@types/mdast': 4.0.4 @@ -23597,17 +23050,6 @@ snapshots: vscode-oniguruma: 1.7.0 vscode-textmate: 8.0.0 - shiki@1.29.2: - dependencies: - '@shikijs/core': 1.29.2 - '@shikijs/engine-javascript': 1.29.2 - '@shikijs/engine-oniguruma': 1.29.2 - '@shikijs/langs': 1.29.2 - '@shikijs/themes': 1.29.2 - '@shikijs/types': 1.29.2 - '@shikijs/vscode-textmate': 10.0.2 - '@types/hast': 3.0.4 - shimmer@1.2.1: {} side-channel-list@1.0.0: @@ -24214,11 +23656,6 @@ snapshots: trough: 2.2.0 vfile: 6.0.3 - unist-util-find-after@4.0.1: - dependencies: - '@types/unist': 2.0.11 - unist-util-is: 5.2.1 - unist-util-find-after@5.0.0: dependencies: '@types/unist': 3.0.3 @@ -24405,11 +23842,6 @@ snapshots: vary@1.1.2: {} - vfile-location@4.1.0: - dependencies: - '@types/unist': 2.0.11 - vfile: 5.3.7 - vfile-location@5.0.3: dependencies: '@types/unist': 3.0.3 @@ -24449,6 +23881,24 @@ snapshots: string_decoder: 1.3.0 util-deprecate: 1.0.2 + vite-node@2.1.9(@types/node@20.17.28)(terser@5.39.0): + dependencies: + cac: 6.7.14 + debug: 4.4.0 + es-module-lexer: 1.6.0 + pathe: 1.1.2 + vite: 5.4.15(@types/node@20.17.28)(terser@5.39.0) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vite-node@2.1.9(@types/node@22.13.13)(terser@5.39.0): dependencies: cac: 6.7.14 @@ -24520,6 +23970,43 @@ snapshots: transitivePeerDependencies: - supports-color + vitest@2.1.9(@types/node@20.17.28)(@vitest/ui@2.1.9)(jsdom@25.0.1(canvas@2.11.2(encoding@0.1.13)))(terser@5.39.0): + dependencies: + '@vitest/expect': 2.1.9 + '@vitest/mocker': 2.1.9(vite@5.4.15(@types/node@20.17.28)(terser@5.39.0)) + '@vitest/pretty-format': 2.1.9 + '@vitest/runner': 2.1.9 + '@vitest/snapshot': 2.1.9 + '@vitest/spy': 2.1.9 + '@vitest/utils': 2.1.9 + chai: 5.2.0 + debug: 4.4.0 + expect-type: 1.2.0 + magic-string: 0.30.17 + pathe: 1.1.2 + std-env: 3.8.1 + tinybench: 2.9.0 + tinyexec: 0.3.2 + tinypool: 1.0.2 + tinyrainbow: 1.2.0 + vite: 5.4.15(@types/node@20.17.28)(terser@5.39.0) + vite-node: 2.1.9(@types/node@20.17.28)(terser@5.39.0) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 20.17.28 + '@vitest/ui': 2.1.9(vitest@2.1.9) + jsdom: 25.0.1(canvas@2.11.2(encoding@0.1.13)) + transitivePeerDependencies: + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vitest@2.1.9(@types/node@22.13.13)(@vitest/ui@2.1.9)(jsdom@21.1.2(canvas@2.11.2(encoding@0.1.13)))(terser@5.39.0): dependencies: '@vitest/expect': 2.1.9 @@ -24841,15 +24328,6 @@ snapshots: y-protocols: 1.0.6(yjs@13.6.24) yjs: 13.6.24 - y-prosemirror@1.2.17(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24): - dependencies: - lib0: 0.2.101 - prosemirror-model: 1.25.0 - prosemirror-state: 1.4.3 - prosemirror-view: 1.38.1 - y-protocols: 1.0.6(yjs@13.6.24) - yjs: 13.6.24 - y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24): dependencies: lib0: 0.2.101 diff --git a/shared/formatConversionTestUtil.ts b/shared/formatConversionTestUtil.ts new file mode 100644 index 0000000000..a71cdbda08 --- /dev/null +++ b/shared/formatConversionTestUtil.ts @@ -0,0 +1,197 @@ +import { + Block, + BlockNoteSchema, + BlockSchema, + InlineContent, + InlineContentSchema, + isPartialLinkInlineContent, + isStyledTextInlineContent, + PartialBlock, + PartialInlineContent, + PartialTableCell, + StyledText, + StyleSchema, + TableCell, + TableContent, + UniqueID, +} from "@blocknote/core"; + +function textShorthandToStyledText( + content: string | StyledText[] = "" +): StyledText[] { + if (typeof content === "string") { + return [ + { + type: "text", + text: content, + styles: {}, + }, + ]; + } + return content; +} + +function partialContentToInlineContent( + content: + | PartialInlineContent + | PartialTableCell + | TableContent + | undefined +): + | InlineContent[] + | TableContent + | TableCell + | undefined { + if (typeof content === "string") { + return textShorthandToStyledText(content); + } + + if (Array.isArray(content)) { + return content.flatMap((partialContent) => { + if (typeof partialContent === "string") { + return textShorthandToStyledText(partialContent); + } else if (isPartialLinkInlineContent(partialContent)) { + return { + ...partialContent, + content: textShorthandToStyledText(partialContent.content), + }; + } else if (isStyledTextInlineContent(partialContent)) { + return partialContent; + } else { + // custom inline content + + return { + props: {}, + ...partialContent, + content: partialContentToInlineContent(partialContent.content), + } as any; + } + }); + } else if (content?.type === "tableContent") { + return { + type: "tableContent", + columnWidths: content.columnWidths, + headerRows: content.headerRows, + headerCols: content.headerCols, + rows: content.rows.map((row) => ({ + ...row, + cells: row.cells.map( + (cell) => partialContentToInlineContent(cell) as any + ), + })), + }; + } else if (content?.type === "tableCell") { + return { + type: "tableCell", + content: partialContentToInlineContent(content.content) as any[], + props: { + backgroundColor: content.props?.backgroundColor ?? "default", + textColor: content.props?.textColor ?? "default", + textAlignment: content.props?.textAlignment ?? "left", + colspan: content.props?.colspan ?? 1, + rowspan: content.props?.rowspan ?? 1, + }, + } satisfies TableCell; + } + + return content; +} + +export function partialBlocksToBlocksForTesting< + BSchema extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + schema: BlockNoteSchema, + partialBlocks: Array, NoInfer, NoInfer>> +): Array> { + return partialBlocks.map((partialBlock) => + partialBlockToBlockForTesting(schema.blockSchema, partialBlock) + ); +} + +export function partialBlockToBlockForTesting< + BSchema extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + schema: BSchema, + partialBlock: PartialBlock +): Block { + const contentType: "inline" | "table" | "none" = + schema[partialBlock.type!].content; + + const withDefaults: Block = { + id: "", + type: partialBlock.type!, + props: {} as any, + content: + contentType === "inline" + ? [] + : contentType === "table" + ? { + type: "tableContent", + columnWidths: undefined, + headerRows: undefined, + headerCols: undefined, + rows: [], + } + : (undefined as any), + children: [] as any, + ...partialBlock, + }; + + Object.entries(schema[partialBlock.type!].propSchema).forEach( + ([propKey, propValue]) => { + if ( + withDefaults.props[propKey] === undefined && + propValue.default !== undefined + ) { + (withDefaults.props as any)[propKey] = propValue.default; + } + } + ); + + if (contentType === "inline") { + const content = withDefaults.content as InlineContent[] | undefined; + withDefaults.content = partialContentToInlineContent(content) as any; + } else if (contentType === "table") { + const content = withDefaults.content as TableContent | undefined; + withDefaults.content = { + type: "tableContent", + columnWidths: + content?.columnWidths || + content?.rows[0]?.cells.map(() => undefined) || + [], + headerRows: content?.headerRows || undefined, + headerCols: content?.headerCols || undefined, + rows: + content?.rows.map((row) => ({ + cells: row.cells.map((cell) => partialContentToInlineContent(cell)), + })) || [], + } as any; + } + + return { + ...withDefaults, + content: partialContentToInlineContent(withDefaults.content), + children: withDefaults.children.map((c) => { + return partialBlockToBlockForTesting(schema, c); + }), + } as any; +} + +export function addIdsToBlock(block: PartialBlock) { + if (!block.id) { + block.id = UniqueID.options.generateID(); + } + if (block.children) { + addIdsToBlocks(block.children); + } +} + +export function addIdsToBlocks(blocks: PartialBlock[]) { + for (const block of blocks) { + addIdsToBlock(block); + } +} diff --git a/shared/package.json b/shared/package.json index 25fcd959fc..0f7c3e3818 100644 --- a/shared/package.json +++ b/shared/package.json @@ -13,7 +13,7 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@blocknote/core": "^0.26.0" + "@blocknote/core": "workspace:*" }, "devDependencies": { "@types/node": "22.13.13", diff --git a/shared/testDocument.ts b/shared/testDocument.ts index f61fd9df31..608219ad16 100644 --- a/shared/testDocument.ts +++ b/shared/testDocument.ts @@ -1,9 +1,6 @@ -import { - BlockNoteSchema, - defaultBlockSpecs, - PageBreak, - partialBlocksToBlocksForTesting, -} from "@blocknote/core"; +import { BlockNoteSchema, defaultBlockSpecs, PageBreak } from "@blocknote/core"; + +import { partialBlocksToBlocksForTesting } from "./formatConversionTestUtil.js"; // TODO export const testDocument = partialBlocksToBlocksForTesting( diff --git a/tests/package.json b/tests/package.json index 40f7a1bb99..741cfd447f 100644 --- a/tests/package.json +++ b/tests/package.json @@ -6,6 +6,7 @@ "build": "tsc", "lint": "eslint src --max-warnings 0", "playwright": "playwright test", + "test": "vitest --run", "test:updateSnaps": "docker run --rm -e RUN_IN_DOCKER=true --network host -v $(pwd)/..:/work/ -w /work/tests -it mcr.microsoft.com/playwright:v1.51.1-noble npx playwright test -u", "test-ct": "playwright test -c playwright-ct.config.ts --headed", "test-ct:updateSnaps": "docker run --rm -e RUN_IN_DOCKER=true --network host -v $(pwd)/..:/work/ -w /work/tests -it mcr.microsoft.com/playwright:v1.51.1-noble npx playwright test -c playwright-ct.config.ts -u", @@ -13,20 +14,25 @@ }, "devDependencies": { "@types/node": "^20.11.18", - "@blocknote/ariakit": "^0.26.0", - "@blocknote/core": "^0.26.0", - "@blocknote/mantine": "^0.26.0", - "@blocknote/react": "^0.26.0", - "@blocknote/shadcn": "^0.26.0", + "@blocknote/ariakit": "workspace:*", + "@blocknote/core": "workspace:*", + "@blocknote/mantine": "workspace:*", + "@blocknote/react": "workspace:*", + "@blocknote/shadcn": "workspace:*", + "@tiptap/pm": "^2.11.5", "@types/react": "^18.0.25", "@types/react-dom": "^18.0.9", "@playwright/experimental-ct-react": "1.51.1", "@playwright/test": "1.51.1", "eslint": "^8.10.0", + "htmlfy": "^0.6.7", "react-icons": "^5.2.1", "rimraf": "^5.0.5", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "vite": "^5.3.4", + "vite-plugin-eslint": "^1.8.1", + "vitest": "^2.0.3" }, "eslintConfig": { "extends": [ diff --git a/packages/core/src/api/tests/clipboard/clipboardTestUtil.ts b/tests/src/unit/core/clipboard/clipboardTestUtil.ts similarity index 94% rename from packages/core/src/api/tests/clipboard/clipboardTestUtil.ts rename to tests/src/unit/core/clipboard/clipboardTestUtil.ts index 3523150840..73881a00e3 100644 --- a/packages/core/src/api/tests/clipboard/clipboardTestUtil.ts +++ b/tests/src/unit/core/clipboard/clipboardTestUtil.ts @@ -1,15 +1,14 @@ -import { Node, Slice } from "@tiptap/pm/model"; -import { Selection } from "@tiptap/pm/state"; -import { EditorView } from "@tiptap/pm/view"; -import * as pmView from "@tiptap/pm/view"; - -import { PartialBlock } from "../../../blocks/defaultBlocks.js"; -import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js"; import { + BlockNoteEditor, BlockSchema, InlineContentSchema, + PartialBlock, StyleSchema, -} from "../../../schema/index.js"; +} from "@blocknote/core"; +import { Node, Slice } from "@tiptap/pm/model"; +import { Selection } from "@tiptap/pm/state"; +import { EditorView } from "@tiptap/pm/view"; +import * as pmView from "@tiptap/pm/view"; // Helper function to get the position of a text node with given text content. // By default, returns the position just before the node, but can be just after diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocks.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/basicBlocks.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocks.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/basicBlocks.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/basicBlocksWithProps.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childToParent.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/childToParent.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childToParent.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/childToParent.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/childrenToNextParent.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/childrenToNextParentsChildren.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/image.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/image.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/image.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/image.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleChildren.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/multipleChildren.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleChildren.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/multipleChildren.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleStyledText.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/multipleStyledText.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/multipleStyledText.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/multipleStyledText.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/nestedImage.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/nestedImage.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/nestedImage.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/nestedImage.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/partialChildToParent.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/partialChildToParent.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/partialChildToParent.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/partialChildToParent.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/styledText.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/styledText.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/styledText.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/styledText.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableAllCells.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/tableAllCells.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableAllCells.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/tableAllCells.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCell.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/tableCell.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCell.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/tableCell.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCellText.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/tableCellText.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCellText.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/tableCellText.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCol.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/tableCol.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableCol.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/tableCol.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableRow.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/tableRow.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/tableRow.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/tableRow.html diff --git a/packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/unstyledText.html b/tests/src/unit/core/clipboard/copy/__snapshots__/text/html/unstyledText.html similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/__snapshots__/text/html/unstyledText.html rename to tests/src/unit/core/clipboard/copy/__snapshots__/text/html/unstyledText.html diff --git a/packages/core/src/api/tests/clipboard/copy/getCopyTestInstances.ts b/tests/src/unit/core/clipboard/copy/getCopyTestInstances.ts similarity index 98% rename from packages/core/src/api/tests/clipboard/copy/getCopyTestInstances.ts rename to tests/src/unit/core/clipboard/copy/getCopyTestInstances.ts index 9a347dc01c..a4d1a30809 100644 --- a/packages/core/src/api/tests/clipboard/copy/getCopyTestInstances.ts +++ b/tests/src/unit/core/clipboard/copy/getCopyTestInstances.ts @@ -6,13 +6,13 @@ import { TestInlineContentSchema, TestStyleSchema, } from "../../testSchema.js"; -import { TestInstance } from "../../types.js"; +import { CopyTestCase } from "../../../shared/clipboard/copy/copyTestCase.js"; +import { testCopyHTML } from "../../../shared/clipboard/copy/copyTestExecutors.js"; +import { TestInstance } from "../../../types.js"; import { getPosOfTableCellNode, getPosOfTextNode, } from "../clipboardTestUtil.js"; -import { CopyTestCase } from "./copyTestCase.js"; -import { testCopyHTML } from "./copyTestExecutors.js"; export const getCopyTestInstances = (): TestInstance< CopyTestCase, diff --git a/packages/core/src/api/tests/clipboard/copy/runTests.test.ts b/tests/src/unit/core/clipboard/copy/runTests.test.ts similarity index 100% rename from packages/core/src/api/tests/clipboard/copy/runTests.test.ts rename to tests/src/unit/core/clipboard/copy/runTests.test.ts diff --git a/packages/core/src/api/tests/clipboard/copyPaste/__snapshots__/paragraphInCustomBlock.json b/tests/src/unit/core/clipboard/copyPaste/__snapshots__/paragraphInCustomBlock.json similarity index 100% rename from packages/core/src/api/tests/clipboard/copyPaste/__snapshots__/paragraphInCustomBlock.json rename to tests/src/unit/core/clipboard/copyPaste/__snapshots__/paragraphInCustomBlock.json diff --git a/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestInstances.ts b/tests/src/unit/core/clipboard/copyPaste/getCopyPasteTestInstances.ts similarity index 83% rename from packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestInstances.ts rename to tests/src/unit/core/clipboard/copyPaste/getCopyPasteTestInstances.ts index 93f26a9ffc..27f4b78ba0 100644 --- a/packages/core/src/api/tests/clipboard/copyPaste/getCopyPasteTestInstances.ts +++ b/tests/src/unit/core/clipboard/copyPaste/getCopyPasteTestInstances.ts @@ -5,10 +5,10 @@ import { TestInlineContentSchema, TestStyleSchema, } from "../../testSchema.js"; -import { TestInstance } from "../../types.js"; +import { CopyPasteTestCase } from "../../../shared/clipboard/copyPaste/copyPasteTestCase.js"; +import { testCopyPaste } from "../../../shared/clipboard/copyPaste/copyPasteTestExecutors.js"; +import { TestInstance } from "../../../types.js"; import { getPosOfTextNode } from "../clipboardTestUtil.js"; -import { CopyPasteTestCase } from "./copyPasteTestCase.js"; -import { testCopyPaste } from "./copyPasteTestExecutors.js"; export const getCopyPasteTestInstances = (): TestInstance< CopyPasteTestCase, diff --git a/packages/core/src/api/tests/clipboard/copyPaste/runTests.test.ts b/tests/src/unit/core/clipboard/copyPaste/runTests.test.ts similarity index 100% rename from packages/core/src/api/tests/clipboard/copyPaste/runTests.test.ts rename to tests/src/unit/core/clipboard/copyPaste/runTests.test.ts diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts b/tests/src/unit/core/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts similarity index 69% rename from packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts rename to tests/src/unit/core/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts index 46b8e0cd34..72418dc98c 100644 --- a/packages/core/src/api/tests/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts +++ b/tests/src/unit/core/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts @@ -3,10 +3,10 @@ import { TestInlineContentSchema, TestStyleSchema, } from "../../testSchema.js"; -import { TestInstance } from "../../types.js"; +import { CopyPasteEqualityTestCase } from "../../../shared/clipboard/copyPasteEquality/copyPasteEqualityTestCase.js"; +import { testCopyPasteEquality } from "../../../shared/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.js"; +import { TestInstance } from "../../../types.js"; import { getCopyTestInstances } from "../copy/getCopyTestInstances.js"; -import { CopyPasteEqualityTestCase } from "./copyPasteEqualityTestCase.js"; -import { testCopyPasteEquality } from "./copyPasteEqualityTestExecutors.js"; export const getCopyPasteEqualityTestInstances = (): TestInstance< CopyPasteEqualityTestCase< diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/runTests.test.ts b/tests/src/unit/core/clipboard/copyPasteEquality/runTests.test.ts similarity index 100% rename from packages/core/src/api/tests/clipboard/copyPasteEquality/runTests.test.ts rename to tests/src/unit/core/clipboard/copyPasteEquality/runTests.test.ts diff --git a/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteEndOfParagraph.json b/tests/src/unit/core/clipboard/paste/__snapshots__/text/html/pasteEndOfParagraph.json similarity index 100% rename from packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteEndOfParagraph.json rename to tests/src/unit/core/clipboard/paste/__snapshots__/text/html/pasteEndOfParagraph.json diff --git a/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteImage.json b/tests/src/unit/core/clipboard/paste/__snapshots__/text/html/pasteImage.json similarity index 100% rename from packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteImage.json rename to tests/src/unit/core/clipboard/paste/__snapshots__/text/html/pasteImage.json diff --git a/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteParagraphInCustomBlock.json b/tests/src/unit/core/clipboard/paste/__snapshots__/text/html/pasteParagraphInCustomBlock.json similarity index 100% rename from packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteParagraphInCustomBlock.json rename to tests/src/unit/core/clipboard/paste/__snapshots__/text/html/pasteParagraphInCustomBlock.json diff --git a/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteTable.json b/tests/src/unit/core/clipboard/paste/__snapshots__/text/html/pasteTable.json similarity index 100% rename from packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteTable.json rename to tests/src/unit/core/clipboard/paste/__snapshots__/text/html/pasteTable.json diff --git a/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteTableInExistingTable.json b/tests/src/unit/core/clipboard/paste/__snapshots__/text/html/pasteTableInExistingTable.json similarity index 100% rename from packages/core/src/api/tests/clipboard/paste/__snapshots__/text/html/pasteTableInExistingTable.json rename to tests/src/unit/core/clipboard/paste/__snapshots__/text/html/pasteTableInExistingTable.json diff --git a/packages/core/src/api/tests/clipboard/paste/__snapshots__/text/plain/pasteEndOfParagraphText.json b/tests/src/unit/core/clipboard/paste/__snapshots__/text/plain/pasteEndOfParagraphText.json similarity index 100% rename from packages/core/src/api/tests/clipboard/paste/__snapshots__/text/plain/pasteEndOfParagraphText.json rename to tests/src/unit/core/clipboard/paste/__snapshots__/text/plain/pasteEndOfParagraphText.json diff --git a/packages/core/src/api/tests/clipboard/paste/getPasteTestInstances.ts b/tests/src/unit/core/clipboard/paste/getPasteTestInstances.ts similarity index 93% rename from packages/core/src/api/tests/clipboard/paste/getPasteTestInstances.ts rename to tests/src/unit/core/clipboard/paste/getPasteTestInstances.ts index c51a13f475..925c4a47a3 100644 --- a/packages/core/src/api/tests/clipboard/paste/getPasteTestInstances.ts +++ b/tests/src/unit/core/clipboard/paste/getPasteTestInstances.ts @@ -5,10 +5,13 @@ import { TestInlineContentSchema, TestStyleSchema, } from "../../testSchema.js"; -import { TestInstance } from "../../types.js"; +import { PasteTestCase } from "../../../shared/clipboard/paste/pasteTestCase.js"; +import { + testPasteHTML, + testPasteMarkdown, +} from "../../../shared/clipboard/paste/pasteTestExecutors.js"; +import { TestInstance } from "../../../types.js"; import { getPosOfTextNode } from "../clipboardTestUtil.js"; -import { PasteTestCase } from "./pasteTestCase.js"; -import { testPasteHTML, testPasteMarkdown } from "./pasteTestExecutors.js"; export const getPasteTestInstances = (): TestInstance< PasteTestCase, diff --git a/packages/core/src/api/tests/clipboard/paste/runTests.test.ts b/tests/src/unit/core/clipboard/paste/runTests.test.ts similarity index 100% rename from packages/core/src/api/tests/clipboard/paste/runTests.test.ts rename to tests/src/unit/core/clipboard/paste/runTests.test.ts diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/codeBlock/empty.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/codeBlock/empty.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/codeBlock/python.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/codeBlock/python.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/complex/misc.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/complex/misc.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/complex/misc.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/complex/misc.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/file/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/file/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/button.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/file/button.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/button.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/file/button.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/nested.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/file/nested.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/nested.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/file/nested.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noCaption.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/file/noCaption.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noCaption.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/file/noCaption.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noName.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/file/noName.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/file/noName.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/file/noName.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/between-links.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/between-links.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/end.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/end.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/link.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/link.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/multiple.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/multiple.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/only.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/only.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/start.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/start.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/styles.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/styles.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/image/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/image/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/button.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/image/button.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/button.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/image/button.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/nested.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/image/nested.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/nested.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/image/nested.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noCaption.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/image/noCaption.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noCaption.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/image/noCaption.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noName.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/image/noName.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noName.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/image/noName.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noPreview.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/image/noPreview.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/image/noPreview.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/image/noPreview.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/adjacent.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/adjacent.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/adjacent.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/link/adjacent.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/link/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/styled.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/styled.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/link/styled.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/link/styled.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/lists/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/lists/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/nested.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/lists/nested.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/lists/nested.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/lists/nested.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/pageBreak/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/pageBreak/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/paragraph/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/paragraph/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/empty.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/paragraph/empty.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/empty.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/paragraph/empty.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/paragraph/nested.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/paragraph/nested.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/paragraph/styled.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/paragraph/styled.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/table/allColWidths.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/table/allColWidths.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/table/basic.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/basic.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/table/basic.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerCols.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/table/headerCols.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerCols.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/table/headerCols.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerRows.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/table/headerRows.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/headerRows.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/table/headerRows.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/table/mixedCellColors.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/table/mixedCellColors.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/table/mixedColWidths.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/table/mixedColWidths.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html rename to tests/src/unit/core/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/codeBlock/contains-newlines.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/codeBlock/defaultLanguage.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/codeBlock/empty.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/codeBlock/python.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/codeBlock/python.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/codeBlock/python.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/complex/misc.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/complex/misc.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/complex/misc.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/basic.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/file/basic.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/basic.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/file/basic.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/button.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/file/button.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/button.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/file/button.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/nested.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/file/nested.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/nested.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/file/nested.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/file/noCaption.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/noCaption.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/file/noCaption.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/noName.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/file/noName.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/file/noName.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/file/noName.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/basic.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/between-links.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/end.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/end.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/end.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/link.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/link.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/link.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/multiple.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/only.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/only.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/only.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/only.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/start.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/start.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/start.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/hardbreak/styles.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/basic.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/basic.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/basic.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/basic.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/button.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/button.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/button.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/button.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/nested.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/nested.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/nested.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/nested.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/noCaption.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noCaption.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/noCaption.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noName.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/noName.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noName.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/noName.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/noPreview.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/image/noPreview.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/image/noPreview.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/link/adjacent.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/adjacent.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/link/adjacent.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/basic.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/link/basic.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/basic.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/link/basic.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/styled.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/link/styled.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/link/styled.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/link/styled.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/basic.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/lists/basic.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/basic.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/nested.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/lists/nested.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/nested.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/pageBreak/basic.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/paragraph/basic.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/basic.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/paragraph/basic.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/empty.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/paragraph/empty.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/empty.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/paragraph/empty.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/paragraph/lineBreaks.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/paragraph/nested.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/nested.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/paragraph/nested.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/paragraph/styled.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/paragraph/styled.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/paragraph/styled.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/allColWidths.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/allColWidths.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/allColWidths.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/basic.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/basic.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/basic.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/basic.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/headerCols.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/headerCols.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/headerCols.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/headerRows.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/headerRows.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/headerRows.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/mixedCellColors.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/mixedColWidths.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md rename to tests/src/unit/core/formatConversion/export/__snapshots__/markdown/table/mixedRowspansAndColspans.md diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/codeBlock/contains-newlines.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/codeBlock/defaultLanguage.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/codeBlock/empty.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/codeBlock/python.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/codeBlock/python.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/codeBlock/python.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/complex/misc.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/complex/misc.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/complex/misc.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/basic.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/file/basic.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/basic.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/file/basic.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/button.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/file/button.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/button.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/file/button.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/nested.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/file/nested.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/nested.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/file/nested.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/file/noCaption.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noCaption.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/file/noCaption.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noName.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/file/noName.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/file/noName.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/file/noName.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/basic.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/between-links.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/end.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/end.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/end.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/link.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/link.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/link.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/multiple.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/only.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/only.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/only.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/start.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/start.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/start.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/hardbreak/styles.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/basic.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/basic.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/basic.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/basic.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/button.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/button.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/button.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/button.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/nested.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/nested.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/nested.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/nested.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/noCaption.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noCaption.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/noCaption.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noName.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/noName.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noName.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/noName.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/noPreview.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/image/noPreview.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/image/noPreview.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/link/adjacent.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/adjacent.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/link/adjacent.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/basic.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/link/basic.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/basic.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/link/basic.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/styled.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/link/styled.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/link/styled.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/link/styled.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/lists/basic.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/basic.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/lists/basic.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/lists/nested.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/lists/nested.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/lists/nested.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/pageBreak/basic.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/paragraph/basic.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/basic.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/paragraph/basic.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/paragraph/empty.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/empty.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/paragraph/empty.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/paragraph/lineBreaks.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/paragraph/nested.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/nested.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/paragraph/nested.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/paragraph/styled.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/paragraph/styled.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/paragraph/styled.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/allColWidths.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/allColWidths.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/allColWidths.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/basic.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/basic.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/basic.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/basic.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/headerCols.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerCols.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/headerCols.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/headerRows.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/headerRows.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/headerRows.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/mixedCellColors.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/mixedColWidths.json diff --git a/packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json b/tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json rename to tests/src/unit/core/formatConversion/export/__snapshots__/nodes/table/mixedRowspansAndColspans.json diff --git a/packages/core/src/api/tests/formatConversion/export/getExportTestInstances.ts b/tests/src/unit/core/formatConversion/export/getExportTestInstances.ts similarity index 99% rename from packages/core/src/api/tests/formatConversion/export/getExportTestInstances.ts rename to tests/src/unit/core/formatConversion/export/getExportTestInstances.ts index d44c520bcb..4ca06cbf92 100644 --- a/packages/core/src/api/tests/formatConversion/export/getExportTestInstances.ts +++ b/tests/src/unit/core/formatConversion/export/getExportTestInstances.ts @@ -1,11 +1,10 @@ +import { ExportTestCase } from "../../../shared/formatConversion/export/exportTestCase.js"; +import { TestExecutor, TestInstance } from "../../../types.js"; import { TestBlockSchema, TestInlineContentSchema, TestStyleSchema, } from "../../testSchema.js"; -import { TestExecutor, TestInstance } from "../../types.js"; - -import { ExportTestCase } from "./exportTestCase.js"; export const getExportTestInstances = ( executeTest: TestExecutor< diff --git a/packages/core/src/api/tests/formatConversion/export/runTests.test.ts b/tests/src/unit/core/formatConversion/export/runTests.test.ts similarity index 92% rename from packages/core/src/api/tests/formatConversion/export/runTests.test.ts rename to tests/src/unit/core/formatConversion/export/runTests.test.ts index f830667637..486cf5b90d 100644 --- a/packages/core/src/api/tests/formatConversion/export/runTests.test.ts +++ b/tests/src/unit/core/formatConversion/export/runTests.test.ts @@ -1,13 +1,13 @@ import { describe, it } from "vitest"; -import { setupTestEditor } from "../../setupTestEditor.js"; -import { testSchema } from "../../testSchema.js"; import { testExportBlockNoteHTML, testExportHTML, testExportMarkdown, testExportNodes, -} from "./exportTestExecutors.js"; +} from "../../../shared/formatConversion/export/exportTestExecutors.js"; +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; import { getExportTestInstances } from "./getExportTestInstances.js"; // Tests for verifying that exporting blocks to other formats works as expected. diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts b/tests/src/unit/core/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts similarity index 77% rename from packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts rename to tests/src/unit/core/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts index c2f035da5d..1042cddf91 100644 --- a/packages/core/src/api/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts +++ b/tests/src/unit/core/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts @@ -1,11 +1,10 @@ +import { ExportParseEqualityTestCase } from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestCase.js"; +import { TestExecutor, TestInstance } from "../../../types.js"; import { TestBlockSchema, TestInlineContentSchema, TestStyleSchema, } from "../../testSchema.js"; -import { TestExecutor, TestInstance } from "../../types.js"; - -import { ExportParseEqualityTestCase } from "./exportParseEqualityTestCase.js"; import { getExportTestInstances } from "../export/getExportTestInstances.js"; export const getExportParseEqualityTestInstances = ( diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/runTests.test.ts b/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts similarity index 91% rename from packages/core/src/api/tests/formatConversion/exportParseEquality/runTests.test.ts rename to tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts index 1c22c4e222..ebdd90cc85 100644 --- a/packages/core/src/api/tests/formatConversion/exportParseEquality/runTests.test.ts +++ b/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts @@ -5,7 +5,7 @@ import { testSchema } from "../../testSchema.js"; import { testExportParseEqualityBlockNoteHTML, testExportParseEqualityNodes, -} from "./exportParseEqualityTestExecutors.js"; +} from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestExecutors"; import { getExportParseEqualityTestInstances } from "./getExportParseEqualityTestInstances.js"; // Tests for verifying that exporting blocks to another format, then importing diff --git a/tests/src/unit/core/formatConversion/formatConversionTestUtil.ts b/tests/src/unit/core/formatConversion/formatConversionTestUtil.ts new file mode 100644 index 0000000000..a71cdbda08 --- /dev/null +++ b/tests/src/unit/core/formatConversion/formatConversionTestUtil.ts @@ -0,0 +1,197 @@ +import { + Block, + BlockNoteSchema, + BlockSchema, + InlineContent, + InlineContentSchema, + isPartialLinkInlineContent, + isStyledTextInlineContent, + PartialBlock, + PartialInlineContent, + PartialTableCell, + StyledText, + StyleSchema, + TableCell, + TableContent, + UniqueID, +} from "@blocknote/core"; + +function textShorthandToStyledText( + content: string | StyledText[] = "" +): StyledText[] { + if (typeof content === "string") { + return [ + { + type: "text", + text: content, + styles: {}, + }, + ]; + } + return content; +} + +function partialContentToInlineContent( + content: + | PartialInlineContent + | PartialTableCell + | TableContent + | undefined +): + | InlineContent[] + | TableContent + | TableCell + | undefined { + if (typeof content === "string") { + return textShorthandToStyledText(content); + } + + if (Array.isArray(content)) { + return content.flatMap((partialContent) => { + if (typeof partialContent === "string") { + return textShorthandToStyledText(partialContent); + } else if (isPartialLinkInlineContent(partialContent)) { + return { + ...partialContent, + content: textShorthandToStyledText(partialContent.content), + }; + } else if (isStyledTextInlineContent(partialContent)) { + return partialContent; + } else { + // custom inline content + + return { + props: {}, + ...partialContent, + content: partialContentToInlineContent(partialContent.content), + } as any; + } + }); + } else if (content?.type === "tableContent") { + return { + type: "tableContent", + columnWidths: content.columnWidths, + headerRows: content.headerRows, + headerCols: content.headerCols, + rows: content.rows.map((row) => ({ + ...row, + cells: row.cells.map( + (cell) => partialContentToInlineContent(cell) as any + ), + })), + }; + } else if (content?.type === "tableCell") { + return { + type: "tableCell", + content: partialContentToInlineContent(content.content) as any[], + props: { + backgroundColor: content.props?.backgroundColor ?? "default", + textColor: content.props?.textColor ?? "default", + textAlignment: content.props?.textAlignment ?? "left", + colspan: content.props?.colspan ?? 1, + rowspan: content.props?.rowspan ?? 1, + }, + } satisfies TableCell; + } + + return content; +} + +export function partialBlocksToBlocksForTesting< + BSchema extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + schema: BlockNoteSchema, + partialBlocks: Array, NoInfer, NoInfer>> +): Array> { + return partialBlocks.map((partialBlock) => + partialBlockToBlockForTesting(schema.blockSchema, partialBlock) + ); +} + +export function partialBlockToBlockForTesting< + BSchema extends BlockSchema, + I extends InlineContentSchema, + S extends StyleSchema +>( + schema: BSchema, + partialBlock: PartialBlock +): Block { + const contentType: "inline" | "table" | "none" = + schema[partialBlock.type!].content; + + const withDefaults: Block = { + id: "", + type: partialBlock.type!, + props: {} as any, + content: + contentType === "inline" + ? [] + : contentType === "table" + ? { + type: "tableContent", + columnWidths: undefined, + headerRows: undefined, + headerCols: undefined, + rows: [], + } + : (undefined as any), + children: [] as any, + ...partialBlock, + }; + + Object.entries(schema[partialBlock.type!].propSchema).forEach( + ([propKey, propValue]) => { + if ( + withDefaults.props[propKey] === undefined && + propValue.default !== undefined + ) { + (withDefaults.props as any)[propKey] = propValue.default; + } + } + ); + + if (contentType === "inline") { + const content = withDefaults.content as InlineContent[] | undefined; + withDefaults.content = partialContentToInlineContent(content) as any; + } else if (contentType === "table") { + const content = withDefaults.content as TableContent | undefined; + withDefaults.content = { + type: "tableContent", + columnWidths: + content?.columnWidths || + content?.rows[0]?.cells.map(() => undefined) || + [], + headerRows: content?.headerRows || undefined, + headerCols: content?.headerCols || undefined, + rows: + content?.rows.map((row) => ({ + cells: row.cells.map((cell) => partialContentToInlineContent(cell)), + })) || [], + } as any; + } + + return { + ...withDefaults, + content: partialContentToInlineContent(withDefaults.content), + children: withDefaults.children.map((c) => { + return partialBlockToBlockForTesting(schema, c); + }), + } as any; +} + +export function addIdsToBlock(block: PartialBlock) { + if (!block.id) { + block.id = UniqueID.options.generateID(); + } + if (block.children) { + addIdsToBlocks(block.children); + } +} + +export function addIdsToBlocks(blocks: PartialBlock[]) { + for (const block of blocks) { + addIdsToBlock(block); + } +} diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/basicBlockTypes.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/basicBlockTypes.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/basicBlockTypes.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/basicBlockTypes.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/codeBlocks.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/codeBlocks.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/codeBlocks.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/codeBlocks.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/deepNestedContent.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/deepNestedContent.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/deepNestedContent.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/deepNestedContent.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/divs.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/divs.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/divs.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/divs.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/fakeImageCaption.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/fakeImageCaption.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/fakeImageCaption.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/fakeImageCaption.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/googleDocs.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/googleDocs.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/googleDocs.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/googleDocs.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/imageInParagraph.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/imageInParagraph.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/imageInParagraph.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/imageInParagraph.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/inlineContentAndNestedBlocks.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/inlineContentAndNestedBlocks.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/inlineContentAndNestedBlocks.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/inlineContentAndNestedBlocks.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/lists.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/lists.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/lists.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/lists.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/mixedNestedLists.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/mixedNestedLists.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/mixedNestedLists.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/mixedNestedLists.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/nestedLists.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/nestedLists.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/nestedLists.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/nestedLists.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/nestedListsWithParagraphs.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/nestedListsWithParagraphs.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/nestedListsWithParagraphs.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/nestedListsWithParagraphs.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/notion.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/notion.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/notion.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/notion.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/twoDivs.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/twoDivs.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/twoDivs.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/twoDivs.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/twoTables.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/twoTables.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/html/twoTables.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/html/twoTables.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/basic.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/basic.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/basic.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/basic.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/boldWithWhitespace.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/boldWithWhitespace.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/boldWithWhitespace.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/boldWithWhitespace.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/complex.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/complex.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/complex.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/complex.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/issue226case1.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/issue226case1.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/issue226case1.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/issue226case1.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/issue226case2.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/issue226case2.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/issue226case2.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/issue226case2.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/nested.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/nested.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/nested.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/nested.json diff --git a/packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/styled.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/styled.json similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/__snapshots__/markdown/styled.json rename to tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/styled.json diff --git a/packages/core/src/api/tests/formatConversion/parse/parseTestInstances.ts b/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts similarity index 99% rename from packages/core/src/api/tests/formatConversion/parse/parseTestInstances.ts rename to tests/src/unit/core/formatConversion/parse/parseTestInstances.ts index 1844af8151..3be2a4ac29 100644 --- a/packages/core/src/api/tests/formatConversion/parse/parseTestInstances.ts +++ b/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts @@ -1,12 +1,14 @@ +import { ParseTestCase } from "../../../shared/formatConversion/parse/parseTestCase.js"; +import { + testParseHTML, + testParseMarkdown, +} from "../../../shared/formatConversion/parse/parseTestExecutors.js"; +import { TestInstance } from "../../../types.js"; import { TestBlockSchema, TestInlineContentSchema, TestStyleSchema, } from "../../testSchema.js"; -import { TestInstance } from "../../types.js"; - -import { ParseTestCase } from "./parseTestCase.js"; -import { testParseHTML, testParseMarkdown } from "./parseTestExecutors.js"; export const parseTestInstances = (): TestInstance< ParseTestCase, diff --git a/packages/core/src/api/tests/formatConversion/parse/runTests.test.ts b/tests/src/unit/core/formatConversion/parse/runTests.test.ts similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/runTests.test.ts rename to tests/src/unit/core/formatConversion/parse/runTests.test.ts diff --git a/packages/core/src/api/tests/setupTestEditor.ts b/tests/src/unit/core/setupTestEditor.ts similarity index 76% rename from packages/core/src/api/tests/setupTestEditor.ts rename to tests/src/unit/core/setupTestEditor.ts index 24a5ad8988..5df422680a 100644 --- a/packages/core/src/api/tests/setupTestEditor.ts +++ b/tests/src/unit/core/setupTestEditor.ts @@ -1,14 +1,13 @@ -import { afterAll, beforeAll } from "vitest"; - -import { uploadToTmpFilesDotOrg_DEV_ONLY } from "../../blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js"; -import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js"; -import { BlockNoteSchema } from "../../editor/BlockNoteSchema.js"; import { + BlockNoteEditor, + BlockNoteSchema, BlockSchema, + initializeESMDependencies, InlineContentSchema, StyleSchema, -} from "../../schema/index.js"; -import { initializeESMDependencies } from "../../util/esmDependencies.js"; + uploadToTmpFilesDotOrg_DEV_ONLY, +} from "@blocknote/core"; +import { afterAll, beforeAll } from "vitest"; export const setupTestEditor = < B extends BlockSchema, diff --git a/packages/core/src/api/tests/testSchema.ts b/tests/src/unit/core/testSchema.ts similarity index 91% rename from packages/core/src/api/tests/testSchema.ts rename to tests/src/unit/core/testSchema.ts index 0bb434f4c1..e6a566f630 100644 --- a/packages/core/src/api/tests/testSchema.ts +++ b/tests/src/unit/core/testSchema.ts @@ -1,20 +1,16 @@ import { + BlockNoteSchema, + createBlockSpec, + createInlineContentSpec, + createStyleSpec, defaultBlockSpecs, defaultInlineContentSpecs, + defaultProps, defaultStyleSpecs, -} from "../../blocks/defaultBlocks.js"; -import { defaultProps } from "../../blocks/defaultProps.js"; -import { imagePropSchema, imageRender, -} from "../../blocks/ImageBlockContent/ImageBlockContent.js"; -import { PageBreak } from "../../blocks/PageBreakBlockContent/PageBreakBlockContent.js"; -import { BlockNoteSchema } from "../../editor/BlockNoteSchema.js"; -import { - createBlockSpec, - createInlineContentSpec, - createStyleSpec, -} from "../../schema/index.js"; + PageBreak, +} from "@blocknote/core"; // BLOCKS ---------------------------------------------------------------------- diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/contains-newlines.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/defaultLanguage.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/empty.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/codeBlock/python.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/complex/misc.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/contextParagraph/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/contextParagraph/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/contextParagraph/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/contextParagraph/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/lineBreaks.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/lineBreaks.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/lineBreaks.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/lineBreaks.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/styled.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/styled.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/styled.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/customParagraph/styled.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/file/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/file/button.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/file/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/file/noCaption.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/file/noName.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/fontSize/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/fontSize/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/fontSize/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/fontSize/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/end.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/multiple.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/only.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/start.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/styles.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/button.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/noCaption.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/noName.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/image/noPreview.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/lists/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/lists/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/mention/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/mention/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/mention/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/mention/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/pageBreak/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/empty.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/lineBreaks.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/paragraph/styled.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/button.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/button.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/button.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/button.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noCaption.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noCaption.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noCaption.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noCaption.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noName.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noName.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noName.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactFile/noName.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/button.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/button.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/button.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/button.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noCaption.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noCaption.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noCaption.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noCaption.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noName.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noName.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noName.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noName.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noPreview.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noPreview.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noPreview.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/reactImage/noPreview.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/styled.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/styled.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/styled.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/simpleCustomParagraph/styled.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/small/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/small/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/small/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/small/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/allColWidths.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/headerCols.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/headerRows.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedCellColors.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedColWidths.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/table/mixedRowspansAndColspans.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/tag/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/tag/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/blocknoteHTML/tag/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/blocknoteHTML/tag/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/basicBlockTypes.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/basicBlockTypes.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/basicBlockTypes.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/basicBlockTypes.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/codeBlock/contains-newlines.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/codeBlock/defaultLanguage.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/codeBlock/empty.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/empty.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/codeBlock/empty.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/codeBlock/python.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlock/python.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/codeBlock/python.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlocks.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/codeBlocks.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/codeBlocks.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/codeBlocks.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/complex/misc.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/complex/misc.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/complex/misc.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/complex/misc.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/contextParagraph/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/contextParagraph/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/contextParagraph/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/contextParagraph/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/customParagraph/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/customParagraph/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/lineBreaks.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/customParagraph/lineBreaks.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/lineBreaks.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/customParagraph/lineBreaks.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/customParagraph/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/customParagraph/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/styled.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/customParagraph/styled.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/customParagraph/styled.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/customParagraph/styled.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/deepNestedContent.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/deepNestedContent.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/deepNestedContent.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/deepNestedContent.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/divs.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/divs.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/divs.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/divs.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/fakeImageCaption.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/fakeImageCaption.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/fakeImageCaption.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/fakeImageCaption.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/file/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/file/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/file/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/button.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/file/button.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/file/button.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/file/button.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/file/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/file/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/file/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/noCaption.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/file/noCaption.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/file/noCaption.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/file/noCaption.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/file/noName.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/file/noName.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/file/noName.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/file/noName.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/fontSize/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/fontSize/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/fontSize/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/fontSize/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/googleDocs.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/googleDocs.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/googleDocs.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/googleDocs.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/between-links.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/between-links.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/between-links.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/end.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/end.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/end.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/link.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/link.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/link.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/multiple.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/multiple.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/multiple.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/only.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/only.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/only.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/start.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/start.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/start.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/styles.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/hardbreak/styles.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/hardbreak/styles.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/image/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/image/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/image/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/button.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/image/button.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/image/button.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/image/button.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/image/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/image/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/image/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noCaption.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/image/noCaption.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noCaption.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/image/noCaption.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noName.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/image/noName.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noName.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/image/noName.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noPreview.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/image/noPreview.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/image/noPreview.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/image/noPreview.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/imageInParagraph.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/imageInParagraph.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/imageInParagraph.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/imageInParagraph.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/inlineContentAndNestedBlocks.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/inlineContentAndNestedBlocks.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/inlineContentAndNestedBlocks.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/inlineContentAndNestedBlocks.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/adjacent.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/link/adjacent.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/link/adjacent.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/link/adjacent.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/link/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/link/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/link/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/link/styled.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/link/styled.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/link/styled.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/link/styled.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/lists.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/lists.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/lists.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/lists/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/lists/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/lists/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/lists/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/lists/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/mention/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/mention/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/mention/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/mention/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/mixedNestedLists.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/mixedNestedLists.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/mixedNestedLists.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/mixedNestedLists.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedLists.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/nestedLists.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedLists.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/nestedLists.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedListsWithParagraphs.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/nestedListsWithParagraphs.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/nestedListsWithParagraphs.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/nestedListsWithParagraphs.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/notion.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/notion.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/notion.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/notion.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/pageBreak/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/pageBreak/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/pageBreak/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/paragraph/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/paragraph/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/empty.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/paragraph/empty.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/empty.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/paragraph/empty.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/paragraph/lineBreaks.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/paragraph/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/paragraph/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/paragraph/styled.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/paragraph/styled.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/paragraph/styled.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/reactFile/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/reactFile/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/button.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/reactFile/button.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/button.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/reactFile/button.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/reactFile/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/reactFile/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noCaption.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/reactFile/noCaption.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noCaption.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/reactFile/noCaption.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noName.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/reactFile/noName.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/reactFile/noName.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/reactFile/noName.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/button.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/button.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/button.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/button.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noCaption.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/noCaption.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noCaption.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/noCaption.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noName.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/noName.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noName.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/noName.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noPreview.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/noPreview.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/reactImage/noPreview.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/reactImage/noPreview.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/simpleCustomParagraph/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/simpleCustomParagraph/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/nested.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/simpleCustomParagraph/nested.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/nested.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/simpleCustomParagraph/nested.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/styled.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/simpleCustomParagraph/styled.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/simpleCustomParagraph/styled.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/simpleCustomParagraph/styled.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/small/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/small/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/small/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/small/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/table/allColWidths.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/table/allColWidths.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/table/allColWidths.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/table/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/table/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/table/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerCols.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/table/headerCols.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerCols.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/table/headerCols.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerRows.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/table/headerRows.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/table/headerRows.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/table/headerRows.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/table/mixedCellColors.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedCellColors.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/table/mixedCellColors.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/table/mixedColWidths.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedColWidths.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/table/mixedColWidths.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/table/mixedRowspansAndColspans.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/tag/basic.html b/tests/src/unit/react/formatConversion/export/__snapshots__/html/tag/basic.html similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/tag/basic.html rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/tag/basic.html diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/twoDivs.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/twoDivs.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/twoDivs.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/twoDivs.json diff --git a/packages/react/src/tests/formatConversion/export/__snapshots__/html/twoTables.json b/tests/src/unit/react/formatConversion/export/__snapshots__/html/twoTables.json similarity index 100% rename from packages/react/src/tests/formatConversion/export/__snapshots__/html/twoTables.json rename to tests/src/unit/react/formatConversion/export/__snapshots__/html/twoTables.json diff --git a/packages/react/src/tests/formatConversion/export/getExportTestInstances.ts b/tests/src/unit/react/formatConversion/export/getExportTestInstances.ts similarity index 98% rename from packages/react/src/tests/formatConversion/export/getExportTestInstances.ts rename to tests/src/unit/react/formatConversion/export/getExportTestInstances.ts index 2db0a49741..2f788c5ba9 100644 --- a/packages/react/src/tests/formatConversion/export/getExportTestInstances.ts +++ b/tests/src/unit/react/formatConversion/export/getExportTestInstances.ts @@ -1,5 +1,5 @@ -import { ExportTestCase, TestExecutor, TestInstance } from "@blocknote/core"; - +import { ExportTestCase } from "../../../shared/formatConversion/export/exportTestCase.js"; +import { TestExecutor, TestInstance } from "../../../types.js"; import { TestBlockSchema, TestInlineContentSchema, diff --git a/packages/react/src/tests/formatConversion/export/testExport.test.ts b/tests/src/unit/react/formatConversion/export/testExport.test.ts similarity index 81% rename from packages/react/src/tests/formatConversion/export/testExport.test.ts rename to tests/src/unit/react/formatConversion/export/testExport.test.ts index 43bf3a6781..27490d1f61 100644 --- a/packages/react/src/tests/formatConversion/export/testExport.test.ts +++ b/tests/src/unit/react/formatConversion/export/testExport.test.ts @@ -1,6 +1,9 @@ -import { testExportBlockNoteHTML, testExportHTML } from "@blocknote/core"; import { describe, it } from "vitest"; +import { + testExportBlockNoteHTML, + testExportHTML, +} from "../../../shared/formatConversion/export/exportTestExecutors.js"; import { setupTestEditor } from "../../setupTestEditor.js"; import { testSchema } from "../../testSchema.js"; import { getExportTestInstances } from "./getExportTestInstances.js"; diff --git a/packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts b/tests/src/unit/react/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts similarity index 77% rename from packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts rename to tests/src/unit/react/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts index 46992730a2..1042cddf91 100644 --- a/packages/react/src/tests/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts +++ b/tests/src/unit/react/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts @@ -1,9 +1,5 @@ -import { - ExportParseEqualityTestCase, - TestExecutor, - TestInstance, -} from "@blocknote/core"; - +import { ExportParseEqualityTestCase } from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestCase.js"; +import { TestExecutor, TestInstance } from "../../../types.js"; import { TestBlockSchema, TestInlineContentSchema, diff --git a/packages/react/src/tests/formatConversion/exportParseEquality/runTests.test.ts b/tests/src/unit/react/formatConversion/exportParseEquality/runTests.test.ts similarity index 88% rename from packages/react/src/tests/formatConversion/exportParseEquality/runTests.test.ts rename to tests/src/unit/react/formatConversion/exportParseEquality/runTests.test.ts index 9a4d1f9eb0..6dc4ce8650 100644 --- a/packages/react/src/tests/formatConversion/exportParseEquality/runTests.test.ts +++ b/tests/src/unit/react/formatConversion/exportParseEquality/runTests.test.ts @@ -1,9 +1,9 @@ +import { describe, it } from "vitest"; + import { testExportParseEqualityBlockNoteHTML, testExportParseEqualityNodes, -} from "@blocknote/core"; -import { describe, it } from "vitest"; - +} from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.js"; import { setupTestEditor } from "../../setupTestEditor.js"; import { testSchema } from "../../testSchema.js"; import { getExportParseEqualityTestInstances } from "./getExportParseEqualityTestInstances.js"; diff --git a/packages/react/src/tests/setupTestEditor.tsx b/tests/src/unit/react/setupTestEditor.tsx similarity index 96% rename from packages/react/src/tests/setupTestEditor.tsx rename to tests/src/unit/react/setupTestEditor.tsx index dda19195a2..428a9d73b2 100644 --- a/packages/react/src/tests/setupTestEditor.tsx +++ b/tests/src/unit/react/setupTestEditor.tsx @@ -6,11 +6,11 @@ import { InlineContentSchema, StyleSchema, } from "@blocknote/core"; +import { BlockNoteViewRaw } from "@blocknote/react"; import { flushSync } from "react-dom"; import { createRoot, Root } from "react-dom/client"; import { afterAll, beforeAll } from "vitest"; -import { BlockNoteViewRaw } from "../editor/BlockNoteView.js"; import { TestContext } from "./testSchema.js"; export const setupTestEditor = < diff --git a/packages/react/src/tests/testSchema.tsx b/tests/src/unit/react/testSchema.tsx similarity index 93% rename from packages/react/src/tests/testSchema.tsx rename to tests/src/unit/react/testSchema.tsx index e430ec6644..e08151c1ca 100644 --- a/packages/react/src/tests/testSchema.tsx +++ b/tests/src/unit/react/testSchema.tsx @@ -6,12 +6,13 @@ import { defaultStyleSpecs, PageBreak, } from "@blocknote/core"; +import { + createReactBlockSpec, + createReactInlineContentSpec, + createReactStyleSpec, +} from "@blocknote/react"; import { createContext, useContext } from "react"; -import { createReactBlockSpec } from "../schema/ReactBlockSpec.js"; -import { createReactInlineContentSpec } from "../schema/ReactInlineContentSpec.js"; -import { createReactStyleSpec } from "../schema/ReactStyleSpec.js"; - // BLOCKS ---------------------------------------------------------------------- const CustomParagraph = createReactBlockSpec( diff --git a/packages/core/src/api/tests/clipboard/copy/copyTestCase.ts b/tests/src/unit/shared/clipboard/copy/copyTestCase.ts similarity index 77% rename from packages/core/src/api/tests/clipboard/copy/copyTestCase.ts rename to tests/src/unit/shared/clipboard/copy/copyTestCase.ts index 71f8970576..fdc3eeeedb 100644 --- a/packages/core/src/api/tests/clipboard/copy/copyTestCase.ts +++ b/tests/src/unit/shared/clipboard/copy/copyTestCase.ts @@ -1,12 +1,11 @@ -import { Node } from "@tiptap/pm/model"; -import { Selection } from "@tiptap/pm/state"; - -import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; import { BlockSchema, InlineContentSchema, + PartialBlock, StyleSchema, -} from "../../../../schema/index.js"; +} from "@blocknote/core"; +import { Node } from "@tiptap/pm/model"; +import { Selection } from "@tiptap/pm/state"; export type CopyTestCase< B extends BlockSchema, diff --git a/packages/core/src/api/tests/clipboard/copy/copyTestExecutors.ts b/tests/src/unit/shared/clipboard/copy/copyTestExecutors.ts similarity index 86% rename from packages/core/src/api/tests/clipboard/copy/copyTestExecutors.ts rename to tests/src/unit/shared/clipboard/copy/copyTestExecutors.ts index 1981088ccf..90ac812fc6 100644 --- a/packages/core/src/api/tests/clipboard/copy/copyTestExecutors.ts +++ b/tests/src/unit/shared/clipboard/copy/copyTestExecutors.ts @@ -1,14 +1,14 @@ import { prettify } from "htmlfy"; import { expect } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; import { + BlockNoteEditor, BlockSchema, InlineContentSchema, + selectedFragmentToHTML, StyleSchema, -} from "../../../../schema/index.js"; -import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; -import { setupClipboardTest } from "../clipboardTestUtil.js"; +} from "@blocknote/core"; + +import { setupClipboardTest } from "../../../core/clipboard/clipboardTestUtil.js"; import { CopyTestCase } from "./copyTestCase.js"; export const testCopyBlockNoteHTML = async < diff --git a/packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestCase.ts b/tests/src/unit/shared/clipboard/copyPaste/copyPasteTestCase.ts similarity index 79% rename from packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestCase.ts rename to tests/src/unit/shared/clipboard/copyPaste/copyPasteTestCase.ts index 8c1e1d2db2..9eb7c350c7 100644 --- a/packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestCase.ts +++ b/tests/src/unit/shared/clipboard/copyPaste/copyPasteTestCase.ts @@ -1,12 +1,11 @@ -import { Node } from "@tiptap/pm/model"; -import { Selection } from "@tiptap/pm/state"; - -import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; import { BlockSchema, InlineContentSchema, + PartialBlock, StyleSchema, -} from "../../../../schema/index.js"; +} from "@blocknote/core"; +import { Node } from "@tiptap/pm/model"; +import { Selection } from "@tiptap/pm/state"; export type CopyPasteTestCase< B extends BlockSchema, diff --git a/packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestExecutors.ts b/tests/src/unit/shared/clipboard/copyPaste/copyPasteTestExecutors.ts similarity index 76% rename from packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestExecutors.ts rename to tests/src/unit/shared/clipboard/copyPaste/copyPasteTestExecutors.ts index 78aa4b033e..39eab11325 100644 --- a/packages/core/src/api/tests/clipboard/copyPaste/copyPasteTestExecutors.ts +++ b/tests/src/unit/shared/clipboard/copyPaste/copyPasteTestExecutors.ts @@ -1,13 +1,16 @@ -import { expect } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; import { + BlockNoteEditor, BlockSchema, InlineContentSchema, + selectedFragmentToHTML, StyleSchema, -} from "../../../../schema/index.js"; -import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; -import { doPaste, setupClipboardTest } from "../clipboardTestUtil.js"; +} from "@blocknote/core"; +import { expect } from "vitest"; + +import { + doPaste, + setupClipboardTest, +} from "../../../core/clipboard/clipboardTestUtil.js"; import { CopyPasteTestCase } from "./copyPasteTestCase.js"; export const testCopyPaste = async < diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestCase.ts b/tests/src/unit/shared/clipboard/copyPasteEquality/copyPasteEqualityTestCase.ts similarity index 78% rename from packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestCase.ts rename to tests/src/unit/shared/clipboard/copyPasteEquality/copyPasteEqualityTestCase.ts index e5fae48b26..378a8cc275 100644 --- a/packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestCase.ts +++ b/tests/src/unit/shared/clipboard/copyPasteEquality/copyPasteEqualityTestCase.ts @@ -1,12 +1,11 @@ -import { Node } from "@tiptap/pm/model"; -import { Selection } from "@tiptap/pm/state"; - -import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; import { BlockSchema, InlineContentSchema, + PartialBlock, StyleSchema, -} from "../../../../schema/index.js"; +} from "@blocknote/core"; +import { Node } from "@tiptap/pm/model"; +import { Selection } from "@tiptap/pm/state"; export type CopyPasteEqualityTestCase< B extends BlockSchema, diff --git a/packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.ts b/tests/src/unit/shared/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.ts similarity index 75% rename from packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.ts rename to tests/src/unit/shared/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.ts index 590f6a603f..1406739f55 100644 --- a/packages/core/src/api/tests/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.ts +++ b/tests/src/unit/shared/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.ts @@ -1,13 +1,16 @@ -import { expect } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; import { + BlockNoteEditor, BlockSchema, InlineContentSchema, + selectedFragmentToHTML, StyleSchema, -} from "../../../../schema/index.js"; -import { selectedFragmentToHTML } from "../../../clipboard/toClipboard/copyExtension.js"; -import { doPaste, setupClipboardTest } from "../clipboardTestUtil.js"; +} from "@blocknote/core"; +import { expect } from "vitest"; + +import { + doPaste, + setupClipboardTest, +} from "../../../core/clipboard/clipboardTestUtil.js"; import { CopyPasteEqualityTestCase } from "./copyPasteEqualityTestCase.js"; export const testCopyPasteEquality = async < diff --git a/packages/core/src/api/tests/clipboard/paste/pasteTestCase.ts b/tests/src/unit/shared/clipboard/paste/pasteTestCase.ts similarity index 78% rename from packages/core/src/api/tests/clipboard/paste/pasteTestCase.ts rename to tests/src/unit/shared/clipboard/paste/pasteTestCase.ts index 2129be7f56..2aaf323428 100644 --- a/packages/core/src/api/tests/clipboard/paste/pasteTestCase.ts +++ b/tests/src/unit/shared/clipboard/paste/pasteTestCase.ts @@ -1,12 +1,11 @@ -import { Node } from "@tiptap/pm/model"; -import { Selection } from "@tiptap/pm/state"; - -import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; import { BlockSchema, InlineContentSchema, + PartialBlock, StyleSchema, -} from "../../../../schema/index.js"; +} from "@blocknote/core"; +import { Node } from "@tiptap/pm/model"; +import { Selection } from "@tiptap/pm/state"; export type PasteTestCase< B extends BlockSchema, diff --git a/packages/core/src/api/tests/clipboard/paste/pasteTestExecutors.ts b/tests/src/unit/shared/clipboard/paste/pasteTestExecutors.ts similarity index 86% rename from packages/core/src/api/tests/clipboard/paste/pasteTestExecutors.ts rename to tests/src/unit/shared/clipboard/paste/pasteTestExecutors.ts index e1000b6190..8cd46e81bc 100644 --- a/packages/core/src/api/tests/clipboard/paste/pasteTestExecutors.ts +++ b/tests/src/unit/shared/clipboard/paste/pasteTestExecutors.ts @@ -1,12 +1,15 @@ -import { expect } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; import { + BlockNoteEditor, BlockSchema, InlineContentSchema, StyleSchema, -} from "../../../../schema/index.js"; -import { doPaste, setupClipboardTest } from "../clipboardTestUtil.js"; +} from "@blocknote/core"; +import { expect } from "vitest"; + +import { + doPaste, + setupClipboardTest, +} from "../../../core/clipboard/clipboardTestUtil.js"; import { PasteTestCase } from "./pasteTestCase.js"; export const testPasteHTML = async < diff --git a/packages/core/src/api/tests/formatConversion/export/exportTestCase.ts b/tests/src/unit/shared/formatConversion/export/exportTestCase.ts similarity index 68% rename from packages/core/src/api/tests/formatConversion/export/exportTestCase.ts rename to tests/src/unit/shared/formatConversion/export/exportTestCase.ts index 57e7a461f8..5375dc00d3 100644 --- a/packages/core/src/api/tests/formatConversion/export/exportTestCase.ts +++ b/tests/src/unit/shared/formatConversion/export/exportTestCase.ts @@ -1,9 +1,9 @@ -import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; import { BlockSchema, InlineContentSchema, + PartialBlock, StyleSchema, -} from "../../../../schema/index.js"; +} from "@blocknote/core"; export type ExportTestCase< B extends BlockSchema, diff --git a/packages/core/src/api/tests/formatConversion/export/exportTestExecutors.ts b/tests/src/unit/shared/formatConversion/export/exportTestExecutors.ts similarity index 89% rename from packages/core/src/api/tests/formatConversion/export/exportTestExecutors.ts rename to tests/src/unit/shared/formatConversion/export/exportTestExecutors.ts index a778121270..3bcfebbdb4 100644 --- a/packages/core/src/api/tests/formatConversion/export/exportTestExecutors.ts +++ b/tests/src/unit/shared/formatConversion/export/exportTestExecutors.ts @@ -1,14 +1,14 @@ -import { prettify } from "htmlfy"; -import { expect } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; import { + BlockNoteEditor, BlockSchema, + blockToNode, InlineContentSchema, StyleSchema, -} from "../../../../schema/index.js"; -import { blockToNode } from "../../../nodeConversions/blockToNode.js"; -import { addIdsToBlocks } from "../formatConversionTestUtil.js"; +} from "@blocknote/core"; +import { prettify } from "htmlfy"; +import { expect } from "vitest"; + +import { addIdsToBlocks } from "../../../core/formatConversion/formatConversionTestUtil.js"; import { ExportTestCase } from "./exportTestCase.js"; export const testExportBlockNoteHTML = async < diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestCase.ts b/tests/src/unit/shared/formatConversion/exportParseEquality/exportParseEqualityTestCase.ts similarity index 69% rename from packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestCase.ts rename to tests/src/unit/shared/formatConversion/exportParseEquality/exportParseEqualityTestCase.ts index 40087f35ba..069f902669 100644 --- a/packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestCase.ts +++ b/tests/src/unit/shared/formatConversion/exportParseEquality/exportParseEqualityTestCase.ts @@ -1,9 +1,9 @@ -import { PartialBlock } from "../../../../blocks/defaultBlocks.js"; import { BlockSchema, InlineContentSchema, + PartialBlock, StyleSchema, -} from "../../../../schema/index.js"; +} from "@blocknote/core"; export type ExportParseEqualityTestCase< B extends BlockSchema, diff --git a/packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.ts b/tests/src/unit/shared/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.ts similarity index 83% rename from packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.ts rename to tests/src/unit/shared/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.ts index 30c3c485fa..2f8625282e 100644 --- a/packages/core/src/api/tests/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.ts +++ b/tests/src/unit/shared/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.ts @@ -1,17 +1,17 @@ -import { expect } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; import { + BlockNoteEditor, BlockSchema, + blockToNode, InlineContentSchema, + nodeToBlock, StyleSchema, -} from "../../../../schema/index.js"; -import { blockToNode } from "../../../nodeConversions/blockToNode.js"; -import { nodeToBlock } from "../../../nodeConversions/nodeToBlock.js"; +} from "@blocknote/core"; +import { expect } from "vitest"; + import { addIdsToBlocks, partialBlocksToBlocksForTesting, -} from "../formatConversionTestUtil.js"; +} from "../../../core/formatConversion/formatConversionTestUtil.js"; import { ExportParseEqualityTestCase } from "./exportParseEqualityTestCase.js"; export const testExportParseEqualityBlockNoteHTML = async < diff --git a/packages/core/src/api/tests/formatConversion/parse/parseTestCase.ts b/tests/src/unit/shared/formatConversion/parse/parseTestCase.ts similarity index 100% rename from packages/core/src/api/tests/formatConversion/parse/parseTestCase.ts rename to tests/src/unit/shared/formatConversion/parse/parseTestCase.ts diff --git a/packages/core/src/api/tests/formatConversion/parse/parseTestExecutors.ts b/tests/src/unit/shared/formatConversion/parse/parseTestExecutors.ts similarity index 89% rename from packages/core/src/api/tests/formatConversion/parse/parseTestExecutors.ts rename to tests/src/unit/shared/formatConversion/parse/parseTestExecutors.ts index 8558f38576..5f10fffaf1 100644 --- a/packages/core/src/api/tests/formatConversion/parse/parseTestExecutors.ts +++ b/tests/src/unit/shared/formatConversion/parse/parseTestExecutors.ts @@ -1,11 +1,11 @@ -import { expect } from "vitest"; - -import { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js"; import { + BlockNoteEditor, BlockSchema, InlineContentSchema, StyleSchema, -} from "../../../../schema/index.js"; +} from "@blocknote/core"; +import { expect } from "vitest"; + import { ParseTestCase } from "./parseTestCase.js"; export const testParseHTML = async < diff --git a/packages/core/src/api/tests/types.ts b/tests/src/unit/types.ts similarity index 82% rename from packages/core/src/api/tests/types.ts rename to tests/src/unit/types.ts index 29c72b22cb..766d5e2528 100644 --- a/packages/core/src/api/tests/types.ts +++ b/tests/src/unit/types.ts @@ -1,9 +1,9 @@ -import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js"; import { + BlockNoteEditor, BlockSchema, InlineContentSchema, StyleSchema, -} from "../../schema/index.js"; +} from "@blocknote/core"; export type TestExecutor< TestCase, diff --git a/tests/vite.config.ts b/tests/vite.config.ts new file mode 100644 index 0000000000..a7be0979c9 --- /dev/null +++ b/tests/vite.config.ts @@ -0,0 +1,25 @@ +import * as path from "path"; +import { defineConfig } from "vite"; +import eslintPlugin from "vite-plugin-eslint"; + +// https://vitejs.dev/config/ +export default defineConfig((conf) => ({ + test: { + environment: "jsdom", + setupFiles: ["./vitestSetup.ts"], + include: ["./src/unitTests/**/*.test.ts"], + }, + resolve: { + alias: + conf.command === "build" + ? ({} as Record) + : ({ + // load live from sources with live reload working + "@blocknote/core": path.resolve(__dirname, "../packages/core/src/"), + "@blocknote/react": path.resolve( + __dirname, + "../packages/react/src/" + ), + } as Record), + }, +})); diff --git a/tests/vitestSetup.ts b/tests/vitestSetup.ts new file mode 100644 index 0000000000..9a869521e0 --- /dev/null +++ b/tests/vitestSetup.ts @@ -0,0 +1,35 @@ +import { afterEach, beforeEach } from "vitest"; + +beforeEach(() => { + (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS = {}; +}); + +afterEach(() => { + delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS; +}); + +// Mock ClipboardEvent +class ClipboardEventMock extends Event { + public clipboardData = { + getData: () => { + // + }, + setData: () => { + // + }, + }; +} +(global as any).ClipboardEvent = ClipboardEventMock; + +// Mock DragEvent +class DragEventMock extends Event { + public dataTransfer = { + getData: () => { + // + }, + setData: () => { + // + }, + }; +} +(global as any).DragEvent = DragEventMock; From d92dcac1413cd1b117111a74e48c96d05a09138f Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Fri, 11 Apr 2025 19:24:36 +0200 Subject: [PATCH 08/12] Small fixes --- .../formatConversionTestUtil.ts | 198 ------------------ .../exportParseEquality/runTests.test.ts | 2 +- tests/vite.config.ts | 2 +- 3 files changed, 2 insertions(+), 200 deletions(-) delete mode 100644 packages/core/src/api/tests/formatConversion/formatConversionTestUtil.ts diff --git a/packages/core/src/api/tests/formatConversion/formatConversionTestUtil.ts b/packages/core/src/api/tests/formatConversion/formatConversionTestUtil.ts deleted file mode 100644 index b0dd27d71a..0000000000 --- a/packages/core/src/api/tests/formatConversion/formatConversionTestUtil.ts +++ /dev/null @@ -1,198 +0,0 @@ -import { Block, PartialBlock } from "../../../blocks/defaultBlocks.js"; -import { BlockNoteSchema } from "../../../editor/BlockNoteSchema.js"; -import UniqueID from "../../../extensions/UniqueID/UniqueID.js"; -import { - BlockSchema, - PartialTableCell, - TableCell, - TableContent, -} from "../../../schema/blocks/types.js"; -import { - InlineContent, - InlineContentSchema, - PartialInlineContent, - StyledText, - isPartialLinkInlineContent, - isStyledTextInlineContent, -} from "../../../schema/inlineContent/types.js"; -import { StyleSchema } from "../../../schema/styles/types.js"; - -function textShorthandToStyledText( - content: string | StyledText[] = "" -): StyledText[] { - if (typeof content === "string") { - return [ - { - type: "text", - text: content, - styles: {}, - }, - ]; - } - return content; -} - -function partialContentToInlineContent( - content: - | PartialInlineContent - | PartialTableCell - | TableContent - | undefined -): - | InlineContent[] - | TableContent - | TableCell - | undefined { - if (typeof content === "string") { - return textShorthandToStyledText(content); - } - - if (Array.isArray(content)) { - return content.flatMap((partialContent) => { - if (typeof partialContent === "string") { - return textShorthandToStyledText(partialContent); - } else if (isPartialLinkInlineContent(partialContent)) { - return { - ...partialContent, - content: textShorthandToStyledText(partialContent.content), - }; - } else if (isStyledTextInlineContent(partialContent)) { - return partialContent; - } else { - // custom inline content - - return { - props: {}, - ...partialContent, - content: partialContentToInlineContent(partialContent.content), - } as any; - } - }); - } else if (content?.type === "tableContent") { - return { - type: "tableContent", - columnWidths: content.columnWidths, - headerRows: content.headerRows, - headerCols: content.headerCols, - rows: content.rows.map((row) => ({ - ...row, - cells: row.cells.map( - (cell) => partialContentToInlineContent(cell) as any - ), - })), - }; - } else if (content?.type === "tableCell") { - return { - type: "tableCell", - content: partialContentToInlineContent(content.content) as any[], - props: { - backgroundColor: content.props?.backgroundColor ?? "default", - textColor: content.props?.textColor ?? "default", - textAlignment: content.props?.textAlignment ?? "left", - colspan: content.props?.colspan ?? 1, - rowspan: content.props?.rowspan ?? 1, - }, - } satisfies TableCell; - } - - return content; -} - -export function partialBlocksToBlocksForTesting< - BSchema extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - schema: BlockNoteSchema, - partialBlocks: Array, NoInfer, NoInfer>> -): Array> { - return partialBlocks.map((partialBlock) => - partialBlockToBlockForTesting(schema.blockSchema, partialBlock) - ); -} - -export function partialBlockToBlockForTesting< - BSchema extends BlockSchema, - I extends InlineContentSchema, - S extends StyleSchema ->( - schema: BSchema, - partialBlock: PartialBlock -): Block { - const contentType: "inline" | "table" | "none" = - schema[partialBlock.type!].content; - - const withDefaults: Block = { - id: "", - type: partialBlock.type!, - props: {} as any, - content: - contentType === "inline" - ? [] - : contentType === "table" - ? { - type: "tableContent", - columnWidths: undefined, - headerRows: undefined, - headerCols: undefined, - rows: [], - } - : (undefined as any), - children: [] as any, - ...partialBlock, - }; - - Object.entries(schema[partialBlock.type!].propSchema).forEach( - ([propKey, propValue]) => { - if ( - withDefaults.props[propKey] === undefined && - propValue.default !== undefined - ) { - (withDefaults.props as any)[propKey] = propValue.default; - } - } - ); - - if (contentType === "inline") { - const content = withDefaults.content as InlineContent[] | undefined; - withDefaults.content = partialContentToInlineContent(content) as any; - } else if (contentType === "table") { - const content = withDefaults.content as TableContent | undefined; - withDefaults.content = { - type: "tableContent", - columnWidths: - content?.columnWidths || - content?.rows[0]?.cells.map(() => undefined) || - [], - headerRows: content?.headerRows || undefined, - headerCols: content?.headerCols || undefined, - rows: - content?.rows.map((row) => ({ - cells: row.cells.map((cell) => partialContentToInlineContent(cell)), - })) || [], - } as any; - } - - return { - ...withDefaults, - content: partialContentToInlineContent(withDefaults.content), - children: withDefaults.children.map((c) => { - return partialBlockToBlockForTesting(schema, c); - }), - } as any; -} - -export function addIdsToBlock(block: PartialBlock) { - if (!block.id) { - block.id = UniqueID.options.generateID(); - } - if (block.children) { - addIdsToBlocks(block.children); - } -} - -export function addIdsToBlocks(blocks: PartialBlock[]) { - for (const block of blocks) { - addIdsToBlock(block); - } -} diff --git a/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts b/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts index ebdd90cc85..2c3f922fc3 100644 --- a/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts +++ b/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts @@ -5,7 +5,7 @@ import { testSchema } from "../../testSchema.js"; import { testExportParseEqualityBlockNoteHTML, testExportParseEqualityNodes, -} from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestExecutors"; +} from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.js"; import { getExportParseEqualityTestInstances } from "./getExportParseEqualityTestInstances.js"; // Tests for verifying that exporting blocks to another format, then importing diff --git a/tests/vite.config.ts b/tests/vite.config.ts index a7be0979c9..4aa2e6d97c 100644 --- a/tests/vite.config.ts +++ b/tests/vite.config.ts @@ -7,7 +7,7 @@ export default defineConfig((conf) => ({ test: { environment: "jsdom", setupFiles: ["./vitestSetup.ts"], - include: ["./src/unitTests/**/*.test.ts"], + include: ["./src/unit/**/*.test.ts"], }, resolve: { alias: From 97068eefa0c118be7a0152970e0795a7dd5a2bf0 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Fri, 11 Apr 2025 20:27:15 +0200 Subject: [PATCH 09/12] Separated tests for different formats --- ...yTestInstances.ts => copyTestInstances.ts} | 4 +- .../unit/core/clipboard/copy/runTests.test.ts | 6 +- ...Instances.ts => copyPasteTestInstances.ts} | 4 +- .../core/clipboard/copyPaste/runTests.test.ts | 4 +- ...s.ts => copyPasteEqualityTestInstances.ts} | 21 ++- .../copyPasteEquality/runTests.test.ts | 4 +- ...TestInstances.ts => pasteTestInstances.ts} | 48 ++++--- .../core/clipboard/paste/runTests.test.ts | 19 ++- ...estInstances.ts => exportTestInstances.ts} | 133 +++++++++++------- .../formatConversion/export/runTests.test.ts | 52 +++++-- .../exportParseEqualityTestInstances.ts | 23 +++ .../getExportParseEqualityTestInstances.ts | 30 ---- .../exportParseEquality/runTests.test.ts | 18 +-- .../parse/parseTestInstances.ts | 12 +- .../formatConversion/parse/runTests.test.ts | 19 ++- ...estInstances.ts => exportTestInstances.ts} | 73 +++++----- .../formatConversion/export/runTests.test.ts | 28 ++++ .../export/testExport.test.ts | 22 --- .../exportParseEqualityTestInstances.ts | 40 ++++++ .../getExportParseEqualityTestInstances.ts | 30 ---- .../exportParseEquality/runTests.test.ts | 34 +++-- 21 files changed, 369 insertions(+), 255 deletions(-) rename tests/src/unit/core/clipboard/copy/{getCopyTestInstances.ts => copyTestInstances.ts} (99%) rename tests/src/unit/core/clipboard/copyPaste/{getCopyPasteTestInstances.ts => copyPasteTestInstances.ts} (95%) rename tests/src/unit/core/clipboard/copyPasteEquality/{getCopyPasteEqualityTestInstances.ts => copyPasteEqualityTestInstances.ts} (59%) rename tests/src/unit/core/clipboard/paste/{getPasteTestInstances.ts => pasteTestInstances.ts} (93%) rename tests/src/unit/core/formatConversion/export/{getExportTestInstances.ts => exportTestInstances.ts} (93%) create mode 100644 tests/src/unit/core/formatConversion/exportParseEquality/exportParseEqualityTestInstances.ts delete mode 100644 tests/src/unit/core/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts rename tests/src/unit/react/formatConversion/export/{getExportTestInstances.ts => exportTestInstances.ts} (85%) create mode 100644 tests/src/unit/react/formatConversion/export/runTests.test.ts delete mode 100644 tests/src/unit/react/formatConversion/export/testExport.test.ts create mode 100644 tests/src/unit/react/formatConversion/exportParseEquality/exportParseEqualityTestInstances.ts delete mode 100644 tests/src/unit/react/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts diff --git a/tests/src/unit/core/clipboard/copy/getCopyTestInstances.ts b/tests/src/unit/core/clipboard/copy/copyTestInstances.ts similarity index 99% rename from tests/src/unit/core/clipboard/copy/getCopyTestInstances.ts rename to tests/src/unit/core/clipboard/copy/copyTestInstances.ts index a4d1a30809..5018f0d552 100644 --- a/tests/src/unit/core/clipboard/copy/getCopyTestInstances.ts +++ b/tests/src/unit/core/clipboard/copy/copyTestInstances.ts @@ -14,12 +14,12 @@ import { getPosOfTextNode, } from "../clipboardTestUtil.js"; -export const getCopyTestInstances = (): TestInstance< +export const copyTestInstancesHTML: TestInstance< CopyTestCase, TestBlockSchema, TestInlineContentSchema, TestStyleSchema ->[] => [ +>[] = [ { testCase: { name: "multipleChildren", diff --git a/tests/src/unit/core/clipboard/copy/runTests.test.ts b/tests/src/unit/core/clipboard/copy/runTests.test.ts index 5ca32b57c9..8070dc961f 100644 --- a/tests/src/unit/core/clipboard/copy/runTests.test.ts +++ b/tests/src/unit/core/clipboard/copy/runTests.test.ts @@ -2,15 +2,15 @@ import { describe, it } from "vitest"; import { setupTestEditor } from "../../setupTestEditor.js"; import { testSchema } from "../../testSchema.js"; -import { getCopyTestInstances } from "./getCopyTestInstances.js"; +import { copyTestInstancesHTML } from "./copyTestInstances.js"; // Tests for verifying content that gets put on the clipboard when copying // within the editor. Used broadly to ensure each block or set of blocks is correctly // converted into different types of clipboard data. -describe("Copy tests", () => { +describe("Copy tests (HTML)", () => { const getEditor = setupTestEditor(testSchema); - for (const { testCase, executeTest } of getCopyTestInstances()) { + for (const { testCase, executeTest } of copyTestInstancesHTML) { it(`${testCase.name}`, async () => { await executeTest(getEditor(), testCase); }); diff --git a/tests/src/unit/core/clipboard/copyPaste/getCopyPasteTestInstances.ts b/tests/src/unit/core/clipboard/copyPaste/copyPasteTestInstances.ts similarity index 95% rename from tests/src/unit/core/clipboard/copyPaste/getCopyPasteTestInstances.ts rename to tests/src/unit/core/clipboard/copyPaste/copyPasteTestInstances.ts index 27f4b78ba0..1174599c2b 100644 --- a/tests/src/unit/core/clipboard/copyPaste/getCopyPasteTestInstances.ts +++ b/tests/src/unit/core/clipboard/copyPaste/copyPasteTestInstances.ts @@ -10,12 +10,12 @@ import { testCopyPaste } from "../../../shared/clipboard/copyPaste/copyPasteTest import { TestInstance } from "../../../types.js"; import { getPosOfTextNode } from "../clipboardTestUtil.js"; -export const getCopyPasteTestInstances = (): TestInstance< +export const copyPasteTestInstances: TestInstance< CopyPasteTestCase, TestBlockSchema, TestInlineContentSchema, TestStyleSchema ->[] => [ +>[] = [ { testCase: { name: "paragraphInCustomBlock", diff --git a/tests/src/unit/core/clipboard/copyPaste/runTests.test.ts b/tests/src/unit/core/clipboard/copyPaste/runTests.test.ts index 204fdcca5c..1c55cbaf13 100644 --- a/tests/src/unit/core/clipboard/copyPaste/runTests.test.ts +++ b/tests/src/unit/core/clipboard/copyPaste/runTests.test.ts @@ -2,14 +2,14 @@ import { describe, it } from "vitest"; import { setupTestEditor } from "../../setupTestEditor.js"; import { testSchema } from "../../testSchema.js"; -import { getCopyPasteTestInstances } from "./getCopyPasteTestInstances.js"; +import { copyPasteTestInstances } from "./copyPasteTestInstances.js"; // Tests for verifying that copying and pasting content within the editor works // as expected. Used for specific cases where unexpected behaviour was noticed. describe("Copy/paste tests", () => { const getEditor = setupTestEditor(testSchema); - for (const { testCase, executeTest } of getCopyPasteTestInstances()) { + for (const { testCase, executeTest } of copyPasteTestInstances) { it(`${testCase.name}`, async () => { await executeTest(getEditor(), testCase); }); diff --git a/tests/src/unit/core/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts b/tests/src/unit/core/clipboard/copyPasteEquality/copyPasteEqualityTestInstances.ts similarity index 59% rename from tests/src/unit/core/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts rename to tests/src/unit/core/clipboard/copyPasteEquality/copyPasteEqualityTestInstances.ts index 72418dc98c..e3bc47da79 100644 --- a/tests/src/unit/core/clipboard/copyPasteEquality/getCopyPasteEqualityTestInstances.ts +++ b/tests/src/unit/core/clipboard/copyPasteEquality/copyPasteEqualityTestInstances.ts @@ -6,9 +6,9 @@ import { import { CopyPasteEqualityTestCase } from "../../../shared/clipboard/copyPasteEquality/copyPasteEqualityTestCase.js"; import { testCopyPasteEquality } from "../../../shared/clipboard/copyPasteEquality/copyPasteEqualityTestExecutors.js"; import { TestInstance } from "../../../types.js"; -import { getCopyTestInstances } from "../copy/getCopyTestInstances.js"; +import { copyTestInstancesHTML } from "../copy/copyTestInstances.js"; -export const getCopyPasteEqualityTestInstances = (): TestInstance< +export const copyPasteEqualityTestInstances: TestInstance< CopyPasteEqualityTestCase< TestBlockSchema, TestInlineContentSchema, @@ -17,12 +17,11 @@ export const getCopyPasteEqualityTestInstances = (): TestInstance< TestBlockSchema, TestInlineContentSchema, TestStyleSchema ->[] => - getCopyTestInstances().map(({ testCase }) => ({ - testCase: { - name: testCase.name, - document: testCase.document, - getCopyAndPasteSelection: testCase.getCopySelection, - }, - executeTest: testCopyPasteEquality, - })); +>[] = copyTestInstancesHTML.map(({ testCase }) => ({ + testCase: { + name: testCase.name, + document: testCase.document, + getCopyAndPasteSelection: testCase.getCopySelection, + }, + executeTest: testCopyPasteEquality, +})); diff --git a/tests/src/unit/core/clipboard/copyPasteEquality/runTests.test.ts b/tests/src/unit/core/clipboard/copyPasteEquality/runTests.test.ts index 1151361365..46327f26ba 100644 --- a/tests/src/unit/core/clipboard/copyPasteEquality/runTests.test.ts +++ b/tests/src/unit/core/clipboard/copyPasteEquality/runTests.test.ts @@ -2,7 +2,7 @@ import { describe, it } from "vitest"; import { setupTestEditor } from "../../setupTestEditor.js"; import { testSchema } from "../../testSchema.js"; -import { getCopyPasteEqualityTestInstances } from "./getCopyPasteEqualityTestInstances.js"; +import { copyPasteEqualityTestInstances } from "./copyPasteEqualityTestInstances.js"; // Tests for verifying that copying and pasting content in place within the // editor results in the same document as the original. Used broadly to ensure @@ -10,7 +10,7 @@ import { getCopyPasteEqualityTestInstances } from "./getCopyPasteEqualityTestIns describe("Copy/paste equality tests", () => { const getEditor = setupTestEditor(testSchema); - for (const { testCase, executeTest } of getCopyPasteEqualityTestInstances()) { + for (const { testCase, executeTest } of copyPasteEqualityTestInstances) { it(`${testCase.name}`, async () => { await executeTest(getEditor(), testCase); }); diff --git a/tests/src/unit/core/clipboard/paste/getPasteTestInstances.ts b/tests/src/unit/core/clipboard/paste/pasteTestInstances.ts similarity index 93% rename from tests/src/unit/core/clipboard/paste/getPasteTestInstances.ts rename to tests/src/unit/core/clipboard/paste/pasteTestInstances.ts index 925c4a47a3..1df662d4f7 100644 --- a/tests/src/unit/core/clipboard/paste/getPasteTestInstances.ts +++ b/tests/src/unit/core/clipboard/paste/pasteTestInstances.ts @@ -13,12 +13,12 @@ import { import { TestInstance } from "../../../types.js"; import { getPosOfTextNode } from "../clipboardTestUtil.js"; -export const getPasteTestInstances = (): TestInstance< +export const pasteTestInstancesHTML: TestInstance< PasteTestCase, TestBlockSchema, TestInlineContentSchema, TestStyleSchema ->[] => [ +>[] = [ { testCase: { name: "pasteEndOfParagraph", @@ -37,24 +37,6 @@ export const getPasteTestInstances = (): TestInstance< }, executeTest: testPasteHTML, }, - { - testCase: { - name: "pasteEndOfParagraphText", - content: `Paragraph`, - document: [ - { - type: "paragraph", - content: "Paragraph 1", - }, - ], - getPasteSelection: (doc) => { - const startPos = getPosOfTextNode(doc, "Paragraph 1", true); - - return TextSelection.create(doc, startPos); - }, - }, - executeTest: testPasteMarkdown, - }, { testCase: { name: "pasteImage", @@ -156,3 +138,29 @@ export const getPasteTestInstances = (): TestInstance< executeTest: testPasteHTML, }, ]; + +export const pasteTestInstancesMarkdown: TestInstance< + PasteTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] = [ + { + testCase: { + name: "pasteEndOfParagraphText", + content: `Paragraph`, + document: [ + { + type: "paragraph", + content: "Paragraph 1", + }, + ], + getPasteSelection: (doc) => { + const startPos = getPosOfTextNode(doc, "Paragraph 1", true); + + return TextSelection.create(doc, startPos); + }, + }, + executeTest: testPasteMarkdown, + }, +]; diff --git a/tests/src/unit/core/clipboard/paste/runTests.test.ts b/tests/src/unit/core/clipboard/paste/runTests.test.ts index b3c90a16fe..92fba65fef 100644 --- a/tests/src/unit/core/clipboard/paste/runTests.test.ts +++ b/tests/src/unit/core/clipboard/paste/runTests.test.ts @@ -2,16 +2,29 @@ import { describe, it } from "vitest"; import { setupTestEditor } from "../../setupTestEditor.js"; import { testSchema } from "../../testSchema.js"; -import { getPasteTestInstances } from "./getPasteTestInstances.js"; +import { + pasteTestInstancesHTML, + pasteTestInstancesMarkdown, +} from "./pasteTestInstances.js"; // Tests for verifying that clipboard data gets pasted into the editor properly. // Used for specific cases for when content from outside the editor is pasted // into it. This includes content from other editors, as well as content from // the web that has produced bugs in the past. -describe("Paste tests", () => { +describe("Paste tests (HTML)", () => { const getEditor = setupTestEditor(testSchema); - for (const { testCase, executeTest } of getPasteTestInstances()) { + for (const { testCase, executeTest } of pasteTestInstancesHTML) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); + +describe("Paste tests (Markdown)", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of pasteTestInstancesMarkdown) { it(`${testCase.name}`, async () => { await executeTest(getEditor(), testCase); }); diff --git a/tests/src/unit/core/formatConversion/export/getExportTestInstances.ts b/tests/src/unit/core/formatConversion/export/exportTestInstances.ts similarity index 93% rename from tests/src/unit/core/formatConversion/export/getExportTestInstances.ts rename to tests/src/unit/core/formatConversion/export/exportTestInstances.ts index 4ca06cbf92..2e476712af 100644 --- a/tests/src/unit/core/formatConversion/export/getExportTestInstances.ts +++ b/tests/src/unit/core/formatConversion/export/exportTestInstances.ts @@ -1,24 +1,23 @@ import { ExportTestCase } from "../../../shared/formatConversion/export/exportTestCase.js"; -import { TestExecutor, TestInstance } from "../../../types.js"; +import { + testExportBlockNoteHTML, + testExportHTML, + testExportMarkdown, + testExportNodes, +} from "../../../shared/formatConversion/export/exportTestExecutors.js"; +import { TestInstance } from "../../../types.js"; import { TestBlockSchema, TestInlineContentSchema, TestStyleSchema, } from "../../testSchema.js"; -export const getExportTestInstances = ( - executeTest: TestExecutor< - ExportTestCase, - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - > -): TestInstance< +export const exportTestInstancesBlockNoteHTML: TestInstance< ExportTestCase, TestBlockSchema, TestInlineContentSchema, TestStyleSchema ->[] => [ +>[] = [ { testCase: { name: "paragraph/empty", @@ -28,7 +27,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -40,7 +39,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -85,7 +84,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -107,7 +106,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -119,7 +118,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -154,7 +153,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -193,7 +192,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -204,7 +203,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -216,7 +215,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -229,7 +228,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -242,7 +241,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -253,7 +252,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -264,7 +263,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -280,7 +279,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -295,7 +294,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -310,7 +309,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -336,7 +335,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -347,7 +346,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -364,7 +363,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -380,7 +379,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -396,7 +395,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -414,7 +413,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -440,7 +439,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -567,7 +566,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -695,7 +694,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -823,7 +822,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -951,7 +950,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1046,7 +1045,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1174,7 +1173,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1302,7 +1301,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1321,7 +1320,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1353,7 +1352,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1377,7 +1376,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1396,7 +1395,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1415,7 +1414,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1434,7 +1433,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1453,7 +1452,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1472,7 +1471,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1496,7 +1495,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1515,7 +1514,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1539,7 +1538,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -1591,6 +1590,36 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, ]; + +export const exportTestInstancesHTML: TestInstance< + ExportTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] = exportTestInstancesBlockNoteHTML.map(({ testCase }) => ({ + testCase, + executeTest: testExportHTML, +})); + +export const exportTestInstancesMarkdown: TestInstance< + ExportTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] = exportTestInstancesBlockNoteHTML.map(({ testCase }) => ({ + testCase, + executeTest: testExportMarkdown, +})); + +export const exportTestInstancesNodes: TestInstance< + ExportTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] = exportTestInstancesBlockNoteHTML.map(({ testCase }) => ({ + testCase, + executeTest: testExportNodes, +})); diff --git a/tests/src/unit/core/formatConversion/export/runTests.test.ts b/tests/src/unit/core/formatConversion/export/runTests.test.ts index 486cf5b90d..f3069bd66a 100644 --- a/tests/src/unit/core/formatConversion/export/runTests.test.ts +++ b/tests/src/unit/core/formatConversion/export/runTests.test.ts @@ -1,27 +1,51 @@ import { describe, it } from "vitest"; -import { - testExportBlockNoteHTML, - testExportHTML, - testExportMarkdown, - testExportNodes, -} from "../../../shared/formatConversion/export/exportTestExecutors.js"; import { setupTestEditor } from "../../setupTestEditor.js"; import { testSchema } from "../../testSchema.js"; -import { getExportTestInstances } from "./getExportTestInstances.js"; +import { + exportTestInstancesBlockNoteHTML, + exportTestInstancesHTML, + exportTestInstancesMarkdown, + exportTestInstancesNodes, +} from "./exportTestInstances.js"; // Tests for verifying that exporting blocks to other formats works as expected. // Used broadly to ensure each block or set of blocks is correctly converted // into different formats. -describe("Export tests", () => { +describe("Export tests (BlockNote HTML)", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of exportTestInstancesBlockNoteHTML) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); + +describe("Export tests (HTML)", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of exportTestInstancesHTML) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); + +describe("Export tests (Markdown)", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of exportTestInstancesMarkdown) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); + +describe("Export tests (TipTap nodes)", () => { const getEditor = setupTestEditor(testSchema); - for (const { testCase, executeTest } of [ - ...getExportTestInstances(testExportBlockNoteHTML), - ...getExportTestInstances(testExportHTML), - ...getExportTestInstances(testExportMarkdown), - ...getExportTestInstances(testExportNodes), - ]) { + for (const { testCase, executeTest } of exportTestInstancesNodes) { it(`${testCase.name}`, async () => { await executeTest(getEditor(), testCase); }); diff --git a/tests/src/unit/core/formatConversion/exportParseEquality/exportParseEqualityTestInstances.ts b/tests/src/unit/core/formatConversion/exportParseEquality/exportParseEqualityTestInstances.ts new file mode 100644 index 0000000000..63d3552df0 --- /dev/null +++ b/tests/src/unit/core/formatConversion/exportParseEquality/exportParseEqualityTestInstances.ts @@ -0,0 +1,23 @@ +import { ExportParseEqualityTestCase } from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestCase.js"; +import { testExportParseEqualityBlockNoteHTML } from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.js"; +import { TestInstance } from "../../../types.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { exportTestInstancesBlockNoteHTML } from "../export/exportTestInstances.js"; + +export const exportParseEqualityTestInstancesBlockNoteHTML: TestInstance< + ExportParseEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] = exportTestInstancesBlockNoteHTML.map(({ testCase }) => ({ + testCase, + executeTest: testExportParseEqualityBlockNoteHTML, +})); diff --git a/tests/src/unit/core/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts b/tests/src/unit/core/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts deleted file mode 100644 index 1042cddf91..0000000000 --- a/tests/src/unit/core/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ExportParseEqualityTestCase } from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestCase.js"; -import { TestExecutor, TestInstance } from "../../../types.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; -import { getExportTestInstances } from "../export/getExportTestInstances.js"; - -export const getExportParseEqualityTestInstances = ( - executeTest: TestExecutor< - ExportParseEqualityTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >, - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - > -): TestInstance< - ExportParseEqualityTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >, - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema ->[] => getExportTestInstances(executeTest); diff --git a/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts b/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts index 2c3f922fc3..76ad6ef24c 100644 --- a/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts +++ b/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts @@ -2,24 +2,18 @@ import { describe, it } from "vitest"; import { setupTestEditor } from "../../setupTestEditor.js"; import { testSchema } from "../../testSchema.js"; -import { - testExportParseEqualityBlockNoteHTML, - testExportParseEqualityNodes, -} from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.js"; -import { getExportParseEqualityTestInstances } from "./getExportParseEqualityTestInstances.js"; +import { exportParseEqualityTestInstancesBlockNoteHTML } from "./exportParseEqualityTestInstances.js"; // Tests for verifying that exporting blocks to another format, then importing // them back results in the same blocks as the original. Used broadly to ensure // that exporting and importing blocks does not result in any data loss. -describe("Export/parse equality tests", () => { +describe("Export/parse equality tests (BlockNote HTML)", () => { const getEditor = setupTestEditor(testSchema); - for (const { testCase, executeTest } of [ - ...getExportParseEqualityTestInstances( - testExportParseEqualityBlockNoteHTML - ), - ...getExportParseEqualityTestInstances(testExportParseEqualityNodes), - ]) { + for (const { + testCase, + executeTest, + } of exportParseEqualityTestInstancesBlockNoteHTML) { it(`${testCase.name}`, async () => { await executeTest(getEditor(), testCase); }); diff --git a/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts b/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts index 3be2a4ac29..1953d1ca75 100644 --- a/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts +++ b/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts @@ -10,12 +10,12 @@ import { TestStyleSchema, } from "../../testSchema.js"; -export const parseTestInstances = (): TestInstance< +export const parseTestInstancesHTML: TestInstance< ParseTestCase, TestBlockSchema, TestInlineContentSchema, TestStyleSchema ->[] => [ +>[] = [ { testCase: { name: "basicBlockTypes", @@ -512,6 +512,14 @@ With Hard Break

          }, executeTest: testParseHTML, }, +]; + +export const parseTestInstancesMarkdown: TestInstance< + ParseTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] = [ { testCase: { name: "basic", diff --git a/tests/src/unit/core/formatConversion/parse/runTests.test.ts b/tests/src/unit/core/formatConversion/parse/runTests.test.ts index 2e95d8008a..dd87c5fa03 100644 --- a/tests/src/unit/core/formatConversion/parse/runTests.test.ts +++ b/tests/src/unit/core/formatConversion/parse/runTests.test.ts @@ -2,16 +2,29 @@ import { describe, it } from "vitest"; import { setupTestEditor } from "../../setupTestEditor.js"; import { testSchema } from "../../testSchema.js"; -import { parseTestInstances } from "./parseTestInstances.js"; +import { + parseTestInstancesHTML, + parseTestInstancesMarkdown, +} from "./parseTestInstances.js"; // Tests for verifying that importing blocks from other formats works as // expected. Used for specific cases for when content from outside the editor is // imported as blocks. This includes content from other editors, as well as // content from the web that has produced bugs in the past. -describe("Parse tests", () => { +describe("Parse tests (HTML)", () => { const getEditor = setupTestEditor(testSchema); - for (const { testCase, executeTest } of parseTestInstances()) { + for (const { testCase, executeTest } of parseTestInstancesHTML) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); + +describe("Parse tests (Markdown)", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of parseTestInstancesMarkdown) { it(`${testCase.name}`, async () => { await executeTest(getEditor(), testCase); }); diff --git a/tests/src/unit/react/formatConversion/export/getExportTestInstances.ts b/tests/src/unit/react/formatConversion/export/exportTestInstances.ts similarity index 85% rename from tests/src/unit/react/formatConversion/export/getExportTestInstances.ts rename to tests/src/unit/react/formatConversion/export/exportTestInstances.ts index 2f788c5ba9..d822928fb6 100644 --- a/tests/src/unit/react/formatConversion/export/getExportTestInstances.ts +++ b/tests/src/unit/react/formatConversion/export/exportTestInstances.ts @@ -1,24 +1,21 @@ import { ExportTestCase } from "../../../shared/formatConversion/export/exportTestCase.js"; -import { TestExecutor, TestInstance } from "../../../types.js"; +import { + testExportBlockNoteHTML, + testExportHTML, +} from "../../../shared/formatConversion/export/exportTestExecutors.js"; +import { TestInstance } from "../../../types.js"; import { TestBlockSchema, TestInlineContentSchema, TestStyleSchema, } from "../../testSchema.js"; -export const getExportTestInstances = ( - executeTest: TestExecutor< - ExportTestCase, - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - > -): TestInstance< +export const exportTestInstancesBlockNoteHTML: TestInstance< ExportTestCase, TestBlockSchema, TestInlineContentSchema, TestStyleSchema ->[] => [ +>[] = [ { testCase: { name: "reactFile/button", @@ -28,7 +25,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -44,7 +41,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -59,7 +56,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -74,7 +71,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -100,7 +97,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, // Because images need to fetch the download URL async, their internal HTML // is initially rendered without a `src` attribute, which is reflected in @@ -114,7 +111,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -131,7 +128,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -147,7 +144,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -163,7 +160,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -181,7 +178,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -209,7 +206,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -221,7 +218,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -266,7 +263,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -288,7 +285,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -300,7 +297,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -312,7 +309,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -357,7 +354,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -379,7 +376,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -391,7 +388,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -412,7 +409,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -431,7 +428,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -451,7 +448,7 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, { testCase: { @@ -471,6 +468,16 @@ export const getExportTestInstances = ( }, ], }, - executeTest, + executeTest: testExportBlockNoteHTML, }, ]; + +export const exportTestInstancesHTML: TestInstance< + ExportTestCase, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] = exportTestInstancesBlockNoteHTML.map(({ testCase }) => ({ + testCase, + executeTest: testExportHTML, +})); diff --git a/tests/src/unit/react/formatConversion/export/runTests.test.ts b/tests/src/unit/react/formatConversion/export/runTests.test.ts new file mode 100644 index 0000000000..92395d74ff --- /dev/null +++ b/tests/src/unit/react/formatConversion/export/runTests.test.ts @@ -0,0 +1,28 @@ +import { describe, it } from "vitest"; + +import { setupTestEditor } from "../../setupTestEditor.js"; +import { testSchema } from "../../testSchema.js"; +import { + exportTestInstancesBlockNoteHTML, + exportTestInstancesHTML, +} from "./exportTestInstances.js"; + +describe("React export tests (BlockNote HTML)", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of exportTestInstancesBlockNoteHTML) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); + +describe("React export tests (HTML)", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { testCase, executeTest } of exportTestInstancesHTML) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); diff --git a/tests/src/unit/react/formatConversion/export/testExport.test.ts b/tests/src/unit/react/formatConversion/export/testExport.test.ts deleted file mode 100644 index 27490d1f61..0000000000 --- a/tests/src/unit/react/formatConversion/export/testExport.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { describe, it } from "vitest"; - -import { - testExportBlockNoteHTML, - testExportHTML, -} from "../../../shared/formatConversion/export/exportTestExecutors.js"; -import { setupTestEditor } from "../../setupTestEditor.js"; -import { testSchema } from "../../testSchema.js"; -import { getExportTestInstances } from "./getExportTestInstances.js"; - -describe("React export tests", () => { - const getEditor = setupTestEditor(testSchema); - - for (const { testCase, executeTest } of [ - ...getExportTestInstances(testExportBlockNoteHTML), - ...getExportTestInstances(testExportHTML), - ]) { - it(`${testCase.name}`, async () => { - await executeTest(getEditor(), testCase); - }); - } -}); diff --git a/tests/src/unit/react/formatConversion/exportParseEquality/exportParseEqualityTestInstances.ts b/tests/src/unit/react/formatConversion/exportParseEquality/exportParseEqualityTestInstances.ts new file mode 100644 index 0000000000..2deca013d9 --- /dev/null +++ b/tests/src/unit/react/formatConversion/exportParseEquality/exportParseEqualityTestInstances.ts @@ -0,0 +1,40 @@ +import { ExportParseEqualityTestCase } from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestCase.js"; +import { + testExportParseEqualityBlockNoteHTML, + testExportParseEqualityNodes, +} from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.js"; +import { TestInstance } from "../../../types.js"; +import { + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema, +} from "../../testSchema.js"; +import { exportTestInstancesBlockNoteHTML } from "../export/exportTestInstances.js"; + +export const exportParseEqualityTestInstancesBlockNoteHTML: TestInstance< + ExportParseEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] = exportTestInstancesBlockNoteHTML.map(({ testCase }) => ({ + testCase, + executeTest: testExportParseEqualityBlockNoteHTML, +})); + +export const exportParseEqualityTestInstancesNodes: TestInstance< + ExportParseEqualityTestCase< + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema + >, + TestBlockSchema, + TestInlineContentSchema, + TestStyleSchema +>[] = exportParseEqualityTestInstancesBlockNoteHTML.map(({ testCase }) => ({ + testCase, + executeTest: testExportParseEqualityNodes, +})); diff --git a/tests/src/unit/react/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts b/tests/src/unit/react/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts deleted file mode 100644 index 1042cddf91..0000000000 --- a/tests/src/unit/react/formatConversion/exportParseEquality/getExportParseEqualityTestInstances.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ExportParseEqualityTestCase } from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestCase.js"; -import { TestExecutor, TestInstance } from "../../../types.js"; -import { - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema, -} from "../../testSchema.js"; -import { getExportTestInstances } from "../export/getExportTestInstances.js"; - -export const getExportParseEqualityTestInstances = ( - executeTest: TestExecutor< - ExportParseEqualityTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >, - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - > -): TestInstance< - ExportParseEqualityTestCase< - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema - >, - TestBlockSchema, - TestInlineContentSchema, - TestStyleSchema ->[] => getExportTestInstances(executeTest); diff --git a/tests/src/unit/react/formatConversion/exportParseEquality/runTests.test.ts b/tests/src/unit/react/formatConversion/exportParseEquality/runTests.test.ts index 6dc4ce8650..75bfe85897 100644 --- a/tests/src/unit/react/formatConversion/exportParseEquality/runTests.test.ts +++ b/tests/src/unit/react/formatConversion/exportParseEquality/runTests.test.ts @@ -1,22 +1,32 @@ import { describe, it } from "vitest"; -import { - testExportParseEqualityBlockNoteHTML, - testExportParseEqualityNodes, -} from "../../../shared/formatConversion/exportParseEquality/exportParseEqualityTestExecutors.js"; import { setupTestEditor } from "../../setupTestEditor.js"; import { testSchema } from "../../testSchema.js"; -import { getExportParseEqualityTestInstances } from "./getExportParseEqualityTestInstances.js"; +import { + exportParseEqualityTestInstancesBlockNoteHTML, + exportParseEqualityTestInstancesNodes, +} from "./exportParseEqualityTestInstances.js"; + +describe("Export/parse equality tests (BlockNote HTML)", () => { + const getEditor = setupTestEditor(testSchema); + + for (const { + testCase, + executeTest, + } of exportParseEqualityTestInstancesBlockNoteHTML) { + it(`${testCase.name}`, async () => { + await executeTest(getEditor(), testCase); + }); + } +}); -describe("Export/parse equality tests", () => { +describe("Export/parse equality tests (TipTap nodes)", () => { const getEditor = setupTestEditor(testSchema); - for (const { testCase, executeTest } of [ - ...getExportParseEqualityTestInstances( - testExportParseEqualityBlockNoteHTML - ), - ...getExportParseEqualityTestInstances(testExportParseEqualityNodes), - ]) { + for (const { + testCase, + executeTest, + } of exportParseEqualityTestInstancesNodes) { it(`${testCase.name}`, async () => { await executeTest(getEditor(), testCase); }); From c389810eb202daf35ad67c3a5ed1070e4f56d5d4 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Fri, 11 Apr 2025 20:56:31 +0200 Subject: [PATCH 10/12] Updated `package-lock.json` --- pnpm-lock.yaml | 203 +++++++++++++++++++++++-------------------------- 1 file changed, 94 insertions(+), 109 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 852f3510a0..efe5237365 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -120,10 +120,10 @@ importers: specifier: ^4.0.2 version: 4.0.2(webpack@5.98.0) react: - specifier: ^18 + specifier: ^18.3.1 version: 18.3.1 react-dom: - specifier: ^18 + specifier: ^18.3.1 version: 18.3.1(react@18.3.1) react-github-btn: specifier: ^1.4.0 @@ -2441,10 +2441,10 @@ importers: version: 2.22.3(react@18.3.1) '@liveblocks/react-blocknote': specifier: ^2.22.3 - version: 2.22.3(d738a86650da06a1dfc27339c4901616) + version: 2.22.3(d5b9c01b7960db6fb188eec3dbab6fda) '@liveblocks/react-tiptap': specifier: ^2.22.3 - version: 2.22.3(@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/pm@2.11.5)(@tiptap/react@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@tiptap/suggestion@2.11.7(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5))(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(y-protocols@1.0.6(yjs@13.6.24)) + version: 2.22.3(@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/pm@2.11.5)(@tiptap/react@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@tiptap/suggestion@2.11.7(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5))(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(y-protocols@1.0.6(yjs@13.6.24)) '@liveblocks/react-ui': specifier: ^2.22.3 version: 2.22.3(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -2754,10 +2754,10 @@ importers: specifier: ^0.4.3 version: 0.4.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@blocknote/core': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../core '@blocknote/react': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../react react: specifier: ^18.0 || ^19.0 || >= 19.0.0-rc @@ -2822,7 +2822,7 @@ importers: version: 3.2.1 devDependencies: '@blocknote/core': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../core eslint: specifier: ^8.10.0 @@ -2868,10 +2868,10 @@ importers: version: 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5)) '@tiptap/extension-collaboration': specifier: ^2.11.5 - version: 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)) + version: 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)) '@tiptap/extension-collaboration-cursor': specifier: ^2.11.5 - version: 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)) + version: 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)) '@tiptap/extension-gapcursor': specifier: ^2.11.5 version: 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5) @@ -2969,8 +2969,8 @@ importers: specifier: ^8.3.2 version: 8.3.2 y-prosemirror: - specifier: 1.3.0 - version: 1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) + specifier: ^1.3.1 + version: 1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) y-protocols: specifier: ^1.0.6 version: 1.0.6(yjs@13.6.24) @@ -3033,10 +3033,10 @@ importers: specifier: ^2.7.1 version: 2.8.8 react: - specifier: ^18 + specifier: ^18.3.1 version: 18.3.1 react-dom: - specifier: ^18 + specifier: ^18.3.1 version: 18.3.1(react@18.3.1) tinyglobby: specifier: 0.2.12 @@ -3051,10 +3051,10 @@ importers: packages/mantine: dependencies: '@blocknote/core': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../core '@blocknote/react': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../react '@mantine/core': specifier: ^7.10.1 @@ -3112,7 +3112,7 @@ importers: packages/react: dependencies: '@blocknote/core': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../core '@emoji-mart/data': specifier: ^1.2.1 @@ -3135,12 +3135,6 @@ importers: lodash.merge: specifier: ^4.6.2 version: 4.6.2 - react: - specifier: ^18.0 || ^19.0 || >= 19.0.0-rc - version: 18.3.1 - react-dom: - specifier: ^18.0 || ^19.0 || >= 19.0.0-rc - version: 18.3.1(react@18.3.1) react-icons: specifier: ^5.2.1 version: 5.5.0(react@18.3.1) @@ -3172,6 +3166,12 @@ importers: prettier: specifier: ^2.7.1 version: 2.8.8 + react: + specifier: ^18.3.1 + version: 18.3.1 + react-dom: + specifier: ^18.3.1 + version: 18.3.1(react@18.3.1) rimraf: specifier: ^5.0.5 version: 5.0.10 @@ -3197,10 +3197,10 @@ importers: packages/server-util: dependencies: '@blocknote/core': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../core '@blocknote/react': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../react '@tiptap/core': specifier: ^2.7.1 @@ -3218,8 +3218,8 @@ importers: specifier: ^18.0 || ^19.0 || >= 19.0.0-rc version: 18.3.1(react@18.3.1) y-prosemirror: - specifier: 1.3.0 - version: 1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) + specifier: ^1.3.1 + version: 1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) y-protocols: specifier: ^1.0.6 version: 1.0.6(yjs@13.6.24) @@ -3261,10 +3261,10 @@ importers: packages/shadcn: dependencies: '@blocknote/core': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../core '@blocknote/react': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../react '@hookform/resolvers': specifier: ^3.6.0 @@ -3306,7 +3306,7 @@ importers: specifier: ^2.1.1 version: 2.1.1 lucide-react: - specifier: ^0.362.0 + specifier: ^0 version: 0.362.0(react@18.3.1) postcss: specifier: ^8.4.38 @@ -3376,7 +3376,7 @@ importers: packages/xl-docx-exporter: dependencies: '@blocknote/core': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../core buffer: specifier: ^6.0.3 @@ -3387,12 +3387,6 @@ importers: image-meta: specifier: ^0.2.1 version: 0.2.1 - react: - specifier: ^18.0 || ^19.0 || >= 19.0.0-rc - version: 18.3.1 - react-dom: - specifier: ^18.0 || ^19.0 || >= 19.0.0-rc - version: 18.3.1(react@18.3.1) devDependencies: '@types/react': specifier: ^18.0.25 @@ -3409,6 +3403,12 @@ importers: prettier: specifier: ^2.7.1 version: 2.8.8 + react: + specifier: ^18.3.1 + version: 18.3.1 + react-dom: + specifier: ^18.3.1 + version: 18.3.1(react@18.3.1) rollup-plugin-webpack-stats: specifier: ^0.2.2 version: 0.2.6(rollup@4.37.0) @@ -3431,10 +3431,10 @@ importers: packages/xl-multi-column: dependencies: '@blocknote/core': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../core '@blocknote/react': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../react '@tiptap/core': specifier: ^2.7.1 @@ -3456,14 +3456,14 @@ importers: version: 1.38.1 react-icons: specifier: ^5.2.1 - version: 5.5.0(react@19.0.0) + version: 5.5.0(react@18.3.1) devDependencies: '@types/react': - specifier: ^19 - version: 19.0.12 + specifier: ^18.3.1 + version: 18.3.20 '@types/react-dom': - specifier: ^19 - version: 19.0.4(@types/react@19.0.12) + specifier: ^18.3.1 + version: 18.3.5(@types/react@18.3.20) '@vitest/ui': specifier: ^2.1.4 version: 2.1.9(vitest@2.1.9) @@ -3477,11 +3477,11 @@ importers: specifier: ^2.7.1 version: 2.8.8 react: - specifier: ^19 - version: 19.0.0 + specifier: ^18.3.1 + version: 18.3.1 react-dom: - specifier: ^19 - version: 19.0.0(react@19.0.0) + specifier: ^18.3.1 + version: 18.3.1(react@18.3.1) rimraf: specifier: ^5.0.5 version: 5.0.10 @@ -3504,7 +3504,7 @@ importers: packages/xl-odt-exporter: dependencies: '@blocknote/core': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../core '@zip.js/zip.js': specifier: ^2.7.57 @@ -3529,10 +3529,10 @@ importers: specifier: ^2.7.1 version: 2.8.8 react: - specifier: ^18 + specifier: ^18.3.1 version: 18.3.1 react-dom: - specifier: ^18 + specifier: ^18.3.1 version: 18.3.1(react@18.3.1) rollup-plugin-webpack-stats: specifier: ^0.2.2 @@ -3556,10 +3556,10 @@ importers: packages/xl-pdf-exporter: dependencies: '@blocknote/core': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../core '@blocknote/react': - specifier: ^0.27.0 + specifier: ^0.28.0 version: link:../react '@react-pdf/renderer': specifier: ^4.3.0 @@ -3570,12 +3570,6 @@ importers: docx: specifier: ^9.0.2 version: 9.3.0 - react: - specifier: ^18.0 || ^19.0 || >= 19.0.0-rc - version: 18.3.1 - react-dom: - specifier: ^18.0 || ^19.0 || >= 19.0.0-rc - version: 18.3.1(react@18.3.1) devDependencies: '@testing-library/react': specifier: ^16.0.1 @@ -3604,6 +3598,12 @@ importers: prettier: specifier: ^2.7.1 version: 2.8.8 + react: + specifier: ^18.3.1 + version: 18.3.1 + react-dom: + specifier: ^18.3.1 + version: 18.3.1(react@18.3.1) react-element-to-jsx-string: specifier: ^15.0.0 version: 15.0.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -3678,10 +3678,10 @@ importers: version: 2.22.3(react@18.3.1) '@liveblocks/react-blocknote': specifier: ^2.22.3 - version: 2.22.3(d738a86650da06a1dfc27339c4901616) + version: 2.22.3(d5b9c01b7960db6fb188eec3dbab6fda) '@liveblocks/react-tiptap': specifier: ^2.22.3 - version: 2.22.3(@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/pm@2.11.5)(@tiptap/react@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@tiptap/suggestion@2.11.7(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5))(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(y-protocols@1.0.6(yjs@13.6.24)) + version: 2.22.3(@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/pm@2.11.5)(@tiptap/react@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@tiptap/suggestion@2.11.7(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5))(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(y-protocols@1.0.6(yjs@13.6.24)) '@liveblocks/react-ui': specifier: ^2.22.3 version: 2.22.3(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -7421,11 +7421,6 @@ packages: peerDependencies: '@types/react': ^18.0.0 - '@types/react-dom@19.0.4': - resolution: {integrity: sha512-4fSQ8vWFkg+TGhePfUzVmat3eC14TXYSsiiDSLI0dVLsrm9gZFABjPy/Qu6TKgl1tq1Bu1yDsuQgY3A3DOjCcg==} - peerDependencies: - '@types/react': ^19.0.0 - '@types/react-transition-group@4.4.12': resolution: {integrity: sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w==} peerDependencies: @@ -11495,11 +11490,6 @@ packages: peerDependencies: react: ^18.3.1 - react-dom@19.0.0: - resolution: {integrity: sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==} - peerDependencies: - react: ^19.0.0 - react-element-to-jsx-string@15.0.0: resolution: {integrity: sha512-UDg4lXB6BzlobN60P8fHWVPX3Kyw8ORrTeBtClmIlGdkOOE+GYQSFvmEU5iLLpwp/6v42DINwNcwOhOLfQ//FQ==} peerDependencies: @@ -11606,10 +11596,6 @@ packages: resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==} engines: {node: '>=0.10.0'} - react@19.0.0: - resolution: {integrity: sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==} - engines: {node: '>=0.10.0'} - read-cache@1.0.0: resolution: {integrity: sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==} @@ -11890,9 +11876,6 @@ packages: scheduler@0.23.2: resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==} - scheduler@0.25.0: - resolution: {integrity: sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==} - scheduler@0.25.0-rc-603e6108-20241029: resolution: {integrity: sha512-pFwF6H1XrSdYYNLfOcGlM28/j8CGLu8IvdrxqhjWULe2bPcKiKW4CV+OWqR/9fT52mywx65l7ysNkjLKBda7eA==} @@ -13005,6 +12988,16 @@ packages: y-protocols: ^1.0.1 yjs: ^13.5.38 + y-prosemirror@1.3.2: + resolution: {integrity: sha512-SBzinIayQIwkRYfXpvyHdOmk1gNWLG8/dj4tLHU7MdW+gphrSgJ+6RDi9Vu371wgvzCYyJvn9iHEVDqAQxkkTQ==} + engines: {node: '>=16.0.0', npm: '>=8.0.0'} + peerDependencies: + prosemirror-model: ^1.7.1 + prosemirror-state: ^1.2.3 + prosemirror-view: ^1.9.10 + y-protocols: ^1.0.1 + yjs: ^13.5.38 + y-protocols@1.0.6: resolution: {integrity: sha512-vHRF2L6iT3rwj1jub/K5tYcTT/mEYDUppgNPXwp8fmLpui9f7Yeq3OEtTLVF012j39QnV+KEQpNqoN7CWU7Y9Q==} engines: {node: '>=16.0.0', npm: '>=8.0.0'} @@ -15022,14 +15015,14 @@ snapshots: '@liveblocks/core@2.22.3': {} - '@liveblocks/react-blocknote@2.22.3(d738a86650da06a1dfc27339c4901616)': + '@liveblocks/react-blocknote@2.22.3(d5b9c01b7960db6fb188eec3dbab6fda)': dependencies: '@blocknote/core': link:packages/core '@blocknote/react': link:packages/react '@liveblocks/client': 2.22.3 '@liveblocks/core': 2.22.3 '@liveblocks/react': 2.22.3(react@18.3.1) - '@liveblocks/react-tiptap': 2.22.3(@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/pm@2.11.5)(@tiptap/react@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@tiptap/suggestion@2.11.7(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5))(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(y-protocols@1.0.6(yjs@13.6.24)) + '@liveblocks/react-tiptap': 2.22.3(@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/pm@2.11.5)(@tiptap/react@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@tiptap/suggestion@2.11.7(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5))(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(y-protocols@1.0.6(yjs@13.6.24)) '@liveblocks/react-ui': 2.22.3(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@liveblocks/yjs': 2.22.3(yjs@13.6.24) '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) @@ -15051,7 +15044,7 @@ snapshots: - y-protocols - yjs - '@liveblocks/react-tiptap@2.22.3(@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/pm@2.11.5)(@tiptap/react@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@tiptap/suggestion@2.11.7(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5))(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(y-protocols@1.0.6(yjs@13.6.24))': + '@liveblocks/react-tiptap@2.22.3(@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)))(@tiptap/pm@2.11.5)(@tiptap/react@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@tiptap/suggestion@2.11.7(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5))(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(y-protocols@1.0.6(yjs@13.6.24))': dependencies: '@floating-ui/react-dom': 2.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@liveblocks/client': 2.22.3 @@ -15062,8 +15055,8 @@ snapshots: '@radix-ui/react-select': 2.1.6(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@radix-ui/react-toggle': 1.1.2(@types/react-dom@18.3.5(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) - '@tiptap/extension-collaboration': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)) - '@tiptap/extension-collaboration-cursor': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)) + '@tiptap/extension-collaboration': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)) + '@tiptap/extension-collaboration-cursor': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24)) '@tiptap/pm': 2.11.5 '@tiptap/react': 2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@tiptap/suggestion': 2.11.7(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5) @@ -15179,7 +15172,7 @@ snapshots: '@mdx-js/react@2.3.0(react@18.3.1)': dependencies: '@types/mdx': 2.0.13 - '@types/react': 19.0.12 + '@types/react': 18.3.20 react: 18.3.1 '@mui/core-downloads-tracker@5.17.1': {} @@ -17006,16 +16999,16 @@ snapshots: dependencies: '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) - '@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))': + '@tiptap/extension-collaboration-cursor@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))': dependencies: '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) - y-prosemirror: 1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) + y-prosemirror: 1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) - '@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))': + '@tiptap/extension-collaboration@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)(y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24))': dependencies: '@tiptap/core': 2.11.5(@tiptap/pm@2.11.5) '@tiptap/pm': 2.11.5 - y-prosemirror: 1.3.0(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) + y-prosemirror: 1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24) '@tiptap/extension-floating-menu@2.11.5(@tiptap/core@2.11.5(@tiptap/pm@2.11.5))(@tiptap/pm@2.11.5)': dependencies: @@ -17306,10 +17299,6 @@ snapshots: dependencies: '@types/react': 18.3.20 - '@types/react-dom@19.0.4(@types/react@19.0.12)': - dependencies: - '@types/react': 19.0.12 - '@types/react-transition-group@4.4.12(@types/react@18.3.20)': dependencies: '@types/react': 18.3.20 @@ -19157,7 +19146,7 @@ snapshots: '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.8.2) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.0(eslint-plugin-import@2.31.0)(eslint@8.57.1) + eslint-import-resolver-typescript: 3.10.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1))(eslint@8.57.1) eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-typescript@3.10.0)(eslint@8.57.1) eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.1) eslint-plugin-react: 7.37.4(eslint@8.57.1) @@ -19204,7 +19193,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.10.0(eslint-plugin-import@2.31.0)(eslint@8.57.1): + eslint-import-resolver-typescript@3.10.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1))(eslint@8.57.1): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.4.0 @@ -19219,14 +19208,14 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0)(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.8.2) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.0(eslint-plugin-import@2.31.0)(eslint@8.57.1) + eslint-import-resolver-typescript: 3.10.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1))(eslint@8.57.1) transitivePeerDependencies: - supports-color @@ -19249,7 +19238,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0)(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -22399,11 +22388,6 @@ snapshots: react: 18.3.1 scheduler: 0.23.2 - react-dom@19.0.0(react@19.0.0): - dependencies: - react: 19.0.0 - scheduler: 0.25.0 - react-element-to-jsx-string@15.0.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@base2/pretty-print-object': 1.0.1 @@ -22425,10 +22409,6 @@ snapshots: dependencies: react: 18.3.1 - react-icons@5.5.0(react@19.0.0): - dependencies: - react: 19.0.0 - react-is@16.13.1: {} react-is@17.0.2: {} @@ -22507,8 +22487,6 @@ snapshots: dependencies: loose-envify: 1.4.0 - react@19.0.0: {} - read-cache@1.0.0: dependencies: pify: 2.3.0 @@ -22915,8 +22893,6 @@ snapshots: dependencies: loose-envify: 1.4.0 - scheduler@0.25.0: {} - scheduler@0.25.0-rc-603e6108-20241029: {} schema-utils@3.3.0: @@ -24337,6 +24313,15 @@ snapshots: y-protocols: 1.0.6(yjs@13.6.24) yjs: 13.6.24 + y-prosemirror@1.3.2(prosemirror-model@1.25.0)(prosemirror-state@1.4.3)(prosemirror-view@1.38.1)(y-protocols@1.0.6(yjs@13.6.24))(yjs@13.6.24): + dependencies: + lib0: 0.2.101 + prosemirror-model: 1.25.0 + prosemirror-state: 1.4.3 + prosemirror-view: 1.38.1 + y-protocols: 1.0.6(yjs@13.6.24) + yjs: 13.6.24 + y-protocols@1.0.6(yjs@13.6.24): dependencies: lib0: 0.2.101 From bad1640ff32cd06757e4404e1a435d14a1896f38 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Fri, 11 Apr 2025 20:58:25 +0200 Subject: [PATCH 11/12] Small fix --- shared/testDocument.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/testDocument.ts b/shared/testDocument.ts index 608219ad16..ebeddf7158 100644 --- a/shared/testDocument.ts +++ b/shared/testDocument.ts @@ -2,7 +2,7 @@ import { BlockNoteSchema, defaultBlockSpecs, PageBreak } from "@blocknote/core"; import { partialBlocksToBlocksForTesting } from "./formatConversionTestUtil.js"; -// TODO +// TODO: Update tests that use this to the new format and remove export const testDocument = partialBlocksToBlocksForTesting( BlockNoteSchema.create({ blockSpecs: { ...defaultBlockSpecs, pageBreak: PageBreak }, From 411201c2c4b697765e7b2caf51f3ee8501a42db0 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Sat, 12 Apr 2025 02:32:22 +0200 Subject: [PATCH 12/12] Updated comments --- tests/src/unit/core/clipboard/copy/runTests.test.ts | 4 ++-- .../unit/core/clipboard/copyPasteEquality/runTests.test.ts | 5 +++-- tests/src/unit/core/formatConversion/export/runTests.test.ts | 4 ++-- .../formatConversion/exportParseEquality/runTests.test.ts | 5 +++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/src/unit/core/clipboard/copy/runTests.test.ts b/tests/src/unit/core/clipboard/copy/runTests.test.ts index 8070dc961f..c1e3d77a0e 100644 --- a/tests/src/unit/core/clipboard/copy/runTests.test.ts +++ b/tests/src/unit/core/clipboard/copy/runTests.test.ts @@ -5,8 +5,8 @@ import { testSchema } from "../../testSchema.js"; import { copyTestInstancesHTML } from "./copyTestInstances.js"; // Tests for verifying content that gets put on the clipboard when copying -// within the editor. Used broadly to ensure each block or set of blocks is correctly -// converted into different types of clipboard data. +// within the editor. Used for as many cases as possible to ensure each block or +// set of blocks is correctly converted into different types of clipboard data. describe("Copy tests (HTML)", () => { const getEditor = setupTestEditor(testSchema); diff --git a/tests/src/unit/core/clipboard/copyPasteEquality/runTests.test.ts b/tests/src/unit/core/clipboard/copyPasteEquality/runTests.test.ts index 46327f26ba..27c4c619b0 100644 --- a/tests/src/unit/core/clipboard/copyPasteEquality/runTests.test.ts +++ b/tests/src/unit/core/clipboard/copyPasteEquality/runTests.test.ts @@ -5,8 +5,9 @@ import { testSchema } from "../../testSchema.js"; import { copyPasteEqualityTestInstances } from "./copyPasteEqualityTestInstances.js"; // Tests for verifying that copying and pasting content in place within the -// editor results in the same document as the original. Used broadly to ensure -// that converting to and from clipboard data does not result in any data loss. +// editor results in the same document as the original. Used for as many cases +// as possible to ensure that converting to and from clipboard data does not +// result in any data loss. describe("Copy/paste equality tests", () => { const getEditor = setupTestEditor(testSchema); diff --git a/tests/src/unit/core/formatConversion/export/runTests.test.ts b/tests/src/unit/core/formatConversion/export/runTests.test.ts index f3069bd66a..badd6638cb 100644 --- a/tests/src/unit/core/formatConversion/export/runTests.test.ts +++ b/tests/src/unit/core/formatConversion/export/runTests.test.ts @@ -10,8 +10,8 @@ import { } from "./exportTestInstances.js"; // Tests for verifying that exporting blocks to other formats works as expected. -// Used broadly to ensure each block or set of blocks is correctly converted -// into different formats. +// Used for as many cases as possible to ensure each block or set of blocks is +// correctly converted into different formats. describe("Export tests (BlockNote HTML)", () => { const getEditor = setupTestEditor(testSchema); diff --git a/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts b/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts index 76ad6ef24c..3970bb02d8 100644 --- a/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts +++ b/tests/src/unit/core/formatConversion/exportParseEquality/runTests.test.ts @@ -5,8 +5,9 @@ import { testSchema } from "../../testSchema.js"; import { exportParseEqualityTestInstancesBlockNoteHTML } from "./exportParseEqualityTestInstances.js"; // Tests for verifying that exporting blocks to another format, then importing -// them back results in the same blocks as the original. Used broadly to ensure -// that exporting and importing blocks does not result in any data loss. +// them back results in the same blocks as the original. Used for as many cases +// as possible to ensure that exporting and importing blocks does not result in +// any data loss. describe("Export/parse equality tests (BlockNote HTML)", () => { const getEditor = setupTestEditor(testSchema);