@blocknote/core 0.20.0 → 0.22.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.
- package/dist/blocknote.js +1602 -1569
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +3 -3
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +3 -3
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +1 -3
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +1 -1
- package/src/api/blockManipulation/selections/selection.ts +5 -5
- package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraph.html +96 -0
- package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html +96 -0
- package/src/api/clipboard/__snapshots__/external/pasteImage.html +111 -0
- package/src/api/clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html +96 -0
- package/src/api/clipboard/__snapshots__/external/pasteTable.html +149 -0
- package/src/api/clipboard/__snapshots__/external/pasteTableInExistingTable.html +124 -0
- package/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/tableAllCells.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/tableCell.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/tableRow.html +1 -0
- package/src/api/clipboard/clipboardExternal.test.ts +161 -0
- package/src/api/clipboard/{clipboard.test.ts → clipboardInternal.test.ts} +66 -40
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +1 -1
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +7 -14
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +6 -6
- package/src/api/clipboard/testUtil.ts +27 -0
- package/src/api/clipboard/toClipboard/copyExtension.ts +8 -2
- package/src/api/exporters/html/__snapshots__/file/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/noCaption/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/noName/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noCaption/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noName/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html +1 -1
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +3 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +1 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +2 -2
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md +1 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md +1 -1
- package/src/api/nodeConversions/nodeToBlock.ts +4 -1
- package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +2 -2
- package/src/api/parsers/markdown/parseMarkdown.test.ts +5 -7
- package/src/api/testUtil/partialBlockTestUtil.ts +4 -1
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +13 -14
- package/src/blocks/FileBlockContent/FileBlockContent.ts +5 -12
- package/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.ts +5 -0
- package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +16 -0
- package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +63 -0
- package/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts +80 -0
- package/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts +24 -0
- package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +204 -0
- package/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts +13 -0
- package/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts +15 -0
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +3 -19
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +20 -28
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +3 -15
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +11 -3
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +25 -5
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +20 -27
- package/src/editor/Block.css +38 -54
- package/src/editor/BlockNoteEditor.test.ts +21 -1
- package/src/editor/BlockNoteEditor.ts +14 -7
- package/src/editor/BlockNoteExtensions.ts +7 -8
- package/src/editor/editor.css +7 -6
- package/src/editor/transformPasted.ts +57 -4
- package/src/extensions/LinkToolbar/protocols.ts +13 -0
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +6 -6
- package/src/extensions/SideMenu/SideMenuPlugin.ts +5 -1
- package/src/extensions/SideMenu/dragging.ts +3 -0
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +3 -6
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +15 -3
- package/src/index.ts +9 -2
- package/src/schema/blocks/createSpec.ts +1 -1
- package/src/schema/blocks/internal.ts +16 -6
- package/src/schema/inlineContent/createSpec.ts +2 -2
- package/src/schema/inlineContent/internal.ts +4 -1
- package/src/schema/propTypes.ts +41 -18
- package/types/src/api/blockManipulation/setupTestEnv.d.ts +8 -0
- package/types/src/api/clipboard/clipboardInternal.test.d.ts +1 -0
- package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +2 -3
- package/types/src/api/clipboard/fromClipboard/pasteExtension.d.ts +1 -3
- package/types/src/api/clipboard/testUtil.d.ts +509 -0
- package/types/src/api/testUtil/cases/customBlocks.d.ts +8 -0
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +8 -0
- package/types/src/api/testUtil/cases/customStyles.d.ts +8 -0
- package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +2 -5
- package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +2 -5
- package/types/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.d.ts +3 -0
- package/types/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.d.ts +4 -0
- package/types/src/blocks/FileBlockContent/helpers/render/createAddFileButton.d.ts +6 -0
- package/types/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.d.ts +9 -0
- package/types/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.d.ts +6 -0
- package/types/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.d.ts +9 -0
- package/types/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.d.ts +3 -0
- package/types/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.d.ts +3 -0
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +2 -5
- package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +12 -0
- package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +2 -5
- package/types/src/blocks/defaultBlocks.d.ts +16 -0
- package/types/src/editor/BlockNoteEditor.d.ts +6 -4
- package/types/src/editor/transformPasted.d.ts +8 -4
- package/types/src/extensions/LinkToolbar/protocols.d.ts +2 -0
- package/types/src/index.d.ts +9 -2
- package/types/src/schema/propTypes.d.ts +20 -2
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +0 -30
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js +0 -99
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js +0 -97
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js +0 -88
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js +0 -219
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js +0 -175
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js +0 -57
- package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +0 -5
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +0 -31
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +0 -71
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js +0 -157
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +0 -27
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +0 -67
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +0 -148
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js +0 -252
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js.map +0 -1
- package/dist/src/api/blockManipulation/getBlock/getBlock.js +0 -56
- package/dist/src/api/blockManipulation/getBlock/getBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/insertContentAt.js +0 -64
- package/dist/src/api/blockManipulation/insertContentAt.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/selection.js +0 -149
- package/dist/src/api/blockManipulation/selections/selection.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/selection.test.js +0 -39
- package/dist/src/api/blockManipulation/selections/selection.test.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +0 -79
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js +0 -33
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js.map +0 -1
- package/dist/src/api/blockManipulation/setupTestEnv.js +0 -172
- package/dist/src/api/blockManipulation/setupTestEnv.js.map +0 -1
- package/dist/src/api/clipboard/clipboard.test.js +0 -246
- package/dist/src/api/clipboard/clipboard.test.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +0 -8
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js +0 -38
- package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +0 -111
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js +0 -26
- package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/pasteExtension.js +0 -57
- package/dist/src/api/clipboard/fromClipboard/pasteExtension.js.map +0 -1
- package/dist/src/api/clipboard/toClipboard/copyExtension.js +0 -132
- package/dist/src/api/clipboard/toClipboard/copyExtension.js.map +0 -1
- package/dist/src/api/exporters/html/externalHTMLExporter.js +0 -35
- package/dist/src/api/exporters/html/externalHTMLExporter.js.map +0 -1
- package/dist/src/api/exporters/html/htmlConversion.test.js +0 -72
- package/dist/src/api/exporters/html/htmlConversion.test.js.map +0 -1
- package/dist/src/api/exporters/html/internalHTMLSerializer.js +0 -21
- package/dist/src/api/exporters/html/internalHTMLSerializer.js.map +0 -1
- package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js +0 -141
- package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js.map +0 -1
- package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js +0 -96
- package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js.map +0 -1
- package/dist/src/api/exporters/markdown/markdownExporter.js +0 -31
- package/dist/src/api/exporters/markdown/markdownExporter.js.map +0 -1
- package/dist/src/api/exporters/markdown/markdownExporter.test.js +0 -57
- package/dist/src/api/exporters/markdown/markdownExporter.test.js.map +0 -1
- package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js +0 -33
- package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js.map +0 -1
- package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js +0 -37
- package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js.map +0 -1
- package/dist/src/api/getBlockInfoFromPos.js +0 -165
- package/dist/src/api/getBlockInfoFromPos.js.map +0 -1
- package/dist/src/api/nodeConversions/blockToNode.js +0 -197
- package/dist/src/api/nodeConversions/blockToNode.js.map +0 -1
- package/dist/src/api/nodeConversions/fragmentToBlocks.js +0 -50
- package/dist/src/api/nodeConversions/fragmentToBlocks.js.map +0 -1
- package/dist/src/api/nodeConversions/nodeConversions.test.js +0 -54
- package/dist/src/api/nodeConversions/nodeConversions.test.js.map +0 -1
- package/dist/src/api/nodeConversions/nodeToBlock.js +0 -316
- package/dist/src/api/nodeConversions/nodeToBlock.js.map +0 -1
- package/dist/src/api/nodeUtil.js +0 -28
- package/dist/src/api/nodeUtil.js.map +0 -1
- package/dist/src/api/parsers/html/parseHTML.js +0 -19
- package/dist/src/api/parsers/html/parseHTML.js.map +0 -1
- package/dist/src/api/parsers/html/parseHTML.test.js +0 -470
- package/dist/src/api/parsers/html/parseHTML.test.js.map +0 -1
- package/dist/src/api/parsers/html/util/nestedLists.js +0 -106
- package/dist/src/api/parsers/html/util/nestedLists.js.map +0 -1
- package/dist/src/api/parsers/html/util/nestedLists.test.js +0 -166
- package/dist/src/api/parsers/html/util/nestedLists.test.js.map +0 -1
- package/dist/src/api/parsers/markdown/parseMarkdown.js +0 -52
- package/dist/src/api/parsers/markdown/parseMarkdown.js.map +0 -1
- package/dist/src/api/parsers/markdown/parseMarkdown.test.js +0 -109
- package/dist/src/api/parsers/markdown/parseMarkdown.test.js.map +0 -1
- package/dist/src/api/testUtil/cases/customBlocks.js +0 -313
- package/dist/src/api/testUtil/cases/customBlocks.js.map +0 -1
- package/dist/src/api/testUtil/cases/customInlineContent.js +0 -91
- package/dist/src/api/testUtil/cases/customInlineContent.js.map +0 -1
- package/dist/src/api/testUtil/cases/customStyles.js +0 -83
- package/dist/src/api/testUtil/cases/customStyles.js.map +0 -1
- package/dist/src/api/testUtil/cases/defaultSchema.js +0 -673
- package/dist/src/api/testUtil/cases/defaultSchema.js.map +0 -1
- package/dist/src/api/testUtil/index.js +0 -2
- package/dist/src/api/testUtil/index.js.map +0 -1
- package/dist/src/api/testUtil/partialBlockTestUtil.js +0 -114
- package/dist/src/api/testUtil/partialBlockTestUtil.js.map +0 -1
- package/dist/src/api/testUtil/paste.js +0 -29
- package/dist/src/api/testUtil/paste.js.map +0 -1
- package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js +0 -97
- package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +0 -1
- package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js +0 -5
- package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js.map +0 -1
- package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js +0 -281
- package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js.map +0 -1
- package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js +0 -110
- package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/FileBlockContent.js +0 -70
- package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js +0 -317
- package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js +0 -15
- package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js.map +0 -1
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +0 -145
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +0 -1
- package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js +0 -106
- package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +0 -1
- package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js +0 -6
- package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +0 -113
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +0 -224
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +0 -45
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js +0 -58
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +0 -130
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +0 -1
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +0 -52
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +0 -1
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js +0 -129
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +0 -1
- package/dist/src/blocks/TableBlockContent/TableExtension.js +0 -64
- package/dist/src/blocks/TableBlockContent/TableExtension.js.map +0 -1
- package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js +0 -103
- package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +0 -1
- package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js +0 -6
- package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js.map +0 -1
- package/dist/src/blocks/defaultBlockHelpers.js +0 -50
- package/dist/src/blocks/defaultBlockHelpers.js.map +0 -1
- package/dist/src/blocks/defaultBlockTypeGuards.js +0 -40
- package/dist/src/blocks/defaultBlockTypeGuards.js.map +0 -1
- package/dist/src/blocks/defaultBlocks.js +0 -50
- package/dist/src/blocks/defaultBlocks.js.map +0 -1
- package/dist/src/blocks/defaultProps.js +0 -19
- package/dist/src/blocks/defaultProps.js.map +0 -1
- package/dist/src/editor/BlockNoteEditor.js +0 -748
- package/dist/src/editor/BlockNoteEditor.js.map +0 -1
- package/dist/src/editor/BlockNoteEditor.test.js +0 -65
- package/dist/src/editor/BlockNoteEditor.test.js.map +0 -1
- package/dist/src/editor/BlockNoteExtensions.js +0 -196
- package/dist/src/editor/BlockNoteExtensions.js.map +0 -1
- package/dist/src/editor/BlockNoteSchema.js +0 -38
- package/dist/src/editor/BlockNoteSchema.js.map +0 -1
- package/dist/src/editor/BlockNoteTipTapEditor.js +0 -169
- package/dist/src/editor/BlockNoteTipTapEditor.js.map +0 -1
- package/dist/src/editor/cursorPositionTypes.js +0 -2
- package/dist/src/editor/cursorPositionTypes.js.map +0 -1
- package/dist/src/editor/defaultColors.js +0 -77
- package/dist/src/editor/defaultColors.js.map +0 -1
- package/dist/src/editor/selectionTypes.js +0 -2
- package/dist/src/editor/selectionTypes.js.map +0 -1
- package/dist/src/editor/transformPasted.js +0 -79
- package/dist/src/editor/transformPasted.js.map +0 -1
- package/dist/src/exporter/Exporter.js +0 -36
- package/dist/src/exporter/Exporter.js.map +0 -1
- package/dist/src/exporter/index.js +0 -3
- package/dist/src/exporter/index.js.map +0 -1
- package/dist/src/exporter/mapping.js +0 -12
- package/dist/src/exporter/mapping.js.map +0 -1
- package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js +0 -30
- package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js.map +0 -1
- package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js +0 -39
- package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js.map +0 -1
- package/dist/src/extensions/FilePanel/FilePanelPlugin.js +0 -131
- package/dist/src/extensions/FilePanel/FilePanelPlugin.js.map +0 -1
- package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +0 -197
- package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +0 -1
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +0 -341
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +0 -1
- package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +0 -251
- package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +0 -1
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +0 -54
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +0 -1
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +0 -90
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +0 -1
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +0 -187
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +0 -1
- package/dist/src/extensions/SideMenu/MultipleNodeSelection.js +0 -68
- package/dist/src/extensions/SideMenu/MultipleNodeSelection.js.map +0 -1
- package/dist/src/extensions/SideMenu/SideMenuPlugin.js +0 -343
- package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +0 -1
- package/dist/src/extensions/SideMenu/dragging.js +0 -132
- package/dist/src/extensions/SideMenu/dragging.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js +0 -2
- package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js +0 -2
- package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js +0 -245
- package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js +0 -26
- package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js +0 -241
- package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js.map +0 -1
- package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +0 -570
- package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +0 -1
- package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js +0 -36
- package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js.map +0 -1
- package/dist/src/extensions/TextColor/TextColorExtension.js +0 -29
- package/dist/src/extensions/TextColor/TextColorExtension.js.map +0 -1
- package/dist/src/extensions/TextColor/TextColorMark.js +0 -37
- package/dist/src/extensions/TextColor/TextColorMark.js.map +0 -1
- package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js +0 -58
- package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js.map +0 -1
- package/dist/src/extensions/UniqueID/UniqueID.js +0 -283
- package/dist/src/extensions/UniqueID/UniqueID.js.map +0 -1
- package/dist/src/extensions/getDraggableBlockFromElement.js +0 -13
- package/dist/src/extensions/getDraggableBlockFromElement.js.map +0 -1
- package/dist/src/extensions-shared/UiElementPosition.js +0 -2
- package/dist/src/extensions-shared/UiElementPosition.js.map +0 -1
- package/dist/src/i18n/dictionary.js +0 -4
- package/dist/src/i18n/dictionary.js.map +0 -1
- package/dist/src/i18n/locales/ar.js +0 -298
- package/dist/src/i18n/locales/ar.js.map +0 -1
- package/dist/src/i18n/locales/de.js +0 -313
- package/dist/src/i18n/locales/de.js.map +0 -1
- package/dist/src/i18n/locales/en.js +0 -314
- package/dist/src/i18n/locales/en.js.map +0 -1
- package/dist/src/i18n/locales/es.js +0 -312
- package/dist/src/i18n/locales/es.js.map +0 -1
- package/dist/src/i18n/locales/fr.js +0 -313
- package/dist/src/i18n/locales/fr.js.map +0 -1
- package/dist/src/i18n/locales/hr.js +0 -308
- package/dist/src/i18n/locales/hr.js.map +0 -1
- package/dist/src/i18n/locales/index.js +0 -16
- package/dist/src/i18n/locales/index.js.map +0 -1
- package/dist/src/i18n/locales/is.js +0 -305
- package/dist/src/i18n/locales/is.js.map +0 -1
- package/dist/src/i18n/locales/ja.js +0 -333
- package/dist/src/i18n/locales/ja.js.map +0 -1
- package/dist/src/i18n/locales/ko.js +0 -326
- package/dist/src/i18n/locales/ko.js.map +0 -1
- package/dist/src/i18n/locales/nl.js +0 -313
- package/dist/src/i18n/locales/nl.js.map +0 -1
- package/dist/src/i18n/locales/pl.js +0 -297
- package/dist/src/i18n/locales/pl.js.map +0 -1
- package/dist/src/i18n/locales/pt.js +0 -305
- package/dist/src/i18n/locales/pt.js.map +0 -1
- package/dist/src/i18n/locales/ru.js +0 -340
- package/dist/src/i18n/locales/ru.js.map +0 -1
- package/dist/src/i18n/locales/vi.js +0 -312
- package/dist/src/i18n/locales/vi.js.map +0 -1
- package/dist/src/i18n/locales/zh.js +0 -346
- package/dist/src/i18n/locales/zh.js.map +0 -1
- package/dist/src/index.js +0 -56
- package/dist/src/index.js.map +0 -1
- package/dist/src/pm-nodes/BlockContainer.js +0 -72
- package/dist/src/pm-nodes/BlockContainer.js.map +0 -1
- package/dist/src/pm-nodes/BlockGroup.js +0 -43
- package/dist/src/pm-nodes/BlockGroup.js.map +0 -1
- package/dist/src/pm-nodes/Doc.js +0 -7
- package/dist/src/pm-nodes/Doc.js.map +0 -1
- package/dist/src/pm-nodes/index.js +0 -4
- package/dist/src/pm-nodes/index.js.map +0 -1
- package/dist/src/schema/blocks/createSpec.js +0 -126
- package/dist/src/schema/blocks/createSpec.js.map +0 -1
- package/dist/src/schema/blocks/internal.js +0 -147
- package/dist/src/schema/blocks/internal.js.map +0 -1
- package/dist/src/schema/blocks/types.js +0 -2
- package/dist/src/schema/blocks/types.js.map +0 -1
- package/dist/src/schema/index.js +0 -11
- package/dist/src/schema/index.js.map +0 -1
- package/dist/src/schema/inlineContent/createSpec.js +0 -64
- package/dist/src/schema/inlineContent/createSpec.js.map +0 -1
- package/dist/src/schema/inlineContent/internal.js +0 -52
- package/dist/src/schema/inlineContent/internal.js.map +0 -1
- package/dist/src/schema/inlineContent/types.js +0 -10
- package/dist/src/schema/inlineContent/types.js.map +0 -1
- package/dist/src/schema/propTypes.js +0 -2
- package/dist/src/schema/propTypes.js.map +0 -1
- package/dist/src/schema/styles/createSpec.js +0 -48
- package/dist/src/schema/styles/createSpec.js.map +0 -1
- package/dist/src/schema/styles/internal.js +0 -53
- package/dist/src/schema/styles/internal.js.map +0 -1
- package/dist/src/schema/styles/types.js +0 -2
- package/dist/src/schema/styles/types.js.map +0 -1
- package/dist/src/util/EventEmitter.js +0 -33
- package/dist/src/util/EventEmitter.js.map +0 -1
- package/dist/src/util/browser.js +0 -17
- package/dist/src/util/browser.js.map +0 -1
- package/dist/src/util/combineByGroup.js +0 -20
- package/dist/src/util/combineByGroup.js.map +0 -1
- package/dist/src/util/esmDependencies.js +0 -35
- package/dist/src/util/esmDependencies.js.map +0 -1
- package/dist/src/util/string.js +0 -14
- package/dist/src/util/string.js.map +0 -1
- package/dist/src/util/typescript.js +0 -12
- package/dist/src/util/typescript.js.map +0 -1
- package/src/api/clipboard/__snapshots__/tableAllCells.html +0 -1
- package/src/api/clipboard/__snapshots__/tableCell.html +0 -1
- package/src/api/clipboard/__snapshots__/tableRow.html +0 -1
- package/src/blocks/FileBlockContent/fileBlockHelpers.ts +0 -456
- package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +0 -41
- /package/src/api/clipboard/__snapshots__/{childToParent.html → internal/childToParent.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{childrenToNextParent.html → internal/childrenToNextParent.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{childrenToNextParentsChildren.html → internal/childrenToNextParentsChildren.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{image.html → internal/image.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{multipleChildren.html → internal/multipleChildren.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{multipleStyledText.html → internal/multipleStyledText.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{nestedImage.html → internal/nestedImage.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{partialChildToParent.html → internal/partialChildToParent.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{styledText.html → internal/styledText.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{tableCellText.html → internal/tableCellText.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{unstyledText.html → internal/unstyledText.html} +0 -0
- /package/src/blocks/AudioBlockContent/{audioBlockHelpers.ts → parseAudioElement.ts} +0 -0
- /package/src/blocks/ImageBlockContent/{imageBlockHelpers.ts → parseImageElement.ts} +0 -0
- /package/src/blocks/VideoBlockContent/{videoBlockHelpers.ts → parseVideoElement.ts} +0 -0
- /package/types/src/api/clipboard/{clipboard.test.d.ts → clipboardExternal.test.d.ts} +0 -0
- /package/types/src/blocks/AudioBlockContent/{audioBlockHelpers.d.ts → parseAudioElement.d.ts} +0 -0
- /package/types/src/blocks/ImageBlockContent/{imageBlockHelpers.d.ts → parseImageElement.d.ts} +0 -0
- /package/types/src/blocks/VideoBlockContent/{videoBlockHelpers.d.ts → parseVideoElement.d.ts} +0 -0
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
import { Plugin, PluginKey } from "prosemirror-state";
|
|
2
|
-
import { EventEmitter } from "../../util/EventEmitter.js";
|
|
3
|
-
import { initializeESMDependencies } from "../../util/esmDependencies.js";
|
|
4
|
-
import { getDraggableBlockFromElement } from "../getDraggableBlockFromElement.js";
|
|
5
|
-
import { dragStart, unsetDragImage } from "./dragging.js";
|
|
6
|
-
const PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP = 0.1;
|
|
7
|
-
function getBlockFromCoords(view, coords, adjustForColumns = true) {
|
|
8
|
-
const elements = view.root.elementsFromPoint(coords.left, coords.top);
|
|
9
|
-
for (const element of elements) {
|
|
10
|
-
if (!view.dom.contains(element)) {
|
|
11
|
-
// probably a ui overlay like formatting toolbar etc
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
if (adjustForColumns) {
|
|
15
|
-
const column = element.closest("[data-node-type=columnList]");
|
|
16
|
-
if (column) {
|
|
17
|
-
return getBlockFromCoords(view, {
|
|
18
|
-
left: coords.left + 50, // bit hacky, but if we're inside a column, offset x position to right to account for the width of sidemenu itself
|
|
19
|
-
top: coords.top,
|
|
20
|
-
}, false);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return getDraggableBlockFromElement(element, view);
|
|
24
|
-
}
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
function getBlockFromMousePos(mousePos, view) {
|
|
28
|
-
// Editor itself may have padding or other styling which affects
|
|
29
|
-
// size/position, so we get the boundingRect of the first child (i.e. the
|
|
30
|
-
// blockGroup that wraps all blocks in the editor) for more accurate side
|
|
31
|
-
// menu placement.
|
|
32
|
-
if (!view.dom.firstChild) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const editorBoundingBox = view.dom.firstChild.getBoundingClientRect();
|
|
36
|
-
// this.horizontalPosAnchor = editorBoundingBox.x;
|
|
37
|
-
// Gets block at mouse cursor's vertical position.
|
|
38
|
-
const coords = {
|
|
39
|
-
left: mousePos.x,
|
|
40
|
-
top: mousePos.y,
|
|
41
|
-
};
|
|
42
|
-
const mouseLeftOfEditor = coords.left < editorBoundingBox.left;
|
|
43
|
-
const mouseRightOfEditor = coords.left > editorBoundingBox.right;
|
|
44
|
-
if (mouseLeftOfEditor) {
|
|
45
|
-
coords.left = editorBoundingBox.left + 10;
|
|
46
|
-
}
|
|
47
|
-
if (mouseRightOfEditor) {
|
|
48
|
-
coords.left = editorBoundingBox.right - 10;
|
|
49
|
-
}
|
|
50
|
-
let block = getBlockFromCoords(view, coords);
|
|
51
|
-
if (!mouseRightOfEditor && block) {
|
|
52
|
-
// note: this case is not necessary when we're on the right side of the editor
|
|
53
|
-
/* Now, because blocks can be nested
|
|
54
|
-
| BlockA |
|
|
55
|
-
x | BlockB y|
|
|
56
|
-
|
|
57
|
-
hovering over position x (the "margin of block B") will return block A instead of block B.
|
|
58
|
-
to fix this, we get the block from the right side of block A (position y, which will fall in BlockB correctly)
|
|
59
|
-
*/
|
|
60
|
-
const rect = block.node.getBoundingClientRect();
|
|
61
|
-
coords.left = rect.right - 10;
|
|
62
|
-
block = getBlockFromCoords(view, coords, false);
|
|
63
|
-
}
|
|
64
|
-
return block;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* With the sidemenu plugin we can position a menu next to a hovered block.
|
|
68
|
-
*/
|
|
69
|
-
export class SideMenuView {
|
|
70
|
-
editor;
|
|
71
|
-
pmView;
|
|
72
|
-
state;
|
|
73
|
-
emitUpdate;
|
|
74
|
-
mousePos;
|
|
75
|
-
hoveredBlock;
|
|
76
|
-
menuFrozen = false;
|
|
77
|
-
constructor(editor, pmView, emitUpdate) {
|
|
78
|
-
this.editor = editor;
|
|
79
|
-
this.pmView = pmView;
|
|
80
|
-
this.emitUpdate = () => {
|
|
81
|
-
if (!this.state) {
|
|
82
|
-
throw new Error("Attempting to update uninitialized side menu");
|
|
83
|
-
}
|
|
84
|
-
emitUpdate(this.state);
|
|
85
|
-
};
|
|
86
|
-
this.pmView.root.addEventListener("drop", this.onDrop, true);
|
|
87
|
-
this.pmView.root.addEventListener("dragover", this.onDragOver);
|
|
88
|
-
initializeESMDependencies();
|
|
89
|
-
// Shows or updates menu position whenever the cursor moves, if the menu isn't frozen.
|
|
90
|
-
this.pmView.root.addEventListener("mousemove", this.onMouseMove, true);
|
|
91
|
-
// Hides and unfreezes the menu whenever the user presses a key.
|
|
92
|
-
this.pmView.root.addEventListener("keydown", this.onKeyDown, true);
|
|
93
|
-
}
|
|
94
|
-
updateState = (state) => {
|
|
95
|
-
this.state = state;
|
|
96
|
-
this.emitUpdate(this.state);
|
|
97
|
-
};
|
|
98
|
-
updateStateFromMousePos = () => {
|
|
99
|
-
if (this.menuFrozen || !this.mousePos) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const block = getBlockFromMousePos(this.mousePos, this.pmView);
|
|
103
|
-
// Closes the menu if the mouse cursor is beyond the editor vertically.
|
|
104
|
-
if (!block || !this.editor.isEditable) {
|
|
105
|
-
if (this.state?.show) {
|
|
106
|
-
this.state.show = false;
|
|
107
|
-
this.updateState(this.state);
|
|
108
|
-
}
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
// Doesn't update if the menu is already open and the mouse cursor is still hovering the same block.
|
|
112
|
-
if (this.state?.show &&
|
|
113
|
-
this.hoveredBlock?.hasAttribute("data-id") &&
|
|
114
|
-
this.hoveredBlock?.getAttribute("data-id") === block.id) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
this.hoveredBlock = block.node;
|
|
118
|
-
// Gets the block's content node, which lets to ignore child blocks when determining the block menu's position.
|
|
119
|
-
// TODO: needed?
|
|
120
|
-
const blockContent = block.node.firstChild;
|
|
121
|
-
if (!blockContent) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
// TODO: needed?
|
|
125
|
-
// Shows or updates elements.
|
|
126
|
-
if (this.editor.isEditable) {
|
|
127
|
-
const blockContentBoundingBox = blockContent.getBoundingClientRect();
|
|
128
|
-
const column = block.node.closest("[data-node-type=column]");
|
|
129
|
-
this.updateState({
|
|
130
|
-
show: true,
|
|
131
|
-
referencePos: new DOMRect(column
|
|
132
|
-
? // We take the first child as column elements have some default
|
|
133
|
-
// padding. This is a little weird since this child element will
|
|
134
|
-
// be the first block, but since it's always non-nested and we
|
|
135
|
-
// only take the x coordinate, it's ok.
|
|
136
|
-
column.firstElementChild.getBoundingClientRect().x
|
|
137
|
-
: this.pmView.dom.firstChild.getBoundingClientRect().x, blockContentBoundingBox.y, blockContentBoundingBox.width, blockContentBoundingBox.height),
|
|
138
|
-
block: this.editor.getBlock(this.hoveredBlock.getAttribute("data-id")),
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* If the event is outside the editor contents,
|
|
144
|
-
* we dispatch a fake event, so that we can still drop the content
|
|
145
|
-
* when dragging / dropping to the side of the editor
|
|
146
|
-
*/
|
|
147
|
-
onDrop = (event) => {
|
|
148
|
-
this.editor._tiptapEditor.commands.blur();
|
|
149
|
-
if (event.synthetic ||
|
|
150
|
-
!event.dataTransfer?.types.includes("blocknote/html")) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const pos = this.pmView.posAtCoords({
|
|
154
|
-
left: event.clientX,
|
|
155
|
-
top: event.clientY,
|
|
156
|
-
});
|
|
157
|
-
if (!pos || pos.inside === -1) {
|
|
158
|
-
const evt = this.createSyntheticEvent(event);
|
|
159
|
-
// console.log("dispatch fake drop");
|
|
160
|
-
this.pmView.dom.dispatchEvent(evt);
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* If the event is outside the editor contents,
|
|
165
|
-
* we dispatch a fake event, so that we can still drop the content
|
|
166
|
-
* when dragging / dropping to the side of the editor
|
|
167
|
-
*/
|
|
168
|
-
onDragOver = (event) => {
|
|
169
|
-
if (event.synthetic ||
|
|
170
|
-
!event.dataTransfer?.types.includes("blocknote/html")) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const pos = this.pmView.posAtCoords({
|
|
174
|
-
left: event.clientX,
|
|
175
|
-
top: event.clientY,
|
|
176
|
-
});
|
|
177
|
-
if (!pos || (pos.inside === -1 && this.pmView.dom.firstChild)) {
|
|
178
|
-
const evt = this.createSyntheticEvent(event);
|
|
179
|
-
// console.log("dispatch fake dragover");
|
|
180
|
-
this.pmView.dom.dispatchEvent(evt);
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
onKeyDown = (_event) => {
|
|
184
|
-
if (this.state?.show && this.editor.isFocused()) {
|
|
185
|
-
// Typing in editor should hide side menu
|
|
186
|
-
this.state.show = false;
|
|
187
|
-
this.emitUpdate(this.state);
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
onMouseMove = (event) => {
|
|
191
|
-
if (this.menuFrozen) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
this.mousePos = { x: event.clientX, y: event.clientY };
|
|
195
|
-
// We want the full area of the editor to check if the cursor is hovering
|
|
196
|
-
// above it though.
|
|
197
|
-
const editorOuterBoundingBox = this.pmView.dom.getBoundingClientRect();
|
|
198
|
-
const cursorWithinEditor = this.mousePos.x > editorOuterBoundingBox.left &&
|
|
199
|
-
this.mousePos.x < editorOuterBoundingBox.right &&
|
|
200
|
-
this.mousePos.y > editorOuterBoundingBox.top &&
|
|
201
|
-
this.mousePos.y < editorOuterBoundingBox.bottom;
|
|
202
|
-
// TODO: remove parentElement, but then we need to remove padding from boundingbox or find a different solution
|
|
203
|
-
const editorWrapper = this.pmView.dom.parentElement;
|
|
204
|
-
// Doesn't update if the mouse hovers an element that's over the editor but
|
|
205
|
-
// isn't a part of it or the side menu.
|
|
206
|
-
if (
|
|
207
|
-
// Cursor is within the editor area
|
|
208
|
-
cursorWithinEditor &&
|
|
209
|
-
// An element is hovered
|
|
210
|
-
event &&
|
|
211
|
-
event.target &&
|
|
212
|
-
// Element is outside the editor
|
|
213
|
-
!(editorWrapper === event.target ||
|
|
214
|
-
editorWrapper.contains(event.target))) {
|
|
215
|
-
if (this.state?.show) {
|
|
216
|
-
this.state.show = false;
|
|
217
|
-
this.emitUpdate(this.state);
|
|
218
|
-
}
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
this.updateStateFromMousePos();
|
|
222
|
-
};
|
|
223
|
-
createSyntheticEvent(event) {
|
|
224
|
-
const evt = new Event(event.type, event);
|
|
225
|
-
const editorBoundingBox = this.pmView.dom.firstChild.getBoundingClientRect();
|
|
226
|
-
evt.clientX = event.clientX;
|
|
227
|
-
evt.clientY = event.clientY;
|
|
228
|
-
if (event.clientX < editorBoundingBox.left &&
|
|
229
|
-
event.clientX >
|
|
230
|
-
editorBoundingBox.left -
|
|
231
|
-
editorBoundingBox.width *
|
|
232
|
-
PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP) {
|
|
233
|
-
// when we're slightly left of the editor, we can drop to the side of the block
|
|
234
|
-
evt.clientX =
|
|
235
|
-
editorBoundingBox.left +
|
|
236
|
-
(editorBoundingBox.width *
|
|
237
|
-
PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP) /
|
|
238
|
-
2;
|
|
239
|
-
}
|
|
240
|
-
else if (event.clientX > editorBoundingBox.right &&
|
|
241
|
-
event.clientX <
|
|
242
|
-
editorBoundingBox.right +
|
|
243
|
-
editorBoundingBox.width *
|
|
244
|
-
PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP) {
|
|
245
|
-
// when we're slightly right of the editor, we can drop to the side of the block
|
|
246
|
-
evt.clientX =
|
|
247
|
-
editorBoundingBox.right -
|
|
248
|
-
(editorBoundingBox.width *
|
|
249
|
-
PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP) /
|
|
250
|
-
2;
|
|
251
|
-
}
|
|
252
|
-
else if (event.clientX < editorBoundingBox.left ||
|
|
253
|
-
event.clientX > editorBoundingBox.right) {
|
|
254
|
-
// when mouse is outside of the editor on x axis, drop it somewhere safe (but not to the side of a block)
|
|
255
|
-
evt.clientX =
|
|
256
|
-
editorBoundingBox.left +
|
|
257
|
-
PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP *
|
|
258
|
-
editorBoundingBox.width *
|
|
259
|
-
2; // put it somewhere in first block, but safe outside of the PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP margin
|
|
260
|
-
}
|
|
261
|
-
evt.clientY = Math.min(Math.max(event.clientY, editorBoundingBox.top), editorBoundingBox.top + editorBoundingBox.height);
|
|
262
|
-
evt.dataTransfer = event.dataTransfer;
|
|
263
|
-
evt.preventDefault = () => event.preventDefault();
|
|
264
|
-
evt.synthetic = true; // prevent recursion
|
|
265
|
-
return evt;
|
|
266
|
-
}
|
|
267
|
-
// Needed in cases where the editor state updates without the mouse cursor
|
|
268
|
-
// moving, as some state updates can require a side menu update. For example,
|
|
269
|
-
// adding a button to the side menu which removes the block can cause the
|
|
270
|
-
// block below to jump up into the place of the removed block when clicked,
|
|
271
|
-
// allowing the user to click the button again without moving the cursor. This
|
|
272
|
-
// would otherwise not update the side menu, and so clicking the button again
|
|
273
|
-
// would attempt to remove the same block again, causing an error.
|
|
274
|
-
update(_view, prevState) {
|
|
275
|
-
const docChanged = !prevState.doc.eq(this.pmView.state.doc);
|
|
276
|
-
if (docChanged && this.state?.show) {
|
|
277
|
-
this.updateStateFromMousePos();
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
destroy() {
|
|
281
|
-
if (this.state?.show) {
|
|
282
|
-
this.state.show = false;
|
|
283
|
-
this.emitUpdate(this.state);
|
|
284
|
-
}
|
|
285
|
-
this.pmView.root.removeEventListener("mousemove", this.onMouseMove, true);
|
|
286
|
-
this.pmView.root.removeEventListener("dragover", this.onDragOver);
|
|
287
|
-
this.pmView.root.removeEventListener("drop", this.onDrop, true);
|
|
288
|
-
this.pmView.root.removeEventListener("keydown", this.onKeyDown, true);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
export const sideMenuPluginKey = new PluginKey("SideMenuPlugin");
|
|
292
|
-
export class SideMenuProsemirrorPlugin extends EventEmitter {
|
|
293
|
-
editor;
|
|
294
|
-
view;
|
|
295
|
-
plugin;
|
|
296
|
-
constructor(editor) {
|
|
297
|
-
super();
|
|
298
|
-
this.editor = editor;
|
|
299
|
-
this.plugin = new Plugin({
|
|
300
|
-
key: sideMenuPluginKey,
|
|
301
|
-
view: (editorView) => {
|
|
302
|
-
this.view = new SideMenuView(editor, editorView, (state) => {
|
|
303
|
-
this.emit("update", state);
|
|
304
|
-
});
|
|
305
|
-
return this.view;
|
|
306
|
-
},
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
onUpdate(callback) {
|
|
310
|
-
return this.on("update", callback);
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Handles drag & drop events for blocks.
|
|
314
|
-
*/
|
|
315
|
-
blockDragStart = (event, block) => {
|
|
316
|
-
dragStart(event, block, this.editor);
|
|
317
|
-
};
|
|
318
|
-
/**
|
|
319
|
-
* Handles drag & drop events for blocks.
|
|
320
|
-
*/
|
|
321
|
-
blockDragEnd = () => unsetDragImage(this.editor.prosemirrorView.root);
|
|
322
|
-
/**
|
|
323
|
-
* Freezes the side menu. When frozen, the side menu will stay
|
|
324
|
-
* attached to the same block regardless of which block is hovered by the
|
|
325
|
-
* mouse cursor.
|
|
326
|
-
*/
|
|
327
|
-
freezeMenu = () => {
|
|
328
|
-
this.view.menuFrozen = true;
|
|
329
|
-
this.view.state.show = true;
|
|
330
|
-
this.view.emitUpdate(this.view.state);
|
|
331
|
-
};
|
|
332
|
-
/**
|
|
333
|
-
* Unfreezes the side menu. When frozen, the side menu will stay
|
|
334
|
-
* attached to the same block regardless of which block is hovered by the
|
|
335
|
-
* mouse cursor.
|
|
336
|
-
*/
|
|
337
|
-
unfreezeMenu = () => {
|
|
338
|
-
this.view.menuFrozen = false;
|
|
339
|
-
this.view.state.show = false;
|
|
340
|
-
this.view.emitUpdate(this.view.state);
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
//# sourceMappingURL=SideMenuPlugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SideMenuPlugin.js","sourceRoot":"","sources":["../../../../src/extensions/SideMenu/SideMenuPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,C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CAAC,CAAC;gBAC7B,CAAC,CAAC,CAAC;gBACH,OAAO,IAAI,CAAC,IAAI,CAAC;YACnB,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAEM,QAAQ,CAAC,QAAuD;QACrE,OAAO,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,cAAc,GAAG,CACf,KAGC,EACD,KAA2B,EAC3B,EAAE;QACF,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC,CAAC;IAEF;;OAEG;IACH,YAAY,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtE;;;;OAIG;IACH,UAAU,GAAG,GAAG,EAAE;QAChB,IAAI,CAAC,IAAK,CAAC,UAAU,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,IAAK,CAAC,KAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,IAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAK,CAAC,KAAM,CAAC,CAAC;IAC3C,CAAC,CAAC;IACF;;;;OAIG;IACH,YAAY,GAAG,GAAG,EAAE;QAClB,IAAI,CAAC,IAAK,CAAC,UAAU,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,IAAK,CAAC,KAAM,CAAC,IAAI,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,IAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAK,CAAC,KAAM,CAAC,CAAC;IAC3C,CAAC,CAAC;CACH"}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { NodeSelection } from "prosemirror-state";
|
|
2
|
-
import * as pmView from "prosemirror-view";
|
|
3
|
-
import { createExternalHTMLExporter } from "../../api/exporters/html/externalHTMLExporter.js";
|
|
4
|
-
import { cleanHTMLToMarkdown } from "../../api/exporters/markdown/markdownExporter.js";
|
|
5
|
-
import { fragmentToBlocks } from "../../api/nodeConversions/fragmentToBlocks.js";
|
|
6
|
-
import { getNodeById } from "../../api/nodeUtil.js";
|
|
7
|
-
import { MultipleNodeSelection } from "./MultipleNodeSelection.js";
|
|
8
|
-
let dragImageElement;
|
|
9
|
-
function blockPositionsFromSelection(selection, doc) {
|
|
10
|
-
// Absolute positions just before the first block spanned by the selection, and just after the last block. Having the
|
|
11
|
-
// selection start and end just before and just after the target blocks ensures no whitespace/line breaks are left
|
|
12
|
-
// behind after dragging & dropping them.
|
|
13
|
-
let beforeFirstBlockPos;
|
|
14
|
-
let afterLastBlockPos;
|
|
15
|
-
// Even the user starts dragging blocks but drops them in the same place, the selection will still be moved just
|
|
16
|
-
// before & just after the blocks spanned by the selection, and therefore doesn't need to change if they try to drag
|
|
17
|
-
// the same blocks again. If this happens, the anchor & head move out of the block content node they were originally
|
|
18
|
-
// in. If the anchor should update but the head shouldn't and vice versa, it means the user selection is outside a
|
|
19
|
-
// block content node, which should never happen.
|
|
20
|
-
const selectionStartInBlockContent = doc.resolve(selection.from).node().type.spec.group === "blockContent";
|
|
21
|
-
const selectionEndInBlockContent = doc.resolve(selection.to).node().type.spec.group === "blockContent";
|
|
22
|
-
// Ensures that entire outermost nodes are selected if the selection spans multiple nesting levels.
|
|
23
|
-
const minDepth = Math.min(selection.$anchor.depth, selection.$head.depth);
|
|
24
|
-
if (selectionStartInBlockContent && selectionEndInBlockContent) {
|
|
25
|
-
// Absolute positions at the start of the first block in the selection and at the end of the last block. User
|
|
26
|
-
// selections will always start and end in block content nodes, but we want the start and end positions of their
|
|
27
|
-
// parent block nodes, which is why minDepth - 1 is used.
|
|
28
|
-
const startFirstBlockPos = selection.$from.start(minDepth - 1);
|
|
29
|
-
const endLastBlockPos = selection.$to.end(minDepth - 1);
|
|
30
|
-
// Shifting start and end positions by one moves them just outside the first and last selected blocks.
|
|
31
|
-
beforeFirstBlockPos = doc.resolve(startFirstBlockPos - 1).pos;
|
|
32
|
-
afterLastBlockPos = doc.resolve(endLastBlockPos + 1).pos;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
beforeFirstBlockPos = selection.from;
|
|
36
|
-
afterLastBlockPos = selection.to;
|
|
37
|
-
}
|
|
38
|
-
return { from: beforeFirstBlockPos, to: afterLastBlockPos };
|
|
39
|
-
}
|
|
40
|
-
function setDragImage(view, from, to = from) {
|
|
41
|
-
if (from === to) {
|
|
42
|
-
// Moves to position to be just after the first (and only) selected block.
|
|
43
|
-
to += view.state.doc.resolve(from + 1).node().nodeSize;
|
|
44
|
-
}
|
|
45
|
-
// Parent element is cloned to remove all unselected children without affecting the editor content.
|
|
46
|
-
const parentClone = view.domAtPos(from).node.cloneNode(true);
|
|
47
|
-
const parent = view.domAtPos(from).node;
|
|
48
|
-
const getElementIndex = (parentElement, targetElement) => Array.prototype.indexOf.call(parentElement.children, targetElement);
|
|
49
|
-
const firstSelectedBlockIndex = getElementIndex(parent,
|
|
50
|
-
// Expects from position to be just before the first selected block.
|
|
51
|
-
view.domAtPos(from + 1).node.parentElement);
|
|
52
|
-
const lastSelectedBlockIndex = getElementIndex(parent,
|
|
53
|
-
// Expects to position to be just after the last selected block.
|
|
54
|
-
view.domAtPos(to - 1).node.parentElement);
|
|
55
|
-
for (let i = parent.childElementCount - 1; i >= 0; i--) {
|
|
56
|
-
if (i > lastSelectedBlockIndex || i < firstSelectedBlockIndex) {
|
|
57
|
-
parentClone.removeChild(parentClone.children[i]);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
// dataTransfer.setDragImage(element) only works if element is attached to the DOM.
|
|
61
|
-
unsetDragImage(view.root);
|
|
62
|
-
dragImageElement = parentClone;
|
|
63
|
-
// TODO: This is hacky, need a better way of assigning classes to the editor so that they can also be applied to the
|
|
64
|
-
// drag preview.
|
|
65
|
-
const classes = view.dom.className.split(" ");
|
|
66
|
-
const inheritedClasses = classes
|
|
67
|
-
.filter((className) => className !== "ProseMirror" &&
|
|
68
|
-
className !== "bn-root" &&
|
|
69
|
-
className !== "bn-editor")
|
|
70
|
-
.join(" ");
|
|
71
|
-
dragImageElement.className =
|
|
72
|
-
dragImageElement.className + " bn-drag-preview " + inheritedClasses;
|
|
73
|
-
if (view.root instanceof ShadowRoot) {
|
|
74
|
-
view.root.appendChild(dragImageElement);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
view.root.body.appendChild(dragImageElement);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
export function unsetDragImage(rootEl) {
|
|
81
|
-
if (dragImageElement !== undefined) {
|
|
82
|
-
if (rootEl instanceof ShadowRoot) {
|
|
83
|
-
rootEl.removeChild(dragImageElement);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
rootEl.body.removeChild(dragImageElement);
|
|
87
|
-
}
|
|
88
|
-
dragImageElement = undefined;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
export function dragStart(e, block, editor) {
|
|
92
|
-
if (!e.dataTransfer) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const view = editor.prosemirrorView;
|
|
96
|
-
const posInfo = getNodeById(block.id, view.state.doc);
|
|
97
|
-
if (!posInfo) {
|
|
98
|
-
throw new Error(`Block with ID ${block.id} not found`);
|
|
99
|
-
}
|
|
100
|
-
const pos = posInfo.posBeforeNode;
|
|
101
|
-
if (pos != null) {
|
|
102
|
-
const selection = view.state.selection;
|
|
103
|
-
const doc = view.state.doc;
|
|
104
|
-
const { from, to } = blockPositionsFromSelection(selection, doc);
|
|
105
|
-
const draggedBlockInSelection = from <= pos && pos < to;
|
|
106
|
-
const multipleBlocksSelected = selection.$anchor.node() !== selection.$head.node() ||
|
|
107
|
-
selection instanceof MultipleNodeSelection;
|
|
108
|
-
if (draggedBlockInSelection && multipleBlocksSelected) {
|
|
109
|
-
view.dispatch(view.state.tr.setSelection(MultipleNodeSelection.create(doc, from, to)));
|
|
110
|
-
setDragImage(view, from, to);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos)));
|
|
114
|
-
setDragImage(view, pos);
|
|
115
|
-
}
|
|
116
|
-
const selectedSlice = view.state.selection.content();
|
|
117
|
-
const schema = editor.pmSchema;
|
|
118
|
-
const clipboardHTML = pmView.__serializeForClipboard(view, selectedSlice).dom.innerHTML;
|
|
119
|
-
const externalHTMLExporter = createExternalHTMLExporter(schema, editor);
|
|
120
|
-
const blocks = fragmentToBlocks(selectedSlice.content, editor.schema);
|
|
121
|
-
const externalHTML = externalHTMLExporter.exportBlocks(blocks, {});
|
|
122
|
-
const plainText = cleanHTMLToMarkdown(externalHTML);
|
|
123
|
-
e.dataTransfer.clearData();
|
|
124
|
-
e.dataTransfer.setData("blocknote/html", clipboardHTML);
|
|
125
|
-
e.dataTransfer.setData("text/html", externalHTML);
|
|
126
|
-
e.dataTransfer.setData("text/plain", plainText);
|
|
127
|
-
e.dataTransfer.effectAllowed = "move";
|
|
128
|
-
e.dataTransfer.setDragImage(dragImageElement, 0, 0);
|
|
129
|
-
view.dragging = { slice: selectedSlice, move: true };
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=dragging.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dragging.js","sourceRoot":"","sources":["../../../../src/extensions/SideMenu/dragging.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAa,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AASpD,OAAO,EAAE,qBAAqB,EAA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ACvD,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultGridSuggestionItem.js","sourceRoot":"","sources":["../../../../src/extensions/SuggestionMenu/DefaultGridSuggestionItem.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultSuggestionItem.js","sourceRoot":"","sources":["../../../../src/extensions/SuggestionMenu/DefaultSuggestionItem.ts"],"names":[],"mappings":""}
|