@blocknote/core 0.21.0 → 0.23.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 +2320 -1692
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +7 -7
- 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/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/basicBlocks.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/basicBlocksWithProps.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html +1 -0
- package/src/api/clipboard/clipboardExternal.test.ts +161 -0
- package/src/api/clipboard/{clipboard.test.ts → clipboardInternal.test.ts} +186 -38
- package/src/api/clipboard/testUtil.ts +27 -0
- package/src/api/clipboard/toClipboard/copyExtension.ts +1 -0
- package/src/api/exporters/html/__snapshots__/pageBreak/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/pageBreak/basic/internal.html +1 -0
- 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__/pageBreak/basic/markdown.md +0 -0
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +16 -0
- package/src/api/nodeConversions/nodeToBlock.ts +4 -1
- package/src/api/parsers/html/__snapshots__/parse-codeblocks.json +62 -0
- package/src/api/parsers/html/parseHTML.test.ts +9 -0
- package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +2 -2
- package/src/api/testUtil/cases/defaultSchema.ts +15 -1
- package/src/api/testUtil/partialBlockTestUtil.ts +4 -1
- package/src/blocks/CodeBlockContent/CodeBlockContent.ts +32 -11
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +3 -28
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +1 -1
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +4 -16
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +11 -3
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +26 -6
- package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +49 -0
- package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +45 -0
- package/src/blocks/PageBreakBlockContent/schema.ts +40 -0
- package/src/editor/Block.css +18 -4
- package/src/editor/BlockNoteEditor.test.ts +21 -1
- package/src/editor/BlockNoteEditor.ts +17 -0
- package/src/editor/BlockNoteExtensions.ts +111 -16
- package/src/editor/editor.css +28 -13
- package/src/editor/transformPasted.ts +57 -4
- package/src/extensions/SideMenu/SideMenuPlugin.ts +115 -23
- package/src/extensions/SideMenu/dragging.ts +0 -1
- package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +1 -1
- package/src/i18n/locales/ar.ts +6 -0
- package/src/i18n/locales/de.ts +6 -0
- package/src/i18n/locales/en.ts +6 -0
- package/src/i18n/locales/es.ts +6 -0
- package/src/i18n/locales/fr.ts +47 -17
- package/src/i18n/locales/hr.ts +72 -54
- package/src/i18n/locales/index.ts +1 -0
- package/src/i18n/locales/is.ts +6 -0
- package/src/i18n/locales/it.ts +315 -0
- package/src/i18n/locales/ja.ts +6 -0
- package/src/i18n/locales/ko.ts +6 -0
- package/src/i18n/locales/nl.ts +6 -0
- package/src/i18n/locales/pl.ts +6 -0
- package/src/i18n/locales/pt.ts +6 -0
- package/src/i18n/locales/ru.ts +6 -0
- package/src/i18n/locales/vi.ts +6 -0
- package/src/i18n/locales/zh.ts +6 -0
- package/src/index.ts +3 -0
- package/src/schema/blocks/createSpec.ts +1 -1
- package/src/schema/blocks/internal.ts +16 -6
- 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/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/api/testUtil/cases/defaultSchema.d.ts +2 -1
- package/types/src/blocks/CodeBlockContent/CodeBlockContent.d.ts +2 -0
- package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +12 -0
- package/types/src/blocks/PageBreakBlockContent/PageBreakBlockContent.d.ts +31 -0
- package/types/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.d.ts +8 -0
- package/types/src/blocks/PageBreakBlockContent/schema.d.ts +86 -0
- package/types/src/blocks/defaultBlocks.d.ts +16 -0
- package/types/src/editor/BlockNoteEditor.d.ts +15 -0
- package/types/src/editor/BlockNoteExtensions.d.ts +2 -0
- package/types/src/editor/transformPasted.d.ts +8 -4
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +25 -5
- package/types/src/extensions/SuggestionMenu/DefaultSuggestionItem.d.ts +1 -1
- package/types/src/i18n/locales/de.d.ts +6 -0
- package/types/src/i18n/locales/en.d.ts +6 -0
- package/types/src/i18n/locales/es.d.ts +6 -0
- package/types/src/i18n/locales/hr.d.ts +6 -0
- package/types/src/i18n/locales/index.d.ts +1 -0
- package/types/src/i18n/locales/it.d.ts +245 -0
- package/types/src/index.d.ts +3 -0
- 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 -249
- 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 -25
- 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 -134
- 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 -112
- 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 -104
- package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +0 -1
- package/dist/src/blocks/AudioBlockContent/parseAudioElement.js +0 -5
- package/dist/src/blocks/AudioBlockContent/parseAudioElement.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 -71
- package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js +0 -5
- package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js +0 -10
- package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js +0 -39
- package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js +0 -51
- package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js +0 -17
- package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js +0 -147
- package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js +0 -9
- package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js +0 -11
- package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.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 -114
- package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +0 -1
- package/dist/src/blocks/ImageBlockContent/parseImageElement.js +0 -6
- package/dist/src/blocks/ImageBlockContent/parseImageElement.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 -114
- package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +0 -1
- package/dist/src/blocks/VideoBlockContent/parseVideoElement.js +0 -6
- package/dist/src/blocks/VideoBlockContent/parseVideoElement.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 -751
- 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 -192
- 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/LinkToolbar/protocols.js +0 -14
- package/dist/src/extensions/LinkToolbar/protocols.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 -347
- package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +0 -1
- package/dist/src/extensions/SideMenu/dragging.js +0 -135
- 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 -579
- 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 -63
- 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__/{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__/{tableAllCells.html → internal/tableAllCells.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{tableCell.html → internal/tableCell.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{tableCellText.html → internal/tableCellText.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{tableRow.html → internal/tableRow.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{unstyledText.html → internal/unstyledText.html} +0 -0
- /package/types/src/api/clipboard/{clipboard.test.d.ts → clipboardExternal.test.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EditorState, Plugin, PluginKey } from "
|
|
3
|
-
import { EditorView } from "
|
|
1
|
+
import { DOMParser, Slice } from "@tiptap/pm/model";
|
|
2
|
+
import { EditorState, Plugin, PluginKey, PluginView } from "@tiptap/pm/state";
|
|
3
|
+
import { EditorView } from "@tiptap/pm/view";
|
|
4
4
|
|
|
5
5
|
import { Block } from "../../blocks/defaultBlocks.js";
|
|
6
6
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
@@ -14,6 +14,7 @@ import { EventEmitter } from "../../util/EventEmitter.js";
|
|
|
14
14
|
import { initializeESMDependencies } from "../../util/esmDependencies.js";
|
|
15
15
|
import { getDraggableBlockFromElement } from "../getDraggableBlockFromElement.js";
|
|
16
16
|
import { dragStart, unsetDragImage } from "./dragging.js";
|
|
17
|
+
|
|
17
18
|
export type SideMenuState<
|
|
18
19
|
BSchema extends BlockSchema,
|
|
19
20
|
I extends InlineContentSchema,
|
|
@@ -28,9 +29,14 @@ const PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP = 0.1;
|
|
|
28
29
|
function getBlockFromCoords(
|
|
29
30
|
view: EditorView,
|
|
30
31
|
coords: { left: number; top: number },
|
|
32
|
+
sideMenuDetection: "viewport" | "editor",
|
|
31
33
|
adjustForColumns = true
|
|
32
34
|
) {
|
|
33
|
-
const elements = view.root.elementsFromPoint(
|
|
35
|
+
const elements = view.root.elementsFromPoint(
|
|
36
|
+
// bit hacky - offset x position to right to account for the width of sidemenu itself
|
|
37
|
+
coords.left + (sideMenuDetection === "editor" ? 50 : 0),
|
|
38
|
+
coords.top
|
|
39
|
+
);
|
|
34
40
|
|
|
35
41
|
for (const element of elements) {
|
|
36
42
|
if (!view.dom.contains(element)) {
|
|
@@ -46,6 +52,7 @@ function getBlockFromCoords(
|
|
|
46
52
|
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
|
|
47
53
|
top: coords.top,
|
|
48
54
|
},
|
|
55
|
+
sideMenuDetection,
|
|
49
56
|
false
|
|
50
57
|
);
|
|
51
58
|
}
|
|
@@ -60,7 +67,8 @@ function getBlockFromMousePos(
|
|
|
60
67
|
x: number;
|
|
61
68
|
y: number;
|
|
62
69
|
},
|
|
63
|
-
view: EditorView
|
|
70
|
+
view: EditorView,
|
|
71
|
+
sideMenuDetection: "viewport" | "editor"
|
|
64
72
|
): { node: HTMLElement; id: string } | undefined {
|
|
65
73
|
// Editor itself may have padding or other styling which affects
|
|
66
74
|
// size/position, so we get the boundingRect of the first child (i.e. the
|
|
@@ -76,7 +84,7 @@ function getBlockFromMousePos(
|
|
|
76
84
|
|
|
77
85
|
// this.horizontalPosAnchor = editorBoundingBox.x;
|
|
78
86
|
|
|
79
|
-
// Gets block at mouse cursor's
|
|
87
|
+
// Gets block at mouse cursor's position.
|
|
80
88
|
const coords = {
|
|
81
89
|
left: mousePos.x,
|
|
82
90
|
top: mousePos.y,
|
|
@@ -85,15 +93,18 @@ function getBlockFromMousePos(
|
|
|
85
93
|
const mouseLeftOfEditor = coords.left < editorBoundingBox.left;
|
|
86
94
|
const mouseRightOfEditor = coords.left > editorBoundingBox.right;
|
|
87
95
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
// Clamps the x position to the editor's bounding box.
|
|
97
|
+
if (sideMenuDetection === "viewport") {
|
|
98
|
+
if (mouseLeftOfEditor) {
|
|
99
|
+
coords.left = editorBoundingBox.left + 10;
|
|
100
|
+
}
|
|
91
101
|
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
if (mouseRightOfEditor) {
|
|
103
|
+
coords.left = editorBoundingBox.right - 10;
|
|
104
|
+
}
|
|
94
105
|
}
|
|
95
106
|
|
|
96
|
-
let block = getBlockFromCoords(view, coords);
|
|
107
|
+
let block = getBlockFromCoords(view, coords, sideMenuDetection);
|
|
97
108
|
|
|
98
109
|
if (!mouseRightOfEditor && block) {
|
|
99
110
|
// note: this case is not necessary when we're on the right side of the editor
|
|
@@ -101,14 +112,14 @@ function getBlockFromMousePos(
|
|
|
101
112
|
/* Now, because blocks can be nested
|
|
102
113
|
| BlockA |
|
|
103
114
|
x | BlockB y|
|
|
104
|
-
|
|
115
|
+
|
|
105
116
|
hovering over position x (the "margin of block B") will return block A instead of block B.
|
|
106
117
|
to fix this, we get the block from the right side of block A (position y, which will fall in BlockB correctly)
|
|
107
118
|
*/
|
|
108
119
|
|
|
109
120
|
const rect = block.node.getBoundingClientRect();
|
|
110
121
|
coords.left = rect.right - 10;
|
|
111
|
-
block = getBlockFromCoords(view, coords, false);
|
|
122
|
+
block = getBlockFromCoords(view, coords, "viewport", false);
|
|
112
123
|
}
|
|
113
124
|
|
|
114
125
|
return block;
|
|
@@ -132,8 +143,11 @@ export class SideMenuView<
|
|
|
132
143
|
|
|
133
144
|
public menuFrozen = false;
|
|
134
145
|
|
|
146
|
+
public isDragOrigin = false;
|
|
147
|
+
|
|
135
148
|
constructor(
|
|
136
149
|
private readonly editor: BlockNoteEditor<BSchema, I, S>,
|
|
150
|
+
private readonly sideMenuDetection: "viewport" | "editor",
|
|
137
151
|
private readonly pmView: EditorView,
|
|
138
152
|
emitUpdate: (state: SideMenuState<BSchema, I, S>) => void
|
|
139
153
|
) {
|
|
@@ -146,14 +160,18 @@ export class SideMenuView<
|
|
|
146
160
|
};
|
|
147
161
|
|
|
148
162
|
this.pmView.root.addEventListener(
|
|
149
|
-
"
|
|
150
|
-
this.
|
|
151
|
-
true
|
|
163
|
+
"dragstart",
|
|
164
|
+
this.onDragStart as EventListener
|
|
152
165
|
);
|
|
153
166
|
this.pmView.root.addEventListener(
|
|
154
167
|
"dragover",
|
|
155
168
|
this.onDragOver as EventListener
|
|
156
169
|
);
|
|
170
|
+
this.pmView.root.addEventListener(
|
|
171
|
+
"drop",
|
|
172
|
+
this.onDrop as EventListener,
|
|
173
|
+
true
|
|
174
|
+
);
|
|
157
175
|
initializeESMDependencies();
|
|
158
176
|
|
|
159
177
|
// Shows or updates menu position whenever the cursor moves, if the menu isn't frozen.
|
|
@@ -181,7 +199,11 @@ export class SideMenuView<
|
|
|
181
199
|
return;
|
|
182
200
|
}
|
|
183
201
|
|
|
184
|
-
const block = getBlockFromMousePos(
|
|
202
|
+
const block = getBlockFromMousePos(
|
|
203
|
+
this.mousePos,
|
|
204
|
+
this.pmView,
|
|
205
|
+
this.sideMenuDetection
|
|
206
|
+
);
|
|
185
207
|
|
|
186
208
|
// Closes the menu if the mouse cursor is beyond the editor vertically.
|
|
187
209
|
if (!block || !this.editor.isEditable) {
|
|
@@ -249,7 +271,16 @@ export class SideMenuView<
|
|
|
249
271
|
onDrop = (event: DragEvent) => {
|
|
250
272
|
this.editor._tiptapEditor.commands.blur();
|
|
251
273
|
|
|
274
|
+
// ProseMirror doesn't remove the dragged content if it's dropped outside
|
|
275
|
+
// the editor (e.g. to other editors), so we need to do it manually. Since
|
|
276
|
+
// the dragged content is the same as the selected content, we can just
|
|
277
|
+
// delete the selection.
|
|
278
|
+
if (this.isDragOrigin && !this.pmView.dom.contains(event.target as Node)) {
|
|
279
|
+
this.pmView.dispatch(this.pmView.state.tr.deleteSelection());
|
|
280
|
+
}
|
|
281
|
+
|
|
252
282
|
if (
|
|
283
|
+
this.sideMenuDetection === "editor" ||
|
|
253
284
|
(event as any).synthetic ||
|
|
254
285
|
!event.dataTransfer?.types.includes("blocknote/html")
|
|
255
286
|
) {
|
|
@@ -268,6 +299,46 @@ export class SideMenuView<
|
|
|
268
299
|
}
|
|
269
300
|
};
|
|
270
301
|
|
|
302
|
+
/**
|
|
303
|
+
* If a block is being dragged, ProseMirror usually gets the context of what's
|
|
304
|
+
* being dragged from `view.dragging`, which is automatically set when a
|
|
305
|
+
* `dragstart` event fires in the editor. However, if the user tries to drag
|
|
306
|
+
* and drop blocks between multiple editors, only the one in which the drag
|
|
307
|
+
* began has that context, so we need to set it on the others manually. This
|
|
308
|
+
* ensures that PM always drops the blocks in between other blocks, and not
|
|
309
|
+
* inside them.
|
|
310
|
+
*
|
|
311
|
+
* After the `dragstart` event fires on the drag handle, it sets
|
|
312
|
+
* `blocknote/html` data on the clipboard. This handler fires right after,
|
|
313
|
+
* parsing the `blocknote/html` data into nodes and setting them on
|
|
314
|
+
* `view.dragging`.
|
|
315
|
+
*
|
|
316
|
+
* Note: Setting `view.dragging` on `dragover` would be better as the user
|
|
317
|
+
* could then drag between editors in different windows, but you can only
|
|
318
|
+
* access `dataTransfer` contents on `dragstart` and `drop` events.
|
|
319
|
+
*/
|
|
320
|
+
onDragStart = (event: DragEvent) => {
|
|
321
|
+
if (!this.pmView.dragging) {
|
|
322
|
+
const html = event.dataTransfer?.getData("blocknote/html");
|
|
323
|
+
if (!html) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
const element = document.createElement("div");
|
|
328
|
+
element.innerHTML = html;
|
|
329
|
+
|
|
330
|
+
const parser = DOMParser.fromSchema(this.pmView.state.schema);
|
|
331
|
+
const node = parser.parse(element, {
|
|
332
|
+
topNode: this.pmView.state.schema.nodes["blockGroup"].create(),
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
this.pmView.dragging = {
|
|
336
|
+
slice: new Slice(node.content, 0, 0),
|
|
337
|
+
move: true,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
|
|
271
342
|
/**
|
|
272
343
|
* If the event is outside the editor contents,
|
|
273
344
|
* we dispatch a fake event, so that we can still drop the content
|
|
@@ -275,11 +346,13 @@ export class SideMenuView<
|
|
|
275
346
|
*/
|
|
276
347
|
onDragOver = (event: DragEvent) => {
|
|
277
348
|
if (
|
|
349
|
+
this.sideMenuDetection === "editor" ||
|
|
278
350
|
(event as any).synthetic ||
|
|
279
351
|
!event.dataTransfer?.types.includes("blocknote/html")
|
|
280
352
|
) {
|
|
281
353
|
return;
|
|
282
354
|
}
|
|
355
|
+
|
|
283
356
|
const pos = this.pmView.posAtCoords({
|
|
284
357
|
left: event.clientX,
|
|
285
358
|
top: event.clientY,
|
|
@@ -424,11 +497,14 @@ export class SideMenuView<
|
|
|
424
497
|
this.onMouseMove as EventListener,
|
|
425
498
|
true
|
|
426
499
|
);
|
|
500
|
+
this.pmView.root.removeEventListener(
|
|
501
|
+
"dragstart",
|
|
502
|
+
this.onDragStart as EventListener
|
|
503
|
+
);
|
|
427
504
|
this.pmView.root.removeEventListener(
|
|
428
505
|
"dragover",
|
|
429
506
|
this.onDragOver as EventListener
|
|
430
507
|
);
|
|
431
|
-
|
|
432
508
|
this.pmView.root.removeEventListener(
|
|
433
509
|
"drop",
|
|
434
510
|
this.onDrop as EventListener,
|
|
@@ -452,14 +528,22 @@ export class SideMenuProsemirrorPlugin<
|
|
|
452
528
|
public view: SideMenuView<BSchema, I, S> | undefined;
|
|
453
529
|
public readonly plugin: Plugin;
|
|
454
530
|
|
|
455
|
-
constructor(
|
|
531
|
+
constructor(
|
|
532
|
+
private readonly editor: BlockNoteEditor<BSchema, I, S>,
|
|
533
|
+
sideMenuDetection: "viewport" | "editor"
|
|
534
|
+
) {
|
|
456
535
|
super();
|
|
457
536
|
this.plugin = new Plugin({
|
|
458
537
|
key: sideMenuPluginKey,
|
|
459
538
|
view: (editorView) => {
|
|
460
|
-
this.view = new SideMenuView(
|
|
461
|
-
|
|
462
|
-
|
|
539
|
+
this.view = new SideMenuView(
|
|
540
|
+
editor,
|
|
541
|
+
sideMenuDetection,
|
|
542
|
+
editorView,
|
|
543
|
+
(state) => {
|
|
544
|
+
this.emit("update", state);
|
|
545
|
+
}
|
|
546
|
+
);
|
|
463
547
|
return this.view;
|
|
464
548
|
},
|
|
465
549
|
});
|
|
@@ -479,6 +563,10 @@ export class SideMenuProsemirrorPlugin<
|
|
|
479
563
|
},
|
|
480
564
|
block: Block<BSchema, I, S>
|
|
481
565
|
) => {
|
|
566
|
+
if (this.view) {
|
|
567
|
+
this.view.isDragOrigin = true;
|
|
568
|
+
}
|
|
569
|
+
|
|
482
570
|
dragStart(event, block, this.editor);
|
|
483
571
|
};
|
|
484
572
|
|
|
@@ -489,6 +577,10 @@ export class SideMenuProsemirrorPlugin<
|
|
|
489
577
|
if (this.editor.prosemirrorView) {
|
|
490
578
|
unsetDragImage(this.editor.prosemirrorView.root);
|
|
491
579
|
}
|
|
580
|
+
|
|
581
|
+
if (this.view) {
|
|
582
|
+
this.view.isDragOrigin = false;
|
|
583
|
+
}
|
|
492
584
|
};
|
|
493
585
|
/**
|
|
494
586
|
* Freezes the side menu. When frozen, the side menu will stay
|
package/src/i18n/locales/ar.ts
CHANGED
|
@@ -58,6 +58,12 @@ export const ar: Dictionary = {
|
|
|
58
58
|
aliases: ["كود", "مسبق"],
|
|
59
59
|
group: "الكتل الأساسية",
|
|
60
60
|
},
|
|
61
|
+
page_break: {
|
|
62
|
+
title: "فاصل الصفحة",
|
|
63
|
+
subtext: "فاصل الصفحة",
|
|
64
|
+
aliases: ["page", "break", "separator", "فاصل", "الصفحة"],
|
|
65
|
+
group: "الكتل الأساسية",
|
|
66
|
+
},
|
|
61
67
|
table: {
|
|
62
68
|
title: "جدول",
|
|
63
69
|
subtext: "يستخدم للجداول",
|
package/src/i18n/locales/de.ts
CHANGED
|
@@ -56,6 +56,12 @@ export const de = {
|
|
|
56
56
|
aliases: ["code", "pre"],
|
|
57
57
|
group: "Grundlegende blöcke",
|
|
58
58
|
},
|
|
59
|
+
page_break: {
|
|
60
|
+
title: "Seitenumbruch",
|
|
61
|
+
subtext: "Seitentrenner",
|
|
62
|
+
aliases: ["page", "break", "separator", "seitenumbruch", "trenner"],
|
|
63
|
+
group: "Grundlegende Blöcke",
|
|
64
|
+
},
|
|
59
65
|
table: {
|
|
60
66
|
title: "Tabelle",
|
|
61
67
|
subtext: "Tabelle mit editierbaren Zellen",
|
package/src/i18n/locales/en.ts
CHANGED
|
@@ -56,6 +56,12 @@ export const en = {
|
|
|
56
56
|
aliases: ["code", "pre"],
|
|
57
57
|
group: "Basic blocks",
|
|
58
58
|
},
|
|
59
|
+
page_break: {
|
|
60
|
+
title: "Page Break",
|
|
61
|
+
subtext: "Page separator",
|
|
62
|
+
aliases: ["page", "break", "separator"],
|
|
63
|
+
group: "Basic blocks",
|
|
64
|
+
},
|
|
59
65
|
table: {
|
|
60
66
|
title: "Table",
|
|
61
67
|
subtext: "Table with editable cells",
|
package/src/i18n/locales/es.ts
CHANGED
|
@@ -55,6 +55,12 @@ export const es = {
|
|
|
55
55
|
aliases: ["code", "pre"],
|
|
56
56
|
group: "Bloques básicos",
|
|
57
57
|
},
|
|
58
|
+
page_break: {
|
|
59
|
+
title: "Salto de página",
|
|
60
|
+
subtext: "Separador de página",
|
|
61
|
+
aliases: ["page", "break", "separator", "salto", "separador"],
|
|
62
|
+
group: "Bloques básicos",
|
|
63
|
+
},
|
|
58
64
|
table: {
|
|
59
65
|
title: "Tabla",
|
|
60
66
|
subtext: "Tabla con celdas editables",
|
package/src/i18n/locales/fr.ts
CHANGED
|
@@ -10,13 +10,14 @@ export const fr: Dictionary = {
|
|
|
10
10
|
},
|
|
11
11
|
heading_2: {
|
|
12
12
|
title: "Titre 2",
|
|
13
|
-
subtext: "Utilisé pour les sections clés",
|
|
13
|
+
subtext: "Titre de deuxième niveau Utilisé pour les sections clés",
|
|
14
14
|
aliases: ["h2", "titre2", "sous-titre"],
|
|
15
15
|
group: "Titres",
|
|
16
16
|
},
|
|
17
17
|
heading_3: {
|
|
18
18
|
title: "Titre 3",
|
|
19
|
-
subtext:
|
|
19
|
+
subtext:
|
|
20
|
+
"Titre de troisième niveau utilisé pour les sous-sections et les titres de groupe",
|
|
20
21
|
aliases: ["h3", "titre3", "sous-titre"],
|
|
21
22
|
group: "Titres",
|
|
22
23
|
},
|
|
@@ -27,13 +28,21 @@ export const fr: Dictionary = {
|
|
|
27
28
|
group: "Blocs de base",
|
|
28
29
|
},
|
|
29
30
|
bullet_list: {
|
|
30
|
-
title: "Liste à
|
|
31
|
-
subtext: "Utilisé pour afficher une liste non
|
|
32
|
-
aliases: [
|
|
31
|
+
title: "Liste à puces",
|
|
32
|
+
subtext: "Utilisé pour afficher une liste à puce non numérotée",
|
|
33
|
+
aliases: [
|
|
34
|
+
"ul",
|
|
35
|
+
"li",
|
|
36
|
+
"liste",
|
|
37
|
+
"listeàpuces",
|
|
38
|
+
"liste à puces",
|
|
39
|
+
"bullet points",
|
|
40
|
+
"bulletpoints",
|
|
41
|
+
],
|
|
33
42
|
group: "Blocs de base",
|
|
34
43
|
},
|
|
35
44
|
check_list: {
|
|
36
|
-
title: "Liste de
|
|
45
|
+
title: "Liste de tâches",
|
|
37
46
|
subtext: "Utilisé pour afficher une liste avec des cases à cocher",
|
|
38
47
|
aliases: [
|
|
39
48
|
"ul",
|
|
@@ -42,13 +51,18 @@ export const fr: Dictionary = {
|
|
|
42
51
|
"liste de vérification",
|
|
43
52
|
"liste cochée",
|
|
44
53
|
"case à cocher",
|
|
54
|
+
"checklist",
|
|
55
|
+
"checkbox",
|
|
56
|
+
"check box",
|
|
57
|
+
"to do",
|
|
58
|
+
"todo",
|
|
45
59
|
],
|
|
46
60
|
group: "Blocs de base",
|
|
47
61
|
},
|
|
48
62
|
paragraph: {
|
|
49
63
|
title: "Paragraphe",
|
|
50
64
|
subtext: "Utilisé pour le corps de votre document",
|
|
51
|
-
aliases: ["p", "paragraphe"],
|
|
65
|
+
aliases: ["p", "paragraphe", "texte"],
|
|
52
66
|
group: "Blocs de base",
|
|
53
67
|
},
|
|
54
68
|
code_block: {
|
|
@@ -57,10 +71,16 @@ export const fr: Dictionary = {
|
|
|
57
71
|
aliases: ["code", "pre"],
|
|
58
72
|
group: "Blocs de base",
|
|
59
73
|
},
|
|
74
|
+
page_break: {
|
|
75
|
+
title: "Saut de page",
|
|
76
|
+
subtext: "Séparateur de page",
|
|
77
|
+
aliases: ["page", "break", "separator", "saut", "séparateur"],
|
|
78
|
+
group: "Blocs de base",
|
|
79
|
+
},
|
|
60
80
|
table: {
|
|
61
81
|
title: "Tableau",
|
|
62
82
|
subtext: "Utilisé pour les tableaux",
|
|
63
|
-
aliases: ["tableau"],
|
|
83
|
+
aliases: ["tableau", "grille"],
|
|
64
84
|
group: "Avancé",
|
|
65
85
|
},
|
|
66
86
|
image: {
|
|
@@ -69,7 +89,9 @@ export const fr: Dictionary = {
|
|
|
69
89
|
aliases: [
|
|
70
90
|
"image",
|
|
71
91
|
"uploadImage",
|
|
72
|
-
"télécharger",
|
|
92
|
+
"télécharger image",
|
|
93
|
+
"téléverser image",
|
|
94
|
+
"uploader image",
|
|
73
95
|
"img",
|
|
74
96
|
"photo",
|
|
75
97
|
"média",
|
|
@@ -82,8 +104,8 @@ export const fr: Dictionary = {
|
|
|
82
104
|
subtext: "Insérer une vidéo",
|
|
83
105
|
aliases: [
|
|
84
106
|
"vidéo",
|
|
85
|
-
"
|
|
86
|
-
"téléverser",
|
|
107
|
+
"télécharger vidéo",
|
|
108
|
+
"téléverser vidéo",
|
|
87
109
|
"mp4",
|
|
88
110
|
"film",
|
|
89
111
|
"média",
|
|
@@ -96,8 +118,8 @@ export const fr: Dictionary = {
|
|
|
96
118
|
subtext: "Insérer un audio",
|
|
97
119
|
aliases: [
|
|
98
120
|
"audio",
|
|
99
|
-
"
|
|
100
|
-
"téléverser",
|
|
121
|
+
"télécharger audio",
|
|
122
|
+
"téléverser audio",
|
|
101
123
|
"mp3",
|
|
102
124
|
"son",
|
|
103
125
|
"média",
|
|
@@ -108,18 +130,26 @@ export const fr: Dictionary = {
|
|
|
108
130
|
file: {
|
|
109
131
|
title: "Fichier",
|
|
110
132
|
subtext: "Insérer un fichier",
|
|
111
|
-
aliases: [
|
|
133
|
+
aliases: [
|
|
134
|
+
"fichier",
|
|
135
|
+
"téléverser fichier",
|
|
136
|
+
"intégrer fichier",
|
|
137
|
+
"insérer fichier",
|
|
138
|
+
"média",
|
|
139
|
+
"url",
|
|
140
|
+
],
|
|
112
141
|
group: "Média",
|
|
113
142
|
},
|
|
114
143
|
emoji: {
|
|
115
144
|
title: "Emoji",
|
|
116
145
|
subtext: "Utilisé pour insérer un emoji",
|
|
117
|
-
aliases: ["emoji", "émoticône", "émotion", "visage"],
|
|
146
|
+
aliases: ["emoji", "émoticône", "émotion", "visage", "smiley"],
|
|
118
147
|
group: "Autres",
|
|
119
148
|
},
|
|
120
149
|
},
|
|
121
150
|
placeholders: {
|
|
122
|
-
default:
|
|
151
|
+
default:
|
|
152
|
+
"Entrez du texte ou tapez '/' pour faire apparaître les options de mise en page",
|
|
123
153
|
heading: "Titre",
|
|
124
154
|
bulletListItem: "Liste",
|
|
125
155
|
numberedListItem: "Liste",
|
|
@@ -280,7 +310,7 @@ export const fr: Dictionary = {
|
|
|
280
310
|
audio: "Télécharger un fichier audio",
|
|
281
311
|
file: "Télécharger un fichier",
|
|
282
312
|
},
|
|
283
|
-
upload_error: "Erreur :
|
|
313
|
+
upload_error: "Erreur : échec du téléchargement",
|
|
284
314
|
},
|
|
285
315
|
embed: {
|
|
286
316
|
title: "Intégrer",
|