@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
|
@@ -204,6 +204,28 @@ declare const schema: BlockNoteSchema<import("../../../schema/index.js").BlockSc
|
|
|
204
204
|
};
|
|
205
205
|
}, any, import("../../../schema/index.js").InlineContentSchema, import("../../../schema/index.js").StyleSchema>;
|
|
206
206
|
};
|
|
207
|
+
codeBlock: {
|
|
208
|
+
config: {
|
|
209
|
+
type: "codeBlock";
|
|
210
|
+
content: "inline";
|
|
211
|
+
propSchema: {
|
|
212
|
+
language: {
|
|
213
|
+
default: string;
|
|
214
|
+
values: string[];
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
implementation: import("../../../schema/index.js").TiptapBlockImplementation<{
|
|
219
|
+
type: "codeBlock";
|
|
220
|
+
content: "inline";
|
|
221
|
+
propSchema: {
|
|
222
|
+
language: {
|
|
223
|
+
default: string;
|
|
224
|
+
values: string[];
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
}, any, import("../../../schema/index.js").InlineContentSchema, import("../../../schema/index.js").StyleSchema>;
|
|
228
|
+
};
|
|
207
229
|
bulletListItem: {
|
|
208
230
|
config: {
|
|
209
231
|
type: "bulletListItem";
|
|
@@ -323,10 +345,6 @@ declare const schema: BlockNoteSchema<import("../../../schema/index.js").BlockSc
|
|
|
323
345
|
textColor: {
|
|
324
346
|
default: "default";
|
|
325
347
|
};
|
|
326
|
-
textAlignment: {
|
|
327
|
-
default: "left";
|
|
328
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
329
|
-
};
|
|
330
348
|
};
|
|
331
349
|
};
|
|
332
350
|
implementation: import("../../../schema/index.js").TiptapBlockImplementation<{
|
|
@@ -339,10 +357,6 @@ declare const schema: BlockNoteSchema<import("../../../schema/index.js").BlockSc
|
|
|
339
357
|
textColor: {
|
|
340
358
|
default: "default";
|
|
341
359
|
};
|
|
342
|
-
textAlignment: {
|
|
343
|
-
default: "left";
|
|
344
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
345
|
-
};
|
|
346
360
|
};
|
|
347
361
|
}, any, import("../../../schema/index.js").InlineContentSchema, import("../../../schema/index.js").StyleSchema>;
|
|
348
362
|
};
|
|
@@ -78,6 +78,28 @@ declare const schema: BlockNoteSchema<import("../../../index.js").BlockSchemaFro
|
|
|
78
78
|
};
|
|
79
79
|
}, any, import("../../../index.js").InlineContentSchema, import("../../../index.js").StyleSchema>;
|
|
80
80
|
};
|
|
81
|
+
codeBlock: {
|
|
82
|
+
config: {
|
|
83
|
+
type: "codeBlock";
|
|
84
|
+
content: "inline";
|
|
85
|
+
propSchema: {
|
|
86
|
+
language: {
|
|
87
|
+
default: string;
|
|
88
|
+
values: string[];
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
implementation: import("../../../index.js").TiptapBlockImplementation<{
|
|
93
|
+
type: "codeBlock";
|
|
94
|
+
content: "inline";
|
|
95
|
+
propSchema: {
|
|
96
|
+
language: {
|
|
97
|
+
default: string;
|
|
98
|
+
values: string[];
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
}, any, import("../../../index.js").InlineContentSchema, import("../../../index.js").StyleSchema>;
|
|
102
|
+
};
|
|
81
103
|
bulletListItem: {
|
|
82
104
|
config: {
|
|
83
105
|
type: "bulletListItem";
|
|
@@ -197,10 +219,6 @@ declare const schema: BlockNoteSchema<import("../../../index.js").BlockSchemaFro
|
|
|
197
219
|
textColor: {
|
|
198
220
|
default: "default";
|
|
199
221
|
};
|
|
200
|
-
textAlignment: {
|
|
201
|
-
default: "left";
|
|
202
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
203
|
-
};
|
|
204
222
|
};
|
|
205
223
|
};
|
|
206
224
|
implementation: import("../../../index.js").TiptapBlockImplementation<{
|
|
@@ -213,10 +231,6 @@ declare const schema: BlockNoteSchema<import("../../../index.js").BlockSchemaFro
|
|
|
213
231
|
textColor: {
|
|
214
232
|
default: "default";
|
|
215
233
|
};
|
|
216
|
-
textAlignment: {
|
|
217
|
-
default: "left";
|
|
218
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
219
|
-
};
|
|
220
234
|
};
|
|
221
235
|
}, any, import("../../../index.js").InlineContentSchema, import("../../../index.js").StyleSchema>;
|
|
222
236
|
};
|
|
@@ -78,6 +78,28 @@ declare const schema: BlockNoteSchema<import("../../../index.js").BlockSchemaFro
|
|
|
78
78
|
};
|
|
79
79
|
}, any, import("../../../index.js").InlineContentSchema, import("../../../index.js").StyleSchema>;
|
|
80
80
|
};
|
|
81
|
+
codeBlock: {
|
|
82
|
+
config: {
|
|
83
|
+
type: "codeBlock";
|
|
84
|
+
content: "inline";
|
|
85
|
+
propSchema: {
|
|
86
|
+
language: {
|
|
87
|
+
default: string;
|
|
88
|
+
values: string[];
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
implementation: import("../../../index.js").TiptapBlockImplementation<{
|
|
93
|
+
type: "codeBlock";
|
|
94
|
+
content: "inline";
|
|
95
|
+
propSchema: {
|
|
96
|
+
language: {
|
|
97
|
+
default: string;
|
|
98
|
+
values: string[];
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
}, any, import("../../../index.js").InlineContentSchema, import("../../../index.js").StyleSchema>;
|
|
102
|
+
};
|
|
81
103
|
bulletListItem: {
|
|
82
104
|
config: {
|
|
83
105
|
type: "bulletListItem";
|
|
@@ -197,10 +219,6 @@ declare const schema: BlockNoteSchema<import("../../../index.js").BlockSchemaFro
|
|
|
197
219
|
textColor: {
|
|
198
220
|
default: "default";
|
|
199
221
|
};
|
|
200
|
-
textAlignment: {
|
|
201
|
-
default: "left";
|
|
202
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
203
|
-
};
|
|
204
222
|
};
|
|
205
223
|
};
|
|
206
224
|
implementation: import("../../../index.js").TiptapBlockImplementation<{
|
|
@@ -213,10 +231,6 @@ declare const schema: BlockNoteSchema<import("../../../index.js").BlockSchemaFro
|
|
|
213
231
|
textColor: {
|
|
214
232
|
default: "default";
|
|
215
233
|
};
|
|
216
|
-
textAlignment: {
|
|
217
|
-
default: "left";
|
|
218
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
219
|
-
};
|
|
220
234
|
};
|
|
221
235
|
}, any, import("../../../index.js").InlineContentSchema, import("../../../index.js").StyleSchema>;
|
|
222
236
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Block, PartialBlock } from "../../blocks/defaultBlocks.js";
|
|
2
|
+
import { BlockNoteSchema } from "../../editor/BlockNoteSchema.js";
|
|
2
3
|
import { BlockSchema } from "../../schema/blocks/types.js";
|
|
3
4
|
import { InlineContentSchema } from "../../schema/inlineContent/types.js";
|
|
4
5
|
import { StyleSchema } from "../../schema/styles/types.js";
|
|
5
|
-
export declare function partialBlocksToBlocksForTesting<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(schema: BSchema, partialBlocks: Array<PartialBlock<BSchema
|
|
6
|
+
export declare function partialBlocksToBlocksForTesting<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(schema: BlockNoteSchema<BSchema, I, S>, partialBlocks: Array<PartialBlock<NoInfer<BSchema>, NoInfer<I>, NoInfer<S>>>): Array<Block<BSchema, I, S>>;
|
|
6
7
|
export declare function partialBlockToBlockForTesting<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(schema: BSchema, partialBlock: PartialBlock<BSchema, I, S>): Block<BSchema, I, S>;
|
|
7
8
|
export declare function addIdsToBlock(block: PartialBlock<any, any, any>): void;
|
|
8
9
|
export declare function addIdsToBlocks(blocks: PartialBlock<any, any, any>[]): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
2
2
|
import { BlockFromConfig, Props } from "../../schema/index.js";
|
|
3
|
+
export declare const FILE_AUDIO_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>";
|
|
3
4
|
export declare const audioPropSchema: {
|
|
4
5
|
backgroundColor: {
|
|
5
6
|
default: "default";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SupportedLanguageConfig } from "./defaultSupportedLanguages.js";
|
|
2
|
+
interface CodeBlockOptions {
|
|
3
|
+
defaultLanguage: string;
|
|
4
|
+
indentLineWithTab: boolean;
|
|
5
|
+
supportedLanguages: SupportedLanguageConfig[];
|
|
6
|
+
}
|
|
7
|
+
export declare const defaultCodeBlockPropSchema: {
|
|
8
|
+
language: {
|
|
9
|
+
default: string;
|
|
10
|
+
values: string[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const CodeBlock: {
|
|
14
|
+
config: {
|
|
15
|
+
type: "codeBlock";
|
|
16
|
+
content: "inline";
|
|
17
|
+
propSchema: {
|
|
18
|
+
language: {
|
|
19
|
+
default: string;
|
|
20
|
+
values: string[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
implementation: import("../../schema/index.js").TiptapBlockImplementation<{
|
|
25
|
+
type: "codeBlock";
|
|
26
|
+
content: "inline";
|
|
27
|
+
propSchema: {
|
|
28
|
+
language: {
|
|
29
|
+
default: string;
|
|
30
|
+
values: string[];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}, any, import("../../schema/index.js").InlineContentSchema, import("../../schema/index.js").StyleSchema>;
|
|
34
|
+
};
|
|
35
|
+
export declare function customizeCodeBlock(options: Partial<CodeBlockOptions>): {
|
|
36
|
+
config: {
|
|
37
|
+
type: string;
|
|
38
|
+
content: "none";
|
|
39
|
+
propSchema: {
|
|
40
|
+
language: {
|
|
41
|
+
default: string;
|
|
42
|
+
values: string[];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
implementation: import("../../schema/index.js").TiptapBlockImplementation<{
|
|
47
|
+
type: string;
|
|
48
|
+
content: "none";
|
|
49
|
+
propSchema: {
|
|
50
|
+
language: {
|
|
51
|
+
default: string;
|
|
52
|
+
values: string[];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}, any, import("../../schema/index.js").InlineContentSchema, import("../../schema/index.js").StyleSchema>;
|
|
56
|
+
};
|
|
57
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
2
2
|
import { BlockFromConfig, BlockSchemaWithBlock, FileBlockConfig } from "../../schema/index.js";
|
|
3
|
+
export declare const FILE_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>";
|
|
3
4
|
export declare const createFileBlockWrapper: (block: BlockFromConfig<FileBlockConfig, any, any>, editor: BlockNoteEditor<BlockSchemaWithBlock<FileBlockConfig["type"], FileBlockConfig>, any, any>, element: {
|
|
4
5
|
dom: HTMLElement;
|
|
5
6
|
destroy?: () => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
2
2
|
import { BlockFromConfig, Props } from "../../schema/index.js";
|
|
3
|
+
export declare const FILE_IMAGE_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>";
|
|
3
4
|
export declare const imagePropSchema: {
|
|
4
5
|
textAlignment: {
|
|
5
6
|
default: "left";
|
|
@@ -6,10 +6,6 @@ export declare const tablePropSchema: {
|
|
|
6
6
|
textColor: {
|
|
7
7
|
default: "default";
|
|
8
8
|
};
|
|
9
|
-
textAlignment: {
|
|
10
|
-
default: "left";
|
|
11
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
12
|
-
};
|
|
13
9
|
};
|
|
14
10
|
export declare const TableBlockContent: Node<any, any> & {
|
|
15
11
|
name: "table";
|
|
@@ -28,10 +24,6 @@ export declare const Table: {
|
|
|
28
24
|
textColor: {
|
|
29
25
|
default: "default";
|
|
30
26
|
};
|
|
31
|
-
textAlignment: {
|
|
32
|
-
default: "left";
|
|
33
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
34
|
-
};
|
|
35
27
|
};
|
|
36
28
|
};
|
|
37
29
|
implementation: import("../../schema/index.js").TiptapBlockImplementation<{
|
|
@@ -44,10 +36,6 @@ export declare const Table: {
|
|
|
44
36
|
textColor: {
|
|
45
37
|
default: "default";
|
|
46
38
|
};
|
|
47
|
-
textAlignment: {
|
|
48
|
-
default: "left";
|
|
49
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
50
|
-
};
|
|
51
39
|
};
|
|
52
40
|
}, any, import("../../schema/index.js").InlineContentSchema, import("../../schema/index.js").StyleSchema>;
|
|
53
41
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
2
2
|
import { BlockFromConfig, Props } from "../../schema/index.js";
|
|
3
|
+
export declare const FILE_VIDEO_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>";
|
|
3
4
|
export declare const videoPropSchema: {
|
|
4
5
|
textAlignment: {
|
|
5
6
|
default: "left";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BlockNoDefaults, BlockSchema, InlineContentSchema, PartialBlockNoDefaults, StyleSchema } from "../schema/index.js";
|
|
2
|
+
export { customizeCodeBlock } from "./CodeBlockContent/CodeBlockContent.js";
|
|
2
3
|
export declare const defaultBlockSpecs: {
|
|
3
4
|
paragraph: {
|
|
4
5
|
config: {
|
|
@@ -76,6 +77,28 @@ export declare const defaultBlockSpecs: {
|
|
|
76
77
|
};
|
|
77
78
|
}, any, InlineContentSchema, StyleSchema>;
|
|
78
79
|
};
|
|
80
|
+
codeBlock: {
|
|
81
|
+
config: {
|
|
82
|
+
type: "codeBlock";
|
|
83
|
+
content: "inline";
|
|
84
|
+
propSchema: {
|
|
85
|
+
language: {
|
|
86
|
+
default: string;
|
|
87
|
+
values: string[];
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
implementation: import("../schema/index.js").TiptapBlockImplementation<{
|
|
92
|
+
type: "codeBlock";
|
|
93
|
+
content: "inline";
|
|
94
|
+
propSchema: {
|
|
95
|
+
language: {
|
|
96
|
+
default: string;
|
|
97
|
+
values: string[];
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
101
|
+
};
|
|
79
102
|
bulletListItem: {
|
|
80
103
|
config: {
|
|
81
104
|
type: "bulletListItem";
|
|
@@ -195,10 +218,6 @@ export declare const defaultBlockSpecs: {
|
|
|
195
218
|
textColor: {
|
|
196
219
|
default: "default";
|
|
197
220
|
};
|
|
198
|
-
textAlignment: {
|
|
199
|
-
default: "left";
|
|
200
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
201
|
-
};
|
|
202
221
|
};
|
|
203
222
|
};
|
|
204
223
|
implementation: import("../schema/index.js").TiptapBlockImplementation<{
|
|
@@ -211,10 +230,6 @@ export declare const defaultBlockSpecs: {
|
|
|
211
230
|
textColor: {
|
|
212
231
|
default: "default";
|
|
213
232
|
};
|
|
214
|
-
textAlignment: {
|
|
215
|
-
default: "left";
|
|
216
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
217
|
-
};
|
|
218
233
|
};
|
|
219
234
|
}, any, InlineContentSchema, StyleSchema>;
|
|
220
235
|
};
|
|
@@ -508,6 +523,28 @@ export declare const defaultBlockSchema: import("../schema/index.js").BlockSchem
|
|
|
508
523
|
};
|
|
509
524
|
}, any, InlineContentSchema, StyleSchema>;
|
|
510
525
|
};
|
|
526
|
+
codeBlock: {
|
|
527
|
+
config: {
|
|
528
|
+
type: "codeBlock";
|
|
529
|
+
content: "inline";
|
|
530
|
+
propSchema: {
|
|
531
|
+
language: {
|
|
532
|
+
default: string;
|
|
533
|
+
values: string[];
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
};
|
|
537
|
+
implementation: import("../schema/index.js").TiptapBlockImplementation<{
|
|
538
|
+
type: "codeBlock";
|
|
539
|
+
content: "inline";
|
|
540
|
+
propSchema: {
|
|
541
|
+
language: {
|
|
542
|
+
default: string;
|
|
543
|
+
values: string[];
|
|
544
|
+
};
|
|
545
|
+
};
|
|
546
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
547
|
+
};
|
|
511
548
|
bulletListItem: {
|
|
512
549
|
config: {
|
|
513
550
|
type: "bulletListItem";
|
|
@@ -627,10 +664,6 @@ export declare const defaultBlockSchema: import("../schema/index.js").BlockSchem
|
|
|
627
664
|
textColor: {
|
|
628
665
|
default: "default";
|
|
629
666
|
};
|
|
630
|
-
textAlignment: {
|
|
631
|
-
default: "left";
|
|
632
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
633
|
-
};
|
|
634
667
|
};
|
|
635
668
|
};
|
|
636
669
|
implementation: import("../schema/index.js").TiptapBlockImplementation<{
|
|
@@ -643,10 +676,6 @@ export declare const defaultBlockSchema: import("../schema/index.js").BlockSchem
|
|
|
643
676
|
textColor: {
|
|
644
677
|
default: "default";
|
|
645
678
|
};
|
|
646
|
-
textAlignment: {
|
|
647
|
-
default: "left";
|
|
648
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
649
|
-
};
|
|
650
679
|
};
|
|
651
680
|
}, any, InlineContentSchema, StyleSchema>;
|
|
652
681
|
};
|
|
@@ -15,7 +15,7 @@ import { Selection } from "./selectionTypes.js";
|
|
|
15
15
|
import { BlockNoteSchema } from "./BlockNoteSchema.js";
|
|
16
16
|
import { BlockNoteTipTapEditor } from "./BlockNoteTipTapEditor.js";
|
|
17
17
|
import { Dictionary } from "../i18n/dictionary.js";
|
|
18
|
-
import { Transaction } from "@tiptap/pm/state";
|
|
18
|
+
import { Plugin, Transaction } from "@tiptap/pm/state";
|
|
19
19
|
import "../style.css";
|
|
20
20
|
export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema> = {
|
|
21
21
|
/**
|
|
@@ -28,7 +28,7 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
|
|
|
28
28
|
/**
|
|
29
29
|
* A dictionary object containing translations for the editor.
|
|
30
30
|
*/
|
|
31
|
-
dictionary?: Dictionary
|
|
31
|
+
dictionary?: Dictionary & Record<string, any>;
|
|
32
32
|
/**
|
|
33
33
|
* @deprecated, provide placeholders via dictionary instead
|
|
34
34
|
*/
|
|
@@ -109,6 +109,7 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
|
|
|
109
109
|
* (note that the id is always set on the `data-id` attribute)
|
|
110
110
|
*/
|
|
111
111
|
setIdAttribute?: boolean;
|
|
112
|
+
dropCursor?: (opts: any) => Plugin;
|
|
112
113
|
};
|
|
113
114
|
export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema> {
|
|
114
115
|
protected readonly options: Partial<BlockNoteEditorOptions<any, any, any>>;
|
|
@@ -138,7 +139,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
138
139
|
/**
|
|
139
140
|
* The dictionary contains translations for the editor.
|
|
140
141
|
*/
|
|
141
|
-
readonly dictionary: Dictionary
|
|
142
|
+
readonly dictionary: Dictionary & Record<string, any>;
|
|
142
143
|
/**
|
|
143
144
|
* The schema of the editor. The schema defines which Blocks, InlineContent, and Styles are available in the editor.
|
|
144
145
|
*/
|
|
@@ -12,6 +12,7 @@ export type BlockNoteTipTapEditorOptions = Partial<Omit<EditorOptions, "content"
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class BlockNoteTipTapEditor extends TiptapEditor {
|
|
14
14
|
private _state;
|
|
15
|
+
private _creating;
|
|
15
16
|
static create: (options: BlockNoteTipTapEditorOptions, styleSchema: StyleSchema) => BlockNoteTipTapEditor;
|
|
16
17
|
protected constructor(options: BlockNoteTipTapEditorOptions, styleSchema: StyleSchema);
|
|
17
18
|
get state(): EditorState;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare const COLORS_DEFAULT: {
|
|
2
|
+
gray: {
|
|
3
|
+
text: string;
|
|
4
|
+
background: string;
|
|
5
|
+
};
|
|
6
|
+
brown: {
|
|
7
|
+
text: string;
|
|
8
|
+
background: string;
|
|
9
|
+
};
|
|
10
|
+
red: {
|
|
11
|
+
text: string;
|
|
12
|
+
background: string;
|
|
13
|
+
};
|
|
14
|
+
orange: {
|
|
15
|
+
text: string;
|
|
16
|
+
background: string;
|
|
17
|
+
};
|
|
18
|
+
yellow: {
|
|
19
|
+
text: string;
|
|
20
|
+
background: string;
|
|
21
|
+
};
|
|
22
|
+
green: {
|
|
23
|
+
text: string;
|
|
24
|
+
background: string;
|
|
25
|
+
};
|
|
26
|
+
blue: {
|
|
27
|
+
text: string;
|
|
28
|
+
background: string;
|
|
29
|
+
};
|
|
30
|
+
purple: {
|
|
31
|
+
text: string;
|
|
32
|
+
background: string;
|
|
33
|
+
};
|
|
34
|
+
pink: {
|
|
35
|
+
text: string;
|
|
36
|
+
background: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const COLORS_DARK_MODE_DEFAULT: {
|
|
40
|
+
gray: {
|
|
41
|
+
text: string;
|
|
42
|
+
background: string;
|
|
43
|
+
};
|
|
44
|
+
brown: {
|
|
45
|
+
text: string;
|
|
46
|
+
background: string;
|
|
47
|
+
};
|
|
48
|
+
red: {
|
|
49
|
+
text: string;
|
|
50
|
+
background: string;
|
|
51
|
+
};
|
|
52
|
+
orange: {
|
|
53
|
+
text: string;
|
|
54
|
+
background: string;
|
|
55
|
+
};
|
|
56
|
+
yellow: {
|
|
57
|
+
text: string;
|
|
58
|
+
background: string;
|
|
59
|
+
};
|
|
60
|
+
green: {
|
|
61
|
+
text: string;
|
|
62
|
+
background: string;
|
|
63
|
+
};
|
|
64
|
+
blue: {
|
|
65
|
+
text: string;
|
|
66
|
+
background: string;
|
|
67
|
+
};
|
|
68
|
+
purple: {
|
|
69
|
+
text: string;
|
|
70
|
+
background: string;
|
|
71
|
+
};
|
|
72
|
+
pink: {
|
|
73
|
+
text: string;
|
|
74
|
+
background: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BlockNoteSchema } from "../editor/BlockNoteSchema.js";
|
|
2
|
+
import { COLORS_DEFAULT } from "../editor/defaultColors.js";
|
|
3
|
+
import { BlockFromConfig, BlockSchema, InlineContent, InlineContentSchema, StyleSchema, StyledText, Styles } from "../schema/index.js";
|
|
4
|
+
import type { BlockMapping, InlineContentMapping, StyleMapping } from "./mapping.js";
|
|
5
|
+
export type ExporterOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* A function that can be used to resolve files, images, etc.
|
|
8
|
+
* Exporters might need the binary contents of files like images,
|
|
9
|
+
* which might not always be available from the same origin as the main page.
|
|
10
|
+
* You can use this option to proxy requests through a server you control
|
|
11
|
+
* to avoid cross-origin (CORS) issues.
|
|
12
|
+
*
|
|
13
|
+
* @default uses a BlockNote hosted proxy (https://corsproxy.api.blocknotejs.org/)
|
|
14
|
+
* @param url - The URL of the file to resolve
|
|
15
|
+
* @returns A Promise that resolves to a string (the URL to use instead of the original)
|
|
16
|
+
* or a Blob (you can return the Blob directly if you have already fetched it)
|
|
17
|
+
*/
|
|
18
|
+
resolveFileUrl?: (url: string) => Promise<string | Blob>;
|
|
19
|
+
/**
|
|
20
|
+
* Colors to use for background of blocks, font colors, and highlight colors
|
|
21
|
+
*/
|
|
22
|
+
colors: typeof COLORS_DEFAULT;
|
|
23
|
+
};
|
|
24
|
+
export declare abstract class Exporter<B extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema, RB, RI, RS, TS> {
|
|
25
|
+
protected readonly mappings: {
|
|
26
|
+
blockMapping: BlockMapping<B, I, S, RB, RI>;
|
|
27
|
+
inlineContentMapping: InlineContentMapping<I, S, RI, TS>;
|
|
28
|
+
styleMapping: StyleMapping<S, RS>;
|
|
29
|
+
};
|
|
30
|
+
readonly options: ExporterOptions;
|
|
31
|
+
constructor(_schema: BlockNoteSchema<B, I, S>, // only used for type inference
|
|
32
|
+
mappings: {
|
|
33
|
+
blockMapping: BlockMapping<B, I, S, RB, RI>;
|
|
34
|
+
inlineContentMapping: InlineContentMapping<I, S, RI, TS>;
|
|
35
|
+
styleMapping: StyleMapping<S, RS>;
|
|
36
|
+
}, options: ExporterOptions);
|
|
37
|
+
resolveFile(url: string): Promise<Blob>;
|
|
38
|
+
mapStyles(styles: Styles<S>): RS[];
|
|
39
|
+
mapInlineContent(inlineContent: InlineContent<I, S>): RI;
|
|
40
|
+
transformInlineContent(inlineContentArray: InlineContent<I, S>[]): RI[];
|
|
41
|
+
abstract transformStyledText(styledText: StyledText<S>): TS;
|
|
42
|
+
mapBlock(block: BlockFromConfig<B[keyof B], I, S>, nestingLevel: number, numberedListIndex: number): Promise<RB>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BlockNoteSchema } from "../editor/BlockNoteSchema.js";
|
|
2
|
+
import { BlockFromConfigNoChildren, BlockSchema, InlineContentFromConfig, InlineContentSchema, StyleSchema, Styles } from "../schema/index.js";
|
|
3
|
+
import type { Exporter } from "./Exporter.js";
|
|
4
|
+
/**
|
|
5
|
+
* Defines a mapping from all block types with a schema to a result type `R`.
|
|
6
|
+
*/
|
|
7
|
+
export type BlockMapping<B extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema, RB, RI> = {
|
|
8
|
+
[K in keyof B]: (block: BlockFromConfigNoChildren<B[K], I, S>, exporter: Exporter<any, any, any, RB, RI, any, any>, nestingLevel: number, numberedListIndex?: number) => RB | Promise<RB>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Defines a mapping from all inline content types with a schema to a result type R.
|
|
12
|
+
*/
|
|
13
|
+
export type InlineContentMapping<I extends InlineContentSchema, S extends StyleSchema, RI, TS> = {
|
|
14
|
+
[K in keyof I]: (inlineContent: InlineContentFromConfig<I[K], S>, exporter: Exporter<any, I, S, any, RI, any, TS>) => RI;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Defines a mapping from all style types with a schema to a result type R.
|
|
18
|
+
*/
|
|
19
|
+
export type StyleMapping<S extends StyleSchema, RS> = {
|
|
20
|
+
[K in keyof S]: (style: Styles<S>[K], exporter: Exporter<any, any, any, any, any, RS, any>) => RS;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The mapping factory is a utility function to easily create mappings for
|
|
24
|
+
* a BlockNoteSchema. Using the factory makes it easier to get typescript code completion etc.
|
|
25
|
+
*/
|
|
26
|
+
export declare function mappingFactory<B extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(_schema: BlockNoteSchema<B, I, S>): {
|
|
27
|
+
createBlockMapping: <R, RI>(mapping: BlockMapping<B, I, S, R, RI>) => BlockMapping<B, I, S, R, RI>;
|
|
28
|
+
createInlineContentMapping: <R_1, RS>(mapping: InlineContentMapping<I, S, R_1, RS>) => InlineContentMapping<I, S, R_1, RS>;
|
|
29
|
+
createStyleMapping: <R_2>(mapping: StyleMapping<S, R_2>) => StyleMapping<S, R_2>;
|
|
30
|
+
};
|
|
@@ -37,6 +37,7 @@ export declare class SideMenuView<BSchema extends BlockSchema, I extends InlineC
|
|
|
37
37
|
onDragOver: (event: DragEvent) => void;
|
|
38
38
|
onKeyDown: (_event: KeyboardEvent) => void;
|
|
39
39
|
onMouseMove: (event: MouseEvent) => void;
|
|
40
|
+
private createSyntheticEvent;
|
|
40
41
|
update(_view: EditorView, prevState: EditorState): void;
|
|
41
42
|
destroy(): void;
|
|
42
43
|
}
|
|
@@ -53,7 +54,7 @@ export declare class SideMenuProsemirrorPlugin<BSchema extends BlockSchema, I ex
|
|
|
53
54
|
blockDragStart: (event: {
|
|
54
55
|
dataTransfer: DataTransfer | null;
|
|
55
56
|
clientY: number;
|
|
56
|
-
}) => void;
|
|
57
|
+
}, block: Block<BSchema, I, S>) => void;
|
|
57
58
|
/**
|
|
58
59
|
* Handles drag & drop events for blocks.
|
|
59
60
|
*/
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EditorView } from "prosemirror-view";
|
|
2
1
|
import { Block } from "../../blocks/defaultBlocks.js";
|
|
3
2
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
4
3
|
import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
|
|
@@ -6,12 +5,8 @@ import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema/inde
|
|
|
6
5
|
export type SideMenuState<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = UiElementPosition & {
|
|
7
6
|
block: Block<BSchema, I, S>;
|
|
8
7
|
};
|
|
9
|
-
export declare function getDraggableBlockFromElement(element: Element, view: EditorView): {
|
|
10
|
-
node: HTMLElement;
|
|
11
|
-
id: string;
|
|
12
|
-
} | undefined;
|
|
13
8
|
export declare function unsetDragImage(rootEl: Document | ShadowRoot): void;
|
|
14
9
|
export declare function dragStart<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(e: {
|
|
15
10
|
dataTransfer: DataTransfer | null;
|
|
16
11
|
clientY: number;
|
|
17
|
-
}, editor: BlockNoteEditor<BSchema, I, S>): void;
|
|
12
|
+
}, block: Block<BSchema, I, S>, editor: BlockNoteEditor<BSchema, I, S>): void;
|