@blocknote/core 0.15.11 → 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 (69) hide show
  1. package/dist/blocknote.js +888 -844
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +5 -5
  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/clipboard/__snapshots__/childToParent.html +1 -0
  8. package/src/api/clipboard/__snapshots__/childrenToNextParent.html +1 -0
  9. package/src/api/clipboard/__snapshots__/childrenToNextParentsChildren.html +1 -0
  10. package/src/api/clipboard/__snapshots__/image.html +1 -0
  11. package/src/api/clipboard/__snapshots__/multipleStyledText.html +1 -0
  12. package/src/api/clipboard/__snapshots__/nestedImage.html +1 -0
  13. package/src/api/clipboard/__snapshots__/partialChildToParent.html +1 -0
  14. package/src/api/clipboard/__snapshots__/styledText.html +1 -0
  15. package/src/api/clipboard/__snapshots__/tableAllCells.html +1 -0
  16. package/src/api/clipboard/__snapshots__/tableCell.html +1 -0
  17. package/src/api/clipboard/__snapshots__/tableCellText.html +1 -0
  18. package/src/api/clipboard/__snapshots__/tableRow.html +1 -0
  19. package/src/api/clipboard/__snapshots__/unstyledText.html +1 -0
  20. package/src/api/clipboard/clipboard.test.ts +284 -0
  21. package/src/api/{parsers → clipboard/fromClipboard}/fileDropExtension.ts +2 -2
  22. package/src/api/{parsers → clipboard/fromClipboard}/handleFileInsertion.ts +4 -4
  23. package/src/api/{parsers → clipboard/fromClipboard}/pasteExtension.ts +14 -7
  24. package/src/api/{exporters → clipboard/toClipboard}/copyExtension.ts +70 -43
  25. package/src/api/exporters/html/externalHTMLExporter.ts +14 -7
  26. package/src/api/exporters/html/htmlConversion.test.ts +4 -147
  27. package/src/api/exporters/html/internalHTMLSerializer.ts +5 -2
  28. package/src/api/parsers/html/parseHTML.test.ts +3 -6
  29. package/src/api/parsers/markdown/__snapshots__/pasted/complex.json +319 -0
  30. package/src/api/parsers/markdown/__snapshots__/pasted/issue-226-1.json +81 -0
  31. package/src/api/parsers/{html/__snapshots__/paste/parse-deep-nested-content.json → markdown/__snapshots__/pasted/issue-226-2.json} +35 -110
  32. package/src/api/parsers/markdown/__snapshots__/pasted/nested.json +81 -0
  33. package/src/api/parsers/markdown/__snapshots__/pasted/non-nested.json +81 -0
  34. package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +61 -0
  35. package/src/api/parsers/markdown/parseMarkdown.test.ts +15 -0
  36. package/src/api/testUtil/paste.ts +46 -0
  37. package/src/blocks/TableBlockContent/TableBlockContent.ts +0 -1
  38. package/src/editor/BlockNoteExtensions.ts +3 -3
  39. package/src/editor/transformPasted.ts +34 -2
  40. package/src/extensions/SideMenu/SideMenuPlugin.ts +6 -7
  41. package/src/schema/blocks/createSpec.ts +16 -7
  42. package/types/src/api/clipboard/clipboard.test.d.ts +1 -0
  43. package/types/src/api/clipboard/fromClipboard/fileDropExtension.d.ts +6 -0
  44. package/types/src/api/{parsers → clipboard/fromClipboard}/handleFileInsertion.d.ts +2 -2
  45. package/types/src/api/clipboard/fromClipboard/pasteExtension.d.ts +6 -0
  46. package/types/src/api/clipboard/toClipboard/copyExtension.d.ts +12 -0
  47. package/types/src/api/exporters/html/externalHTMLExporter.d.ts +1 -0
  48. package/types/src/api/testUtil/paste.d.ts +2 -0
  49. package/types/src/editor/transformPasted.d.ts +8 -1
  50. package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionLeavesBlockChildren.html +0 -1
  51. package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionSpansBlocksChildren.html +0 -1
  52. package/src/api/parsers/html/__snapshots__/paste/parse-google-docs-html.json +0 -476
  53. package/types/src/api/exporters/copyExtension.d.ts +0 -6
  54. package/types/src/api/parsers/fileDropExtension.d.ts +0 -6
  55. package/types/src/api/parsers/pasteExtension.d.ts +0 -6
  56. /package/src/api/{exporters/html/__snapshots_fragment_edge_cases__/selectionWithinBlockChildren.html → clipboard/__snapshots__/multipleChildren.html} +0 -0
  57. /package/src/api/{parsers → clipboard/fromClipboard}/acceptedMIMETypes.ts +0 -0
  58. /package/src/api/parsers/html/__snapshots__/{paste/list-test.json → list-test.json} +0 -0
  59. /package/src/api/parsers/html/__snapshots__/{paste/parse-basic-block-types.json → parse-basic-block-types.json} +0 -0
  60. /package/src/api/parsers/html/__snapshots__/{paste/parse-div-with-inline-content.json → parse-div-with-inline-content.json} +0 -0
  61. /package/src/api/parsers/html/__snapshots__/{paste/parse-divs.json → parse-divs.json} +0 -0
  62. /package/src/api/parsers/html/__snapshots__/{paste/parse-fake-image-caption.json → parse-fake-image-caption.json} +0 -0
  63. /package/src/api/parsers/html/__snapshots__/{paste/parse-image-in-paragraph.json → parse-image-in-paragraph.json} +0 -0
  64. /package/src/api/parsers/html/__snapshots__/{paste/parse-mixed-nested-lists.json → parse-mixed-nested-lists.json} +0 -0
  65. /package/src/api/parsers/html/__snapshots__/{paste/parse-nested-lists-with-paragraphs.json → parse-nested-lists-with-paragraphs.json} +0 -0
  66. /package/src/api/parsers/html/__snapshots__/{paste/parse-nested-lists.json → parse-nested-lists.json} +0 -0
  67. /package/src/api/parsers/html/__snapshots__/{paste/parse-notion-html.json → parse-notion-html.json} +0 -0
  68. /package/src/api/parsers/html/__snapshots__/{paste/parse-two-divs.json → parse-two-divs.json} +0 -0
  69. /package/types/src/api/{parsers → clipboard/fromClipboard}/acceptedMIMETypes.d.ts +0 -0
@@ -1 +1 @@
1
- {"builtAt":1727710427090,"assets":[{"name":"blocknote.umd.cjs","size":200565},{"name":"blocknote.umd.cjs.map","size":726187}],"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":3229,"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":15855,"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":3447,"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":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"]}]}
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.11",
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": "7f99a35368217aaab0a8ab9aff2092f2ecfd4aaf"
122
+ "gitHead": "92bd2c2f9d638df930ab29c115f9e9d41c845af3"
123
123
  }
@@ -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
  },