@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
package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts
CHANGED
|
@@ -27,24 +27,30 @@ export const NumberedListIndexingPlugin = () => {
|
|
|
27
27
|
node,
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
+
if (!blockInfo.isBlockContainer) {
|
|
31
|
+
throw new Error("impossible");
|
|
32
|
+
}
|
|
33
|
+
|
|
30
34
|
// Checks if this block is the start of a new ordered list, i.e. if it's the first block in the document, the
|
|
31
35
|
// first block in its nesting level, or the previous block is not an ordered list item.
|
|
32
36
|
|
|
33
37
|
const prevBlock = tr.doc.resolve(
|
|
34
|
-
blockInfo.
|
|
38
|
+
blockInfo.bnBlock.beforePos
|
|
35
39
|
).nodeBefore;
|
|
36
40
|
|
|
37
41
|
if (prevBlock) {
|
|
38
42
|
const prevBlockInfo = getBlockInfo({
|
|
39
|
-
posBeforeNode:
|
|
40
|
-
blockInfo.blockContainer.beforePos - prevBlock.nodeSize,
|
|
43
|
+
posBeforeNode: blockInfo.bnBlock.beforePos - prevBlock.nodeSize,
|
|
41
44
|
node: prevBlock,
|
|
42
45
|
});
|
|
43
46
|
|
|
44
47
|
const isPrevBlockOrderedListItem =
|
|
45
|
-
prevBlockInfo.
|
|
48
|
+
prevBlockInfo.blockNoteType === "numberedListItem";
|
|
46
49
|
|
|
47
50
|
if (isPrevBlockOrderedListItem) {
|
|
51
|
+
if (!prevBlockInfo.isBlockContainer) {
|
|
52
|
+
throw new Error("impossible");
|
|
53
|
+
}
|
|
48
54
|
const prevBlockIndex =
|
|
49
55
|
prevBlockInfo.blockContent.node.attrs["index"];
|
|
50
56
|
|
|
@@ -59,6 +65,7 @@ export const NumberedListIndexingPlugin = () => {
|
|
|
59
65
|
modified = true;
|
|
60
66
|
|
|
61
67
|
tr.setNodeMarkup(blockInfo.blockContent.beforePos, undefined, {
|
|
68
|
+
...contentNode.attrs,
|
|
62
69
|
index: newIndex,
|
|
63
70
|
});
|
|
64
71
|
}
|
package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts
CHANGED
|
@@ -49,7 +49,7 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
49
49
|
.command(
|
|
50
50
|
updateBlockCommand(
|
|
51
51
|
this.options.editor,
|
|
52
|
-
blockInfo.
|
|
52
|
+
blockInfo.bnBlock.beforePos,
|
|
53
53
|
{
|
|
54
54
|
type: "numberedListItem",
|
|
55
55
|
props: {},
|
|
@@ -73,14 +73,10 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
return this.editor.commands.command(
|
|
76
|
-
updateBlockCommand(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
type: "numberedListItem",
|
|
81
|
-
props: {},
|
|
82
|
-
}
|
|
83
|
-
)
|
|
76
|
+
updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {
|
|
77
|
+
type: "numberedListItem",
|
|
78
|
+
props: {},
|
|
79
|
+
})
|
|
84
80
|
);
|
|
85
81
|
},
|
|
86
82
|
};
|
|
@@ -25,14 +25,10 @@ export const ParagraphBlockContent = createStronglyTypedTiptapNode({
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return this.editor.commands.command(
|
|
28
|
-
updateBlockCommand(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type: "paragraph",
|
|
33
|
-
props: {},
|
|
34
|
-
}
|
|
35
|
-
)
|
|
28
|
+
updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {
|
|
29
|
+
type: "paragraph",
|
|
30
|
+
props: {},
|
|
31
|
+
})
|
|
36
32
|
);
|
|
37
33
|
},
|
|
38
34
|
};
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
2
|
import { TableCell } from "@tiptap/extension-table-cell";
|
|
3
3
|
import { TableHeader } from "@tiptap/extension-table-header";
|
|
4
4
|
import { TableRow } from "@tiptap/extension-table-row";
|
|
5
|
+
import { Node as PMNode } from "prosemirror-model";
|
|
6
|
+
import { TableView } from "prosemirror-tables";
|
|
7
|
+
|
|
5
8
|
import {
|
|
6
9
|
createBlockSpecFromStronglyTypedTiptapNode,
|
|
7
10
|
createStronglyTypedTiptapNode,
|
|
8
11
|
} from "../../schema/index.js";
|
|
12
|
+
import { mergeCSSClasses } from "../../util/browser.js";
|
|
9
13
|
import { createDefaultBlockDOMOutputSpec } from "../defaultBlockHelpers.js";
|
|
10
14
|
import { defaultProps } from "../defaultProps.js";
|
|
11
|
-
import { TableExtension } from "./TableExtension.js";
|
|
15
|
+
import { EMPTY_CELL_WIDTH, TableExtension } from "./TableExtension.js";
|
|
12
16
|
|
|
13
17
|
export const tablePropSchema = {
|
|
14
|
-
|
|
18
|
+
backgroundColor: defaultProps.backgroundColor,
|
|
19
|
+
textColor: defaultProps.textColor,
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
export const TableBlockContent = createStronglyTypedTiptapNode({
|
|
@@ -37,6 +42,69 @@ export const TableBlockContent = createStronglyTypedTiptapNode({
|
|
|
37
42
|
this.options.domAttributes?.inlineContent || {}
|
|
38
43
|
);
|
|
39
44
|
},
|
|
45
|
+
|
|
46
|
+
// This node view is needed for the `columnResizing` plugin. By default, the
|
|
47
|
+
// plugin adds its own node view, which overrides how the node is rendered vs
|
|
48
|
+
// `renderHTML`. This means that the wrapping `blockContent` HTML element is
|
|
49
|
+
// no longer rendered. The `columnResizing` plugin uses the `TableView` as its
|
|
50
|
+
// default node view. `BlockNoteTableView` extends it by wrapping it in a
|
|
51
|
+
// `blockContent` element, so the DOM structure is consistent with other block
|
|
52
|
+
// types.
|
|
53
|
+
addNodeView() {
|
|
54
|
+
return ({ node, HTMLAttributes }) => {
|
|
55
|
+
class BlockNoteTableView extends TableView {
|
|
56
|
+
constructor(
|
|
57
|
+
public node: PMNode,
|
|
58
|
+
public cellMinWidth: number,
|
|
59
|
+
public blockContentHTMLAttributes: Record<string, string>
|
|
60
|
+
) {
|
|
61
|
+
super(node, cellMinWidth);
|
|
62
|
+
|
|
63
|
+
const blockContent = document.createElement("div");
|
|
64
|
+
blockContent.className = mergeCSSClasses(
|
|
65
|
+
"bn-block-content",
|
|
66
|
+
blockContentHTMLAttributes.class
|
|
67
|
+
);
|
|
68
|
+
blockContent.setAttribute("data-content-type", "table");
|
|
69
|
+
for (const [attribute, value] of Object.entries(
|
|
70
|
+
blockContentHTMLAttributes
|
|
71
|
+
)) {
|
|
72
|
+
if (attribute !== "class") {
|
|
73
|
+
blockContent.setAttribute(attribute, value);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const tableWrapper = this.dom;
|
|
78
|
+
|
|
79
|
+
const tableWrapperInner = document.createElement("div");
|
|
80
|
+
tableWrapperInner.className = "tableWrapper-inner";
|
|
81
|
+
tableWrapperInner.appendChild(tableWrapper.firstChild!);
|
|
82
|
+
|
|
83
|
+
tableWrapper.appendChild(tableWrapperInner);
|
|
84
|
+
|
|
85
|
+
blockContent.appendChild(tableWrapper);
|
|
86
|
+
const floatingContainer = document.createElement("div");
|
|
87
|
+
floatingContainer.className = "table-widgets-container";
|
|
88
|
+
floatingContainer.style.position = "relative";
|
|
89
|
+
tableWrapper.appendChild(floatingContainer);
|
|
90
|
+
|
|
91
|
+
this.dom = blockContent;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
ignoreMutation(record: MutationRecord): boolean {
|
|
95
|
+
return (
|
|
96
|
+
!(record.target as HTMLElement).closest(".tableWrapper-inner") ||
|
|
97
|
+
super.ignoreMutation(record)
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return new BlockNoteTableView(node, EMPTY_CELL_WIDTH, {
|
|
103
|
+
...(this.options.domAttributes?.blockContent || {}),
|
|
104
|
+
...HTMLAttributes,
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
},
|
|
40
108
|
});
|
|
41
109
|
|
|
42
110
|
const TableParagraph = Node.create({
|
|
@@ -46,6 +114,17 @@ const TableParagraph = Node.create({
|
|
|
46
114
|
|
|
47
115
|
parseHTML() {
|
|
48
116
|
return [
|
|
117
|
+
{
|
|
118
|
+
preserveWhitespace: "full",
|
|
119
|
+
// set this rule as high priority so it takes precedence over the default paragraph rule,
|
|
120
|
+
// but only if we're in the tableContent context
|
|
121
|
+
priority: 210,
|
|
122
|
+
context: "tableContent",
|
|
123
|
+
tag: "p",
|
|
124
|
+
getAttrs: (_element) => {
|
|
125
|
+
return {};
|
|
126
|
+
},
|
|
127
|
+
},
|
|
49
128
|
{
|
|
50
129
|
tag: "p",
|
|
51
130
|
getAttrs: (element) => {
|
|
@@ -70,11 +149,7 @@ const TableParagraph = Node.create({
|
|
|
70
149
|
},
|
|
71
150
|
|
|
72
151
|
renderHTML({ HTMLAttributes }) {
|
|
73
|
-
return [
|
|
74
|
-
"p",
|
|
75
|
-
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
|
|
76
|
-
0,
|
|
77
|
-
];
|
|
152
|
+
return ["p", HTMLAttributes, 0];
|
|
78
153
|
},
|
|
79
154
|
});
|
|
80
155
|
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { callOrReturn, Extension, getExtensionField } from "@tiptap/core";
|
|
2
2
|
import { columnResizing, tableEditing } from "prosemirror-tables";
|
|
3
3
|
|
|
4
|
+
export const RESIZE_MIN_WIDTH = 35;
|
|
5
|
+
export const EMPTY_CELL_WIDTH = 120;
|
|
6
|
+
export const EMPTY_CELL_HEIGHT = 31;
|
|
7
|
+
|
|
4
8
|
export const TableExtension = Extension.create({
|
|
5
9
|
name: "BlockNoteTableExtension",
|
|
6
10
|
|
|
7
11
|
addProseMirrorPlugins: () => {
|
|
8
12
|
return [
|
|
9
13
|
columnResizing({
|
|
10
|
-
cellMinWidth:
|
|
14
|
+
cellMinWidth: RESIZE_MIN_WIDTH,
|
|
15
|
+
defaultCellMinWidth: EMPTY_CELL_WIDTH,
|
|
16
|
+
// We set this to null as we implement our own node view in the table
|
|
17
|
+
// block content. This node view is the same as what's used by default,
|
|
18
|
+
// but is wrapped in a `blockContent` HTML element.
|
|
19
|
+
View: null,
|
|
11
20
|
}),
|
|
12
21
|
tableEditing(),
|
|
13
22
|
];
|
|
@@ -18,6 +18,9 @@ import {
|
|
|
18
18
|
} from "../FileBlockContent/fileBlockHelpers.js";
|
|
19
19
|
import { parseVideoElement } from "./videoBlockHelpers.js";
|
|
20
20
|
|
|
21
|
+
export const FILE_VIDEO_ICON_SVG =
|
|
22
|
+
'<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>';
|
|
23
|
+
|
|
21
24
|
export const videoPropSchema = {
|
|
22
25
|
textAlignment: defaultProps.textAlignment,
|
|
23
26
|
backgroundColor: defaultProps.backgroundColor,
|
|
@@ -56,8 +59,7 @@ export const videoRender = (
|
|
|
56
59
|
editor: BlockNoteEditor<any, any, any>
|
|
57
60
|
) => {
|
|
58
61
|
const icon = document.createElement("div");
|
|
59
|
-
icon.innerHTML =
|
|
60
|
-
'<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>';
|
|
62
|
+
icon.innerHTML = FILE_VIDEO_ICON_SVG;
|
|
61
63
|
|
|
62
64
|
const video = document.createElement("video");
|
|
63
65
|
video.className = "bn-visual-media";
|
|
@@ -67,8 +67,13 @@ export const defaultBlockToHTML = <
|
|
|
67
67
|
dom: HTMLElement;
|
|
68
68
|
contentDOM?: HTMLElement;
|
|
69
69
|
} => {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
let node = blockToNode(block, editor.pmSchema, editor.schema.styleSchema);
|
|
71
|
+
|
|
72
|
+
if (node.type.name === "blockContainer") {
|
|
73
|
+
// for regular blocks, get the toDOM spec from the blockContent node
|
|
74
|
+
node = node.firstChild!;
|
|
75
|
+
}
|
|
76
|
+
|
|
72
77
|
const toDOM = editor.pmSchema.nodes[node.type.name].spec.toDOM;
|
|
73
78
|
|
|
74
79
|
if (toDOM === undefined) {
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
} from "../schema/index.js";
|
|
22
22
|
|
|
23
23
|
import { AudioBlock } from "./AudioBlockContent/AudioBlockContent.js";
|
|
24
|
+
import { CodeBlock } from "./CodeBlockContent/CodeBlockContent.js";
|
|
24
25
|
import { FileBlock } from "./FileBlockContent/FileBlockContent.js";
|
|
25
26
|
import { Heading } from "./HeadingBlockContent/HeadingBlockContent.js";
|
|
26
27
|
import { ImageBlock } from "./ImageBlockContent/ImageBlockContent.js";
|
|
@@ -31,9 +32,12 @@ import { Paragraph } from "./ParagraphBlockContent/ParagraphBlockContent.js";
|
|
|
31
32
|
import { Table } from "./TableBlockContent/TableBlockContent.js";
|
|
32
33
|
import { VideoBlock } from "./VideoBlockContent/VideoBlockContent.js";
|
|
33
34
|
|
|
35
|
+
export { customizeCodeBlock } from "./CodeBlockContent/CodeBlockContent.js";
|
|
36
|
+
|
|
34
37
|
export const defaultBlockSpecs = {
|
|
35
38
|
paragraph: Paragraph,
|
|
36
39
|
heading: Heading,
|
|
40
|
+
codeBlock: CodeBlock,
|
|
37
41
|
bulletListItem: BulletListItem,
|
|
38
42
|
numberedListItem: NumberedListItem,
|
|
39
43
|
checkListItem: CheckListItem,
|
package/src/editor/Block.css
CHANGED
|
@@ -196,7 +196,8 @@ NESTED BLOCKS
|
|
|
196
196
|
cursor: pointer;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
.bn-block-content[data-content-type="checkListItem"][data-checked="true"]
|
|
199
|
+
.bn-block-content[data-content-type="checkListItem"][data-checked="true"]
|
|
200
|
+
.bn-inline-content {
|
|
200
201
|
text-decoration: line-through;
|
|
201
202
|
}
|
|
202
203
|
|
|
@@ -259,6 +260,51 @@ NESTED BLOCKS
|
|
|
259
260
|
content: "▪";
|
|
260
261
|
}
|
|
261
262
|
|
|
263
|
+
/* CODE BLOCKS */
|
|
264
|
+
.bn-block-content[data-content-type="codeBlock"] {
|
|
265
|
+
position: relative;
|
|
266
|
+
|
|
267
|
+
background-color: rgb(22 22 22);
|
|
268
|
+
color: white;
|
|
269
|
+
border-radius: 8px;
|
|
270
|
+
}
|
|
271
|
+
.bn-block-content[data-content-type="codeBlock"] > pre {
|
|
272
|
+
white-space: pre;
|
|
273
|
+
overflow-x: auto;
|
|
274
|
+
margin: 0;
|
|
275
|
+
width: 100%;
|
|
276
|
+
tab-size: 2;
|
|
277
|
+
|
|
278
|
+
padding: 24px;
|
|
279
|
+
}
|
|
280
|
+
.bn-block-content[data-content-type="codeBlock"] > div {
|
|
281
|
+
outline: none !important;
|
|
282
|
+
}
|
|
283
|
+
.bn-block-content[data-content-type="codeBlock"] > div > select {
|
|
284
|
+
outline: none !important;
|
|
285
|
+
appearance: none;
|
|
286
|
+
user-select: none;
|
|
287
|
+
border: none;
|
|
288
|
+
cursor: pointer;
|
|
289
|
+
background-color: transparent;
|
|
290
|
+
|
|
291
|
+
position: absolute;
|
|
292
|
+
top: 8px;
|
|
293
|
+
left: 18px;
|
|
294
|
+
|
|
295
|
+
font-size: 0.8em;
|
|
296
|
+
color: white;
|
|
297
|
+
|
|
298
|
+
opacity: 0;
|
|
299
|
+
transition: opacity 0.3s;
|
|
300
|
+
transition-delay: 1s;
|
|
301
|
+
}
|
|
302
|
+
.bn-block-content[data-content-type="codeBlock"]:hover > div > select,
|
|
303
|
+
.bn-block-content[data-content-type="codeBlock"] > div > select:focus {
|
|
304
|
+
opacity: 0.5;
|
|
305
|
+
transition-delay: 0.1s;
|
|
306
|
+
}
|
|
307
|
+
|
|
262
308
|
/* FILES */
|
|
263
309
|
|
|
264
310
|
/* Add block button & default preview */
|
|
@@ -349,13 +395,15 @@ NESTED BLOCKS
|
|
|
349
395
|
cursor: ew-resize;
|
|
350
396
|
}
|
|
351
397
|
|
|
352
|
-
[data-content-type="audio"] > .bn-file-block-content-wrapper,
|
|
398
|
+
[data-content-type="audio"] > .bn-file-block-content-wrapper,
|
|
399
|
+
.bn-audio {
|
|
353
400
|
width: 100%;
|
|
354
401
|
}
|
|
355
402
|
|
|
356
403
|
[data-file-block] .bn-file-caption {
|
|
357
404
|
font-size: 0.8em;
|
|
358
405
|
padding-block: 4px;
|
|
406
|
+
word-break: break-word;
|
|
359
407
|
}
|
|
360
408
|
|
|
361
409
|
[data-file-block] .bn-file-caption:empty {
|
|
@@ -425,7 +473,7 @@ NESTED BLOCKS
|
|
|
425
473
|
}
|
|
426
474
|
|
|
427
475
|
[data-background-color="orange"] {
|
|
428
|
-
background-color: #
|
|
476
|
+
background-color: #f6e9d9;
|
|
429
477
|
}
|
|
430
478
|
|
|
431
479
|
[data-background-color="yellow"] {
|
|
@@ -468,3 +516,23 @@ NESTED BLOCKS
|
|
|
468
516
|
justify-content: flex-start;
|
|
469
517
|
text-align: justify;
|
|
470
518
|
}
|
|
519
|
+
|
|
520
|
+
.bn-block-column-list {
|
|
521
|
+
display: flex;
|
|
522
|
+
flex-direction: row;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
.bn-block-column {
|
|
526
|
+
flex: 1;
|
|
527
|
+
padding: 12px 20px;
|
|
528
|
+
/* scroll if we overflow, for example when tables or images are in the column */
|
|
529
|
+
overflow-x: auto;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.bn-block-column:first-child {
|
|
533
|
+
padding-left: 0;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.bn-block-column:last-child {
|
|
537
|
+
padding-right: 0;
|
|
538
|
+
}
|
|
@@ -14,8 +14,8 @@ it("creates an editor", () => {
|
|
|
14
14
|
editor._tiptapEditor.state.doc,
|
|
15
15
|
2
|
|
16
16
|
);
|
|
17
|
-
const
|
|
18
|
-
expect(
|
|
17
|
+
const info = getBlockInfo(posInfo);
|
|
18
|
+
expect(info.blockNoteType).toEqual("paragraph");
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
it("immediately replaces doc", async () => {
|
|
@@ -7,6 +7,12 @@ import {
|
|
|
7
7
|
moveBlockDown,
|
|
8
8
|
moveBlockUp,
|
|
9
9
|
} from "../api/blockManipulation/commands/moveBlock/moveBlock.js";
|
|
10
|
+
import {
|
|
11
|
+
canNestBlock,
|
|
12
|
+
canUnnestBlock,
|
|
13
|
+
nestBlock,
|
|
14
|
+
unnestBlock,
|
|
15
|
+
} from "../api/blockManipulation/commands/nestBlock/nestBlock.js";
|
|
10
16
|
import { removeBlocks } from "../api/blockManipulation/commands/removeBlocks/removeBlocks.js";
|
|
11
17
|
import { replaceBlocks } from "../api/blockManipulation/commands/replaceBlocks/replaceBlocks.js";
|
|
12
18
|
import { updateBlock } from "../api/blockManipulation/commands/updateBlock/updateBlock.js";
|
|
@@ -17,7 +23,6 @@ import {
|
|
|
17
23
|
} from "../api/blockManipulation/selections/textCursorPosition/textCursorPosition.js";
|
|
18
24
|
import { createExternalHTMLExporter } from "../api/exporters/html/externalHTMLExporter.js";
|
|
19
25
|
import { blocksToMarkdown } from "../api/exporters/markdown/markdownExporter.js";
|
|
20
|
-
import { getBlockInfoFromSelection } from "../api/getBlockInfoFromPos.js";
|
|
21
26
|
import { HTMLToBlocks } from "../api/parsers/html/parseHTML.js";
|
|
22
27
|
import { markdownToBlocks } from "../api/parsers/markdown/parseMarkdown.js";
|
|
23
28
|
import {
|
|
@@ -66,7 +71,8 @@ import { PlaceholderPlugin } from "../extensions/Placeholder/PlaceholderPlugin.j
|
|
|
66
71
|
import { Dictionary } from "../i18n/dictionary.js";
|
|
67
72
|
import { en } from "../i18n/locales/index.js";
|
|
68
73
|
|
|
69
|
-
import { Transaction } from "@tiptap/pm/state";
|
|
74
|
+
import { Plugin, Transaction } from "@tiptap/pm/state";
|
|
75
|
+
import { dropCursor } from "prosemirror-dropcursor";
|
|
70
76
|
import { createInternalHTMLSerializer } from "../api/exporters/html/internalHTMLSerializer.js";
|
|
71
77
|
import { inlineContentToNodes } from "../api/nodeConversions/blockToNode.js";
|
|
72
78
|
import { nodeToBlock } from "../api/nodeConversions/nodeToBlock.js";
|
|
@@ -90,7 +96,7 @@ export type BlockNoteEditorOptions<
|
|
|
90
96
|
/**
|
|
91
97
|
* A dictionary object containing translations for the editor.
|
|
92
98
|
*/
|
|
93
|
-
dictionary?: Dictionary
|
|
99
|
+
dictionary?: Dictionary & Record<string, any>;
|
|
94
100
|
|
|
95
101
|
/**
|
|
96
102
|
* @deprecated, provide placeholders via dictionary instead
|
|
@@ -190,6 +196,8 @@ export type BlockNoteEditorOptions<
|
|
|
190
196
|
* (note that the id is always set on the `data-id` attribute)
|
|
191
197
|
*/
|
|
192
198
|
setIdAttribute?: boolean;
|
|
199
|
+
|
|
200
|
+
dropCursor?: (opts: any) => Plugin;
|
|
193
201
|
};
|
|
194
202
|
|
|
195
203
|
const blockNoteTipTapOptions = {
|
|
@@ -236,7 +244,7 @@ export class BlockNoteEditor<
|
|
|
236
244
|
/**
|
|
237
245
|
* The dictionary contains translations for the editor.
|
|
238
246
|
*/
|
|
239
|
-
public readonly dictionary: Dictionary
|
|
247
|
+
public readonly dictionary: Dictionary & Record<string, any>;
|
|
240
248
|
|
|
241
249
|
/**
|
|
242
250
|
* The schema of the editor. The schema defines which Blocks, InlineContent, and Styles are available in the editor.
|
|
@@ -369,6 +377,7 @@ export class BlockNoteEditor<
|
|
|
369
377
|
setIdAttribute: newOptions.setIdAttribute,
|
|
370
378
|
});
|
|
371
379
|
|
|
380
|
+
const dropCursorPlugin: any = this.options.dropCursor ?? dropCursor;
|
|
372
381
|
const blockNoteUIExtension = Extension.create({
|
|
373
382
|
name: "BlockNoteUIExtension",
|
|
374
383
|
|
|
@@ -380,6 +389,7 @@ export class BlockNoteEditor<
|
|
|
380
389
|
this.suggestionMenus.plugin,
|
|
381
390
|
...(this.filePanel ? [this.filePanel.plugin] : []),
|
|
382
391
|
...(this.tableHandles ? [this.tableHandles.plugin] : []),
|
|
392
|
+
dropCursorPlugin({ width: 5, color: "#ddeeff", editor: this }),
|
|
383
393
|
PlaceholderPlugin(this, newOptions.placeholders),
|
|
384
394
|
NodeSelectionKeyboardPlugin(),
|
|
385
395
|
...(this.options.animations ?? true
|
|
@@ -962,41 +972,28 @@ export class BlockNoteEditor<
|
|
|
962
972
|
* Checks if the block containing the text cursor can be nested.
|
|
963
973
|
*/
|
|
964
974
|
public canNestBlock() {
|
|
965
|
-
|
|
966
|
-
this._tiptapEditor.state
|
|
967
|
-
);
|
|
968
|
-
|
|
969
|
-
return (
|
|
970
|
-
this._tiptapEditor.state.doc.resolve(blockContainer.beforePos)
|
|
971
|
-
.nodeBefore !== null
|
|
972
|
-
);
|
|
975
|
+
return canNestBlock(this);
|
|
973
976
|
}
|
|
974
977
|
|
|
975
978
|
/**
|
|
976
979
|
* Nests the block containing the text cursor into the block above it.
|
|
977
980
|
*/
|
|
978
981
|
public nestBlock() {
|
|
979
|
-
this
|
|
982
|
+
nestBlock(this);
|
|
980
983
|
}
|
|
981
984
|
|
|
982
985
|
/**
|
|
983
986
|
* Checks if the block containing the text cursor is nested.
|
|
984
987
|
*/
|
|
985
988
|
public canUnnestBlock() {
|
|
986
|
-
|
|
987
|
-
this._tiptapEditor.state
|
|
988
|
-
);
|
|
989
|
-
|
|
990
|
-
return (
|
|
991
|
-
this._tiptapEditor.state.doc.resolve(blockContainer.beforePos).depth > 1
|
|
992
|
-
);
|
|
989
|
+
return canUnnestBlock(this);
|
|
993
990
|
}
|
|
994
991
|
|
|
995
992
|
/**
|
|
996
993
|
* Lifts the block containing the text cursor out of its parent.
|
|
997
994
|
*/
|
|
998
995
|
public unnestBlock() {
|
|
999
|
-
this
|
|
996
|
+
unnestBlock(this);
|
|
1000
997
|
}
|
|
1001
998
|
|
|
1002
999
|
/**
|
|
@@ -4,7 +4,6 @@ import type { BlockNoteEditor } from "./BlockNoteEditor.js";
|
|
|
4
4
|
|
|
5
5
|
import Collaboration from "@tiptap/extension-collaboration";
|
|
6
6
|
import CollaborationCursor from "@tiptap/extension-collaboration-cursor";
|
|
7
|
-
import { Dropcursor } from "@tiptap/extension-dropcursor";
|
|
8
7
|
import { Gapcursor } from "@tiptap/extension-gapcursor";
|
|
9
8
|
import { HardBreak } from "@tiptap/extension-hard-break";
|
|
10
9
|
import { History } from "@tiptap/extension-history";
|
|
@@ -70,7 +69,8 @@ export const getBlockNoteExtensions = <
|
|
|
70
69
|
|
|
71
70
|
// DropCursor,
|
|
72
71
|
UniqueID.configure({
|
|
73
|
-
|
|
72
|
+
// everything from bnBlock group (nodes that represent a BlockNote block should have an id)
|
|
73
|
+
types: ["blockContainer", "columnList", "column"],
|
|
74
74
|
setIdAttribute: opts.setIdAttribute,
|
|
75
75
|
}),
|
|
76
76
|
HardBreak.extend({ priority: 10 }),
|
|
@@ -155,7 +155,6 @@ export const getBlockNoteExtensions = <
|
|
|
155
155
|
createPasteFromClipboardExtension(opts.editor),
|
|
156
156
|
createDropFileExtension(opts.editor),
|
|
157
157
|
|
|
158
|
-
Dropcursor.configure({ width: 5, color: "#ddeeff" }),
|
|
159
158
|
// This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
|
|
160
159
|
// should be handled before Enter handlers in other components like splitListItem
|
|
161
160
|
...(opts.trailingBlock === undefined || opts.trailingBlock
|
|
@@ -24,7 +24,7 @@ export type BlockNoteTipTapEditorOptions = Partial<
|
|
|
24
24
|
// @ts-ignore
|
|
25
25
|
export class BlockNoteTipTapEditor extends TiptapEditor {
|
|
26
26
|
private _state: EditorState;
|
|
27
|
-
|
|
27
|
+
private _creating = false;
|
|
28
28
|
public static create = (
|
|
29
29
|
options: BlockNoteTipTapEditorOptions,
|
|
30
30
|
styleSchema: StyleSchema
|
|
@@ -151,8 +151,12 @@ export class BlockNoteTipTapEditor extends TiptapEditor {
|
|
|
151
151
|
* Replace the default `createView` method with a custom one - which we call on mount
|
|
152
152
|
*/
|
|
153
153
|
private createViewAlternative() {
|
|
154
|
+
this._creating = true;
|
|
154
155
|
// Without queueMicrotask, custom IC / styles will give a React FlushSync error
|
|
155
156
|
queueMicrotask(() => {
|
|
157
|
+
if (!this._creating) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
156
160
|
this.view = new EditorView(
|
|
157
161
|
{ mount: this.options.element as any }, // use mount option so that we reuse the existing element instead of creating a new one
|
|
158
162
|
{
|
|
@@ -178,6 +182,7 @@ export class BlockNoteTipTapEditor extends TiptapEditor {
|
|
|
178
182
|
this.commands.focus(this.options.autofocus);
|
|
179
183
|
this.emit("create", { editor: this });
|
|
180
184
|
this.isInitialized = true;
|
|
185
|
+
this._creating = false;
|
|
181
186
|
});
|
|
182
187
|
}
|
|
183
188
|
|
|
@@ -189,6 +194,8 @@ export class BlockNoteTipTapEditor extends TiptapEditor {
|
|
|
189
194
|
public mount = (element?: HTMLElement | null) => {
|
|
190
195
|
if (!element) {
|
|
191
196
|
this.destroy();
|
|
197
|
+
// cancel pending microtask
|
|
198
|
+
this._creating = false;
|
|
192
199
|
} else {
|
|
193
200
|
this.options.element = element;
|
|
194
201
|
// @ts-ignore
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export const COLORS_DEFAULT = {
|
|
2
|
+
gray: {
|
|
3
|
+
text: "#9b9a97",
|
|
4
|
+
background: "#ebeced",
|
|
5
|
+
},
|
|
6
|
+
brown: {
|
|
7
|
+
text: "#64473a",
|
|
8
|
+
background: "#e9e5e3",
|
|
9
|
+
},
|
|
10
|
+
red: {
|
|
11
|
+
text: "#e03e3e",
|
|
12
|
+
background: "#fbe4e4",
|
|
13
|
+
},
|
|
14
|
+
orange: {
|
|
15
|
+
text: "#d9730d",
|
|
16
|
+
background: "#f6e9d9",
|
|
17
|
+
},
|
|
18
|
+
yellow: {
|
|
19
|
+
text: "#dfab01",
|
|
20
|
+
background: "#fbf3db",
|
|
21
|
+
},
|
|
22
|
+
green: {
|
|
23
|
+
text: "#4d6461",
|
|
24
|
+
background: "#ddedea",
|
|
25
|
+
},
|
|
26
|
+
blue: {
|
|
27
|
+
text: "#0b6e99",
|
|
28
|
+
background: "#ddebf1",
|
|
29
|
+
},
|
|
30
|
+
purple: {
|
|
31
|
+
text: "#6940a5",
|
|
32
|
+
background: "#eae4f2",
|
|
33
|
+
},
|
|
34
|
+
pink: {
|
|
35
|
+
text: "#ad1a72",
|
|
36
|
+
background: "#f4dfeb",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const COLORS_DARK_MODE_DEFAULT = {
|
|
41
|
+
gray: {
|
|
42
|
+
text: "#bebdb8",
|
|
43
|
+
background: "#9b9a97",
|
|
44
|
+
},
|
|
45
|
+
brown: {
|
|
46
|
+
text: "#8e6552",
|
|
47
|
+
background: "#64473a",
|
|
48
|
+
},
|
|
49
|
+
red: {
|
|
50
|
+
text: "#ec4040",
|
|
51
|
+
background: "#be3434",
|
|
52
|
+
},
|
|
53
|
+
orange: {
|
|
54
|
+
text: "#e3790d",
|
|
55
|
+
background: "#b7600a",
|
|
56
|
+
},
|
|
57
|
+
yellow: {
|
|
58
|
+
text: "#dfab01",
|
|
59
|
+
background: "#b58b00",
|
|
60
|
+
},
|
|
61
|
+
green: {
|
|
62
|
+
text: "#6b8b87",
|
|
63
|
+
background: "#4d6461",
|
|
64
|
+
},
|
|
65
|
+
blue: {
|
|
66
|
+
text: "#0e87bc",
|
|
67
|
+
background: "#0b6e99",
|
|
68
|
+
},
|
|
69
|
+
purple: {
|
|
70
|
+
text: "#8552d7",
|
|
71
|
+
background: "#6940a5",
|
|
72
|
+
},
|
|
73
|
+
pink: {
|
|
74
|
+
text: "#da208f",
|
|
75
|
+
background: "#ad1a72",
|
|
76
|
+
},
|
|
77
|
+
};
|