@blocknote/core 0.15.10 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/blocknote.js +1019 -957
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +6 -6
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/webpack-stats.json +1 -1
  6. package/package.json +2 -2
  7. package/src/api/blockManipulation/blockManipulation.test.ts +7 -32
  8. package/src/api/clipboard/__snapshots__/childToParent.html +1 -0
  9. package/src/api/clipboard/__snapshots__/childrenToNextParent.html +1 -0
  10. package/src/api/clipboard/__snapshots__/childrenToNextParentsChildren.html +1 -0
  11. package/src/api/clipboard/__snapshots__/image.html +1 -0
  12. package/src/api/clipboard/__snapshots__/multipleStyledText.html +1 -0
  13. package/src/api/clipboard/__snapshots__/nestedImage.html +1 -0
  14. package/src/api/clipboard/__snapshots__/partialChildToParent.html +1 -0
  15. package/src/api/clipboard/__snapshots__/styledText.html +1 -0
  16. package/src/api/clipboard/__snapshots__/tableAllCells.html +1 -0
  17. package/src/api/clipboard/__snapshots__/tableCell.html +1 -0
  18. package/src/api/clipboard/__snapshots__/tableCellText.html +1 -0
  19. package/src/api/clipboard/__snapshots__/tableRow.html +1 -0
  20. package/src/api/clipboard/__snapshots__/unstyledText.html +1 -0
  21. package/src/api/clipboard/clipboard.test.ts +284 -0
  22. package/src/api/{parsers → clipboard/fromClipboard}/fileDropExtension.ts +2 -2
  23. package/src/api/{parsers → clipboard/fromClipboard}/handleFileInsertion.ts +4 -4
  24. package/src/api/{parsers → clipboard/fromClipboard}/pasteExtension.ts +14 -7
  25. package/src/api/{exporters → clipboard/toClipboard}/copyExtension.ts +70 -43
  26. package/src/api/exporters/html/externalHTMLExporter.ts +14 -7
  27. package/src/api/exporters/html/htmlConversion.test.ts +4 -147
  28. package/src/api/exporters/html/internalHTMLSerializer.ts +5 -2
  29. package/src/api/parsers/html/parseHTML.test.ts +3 -6
  30. package/src/api/parsers/markdown/__snapshots__/pasted/complex.json +319 -0
  31. package/src/api/parsers/markdown/__snapshots__/pasted/issue-226-1.json +81 -0
  32. package/src/api/parsers/{html/__snapshots__/paste/parse-deep-nested-content.json → markdown/__snapshots__/pasted/issue-226-2.json} +35 -110
  33. package/src/api/parsers/markdown/__snapshots__/pasted/nested.json +81 -0
  34. package/src/api/parsers/markdown/__snapshots__/pasted/non-nested.json +81 -0
  35. package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +61 -0
  36. package/src/api/parsers/markdown/parseMarkdown.test.ts +15 -0
  37. package/src/api/testUtil/paste.ts +46 -0
  38. package/src/blocks/TableBlockContent/TableBlockContent.ts +0 -1
  39. package/src/editor/BlockNoteEditor.ts +2 -2
  40. package/src/editor/BlockNoteExtensions.ts +3 -3
  41. package/src/editor/BlockNoteTipTapEditor.ts +34 -7
  42. package/src/editor/transformPasted.ts +34 -2
  43. package/src/extensions/SideMenu/SideMenuPlugin.ts +6 -7
  44. package/src/extensions/TableHandles/TableHandlesPlugin.ts +26 -0
  45. package/src/schema/blocks/createSpec.ts +20 -15
  46. package/types/src/api/clipboard/clipboard.test.d.ts +1 -0
  47. package/types/src/api/clipboard/fromClipboard/fileDropExtension.d.ts +6 -0
  48. package/types/src/api/{parsers → clipboard/fromClipboard}/handleFileInsertion.d.ts +2 -2
  49. package/types/src/api/clipboard/fromClipboard/pasteExtension.d.ts +6 -0
  50. package/types/src/api/clipboard/toClipboard/copyExtension.d.ts +12 -0
  51. package/types/src/api/exporters/html/externalHTMLExporter.d.ts +1 -0
  52. package/types/src/api/testUtil/paste.d.ts +2 -0
  53. package/types/src/editor/BlockNoteEditor.d.ts +1 -1
  54. package/types/src/editor/BlockNoteTipTapEditor.d.ts +2 -1
  55. package/types/src/editor/transformPasted.d.ts +8 -1
  56. package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +3 -0
  57. package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionLeavesBlockChildren.html +0 -1
  58. package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionSpansBlocksChildren.html +0 -1
  59. package/src/api/parsers/html/__snapshots__/paste/parse-google-docs-html.json +0 -476
  60. package/types/src/api/exporters/copyExtension.d.ts +0 -6
  61. package/types/src/api/parsers/fileDropExtension.d.ts +0 -6
  62. package/types/src/api/parsers/pasteExtension.d.ts +0 -6
  63. /package/src/api/{exporters/html/__snapshots_fragment_edge_cases__/selectionWithinBlockChildren.html → clipboard/__snapshots__/multipleChildren.html} +0 -0
  64. /package/src/api/{parsers → clipboard/fromClipboard}/acceptedMIMETypes.ts +0 -0
  65. /package/src/api/parsers/html/__snapshots__/{paste/list-test.json → list-test.json} +0 -0
  66. /package/src/api/parsers/html/__snapshots__/{paste/parse-basic-block-types.json → parse-basic-block-types.json} +0 -0
  67. /package/src/api/parsers/html/__snapshots__/{paste/parse-div-with-inline-content.json → parse-div-with-inline-content.json} +0 -0
  68. /package/src/api/parsers/html/__snapshots__/{paste/parse-divs.json → parse-divs.json} +0 -0
  69. /package/src/api/parsers/html/__snapshots__/{paste/parse-fake-image-caption.json → parse-fake-image-caption.json} +0 -0
  70. /package/src/api/parsers/html/__snapshots__/{paste/parse-image-in-paragraph.json → parse-image-in-paragraph.json} +0 -0
  71. /package/src/api/parsers/html/__snapshots__/{paste/parse-mixed-nested-lists.json → parse-mixed-nested-lists.json} +0 -0
  72. /package/src/api/parsers/html/__snapshots__/{paste/parse-nested-lists-with-paragraphs.json → parse-nested-lists-with-paragraphs.json} +0 -0
  73. /package/src/api/parsers/html/__snapshots__/{paste/parse-nested-lists.json → parse-nested-lists.json} +0 -0
  74. /package/src/api/parsers/html/__snapshots__/{paste/parse-notion-html.json → parse-notion-html.json} +0 -0
  75. /package/src/api/parsers/html/__snapshots__/{paste/parse-two-divs.json → parse-two-divs.json} +0 -0
  76. /package/types/src/api/{parsers → clipboard/fromClipboard}/acceptedMIMETypes.d.ts +0 -0
@@ -1 +1 @@
1
- {"builtAt":1726846121918,"assets":[{"name":"blocknote.umd.cjs","size":199731},{"name":"blocknote.umd.cjs.map","size":723863}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/i18n/locales/ar.ts","size":6582,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/de.ts","size":7183,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/en.ts","size":6664,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/es.ts","size":6796,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/fr.ts","size":7294,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/is.ts","size":6876,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ja.ts","size":6323,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ko.ts","size":6146,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/nl.ts","size":7079,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pl.ts","size":6768,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pt.ts","size":6965,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ru.ts","size":7638,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/vi.ts","size":6927,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/zh.ts","size":6093,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/index.ts","size":0,"chunks":["a1ee98a"]},{"name":"./src/util/esmDependencies.ts","size":820,"chunks":["a1ee98a"]},{"name":"./src/extensions/UniqueID/UniqueID.ts","size":8887,"chunks":["a1ee98a"]},{"name":"./src/api/getBlockInfoFromPos.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/types.ts","size":302,"chunks":["a1ee98a"]},{"name":"./src/util/typescript.ts","size":331,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/nodeConversions.ts","size":11998,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/sharedHTMLConversion.ts","size":2311,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts","size":4488,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/externalHTMLExporter.ts","size":1320,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/internalHTMLSerializer.ts","size":758,"chunks":["a1ee98a"]},{"name":"./src/api/getCurrentBlockContentType.ts","size":192,"chunks":["a1ee98a"]},{"name":"./src/util/browser.ts","size":536,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockHelpers.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultProps.ts","size":269,"chunks":["a1ee98a"]},{"name":"./src/util/string.ts","size":299,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/internal.ts","size":3877,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/createSpec.ts","size":3331,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/internal.ts","size":1357,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/createSpec.ts","size":2761,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/internal.ts","size":1162,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/createSpec.ts","size":1263,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/fileBlockHelpers.ts","size":10029,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/audioBlockHelpers.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/AudioBlockContent.ts","size":3075,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/FileBlockContent.ts","size":1581,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","size":316,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/imageBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/ImageBlockContent.ts","size":3242,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/videoBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/VideoBlockContent.ts","size":3050,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorMark.ts","size":946,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorMark.ts","size":866,"chunks":["a1ee98a"]},{"name":"./src/blocks/HeadingBlockContent/HeadingBlockContent.ts","size":3439,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","size":1201,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","size":3122,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","size":1862,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","size":3437,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts","size":6423,"chunks":["a1ee98a"]},{"name":"./src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","size":1307,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableExtension.ts","size":1462,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableBlockContent.ts","size":1624,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlocks.ts","size":1123,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockTypeGuards.ts","size":1580,"chunks":["a1ee98a"]},{"name":"./src/api/nodeUtil.ts","size":548,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/blockManipulation.ts","size":5664,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","size":752,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts","size":962,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/markdownExporter.ts","size":837,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/util/nestedLists.ts","size":2174,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/parseHTML.ts","size":503,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/markdown/parseMarkdown.ts","size":1104,"chunks":["a1ee98a"]},{"name":"./src/util/EventEmitter.ts","size":744,"chunks":["a1ee98a"]},{"name":"./src/extensions/FilePanel/FilePanelPlugin.ts","size":3584,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":5062,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/LinkToolbarPlugin.ts","size":7365,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":17383,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/SuggestionPlugin.ts","size":7996,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":15279,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/copyExtension.ts","size":3195,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/acceptedMIMETypes.ts","size":91,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/handleFileInsertion.ts","size":3396,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/fileDropExtension.ts","size":884,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/pasteExtension.ts","size":1244,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorExtension.ts","size":791,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextAlignment/TextAlignmentExtension.ts","size":928,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorExtension.ts","size":725,"chunks":["a1ee98a"]},{"name":"./src/extensions/TrailingNode/TrailingNodeExtension.ts","size":1594,"chunks":["a1ee98a"]},{"name":"./src/extensions/NonEditableBlocks/NonEditableBlockPlugin.ts","size":1086,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockContainer.ts","size":18085,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockGroup.ts","size":1097,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Doc.ts","size":90,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteExtensions.ts","size":4286,"chunks":["a1ee98a"]},{"name":"./src/editor/transformPasted.ts","size":1062,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteSchema.ts","size":1044,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteTipTapEditor.ts","size":2883,"chunks":["a1ee98a"]},{"name":"./src/extensions/Placeholder/PlaceholderPlugin.ts","size":2762,"chunks":["a1ee98a"]},{"name":"./src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","size":4572,"chunks":["a1ee98a"]},{"name":"./src/style.css","size":0,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteEditor.ts","size":27988,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts","size":700,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","size":6416,"chunks":["a1ee98a"]},{"name":"./src/api/testUtil/partialBlockTestUtil.ts","size":2166,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
1
+ {"builtAt":1727951310690,"assets":[{"name":"blocknote.umd.cjs","size":201923},{"name":"blocknote.umd.cjs.map","size":730994}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/i18n/locales/ar.ts","size":6582,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/de.ts","size":7183,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/en.ts","size":6664,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/es.ts","size":6796,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/fr.ts","size":7294,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/is.ts","size":6876,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ja.ts","size":6323,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ko.ts","size":6146,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/nl.ts","size":7079,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pl.ts","size":6768,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pt.ts","size":6965,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ru.ts","size":7638,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/vi.ts","size":6927,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/zh.ts","size":6093,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/index.ts","size":0,"chunks":["a1ee98a"]},{"name":"./src/util/esmDependencies.ts","size":820,"chunks":["a1ee98a"]},{"name":"./src/extensions/UniqueID/UniqueID.ts","size":8887,"chunks":["a1ee98a"]},{"name":"./src/api/getBlockInfoFromPos.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/types.ts","size":302,"chunks":["a1ee98a"]},{"name":"./src/util/typescript.ts","size":331,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/nodeConversions.ts","size":11998,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/sharedHTMLConversion.ts","size":2311,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts","size":4488,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/externalHTMLExporter.ts","size":1557,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/internalHTMLSerializer.ts","size":867,"chunks":["a1ee98a"]},{"name":"./src/api/getCurrentBlockContentType.ts","size":192,"chunks":["a1ee98a"]},{"name":"./src/util/browser.ts","size":536,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockHelpers.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultProps.ts","size":269,"chunks":["a1ee98a"]},{"name":"./src/util/string.ts","size":299,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/internal.ts","size":3877,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/createSpec.ts","size":3416,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/internal.ts","size":1357,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/createSpec.ts","size":2761,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/internal.ts","size":1162,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/createSpec.ts","size":1263,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/fileBlockHelpers.ts","size":10029,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/audioBlockHelpers.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/AudioBlockContent.ts","size":3075,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/FileBlockContent.ts","size":1581,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","size":316,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/imageBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/ImageBlockContent.ts","size":3242,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/videoBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/VideoBlockContent.ts","size":3050,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorMark.ts","size":946,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorMark.ts","size":866,"chunks":["a1ee98a"]},{"name":"./src/blocks/HeadingBlockContent/HeadingBlockContent.ts","size":3439,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","size":1201,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","size":3122,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","size":1862,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","size":3437,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts","size":6423,"chunks":["a1ee98a"]},{"name":"./src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","size":1307,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableExtension.ts","size":1462,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableBlockContent.ts","size":1603,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlocks.ts","size":1123,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockTypeGuards.ts","size":1580,"chunks":["a1ee98a"]},{"name":"./src/api/nodeUtil.ts","size":548,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/blockManipulation.ts","size":5664,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","size":752,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts","size":962,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/markdownExporter.ts","size":837,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/util/nestedLists.ts","size":2174,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/parseHTML.ts","size":503,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/markdown/parseMarkdown.ts","size":1104,"chunks":["a1ee98a"]},{"name":"./src/util/EventEmitter.ts","size":744,"chunks":["a1ee98a"]},{"name":"./src/extensions/FilePanel/FilePanelPlugin.ts","size":3584,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":5062,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/LinkToolbarPlugin.ts","size":7365,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":17302,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/SuggestionPlugin.ts","size":7960,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":15819,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/toClipboard/copyExtension.ts","size":3895,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/acceptedMIMETypes.ts","size":91,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/handleFileInsertion.ts","size":3396,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/fileDropExtension.ts","size":884,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/pasteExtension.ts","size":1470,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorExtension.ts","size":791,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextAlignment/TextAlignmentExtension.ts","size":928,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorExtension.ts","size":725,"chunks":["a1ee98a"]},{"name":"./src/extensions/TrailingNode/TrailingNodeExtension.ts","size":1594,"chunks":["a1ee98a"]},{"name":"./src/extensions/NonEditableBlocks/NonEditableBlockPlugin.ts","size":1086,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockContainer.ts","size":18085,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockGroup.ts","size":1097,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Doc.ts","size":90,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteExtensions.ts","size":4286,"chunks":["a1ee98a"]},{"name":"./src/editor/transformPasted.ts","size":1776,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteSchema.ts","size":1044,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteTipTapEditor.ts","size":3438,"chunks":["a1ee98a"]},{"name":"./src/extensions/Placeholder/PlaceholderPlugin.ts","size":2744,"chunks":["a1ee98a"]},{"name":"./src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","size":4554,"chunks":["a1ee98a"]},{"name":"./src/style.css","size":0,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteEditor.ts","size":27991,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts","size":700,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","size":6416,"chunks":["a1ee98a"]},{"name":"./src/api/testUtil/partialBlockTestUtil.ts","size":2166,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "homepage": "https://github.com/TypeCellOS/BlockNote",
4
4
  "private": false,
5
5
  "license": "MPL-2.0",
6
- "version": "0.15.10",
6
+ "version": "0.16.0",
7
7
  "files": [
8
8
  "dist",
9
9
  "types",
@@ -119,5 +119,5 @@
119
119
  "access": "public",
120
120
  "registry": "https://registry.npmjs.org/"
121
121
  },
122
- "gitHead": "9354902c7b8774fa8f4ca1921104fb99fdc28e03"
122
+ "gitHead": "92bd2c2f9d638df930ab29c115f9e9d41c845af3"
123
123
  }
@@ -39,17 +39,6 @@ const schema = BlockNoteSchema.create({
39
39
  let editor: BlockNoteEditor<typeof schema.blockSchema>;
40
40
  const div = document.createElement("div");
41
41
 
42
- function waitForEditor() {
43
- // wait for create event on editor,
44
- // this is necessary because otherwise UniqueId.create hasn't been called yet, and
45
- // blocks would have "null" as their id
46
- return new Promise<void>((resolve) => {
47
- editor._tiptapEditor.on("create", () => {
48
- resolve();
49
- });
50
- });
51
- }
52
-
53
42
  let singleBlock: PartialBlock<
54
43
  typeof schema.blockSchema,
55
44
  DefaultInlineContentSchema,
@@ -195,25 +184,19 @@ describe("Test strong typing", () => {
195
184
  });
196
185
 
197
186
  describe("Inserting Blocks with Different Placements", () => {
198
- it("Insert before existing block", async () => {
199
- await waitForEditor();
200
-
187
+ it("Insert before existing block", () => {
201
188
  const output = insert("before");
202
189
 
203
190
  expect(output).toMatchSnapshot();
204
191
  });
205
192
 
206
- it("Insert nested inside existing block", async () => {
207
- await waitForEditor();
208
-
193
+ it("Insert nested inside existing block", () => {
209
194
  const output = insert("nested");
210
195
 
211
196
  expect(output).toMatchSnapshot();
212
197
  });
213
198
 
214
- it("Insert after existing block", async () => {
215
- await waitForEditor();
216
-
199
+ it("Insert after existing block", () => {
217
200
  const output = insert("after");
218
201
 
219
202
  expect(output).toMatchSnapshot();
@@ -221,9 +204,7 @@ describe("Inserting Blocks with Different Placements", () => {
221
204
  });
222
205
 
223
206
  describe("Insert, Update, & Delete Blocks", () => {
224
- it("Insert, update, & delete single block", async () => {
225
- await waitForEditor();
226
-
207
+ it("Insert, update, & delete single block", () => {
227
208
  const existingBlock = editor.document[0];
228
209
  editor.insertBlocks([singleBlock], existingBlock);
229
210
 
@@ -263,9 +244,7 @@ describe("Insert, Update, & Delete Blocks", () => {
263
244
  expect(editor.document).toMatchSnapshot();
264
245
  });
265
246
 
266
- it("Insert, update, & delete multiple blocks", async () => {
267
- await waitForEditor();
268
-
247
+ it("Insert, update, & delete multiple blocks", () => {
269
248
  const existingBlock = editor.document[0];
270
249
  editor.insertBlocks(multipleBlocks, existingBlock);
271
250
 
@@ -286,9 +265,7 @@ describe("Insert, Update, & Delete Blocks", () => {
286
265
  });
287
266
 
288
267
  describe("Update Line Breaks", () => {
289
- it("Update paragraph with line break", async () => {
290
- await waitForEditor();
291
-
268
+ it("Update paragraph with line break", () => {
292
269
  const existingBlock = editor.document[0];
293
270
  editor.insertBlocks(blocksWithLineBreaks, existingBlock);
294
271
 
@@ -300,9 +277,7 @@ describe("Update Line Breaks", () => {
300
277
 
301
278
  expect(editor.document).toMatchSnapshot();
302
279
  });
303
- it("Update custom block with line break", async () => {
304
- await waitForEditor();
305
-
280
+ it("Update custom block with line break", () => {
306
281
  const existingBlock = editor.document[0];
307
282
  editor.insertBlocks(blocksWithLineBreaks, existingBlock);
308
283
 
@@ -0,0 +1 @@
1
+ <h2 data-text-color="red" data-level="2">Heading 1</h2><p>Nested Paragraph 1</p>
@@ -0,0 +1 @@
1
+ <p>Nested Paragraph 1</p><p>Nested Paragraph 2</p><p>Nested Paragraph 3</p><h2 data-text-color="red" data-level="2">Heading 2</h2>
@@ -0,0 +1 @@
1
+ <p>Nested Paragraph 1</p><p>Nested Paragraph 2</p><p>Nested Paragraph 3</p><h2 data-text-color="red" data-level="2">Heading 2</h2><p>Nested Paragraph 1</p><p>Nested Paragraph 2</p><p>Nested Paragraph 3</p>
@@ -0,0 +1 @@
1
+ <img src="https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg" alt="BlockNote image" width="512" data-url="https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg"><p>Nested Paragraph</p>
@@ -0,0 +1 @@
1
+ <strong>Bold</strong><em>Italic</em>Regular
@@ -0,0 +1 @@
1
+ <h2 data-text-color="red" data-level="2"><strong>Bold</strong><em>Italic</em>Regular</h2><img src="https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg" alt="BlockNote image" width="512" data-url="https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg"><p>Nested Paragraph</p>
@@ -0,0 +1 @@
1
+ <h2 data-text-color="red" data-level="2">ding 1</h2><p>Nested </p>
@@ -0,0 +1 @@
1
+ <em>Italic</em>
@@ -0,0 +1 @@
1
+ <div class="bn-block-content" data-content-type="table"><table class="bn-inline-content"><tbody><tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr><tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr></tbody></table></div>
@@ -0,0 +1 @@
1
+ <tr><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr>
@@ -0,0 +1 @@
1
+ Table Cell
@@ -0,0 +1 @@
1
+ <tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr>
@@ -0,0 +1,284 @@
1
+ import { Node } from "prosemirror-model";
2
+ import { NodeSelection, Selection, TextSelection } from "prosemirror-state";
3
+ import { CellSelection } from "prosemirror-tables";
4
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
5
+
6
+ import { PartialBlock } from "../../blocks/defaultBlocks";
7
+ import { BlockNoteEditor } from "../../editor/BlockNoteEditor";
8
+ import { doPaste } from "../testUtil/paste";
9
+ import { initializeESMDependencies } from "../../util/esmDependencies";
10
+ import { selectedFragmentToHTML } from "./toClipboard/copyExtension";
11
+
12
+ type SelectionTestCase = {
13
+ testName: string;
14
+ createSelection: (doc: Node) => Selection;
15
+ };
16
+
17
+ // These tests are meant to test the copying of user selections in the editor.
18
+ // The test cases used for the other HTML conversion tests are not suitable here
19
+ // as they are represented in the BlockNote API, whereas here we want to test
20
+ // ProseMirror/TipTap selections directly.
21
+ describe("Test ProseMirror selection clipboard HTML", () => {
22
+ const initialContent: PartialBlock[] = [
23
+ {
24
+ type: "heading",
25
+ props: {
26
+ level: 2,
27
+ textColor: "red",
28
+ },
29
+ content: "Heading 1",
30
+ children: [
31
+ {
32
+ type: "paragraph",
33
+ content: "Nested Paragraph 1",
34
+ },
35
+ {
36
+ type: "paragraph",
37
+ content: "Nested Paragraph 2",
38
+ },
39
+ {
40
+ type: "paragraph",
41
+ content: "Nested Paragraph 3",
42
+ },
43
+ ],
44
+ },
45
+ {
46
+ type: "heading",
47
+ props: {
48
+ level: 2,
49
+ textColor: "red",
50
+ },
51
+ content: "Heading 2",
52
+ children: [
53
+ {
54
+ type: "paragraph",
55
+ content: "Nested Paragraph 1",
56
+ },
57
+ {
58
+ type: "paragraph",
59
+ content: "Nested Paragraph 2",
60
+ },
61
+ {
62
+ type: "paragraph",
63
+ content: "Nested Paragraph 3",
64
+ },
65
+ ],
66
+ },
67
+ {
68
+ type: "heading",
69
+ props: {
70
+ level: 2,
71
+ textColor: "red",
72
+ },
73
+ content: [
74
+ {
75
+ type: "text",
76
+ text: "Bold",
77
+ styles: {
78
+ bold: true,
79
+ },
80
+ },
81
+ {
82
+ type: "text",
83
+ text: "Italic",
84
+ styles: {
85
+ italic: true,
86
+ },
87
+ },
88
+ {
89
+ type: "text",
90
+ text: "Regular",
91
+ styles: {},
92
+ },
93
+ ],
94
+ children: [
95
+ {
96
+ type: "image",
97
+ props: {
98
+ url: "https://ralfvanveen.com/wp-content/uploads/2021/06/Placeholder-_-Glossary.svg",
99
+ },
100
+ children: [
101
+ {
102
+ type: "paragraph",
103
+ content: "Nested Paragraph",
104
+ },
105
+ ],
106
+ },
107
+ ],
108
+ },
109
+ {
110
+ type: "table",
111
+ content: {
112
+ type: "tableContent",
113
+ rows: [
114
+ {
115
+ cells: ["Table Cell", "Table Cell"],
116
+ },
117
+ {
118
+ cells: ["Table Cell", "Table Cell"],
119
+ },
120
+ ],
121
+ },
122
+ // Not needed as selections starting in table cells will get snapped to
123
+ // the table boundaries.
124
+ // children: [
125
+ // {
126
+ // type: "table",
127
+ // content: {
128
+ // type: "tableContent",
129
+ // rows: [
130
+ // {
131
+ // cells: ["Table Cell", "Table Cell"],
132
+ // },
133
+ // {
134
+ // cells: ["Table Cell", "Table Cell"],
135
+ // },
136
+ // ],
137
+ // },
138
+ // },
139
+ // ],
140
+ },
141
+ ];
142
+
143
+ let editor: BlockNoteEditor;
144
+ const div = document.createElement("div");
145
+
146
+ beforeEach(() => {
147
+ editor.replaceBlocks(editor.document, initialContent);
148
+ });
149
+
150
+ beforeAll(async () => {
151
+ (window as any).__TEST_OPTIONS = (window as any).__TEST_OPTIONS || {};
152
+
153
+ editor = BlockNoteEditor.create();
154
+ editor.mount(div);
155
+
156
+ await initializeESMDependencies();
157
+ });
158
+
159
+ afterAll(() => {
160
+ editor.mount(undefined);
161
+ editor._tiptapEditor.destroy();
162
+ editor = undefined as any;
163
+
164
+ delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS;
165
+ });
166
+
167
+ // Sets the editor selection to the given start and end positions, then
168
+ // exports the selected content to HTML and compares it to a snapshot.
169
+ async function testSelection(testCase: SelectionTestCase) {
170
+ editor.dispatch(
171
+ editor._tiptapEditor.state.tr.setSelection(
172
+ testCase.createSelection(editor._tiptapEditor.view.state.doc)
173
+ )
174
+ );
175
+
176
+ const { clipboardHTML, externalHTML } = await selectedFragmentToHTML(
177
+ editor._tiptapEditor.view,
178
+ editor
179
+ );
180
+
181
+ expect(externalHTML).toMatchFileSnapshot(
182
+ `./__snapshots__/${testCase.testName}.html`
183
+ );
184
+
185
+ const originalDocument = editor.document;
186
+ doPaste(
187
+ editor._tiptapEditor.view,
188
+ "text",
189
+ clipboardHTML,
190
+ false,
191
+ new ClipboardEvent("paste")
192
+ );
193
+ const newDocument = editor.document;
194
+
195
+ expect(newDocument).toStrictEqual(originalDocument);
196
+ }
197
+
198
+ const testCases: SelectionTestCase[] = [
199
+ // TODO: Consider adding test cases for nested blocks & double nested blocks.
200
+ // Selection spans all of first heading's children.
201
+ {
202
+ testName: "multipleChildren",
203
+ createSelection: (doc) => TextSelection.create(doc, 16, 78),
204
+ },
205
+ // Selection spans from start of first heading to end of its first child.
206
+ {
207
+ testName: "childToParent",
208
+ createSelection: (doc) => TextSelection.create(doc, 3, 34),
209
+ },
210
+ // Selection spans from middle of first heading to the middle of its first
211
+ // child.
212
+ {
213
+ testName: "partialChildToParent",
214
+ createSelection: (doc) => TextSelection.create(doc, 6, 23),
215
+ },
216
+ // Selection spans from start of first heading's first child to end of
217
+ // second heading's content (does not include second heading's children).
218
+ {
219
+ testName: "childrenToNextParent",
220
+ createSelection: (doc) => TextSelection.create(doc, 16, 93),
221
+ },
222
+ // Selection spans from start of first heading's first child to end of
223
+ // second heading's last child.
224
+ {
225
+ testName: "childrenToNextParentsChildren",
226
+ createSelection: (doc) => TextSelection.create(doc, 16, 159),
227
+ },
228
+ // Selection spans "Regular" text inside third heading.
229
+ {
230
+ testName: "unstyledText",
231
+ createSelection: (doc) => TextSelection.create(doc, 175, 182),
232
+ },
233
+ // Selection spans "Italic" text inside third heading.
234
+ {
235
+ testName: "styledText",
236
+ createSelection: (doc) => TextSelection.create(doc, 169, 175),
237
+ },
238
+ // Selection spans third heading's content (does not include third heading's
239
+ // children).
240
+ {
241
+ testName: "multipleStyledText",
242
+ createSelection: (doc) => TextSelection.create(doc, 165, 182),
243
+ },
244
+ // Selection spans the image block content.
245
+ {
246
+ testName: "image",
247
+ createSelection: (doc) => NodeSelection.create(doc, 185),
248
+ },
249
+ // Selection spans from start of third heading to end of it's last
250
+ // descendant.
251
+ {
252
+ testName: "nestedImage",
253
+ createSelection: (doc) => TextSelection.create(doc, 165, 205),
254
+ },
255
+ // Selection spans text in first cell of the table.
256
+ {
257
+ testName: "tableCellText",
258
+ createSelection: (doc) => TextSelection.create(doc, 216, 226),
259
+ },
260
+ // Selection spans first cell of the table.
261
+ // TODO: External HTML is wrapped in unnecessary `tr` element.
262
+ {
263
+ testName: "tableCell",
264
+ createSelection: (doc) => CellSelection.create(doc, 214),
265
+ },
266
+ // Selection spans first row of the table.
267
+ {
268
+ testName: "tableRow",
269
+ createSelection: (doc) => CellSelection.create(doc, 214, 228),
270
+ },
271
+ // Selection spans all cells of the table.
272
+ // TODO: External HTML is wrapped in unnecessary `blockContent` element.
273
+ {
274
+ testName: "tableAllCells",
275
+ createSelection: (doc) => CellSelection.create(doc, 214, 258),
276
+ },
277
+ ];
278
+
279
+ for (const testCase of testCases) {
280
+ it(`${testCase.testName}`, async () => {
281
+ await testSelection(testCase);
282
+ });
283
+ }
284
+ });
@@ -1,8 +1,8 @@
1
1
  import { Extension } from "@tiptap/core";
2
2
  import { Plugin } from "prosemirror-state";
3
3
 
4
- import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
5
- import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
4
+ import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
5
+ import { BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema";
6
6
  import { handleFileInsertion } from "./handleFileInsertion";
7
7
  import { acceptedMIMETypes } from "./acceptedMIMETypes";
8
8
 
@@ -1,12 +1,12 @@
1
- import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
2
- import { PartialBlock } from "../../blocks/defaultBlocks";
1
+ import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
2
+ import { PartialBlock } from "../../../blocks/defaultBlocks";
3
3
  import {
4
4
  BlockSchema,
5
5
  FileBlockConfig,
6
6
  InlineContentSchema,
7
7
  StyleSchema,
8
- } from "../../schema";
9
- import { getBlockInfoFromPos } from "../getBlockInfoFromPos";
8
+ } from "../../../schema";
9
+ import { getBlockInfoFromPos } from "../../getBlockInfoFromPos";
10
10
  import { acceptedMIMETypes } from "./acceptedMIMETypes";
11
11
 
12
12
  function checkFileExtensionsMatch(
@@ -1,11 +1,11 @@
1
1
  import { Extension } from "@tiptap/core";
2
2
  import { Plugin } from "prosemirror-state";
3
3
 
4
- import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
5
- import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
6
- import { handleFileInsertion } from "./handleFileInsertion";
7
- import { nestedListsToBlockNoteStructure } from "./html/util/nestedLists";
4
+ import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
5
+ import { BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema";
6
+ import { nestedListsToBlockNoteStructure } from "../../parsers/html/util/nestedLists";
8
7
  import { acceptedMIMETypes } from "./acceptedMIMETypes";
8
+ import { handleFileInsertion } from "./handleFileInsertion";
9
9
 
10
10
  export const createPasteFromClipboardExtension = <
11
11
  BSchema extends BlockSchema,
@@ -28,14 +28,14 @@ export const createPasteFromClipboardExtension = <
28
28
  return;
29
29
  }
30
30
 
31
- let format: (typeof acceptedMIMETypes)[number] | null = null;
31
+ let format: (typeof acceptedMIMETypes)[number] | undefined;
32
32
  for (const mimeType of acceptedMIMETypes) {
33
33
  if (event.clipboardData!.types.includes(mimeType)) {
34
34
  format = mimeType;
35
35
  break;
36
36
  }
37
37
  }
38
- if (format === null) {
38
+ if (!format) {
39
39
  return true;
40
40
  }
41
41
 
@@ -46,12 +46,19 @@ export const createPasteFromClipboardExtension = <
46
46
 
47
47
  let data = event.clipboardData!.getData(format);
48
48
 
49
+ if (format === "blocknote/html") {
50
+ editor._tiptapEditor.view.pasteHTML(data);
51
+ return true;
52
+ }
53
+
49
54
  if (format === "text/html") {
50
55
  const htmlNode = nestedListsToBlockNoteStructure(data.trim());
51
56
  data = htmlNode.innerHTML;
57
+ editor._tiptapEditor.view.pasteHTML(data);
58
+ return true;
52
59
  }
53
60
 
54
- editor._tiptapEditor.view.pasteHTML(data);
61
+ editor._tiptapEditor.view.pasteText(data);
55
62
 
56
63
  return true;
57
64
  },