@blocknote/core 0.17.1 → 0.19.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 +2774 -1804
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +9 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +27 -0
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js +99 -0
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js +97 -0
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js +88 -0
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.js +116 -0
- package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js +106 -0
- package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js +57 -0
- package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +43 -0
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +27 -0
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +29 -0
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js +157 -0
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +27 -0
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +64 -0
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +145 -0
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +1 -0
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js +252 -0
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js.map +1 -0
- package/dist/src/api/blockManipulation/insertContentAt.js +64 -0
- package/dist/src/api/blockManipulation/insertContentAt.js.map +1 -0
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +76 -0
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +1 -0
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js +33 -0
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js.map +1 -0
- package/dist/src/api/blockManipulation/setupTestEnv.js +172 -0
- package/dist/src/api/blockManipulation/setupTestEnv.js.map +1 -0
- package/dist/src/api/clipboard/clipboard.test.js +246 -0
- package/dist/src/api/clipboard/clipboard.test.js.map +1 -0
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +8 -0
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +1 -0
- package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js +38 -0
- package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js.map +1 -0
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +109 -0
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +1 -0
- package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js +26 -0
- package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js.map +1 -0
- package/dist/src/api/clipboard/fromClipboard/pasteExtension.js +57 -0
- package/dist/src/api/clipboard/fromClipboard/pasteExtension.js.map +1 -0
- package/dist/src/api/clipboard/toClipboard/copyExtension.js +132 -0
- package/dist/src/api/clipboard/toClipboard/copyExtension.js.map +1 -0
- package/dist/src/api/exporters/html/externalHTMLExporter.js +35 -0
- package/dist/src/api/exporters/html/externalHTMLExporter.js.map +1 -0
- package/dist/src/api/exporters/html/htmlConversion.test.js +72 -0
- package/dist/src/api/exporters/html/htmlConversion.test.js.map +1 -0
- package/dist/src/api/exporters/html/internalHTMLSerializer.js +21 -0
- package/dist/src/api/exporters/html/internalHTMLSerializer.js.map +1 -0
- package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js +141 -0
- package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js.map +1 -0
- package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js +96 -0
- package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js.map +1 -0
- package/dist/src/api/exporters/markdown/markdownExporter.js +31 -0
- package/dist/src/api/exporters/markdown/markdownExporter.js.map +1 -0
- package/dist/src/api/exporters/markdown/markdownExporter.test.js +57 -0
- package/dist/src/api/exporters/markdown/markdownExporter.test.js.map +1 -0
- package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js +33 -0
- package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js.map +1 -0
- package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js +37 -0
- package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js.map +1 -0
- package/dist/src/api/getBlockInfoFromPos.js +171 -0
- package/dist/src/api/getBlockInfoFromPos.js.map +1 -0
- package/dist/src/api/nodeConversions/blockToNode.js +197 -0
- package/dist/src/api/nodeConversions/blockToNode.js.map +1 -0
- package/dist/src/api/nodeConversions/fragmentToBlocks.js +50 -0
- package/dist/src/api/nodeConversions/fragmentToBlocks.js.map +1 -0
- package/dist/src/api/nodeConversions/nodeConversions.test.js +54 -0
- package/dist/src/api/nodeConversions/nodeConversions.test.js.map +1 -0
- package/dist/src/api/nodeConversions/nodeToBlock.js +316 -0
- package/dist/src/api/nodeConversions/nodeToBlock.js.map +1 -0
- package/dist/src/api/nodeUtil.js +28 -0
- package/dist/src/api/nodeUtil.js.map +1 -0
- package/dist/src/api/parsers/html/parseHTML.js +19 -0
- package/dist/src/api/parsers/html/parseHTML.js.map +1 -0
- package/dist/src/api/parsers/html/parseHTML.test.js +470 -0
- package/dist/src/api/parsers/html/parseHTML.test.js.map +1 -0
- package/dist/src/api/parsers/html/util/nestedLists.js +106 -0
- package/dist/src/api/parsers/html/util/nestedLists.js.map +1 -0
- package/dist/src/api/parsers/html/util/nestedLists.test.js +166 -0
- package/dist/src/api/parsers/html/util/nestedLists.test.js.map +1 -0
- package/dist/src/api/parsers/markdown/parseMarkdown.js +52 -0
- package/dist/src/api/parsers/markdown/parseMarkdown.js.map +1 -0
- package/dist/src/api/parsers/markdown/parseMarkdown.test.js +109 -0
- package/dist/src/api/parsers/markdown/parseMarkdown.test.js.map +1 -0
- package/dist/src/api/testUtil/cases/customBlocks.js +313 -0
- package/dist/src/api/testUtil/cases/customBlocks.js.map +1 -0
- package/dist/src/api/testUtil/cases/customInlineContent.js +91 -0
- package/dist/src/api/testUtil/cases/customInlineContent.js.map +1 -0
- package/dist/src/api/testUtil/cases/customStyles.js +83 -0
- package/dist/src/api/testUtil/cases/customStyles.js.map +1 -0
- package/dist/src/api/testUtil/cases/defaultSchema.js +673 -0
- package/dist/src/api/testUtil/cases/defaultSchema.js.map +1 -0
- package/dist/src/api/testUtil/index.js +2 -0
- package/dist/src/api/testUtil/index.js.map +1 -0
- package/dist/src/api/testUtil/partialBlockTestUtil.js +114 -0
- package/dist/src/api/testUtil/partialBlockTestUtil.js.map +1 -0
- package/dist/src/api/testUtil/paste.js +29 -0
- package/dist/src/api/testUtil/paste.js.map +1 -0
- package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js +97 -0
- package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +1 -0
- package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js +5 -0
- package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js.map +1 -0
- package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js +273 -0
- package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js.map +1 -0
- package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js +90 -0
- package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js.map +1 -0
- package/dist/src/blocks/FileBlockContent/FileBlockContent.js +70 -0
- package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +1 -0
- package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js +317 -0
- package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js.map +1 -0
- package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js +15 -0
- package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js.map +1 -0
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +141 -0
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +1 -0
- package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js +106 -0
- package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +1 -0
- package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js +6 -0
- package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js.map +1 -0
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +111 -0
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +1 -0
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +218 -0
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +1 -0
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +41 -0
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +1 -0
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js +58 -0
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js.map +1 -0
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +128 -0
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +1 -0
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +51 -0
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +1 -0
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js +130 -0
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +1 -0
- package/dist/src/blocks/TableBlockContent/TableExtension.js +57 -0
- package/dist/src/blocks/TableBlockContent/TableExtension.js.map +1 -0
- package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js +103 -0
- package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +1 -0
- package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js +6 -0
- package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js.map +1 -0
- package/dist/src/blocks/defaultBlockHelpers.js +50 -0
- package/dist/src/blocks/defaultBlockHelpers.js.map +1 -0
- package/dist/src/blocks/defaultBlockTypeGuards.js +40 -0
- package/dist/src/blocks/defaultBlockTypeGuards.js.map +1 -0
- package/dist/src/blocks/defaultBlocks.js +50 -0
- package/dist/src/blocks/defaultBlocks.js.map +1 -0
- package/dist/src/blocks/defaultProps.js +19 -0
- package/dist/src/blocks/defaultProps.js.map +1 -0
- package/dist/src/editor/BlockNoteEditor.js +750 -0
- package/dist/src/editor/BlockNoteEditor.js.map +1 -0
- package/dist/src/editor/BlockNoteEditor.test.js +65 -0
- package/dist/src/editor/BlockNoteEditor.test.js.map +1 -0
- package/dist/src/editor/BlockNoteExtensions.js +149 -0
- package/dist/src/editor/BlockNoteExtensions.js.map +1 -0
- package/dist/src/editor/BlockNoteSchema.js +38 -0
- package/dist/src/editor/BlockNoteSchema.js.map +1 -0
- package/dist/src/editor/BlockNoteTipTapEditor.js +169 -0
- package/dist/src/editor/BlockNoteTipTapEditor.js.map +1 -0
- package/dist/src/editor/cursorPositionTypes.js +2 -0
- package/dist/src/editor/cursorPositionTypes.js.map +1 -0
- package/dist/src/editor/defaultColors.js +77 -0
- package/dist/src/editor/defaultColors.js.map +1 -0
- package/dist/src/editor/selectionTypes.js +2 -0
- package/dist/src/editor/selectionTypes.js.map +1 -0
- package/dist/src/editor/transformPasted.js +79 -0
- package/dist/src/editor/transformPasted.js.map +1 -0
- package/dist/src/exporter/Exporter.js +36 -0
- package/dist/src/exporter/Exporter.js.map +1 -0
- package/dist/src/exporter/index.js +3 -0
- package/dist/src/exporter/index.js.map +1 -0
- package/dist/src/exporter/mapping.js +12 -0
- package/dist/src/exporter/mapping.js.map +1 -0
- package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js +30 -0
- package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js.map +1 -0
- package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js +39 -0
- package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js.map +1 -0
- package/dist/src/extensions/FilePanel/FilePanelPlugin.js +131 -0
- package/dist/src/extensions/FilePanel/FilePanelPlugin.js.map +1 -0
- package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +195 -0
- package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +1 -0
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +309 -0
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +1 -0
- package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +247 -0
- package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +1 -0
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +51 -0
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +1 -0
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +81 -0
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +1 -0
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +183 -0
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +1 -0
- package/dist/src/extensions/SideMenu/MultipleNodeSelection.js +68 -0
- package/dist/src/extensions/SideMenu/MultipleNodeSelection.js.map +1 -0
- package/dist/src/extensions/SideMenu/SideMenuPlugin.js +339 -0
- package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +1 -0
- package/dist/src/extensions/SideMenu/dragging.js +128 -0
- package/dist/src/extensions/SideMenu/dragging.js.map +1 -0
- package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js +2 -0
- package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js.map +1 -0
- package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js +2 -0
- package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js.map +1 -0
- package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js +245 -0
- package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js.map +1 -0
- package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js +26 -0
- package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js.map +1 -0
- package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js +244 -0
- package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js.map +1 -0
- package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +553 -0
- package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +1 -0
- package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js +36 -0
- package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js.map +1 -0
- package/dist/src/extensions/TextColor/TextColorExtension.js +29 -0
- package/dist/src/extensions/TextColor/TextColorExtension.js.map +1 -0
- package/dist/src/extensions/TextColor/TextColorMark.js +37 -0
- package/dist/src/extensions/TextColor/TextColorMark.js.map +1 -0
- package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js +58 -0
- package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js.map +1 -0
- package/dist/src/extensions/UniqueID/UniqueID.js +283 -0
- package/dist/src/extensions/UniqueID/UniqueID.js.map +1 -0
- package/dist/src/extensions/getDraggableBlockFromElement.js +13 -0
- package/dist/src/extensions/getDraggableBlockFromElement.js.map +1 -0
- package/dist/src/extensions-shared/UiElementPosition.js +2 -0
- package/dist/src/extensions-shared/UiElementPosition.js.map +1 -0
- package/dist/src/i18n/dictionary.js +4 -0
- package/dist/src/i18n/dictionary.js.map +1 -0
- package/dist/src/i18n/locales/ar.js +298 -0
- package/dist/src/i18n/locales/ar.js.map +1 -0
- package/dist/src/i18n/locales/de.js +313 -0
- package/dist/src/i18n/locales/de.js.map +1 -0
- package/dist/src/i18n/locales/en.js +314 -0
- package/dist/src/i18n/locales/en.js.map +1 -0
- package/dist/src/i18n/locales/es.js +312 -0
- package/dist/src/i18n/locales/es.js.map +1 -0
- package/dist/src/i18n/locales/fr.js +313 -0
- package/dist/src/i18n/locales/fr.js.map +1 -0
- package/dist/src/i18n/locales/hr.js +308 -0
- package/dist/src/i18n/locales/hr.js.map +1 -0
- package/dist/src/i18n/locales/index.js +16 -0
- package/dist/src/i18n/locales/index.js.map +1 -0
- package/dist/src/i18n/locales/is.js +305 -0
- package/dist/src/i18n/locales/is.js.map +1 -0
- package/dist/src/i18n/locales/ja.js +333 -0
- package/dist/src/i18n/locales/ja.js.map +1 -0
- package/dist/src/i18n/locales/ko.js +326 -0
- package/dist/src/i18n/locales/ko.js.map +1 -0
- package/dist/src/i18n/locales/nl.js +313 -0
- package/dist/src/i18n/locales/nl.js.map +1 -0
- package/dist/src/i18n/locales/pl.js +297 -0
- package/dist/src/i18n/locales/pl.js.map +1 -0
- package/dist/src/i18n/locales/pt.js +305 -0
- package/dist/src/i18n/locales/pt.js.map +1 -0
- package/dist/src/i18n/locales/ru.js +340 -0
- package/dist/src/i18n/locales/ru.js.map +1 -0
- package/dist/src/i18n/locales/vi.js +312 -0
- package/dist/src/i18n/locales/vi.js.map +1 -0
- package/dist/src/i18n/locales/zh.js +346 -0
- package/dist/src/i18n/locales/zh.js.map +1 -0
- package/dist/src/index.js +55 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/pm-nodes/BlockContainer.js +72 -0
- package/dist/src/pm-nodes/BlockContainer.js.map +1 -0
- package/dist/src/pm-nodes/BlockGroup.js +43 -0
- package/dist/src/pm-nodes/BlockGroup.js.map +1 -0
- package/dist/src/pm-nodes/Doc.js +7 -0
- package/dist/src/pm-nodes/Doc.js.map +1 -0
- package/dist/src/pm-nodes/index.js +4 -0
- package/dist/src/pm-nodes/index.js.map +1 -0
- package/dist/src/schema/blocks/createSpec.js +126 -0
- package/dist/src/schema/blocks/createSpec.js.map +1 -0
- package/dist/src/schema/blocks/internal.js +147 -0
- package/dist/src/schema/blocks/internal.js.map +1 -0
- package/dist/src/schema/blocks/types.js +2 -0
- package/dist/src/schema/blocks/types.js.map +1 -0
- package/dist/src/schema/index.js +11 -0
- package/dist/src/schema/index.js.map +1 -0
- package/dist/src/schema/inlineContent/createSpec.js +64 -0
- package/dist/src/schema/inlineContent/createSpec.js.map +1 -0
- package/dist/src/schema/inlineContent/internal.js +52 -0
- package/dist/src/schema/inlineContent/internal.js.map +1 -0
- package/dist/src/schema/inlineContent/types.js +10 -0
- package/dist/src/schema/inlineContent/types.js.map +1 -0
- package/dist/src/schema/propTypes.js +2 -0
- package/dist/src/schema/propTypes.js.map +1 -0
- package/dist/src/schema/styles/createSpec.js +48 -0
- package/dist/src/schema/styles/createSpec.js.map +1 -0
- package/dist/src/schema/styles/internal.js +53 -0
- package/dist/src/schema/styles/internal.js.map +1 -0
- package/dist/src/schema/styles/types.js +2 -0
- package/dist/src/schema/styles/types.js.map +1 -0
- package/dist/src/util/EventEmitter.js +33 -0
- package/dist/src/util/EventEmitter.js.map +1 -0
- package/dist/src/util/browser.js +17 -0
- package/dist/src/util/browser.js.map +1 -0
- package/dist/src/util/combineByGroup.js +20 -0
- package/dist/src/util/combineByGroup.js.map +1 -0
- package/dist/src/util/esmDependencies.js +35 -0
- package/dist/src/util/esmDependencies.js.map +1 -0
- package/dist/src/util/string.js +14 -0
- package/dist/src/util/string.js.map +1 -0
- package/dist/src/util/typescript.js +12 -0
- package/dist/src/util/typescript.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/webpack-stats.json +1 -1
- package/package.json +9 -7
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +30 -0
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +2 -0
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +25 -0
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +2 -2
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +104 -39
- package/src/api/blockManipulation/commands/moveBlock/__snapshots__/moveBlock.test.ts.snap +40 -0
- package/src/api/blockManipulation/commands/moveBlock/moveBlock.ts +3 -5
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +100 -0
- package/src/api/blockManipulation/commands/removeBlocks/__snapshots__/removeBlocks.test.ts.snap +10 -0
- package/src/api/blockManipulation/commands/removeBlocks/removeBlocks.ts +1 -1
- package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +40 -0
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +30 -0
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +8 -4
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +11 -7
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +87 -0
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +5 -5
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +192 -107
- package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts +48 -33
- package/src/api/clipboard/clipboard.test.ts +1 -1
- package/src/api/clipboard/fromClipboard/acceptedMIMETypes.ts +1 -0
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +1 -1
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +49 -0
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +6 -0
- package/src/api/clipboard/toClipboard/copyExtension.ts +1 -1
- package/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/codeBlock/empty/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/codeBlock/empty/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/codeBlock/python/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/codeBlock/python/internal.html +1 -0
- 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/noName/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/lists/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/lists/nested/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/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/__snapshots__/table/allColWidths/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/allColWidths/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/mixedColWidths/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/mixedColWidths/internal.html +1 -0
- package/src/api/exporters/html/htmlConversion.test.ts +1 -4
- package/src/api/exporters/html/internalHTMLSerializer.ts +2 -7
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +75 -33
- package/src/api/exporters/markdown/__snapshots__/codeBlock/defaultLanguage/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/codeBlock/empty/markdown.md +2 -0
- package/src/api/exporters/markdown/__snapshots__/codeBlock/python/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/table/allColWidths/markdown.md +5 -0
- package/src/api/exporters/markdown/__snapshots__/table/basic/markdown.md +5 -0
- package/src/api/exporters/markdown/__snapshots__/table/mixedColWidths/markdown.md +5 -0
- package/src/api/exporters/markdown/markdownExporter.test.ts +1 -4
- package/src/api/getBlockInfoFromPos.ts +113 -58
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +711 -0
- package/src/api/nodeConversions/blockToNode.ts +62 -26
- package/src/api/nodeConversions/fragmentToBlocks.ts +18 -0
- package/src/api/nodeConversions/nodeToBlock.ts +35 -22
- package/src/api/nodeUtil.ts +1 -1
- package/src/api/parsers/html/__snapshots__/parse-notion-html.json +5 -0
- package/src/api/parsers/markdown/parseMarkdown.ts +1 -1
- package/src/api/testUtil/cases/defaultSchema.ts +95 -0
- package/src/api/testUtil/partialBlockTestUtil.ts +41 -4
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +4 -2
- package/src/blocks/CodeBlockContent/CodeBlockContent.ts +369 -0
- package/src/blocks/CodeBlockContent/defaultSupportedLanguages.ts +96 -0
- package/src/blocks/FileBlockContent/fileBlockHelpers.ts +10 -2
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +19 -31
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +4 -2
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +5 -9
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +6 -10
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +11 -4
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +5 -9
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +4 -8
- package/src/blocks/TableBlockContent/TableBlockContent.ts +83 -8
- package/src/blocks/TableBlockContent/TableExtension.ts +10 -1
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +4 -2
- package/src/blocks/defaultBlockHelpers.ts +7 -2
- package/src/blocks/defaultBlocks.ts +4 -0
- package/src/editor/Block.css +71 -3
- package/src/editor/BlockNoteEditor.test.ts +2 -2
- package/src/editor/BlockNoteEditor.ts +18 -21
- package/src/editor/BlockNoteExtensions.ts +2 -3
- package/src/editor/BlockNoteTipTapEditor.ts +8 -1
- package/src/editor/defaultColors.ts +77 -0
- package/src/editor/editor.css +43 -5
- package/src/editor/transformPasted.ts +6 -3
- package/src/exporter/Exporter.ts +101 -0
- package/src/exporter/index.ts +2 -0
- package/src/exporter/mapping.ts +75 -0
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +8 -0
- package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +201 -48
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +1 -1
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +5 -0
- package/src/extensions/SideMenu/SideMenuPlugin.ts +141 -52
- package/src/extensions/SideMenu/dragging.ts +3 -54
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +5 -0
- package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +2 -1
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +22 -6
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +225 -120
- package/src/extensions/TrailingNode/TrailingNodeExtension.ts +1 -1
- package/src/extensions/getDraggableBlockFromElement.ts +19 -0
- package/src/i18n/locales/ar.ts +6 -0
- package/src/i18n/locales/de.ts +299 -294
- package/src/i18n/locales/en.ts +6 -0
- package/src/i18n/locales/es.ts +310 -274
- package/src/i18n/locales/fr.ts +6 -0
- package/src/i18n/locales/is.ts +6 -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 +10 -4
- 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 +9 -0
- package/src/pm-nodes/BlockContainer.ts +1 -1
- package/src/pm-nodes/BlockGroup.ts +2 -2
- package/src/pm-nodes/README.md +127 -28
- package/src/schema/blocks/createSpec.ts +4 -1
- package/src/schema/blocks/internal.ts +12 -2
- package/src/schema/blocks/types.ts +3 -1
- package/src/util/combineByGroup.ts +25 -0
- package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.d.ts +22 -2
- package/types/src/api/blockManipulation/commands/nestBlock/nestBlock.d.ts +5 -0
- package/types/src/api/blockManipulation/setupTestEnv.d.ts +22 -8
- package/types/src/api/clipboard/fromClipboard/acceptedMIMETypes.d.ts +1 -1
- package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +3 -0
- package/types/src/api/exporters/html/util/serializeBlocksInternalHTML.d.ts +2 -3
- package/types/src/api/getBlockInfoFromPos.d.ts +55 -5
- package/types/src/api/nodeConversions/blockToNode.d.ts +1 -1
- package/types/src/api/nodeConversions/nodeToBlock.d.ts +3 -1
- package/types/src/api/testUtil/cases/customBlocks.d.ts +22 -8
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +22 -8
- package/types/src/api/testUtil/cases/customStyles.d.ts +22 -8
- package/types/src/api/testUtil/partialBlockTestUtil.d.ts +2 -1
- package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +1 -0
- package/types/src/blocks/CodeBlockContent/CodeBlockContent.d.ts +57 -0
- package/types/src/blocks/CodeBlockContent/defaultSupportedLanguages.d.ts +6 -0
- package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +1 -0
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +1 -0
- package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +0 -12
- package/types/src/blocks/TableBlockContent/TableExtension.d.ts +3 -0
- package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +1 -0
- package/types/src/blocks/defaultBlocks.d.ts +45 -16
- package/types/src/editor/BlockNoteEditor.d.ts +4 -3
- package/types/src/editor/BlockNoteTipTapEditor.d.ts +1 -0
- package/types/src/editor/defaultColors.d.ts +76 -0
- package/types/src/exporter/Exporter.d.ts +43 -0
- package/types/src/exporter/index.d.ts +2 -0
- package/types/src/exporter/mapping.d.ts +30 -0
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +2 -1
- package/types/src/extensions/SideMenu/dragging.d.ts +1 -6
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +9 -5
- package/types/src/extensions/getDraggableBlockFromElement.d.ts +5 -0
- 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/index.d.ts +6 -0
- package/types/src/schema/blocks/createSpec.d.ts +1 -1
- package/types/src/schema/blocks/internal.d.ts +2 -2
- package/types/src/schema/blocks/types.d.ts +3 -1
- package/types/src/util/combineByGroup.d.ts +9 -0
|
@@ -0,0 +1,339 @@
|
|
|
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 = () => (this.view.menuFrozen = true);
|
|
328
|
+
/**
|
|
329
|
+
* Unfreezes the side menu. When frozen, the side menu will stay
|
|
330
|
+
* attached to the same block regardless of which block is hovered by the
|
|
331
|
+
* mouse cursor.
|
|
332
|
+
*/
|
|
333
|
+
unfreezeMenu = () => {
|
|
334
|
+
this.view.menuFrozen = false;
|
|
335
|
+
this.view.state.show = false;
|
|
336
|
+
this.view.emitUpdate(this.view.state);
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
//# sourceMappingURL=SideMenuPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAU1D,MAAM,8CAA8C,GAAG,GAAG,CAAC;AAE3D,SAAS,kBAAkB,CACzB,IAAgB,EAChB,MAAqC,EACrC,gBAAgB,GAAG,IAAI;IAEvB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAEtE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,oDAAoD;YACpD,SAAS;QACX,CAAC;QACD,IAAI,gBAAgB,EAAE,CAAC;Y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AAC,IAAK,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAClD;;;;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"}
|
|
@@ -0,0 +1,128 @@
|
|
|
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 pos = getNodeById(block.id, view.state.doc).posBeforeNode;
|
|
97
|
+
if (pos != null) {
|
|
98
|
+
const selection = view.state.selection;
|
|
99
|
+
const doc = view.state.doc;
|
|
100
|
+
const { from, to } = blockPositionsFromSelection(selection, doc);
|
|
101
|
+
const draggedBlockInSelection = from <= pos && pos < to;
|
|
102
|
+
const multipleBlocksSelected = selection.$anchor.node() !== selection.$head.node() ||
|
|
103
|
+
selection instanceof MultipleNodeSelection;
|
|
104
|
+
if (draggedBlockInSelection && multipleBlocksSelected) {
|
|
105
|
+
view.dispatch(view.state.tr.setSelection(MultipleNodeSelection.create(doc, from, to)));
|
|
106
|
+
setDragImage(view, from, to);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos)));
|
|
110
|
+
setDragImage(view, pos);
|
|
111
|
+
}
|
|
112
|
+
const selectedSlice = view.state.selection.content();
|
|
113
|
+
const schema = editor.pmSchema;
|
|
114
|
+
const clipboardHTML = pmView.__serializeForClipboard(view, selectedSlice).dom.innerHTML;
|
|
115
|
+
const externalHTMLExporter = createExternalHTMLExporter(schema, editor);
|
|
116
|
+
const blocks = fragmentToBlocks(selectedSlice.content, editor.schema);
|
|
117
|
+
const externalHTML = externalHTMLExporter.exportBlocks(blocks, {});
|
|
118
|
+
const plainText = cleanHTMLToMarkdown(externalHTML);
|
|
119
|
+
e.dataTransfer.clearData();
|
|
120
|
+
e.dataTransfer.setData("blocknote/html", clipboardHTML);
|
|
121
|
+
e.dataTransfer.setData("text/html", externalHTML);
|
|
122
|
+
e.dataTransfer.setData("text/plain", plainText);
|
|
123
|
+
e.dataTransfer.effectAllowed = "move";
|
|
124
|
+
e.dataTransfer.setDragImage(dragImageElement, 0, 0);
|
|
125
|
+
view.dragging = { slice: selectedSlice, move: true };
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=dragging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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Y,EAAE,SAAS,CAAC,CAAC;QAChD,CAAC,CAAC,YAAY,CAAC,aAAa,GAAG,MAAM,CAAC;QACtC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,gBAAiB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACvD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultGridSuggestionItem.js","sourceRoot":"","sources":["../../../../src/extensions/SuggestionMenu/DefaultGridSuggestionItem.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultSuggestionItem.js","sourceRoot":"","sources":["../../../../src/extensions/SuggestionMenu/DefaultSuggestionItem.ts"],"names":[],"mappings":""}
|