@blocknote/core 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.js +2315 -1711
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +7 -7
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/clipboard/__snapshots__/internal/basicBlocks.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/basicBlocksWithProps.html +1 -0
- package/src/api/clipboard/clipboardInternal.test.ts +126 -0
- package/src/api/exporters/html/__snapshots__/pageBreak/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/pageBreak/basic/internal.html +1 -0
- package/src/api/exporters/markdown/__snapshots__/pageBreak/basic/markdown.md +0 -0
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +16 -0
- package/src/api/parsers/html/__snapshots__/parse-codeblocks.json +62 -0
- package/src/api/parsers/html/parseHTML.test.ts +9 -0
- package/src/api/testUtil/cases/defaultSchema.ts +15 -1
- package/src/blocks/CodeBlockContent/CodeBlockContent.ts +32 -11
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +0 -9
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +1 -1
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +1 -1
- package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +49 -0
- package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +45 -0
- package/src/blocks/PageBreakBlockContent/schema.ts +40 -0
- package/src/editor/Block.css +15 -1
- package/src/editor/BlockNoteEditor.ts +17 -0
- package/src/editor/BlockNoteExtensions.ts +111 -16
- package/src/editor/editor.css +22 -7
- package/src/extensions/SideMenu/SideMenuPlugin.ts +115 -23
- package/src/extensions/SideMenu/dragging.ts +0 -1
- package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +1 -1
- package/src/i18n/locales/ar.ts +6 -0
- package/src/i18n/locales/de.ts +6 -0
- package/src/i18n/locales/en.ts +6 -0
- package/src/i18n/locales/es.ts +6 -0
- package/src/i18n/locales/fr.ts +47 -17
- package/src/i18n/locales/hr.ts +72 -54
- package/src/i18n/locales/index.ts +1 -0
- package/src/i18n/locales/is.ts +6 -0
- package/src/i18n/locales/it.ts +315 -0
- package/src/i18n/locales/ja.ts +6 -0
- package/src/i18n/locales/ko.ts +6 -0
- package/src/i18n/locales/nl.ts +6 -0
- package/src/i18n/locales/pl.ts +6 -0
- package/src/i18n/locales/pt.ts +6 -0
- package/src/i18n/locales/ru.ts +6 -0
- package/src/i18n/locales/vi.ts +6 -0
- package/src/i18n/locales/zh.ts +6 -0
- package/src/index.ts +3 -0
- package/types/src/api/testUtil/cases/defaultSchema.d.ts +2 -1
- package/types/src/blocks/CodeBlockContent/CodeBlockContent.d.ts +2 -0
- package/types/src/blocks/PageBreakBlockContent/PageBreakBlockContent.d.ts +31 -0
- package/types/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.d.ts +8 -0
- package/types/src/blocks/PageBreakBlockContent/schema.d.ts +86 -0
- package/types/src/editor/BlockNoteEditor.d.ts +15 -0
- package/types/src/editor/BlockNoteExtensions.d.ts +2 -0
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +25 -5
- package/types/src/extensions/SuggestionMenu/DefaultSuggestionItem.d.ts +1 -1
- package/types/src/i18n/locales/de.d.ts +6 -0
- package/types/src/i18n/locales/en.d.ts +6 -0
- package/types/src/i18n/locales/es.d.ts +6 -0
- package/types/src/i18n/locales/hr.d.ts +6 -0
- package/types/src/i18n/locales/index.d.ts +1 -0
- package/types/src/i18n/locales/it.d.ts +245 -0
- package/types/src/index.d.ts +3 -0
package/dist/webpack-stats.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"builtAt":1734956129836,"assets":[{"name":"blocknote.umd.cjs","size":235483},{"name":"blocknote.umd.cjs.map","size":880108}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/i18n/locales/ar.ts","size":6741,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/de.ts","size":7352,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/en.ts","size":6830,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/es.ts","size":7226,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/fr.ts","size":7467,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/hr.ts","size":7031,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/is.ts","size":7034,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ja.ts","size":6484,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ko.ts","size":6280,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/nl.ts","size":7240,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pl.ts","size":6935,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pt.ts","size":7153,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ru.ts","size":7815,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/vi.ts","size":7083,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/zh.ts","size":6234,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/index.ts","size":0,"chunks":["a1ee98a"]},{"name":"./src/util/typescript.ts","size":331,"chunks":["a1ee98a"]},{"name":"./src/extensions/UniqueID/UniqueID.ts","size":8887,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/types.ts","size":302,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/blockToNode.ts","size":5714,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/serializeBlocksExternalHTML.ts","size":5122,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/externalHTMLExporter.ts","size":886,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/serializeBlocksInternalHTML.ts","size":3201,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/internalHTMLSerializer.ts","size":288,"chunks":["a1ee98a"]},{"name":"./src/api/getBlockInfoFromPos.ts","size":3648,"chunks":["a1ee98a"]},{"name":"./src/api/nodeUtil.ts","size":490,"chunks":["a1ee98a"]},{"name":"./src/util/browser.ts","size":536,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockHelpers.ts","size":1755,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultProps.ts","size":269,"chunks":["a1ee98a"]},{"name":"./src/util/string.ts","size":299,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/internal.ts","size":4130,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/createSpec.ts","size":3609,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/nodeToBlock.ts","size":7706,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/internal.ts","size":1398,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/createSpec.ts","size":2739,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/internal.ts","size":1162,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/createSpec.ts","size":1263,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts","size":342,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts","size":1725,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts","size":753,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts","size":1428,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts","size":307,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts","size":294,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/parseAudioElement.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/AudioBlockContent.ts","size":3155,"chunks":["a1ee98a"]},{"name":"./src/blocks/CodeBlockContent/defaultSupportedLanguages.ts","size":1707,"chunks":["a1ee98a"]},{"name":"./src/blocks/CodeBlockContent/CodeBlockContent.ts","size":8550,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/FileBlockContent.ts","size":1460,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts","size":4637,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","size":316,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/parseImageElement.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/ImageBlockContent.ts","size":3243,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableExtension.ts","size":2275,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/parseVideoElement.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/VideoBlockContent.ts","size":3162,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorMark.ts","size":946,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorMark.ts","size":866,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/updateBlock/updateBlock.ts","size":4673,"chunks":["a1ee98a"]},{"name":"./src/blocks/HeadingBlockContent/HeadingBlockContent.ts","size":3631,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/splitBlock/splitBlock.ts","size":868,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","size":1429,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","size":3490,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts","size":7223,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","size":2207,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","size":4502,"chunks":["a1ee98a"]},{"name":"./src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","size":1434,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableBlockContent.ts","size":4223,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlocks.ts","size":1147,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockTypeGuards.ts","size":1580,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/getBlock/getBlock.ts","size":2452,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts","size":1141,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts","size":5693,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/nestBlock/nestBlock.ts","size":2324,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts","size":2533,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/removeBlocks/removeBlocks.ts","size":123,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/insertContentAt.ts","size":1120,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts","size":2880,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/selections/selection.ts","size":4698,"chunks":["a1ee98a"]},{"name":"./src/util/esmDependencies.ts","size":820,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","size":752,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts","size":969,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/markdownExporter.ts","size":837,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/util/nestedLists.ts","size":2174,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/parseHTML.ts","size":503,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/markdown/parseMarkdown.ts","size":1097,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/acceptedMIMETypes.ts","size":115,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/handleFileInsertion.ts","size":3576,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/fileDropExtension.ts","size":884,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/handleVSCodePaste.ts","size":661,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/pasteExtension.ts","size":1552,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/fragmentToBlocks.ts","size":859,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/toClipboard/copyExtension.ts","size":4666,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorExtension.ts","size":791,"chunks":["a1ee98a"]},{"name":"./src/util/EventEmitter.ts","size":744,"chunks":["a1ee98a"]},{"name":"./src/extensions/FilePanel/FilePanelPlugin.ts","size":3584,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":5240,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts","size":3228,"chunks":["a1ee98a"]},{"name":"./src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts","size":14774,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/LinkToolbarPlugin.ts","size":7557,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/protocols.ts","size":172,"chunks":["a1ee98a"]},{"name":"./src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts","size":1195,"chunks":["a1ee98a"]},{"name":"./src/extensions/Placeholder/PlaceholderPlugin.ts","size":3316,"chunks":["a1ee98a"]},{"name":"./src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","size":4802,"chunks":["a1ee98a"]},{"name":"./src/extensions/getDraggableBlockFromElement.ts","size":404,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/dragging.ts","size":4579,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":10354,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/SuggestionPlugin.ts","size":8034,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":19364,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextAlignment/TextAlignmentExtension.ts","size":928,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorExtension.ts","size":725,"chunks":["a1ee98a"]},{"name":"./src/extensions/TrailingNode/TrailingNodeExtension.ts","size":1563,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockContainer.ts","size":2038,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockGroup.ts","size":1102,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Doc.ts","size":90,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteExtensions.ts","size":5498,"chunks":["a1ee98a"]},{"name":"./src/editor/transformPasted.ts","size":2604,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteSchema.ts","size":1044,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteTipTapEditor.ts","size":3599,"chunks":["a1ee98a"]},{"name":"./src/style.css","size":0,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteEditor.ts","size":26291,"chunks":["a1ee98a"]},{"name":"./src/editor/defaultColors.ts","size":1193,"chunks":["a1ee98a"]},{"name":"./src/exporter/Exporter.ts","size":1075,"chunks":["a1ee98a"]},{"name":"./src/exporter/mapping.ts","size":197,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts","size":700,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","size":6735,"chunks":["a1ee98a"]},{"name":"./src/util/combineByGroup.ts","size":550,"chunks":["a1ee98a"]},{"name":"./src/api/testUtil/partialBlockTestUtil.ts","size":3149,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
|
|
1
|
+
{"builtAt":1737452121985,"assets":[{"name":"blocknote.umd.cjs","size":246457},{"name":"blocknote.umd.cjs.map","size":911931}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/i18n/locales/ar.ts","size":6919,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/de.ts","size":7549,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/en.ts","size":6990,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/es.ts","size":7421,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/fr.ts","size":8126,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/hr.ts","size":7328,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/is.ts","size":7210,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ja.ts","size":6639,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ko.ts","size":6437,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/nl.ts","size":7426,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pl.ts","size":7129,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pt.ts","size":7349,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ru.ts","size":8013,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/vi.ts","size":7264,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/zh.ts","size":6381,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/it.ts","size":7338,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/index.ts","size":0,"chunks":["a1ee98a"]},{"name":"./src/util/typescript.ts","size":331,"chunks":["a1ee98a"]},{"name":"./src/extensions/UniqueID/UniqueID.ts","size":8887,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/types.ts","size":302,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/blockToNode.ts","size":5714,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/serializeBlocksExternalHTML.ts","size":5122,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/externalHTMLExporter.ts","size":886,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/serializeBlocksInternalHTML.ts","size":3201,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/internalHTMLSerializer.ts","size":288,"chunks":["a1ee98a"]},{"name":"./src/api/getBlockInfoFromPos.ts","size":3648,"chunks":["a1ee98a"]},{"name":"./src/api/nodeUtil.ts","size":490,"chunks":["a1ee98a"]},{"name":"./src/util/browser.ts","size":536,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockHelpers.ts","size":1755,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultProps.ts","size":269,"chunks":["a1ee98a"]},{"name":"./src/util/string.ts","size":299,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/internal.ts","size":4130,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/createSpec.ts","size":3609,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/nodeToBlock.ts","size":7706,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/internal.ts","size":1398,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/createSpec.ts","size":2739,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/internal.ts","size":1162,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/createSpec.ts","size":1263,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts","size":342,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts","size":1725,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts","size":753,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts","size":1428,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts","size":307,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts","size":294,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/parseAudioElement.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/AudioBlockContent.ts","size":3155,"chunks":["a1ee98a"]},{"name":"./src/blocks/CodeBlockContent/defaultSupportedLanguages.ts","size":1707,"chunks":["a1ee98a"]},{"name":"./src/blocks/CodeBlockContent/CodeBlockContent.ts","size":9104,"chunks":["a1ee98a"]},{"name":"./src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts","size":854,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorMark.ts","size":946,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorMark.ts","size":866,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/FileBlockContent.ts","size":1460,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/updateBlock/updateBlock.ts","size":4673,"chunks":["a1ee98a"]},{"name":"./src/blocks/HeadingBlockContent/HeadingBlockContent.ts","size":3418,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts","size":4637,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/parseImageElement.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/ImageBlockContent.ts","size":3243,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/splitBlock/splitBlock.ts","size":868,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","size":1429,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","size":3415,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts","size":7148,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","size":2207,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","size":4427,"chunks":["a1ee98a"]},{"name":"./src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","size":1434,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableExtension.ts","size":2275,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableBlockContent.ts","size":4223,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/parseVideoElement.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/VideoBlockContent.ts","size":3162,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlocks.ts","size":1147,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockTypeGuards.ts","size":1580,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","size":6735,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteSchema.ts","size":1044,"chunks":["a1ee98a"]},{"name":"./src/blocks/PageBreakBlockContent/schema.ts","size":350,"chunks":["a1ee98a"]},{"name":"./src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts","size":534,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","size":316,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/getBlock/getBlock.ts","size":2452,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts","size":1141,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts","size":5693,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/nestBlock/nestBlock.ts","size":2324,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts","size":2533,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/removeBlocks/removeBlocks.ts","size":123,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/insertContentAt.ts","size":1120,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts","size":2880,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/selections/selection.ts","size":4698,"chunks":["a1ee98a"]},{"name":"./src/util/esmDependencies.ts","size":820,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","size":752,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts","size":969,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/markdownExporter.ts","size":837,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/util/nestedLists.ts","size":2174,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/parseHTML.ts","size":503,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/markdown/parseMarkdown.ts","size":1097,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/acceptedMIMETypes.ts","size":115,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/handleFileInsertion.ts","size":3576,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/fileDropExtension.ts","size":884,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/handleVSCodePaste.ts","size":661,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/fromClipboard/pasteExtension.ts","size":1552,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/fragmentToBlocks.ts","size":859,"chunks":["a1ee98a"]},{"name":"./src/api/clipboard/toClipboard/copyExtension.ts","size":4666,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorExtension.ts","size":791,"chunks":["a1ee98a"]},{"name":"./src/util/EventEmitter.ts","size":744,"chunks":["a1ee98a"]},{"name":"./src/extensions/FilePanel/FilePanelPlugin.ts","size":3584,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":5240,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts","size":3228,"chunks":["a1ee98a"]},{"name":"./src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts","size":14774,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/LinkToolbarPlugin.ts","size":7557,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/protocols.ts","size":172,"chunks":["a1ee98a"]},{"name":"./src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts","size":1195,"chunks":["a1ee98a"]},{"name":"./src/extensions/Placeholder/PlaceholderPlugin.ts","size":3316,"chunks":["a1ee98a"]},{"name":"./src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","size":4802,"chunks":["a1ee98a"]},{"name":"./src/extensions/getDraggableBlockFromElement.ts","size":404,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/dragging.ts","size":4521,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":12987,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/SuggestionPlugin.ts","size":8034,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":19364,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextAlignment/TextAlignmentExtension.ts","size":928,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorExtension.ts","size":725,"chunks":["a1ee98a"]},{"name":"./src/extensions/TrailingNode/TrailingNodeExtension.ts","size":1563,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockContainer.ts","size":2038,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockGroup.ts","size":1102,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Doc.ts","size":90,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteExtensions.ts","size":7869,"chunks":["a1ee98a"]},{"name":"./src/editor/transformPasted.ts","size":2604,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteTipTapEditor.ts","size":3599,"chunks":["a1ee98a"]},{"name":"./src/style.css","size":0,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteEditor.ts","size":26360,"chunks":["a1ee98a"]},{"name":"./src/editor/defaultColors.ts","size":1193,"chunks":["a1ee98a"]},{"name":"./src/exporter/Exporter.ts","size":1075,"chunks":["a1ee98a"]},{"name":"./src/exporter/mapping.ts","size":197,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts","size":700,"chunks":["a1ee98a"]},{"name":"./src/util/combineByGroup.ts","size":550,"chunks":["a1ee98a"]},{"name":"./src/api/testUtil/partialBlockTestUtil.ts","size":3149,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"*.css"
|
|
7
7
|
],
|
|
8
8
|
"license": "MPL-2.0",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.23.0",
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
12
|
"types",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"access": "public",
|
|
125
125
|
"registry": "https://registry.npmjs.org/"
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "147072ca94ec5e9de732a4190c440ae8ae8b2b64"
|
|
128
128
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Paragraph</p><h1>Heading</h1><ol><li><p>Numbered List Item</p></li></ol><ul><li><p>Bullet List Item</p></li><li><input type="checkbox"><p class="bn-inline-content">Check List Item</p></li></ul><pre><code class="bn-inline-content language-javascript">console.log("Hello World");</code></pre><table><tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr><tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr><tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr></table><p>Add image</p><p data-text-color="red"></p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p data-text-color="red">Paragraph</p><h2 data-level="2">Heading</h2><ol start="2"><li><p data-start="2">Numbered List Item</p></li></ol><ul><li><p data-background-color="red">Bullet List Item</p></li><li><input type="checkbox" checked="" data-checked="true"><p class="bn-inline-content">Check List Item</p></li></ul><pre><code class="bn-inline-content language-typescript">console.log("Hello World");</code></pre><table><tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr><tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr><tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr></table><figure data-name="1280px-Placeholder_view_vector.svg.png" data-url="https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/Placeholder_view_vector.svg/1280px-Placeholder_view_vector.svg.png" data-caption="Placeholder" data-preview-width="256"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/Placeholder_view_vector.svg/1280px-Placeholder_view_vector.svg.png" alt="1280px-Placeholder_view_vector.svg.png" width="256"><figcaption>Placeholder</figcaption></figure><p></p>
|
|
@@ -148,6 +148,122 @@ describe("Test ProseMirror selection clipboard HTML", () => {
|
|
|
148
148
|
type: "customParagraph",
|
|
149
149
|
content: "Paragraph",
|
|
150
150
|
},
|
|
151
|
+
{
|
|
152
|
+
type: "paragraph",
|
|
153
|
+
content: "Paragraph",
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
type: "heading",
|
|
157
|
+
content: "Heading",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
type: "numberedListItem",
|
|
161
|
+
content: "Numbered List Item",
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
type: "bulletListItem",
|
|
165
|
+
content: "Bullet List Item",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
type: "checkListItem",
|
|
169
|
+
content: "Check List Item",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
type: "codeBlock",
|
|
173
|
+
content: 'console.log("Hello World");',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
type: "table",
|
|
177
|
+
content: {
|
|
178
|
+
type: "tableContent",
|
|
179
|
+
rows: [
|
|
180
|
+
{
|
|
181
|
+
cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]],
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]],
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]],
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
type: "image",
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
type: "paragraph",
|
|
197
|
+
props: {
|
|
198
|
+
textColor: "red",
|
|
199
|
+
},
|
|
200
|
+
content: "Paragraph",
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
type: "heading",
|
|
204
|
+
props: {
|
|
205
|
+
level: 2,
|
|
206
|
+
},
|
|
207
|
+
content: "Heading",
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: "numberedListItem",
|
|
211
|
+
props: {
|
|
212
|
+
start: 2,
|
|
213
|
+
},
|
|
214
|
+
content: "Numbered List Item",
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
type: "bulletListItem",
|
|
218
|
+
props: {
|
|
219
|
+
backgroundColor: "red",
|
|
220
|
+
},
|
|
221
|
+
content: "Bullet List Item",
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
type: "checkListItem",
|
|
225
|
+
props: {
|
|
226
|
+
checked: true,
|
|
227
|
+
},
|
|
228
|
+
content: "Check List Item",
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
type: "codeBlock",
|
|
232
|
+
props: {
|
|
233
|
+
language: "typescript",
|
|
234
|
+
},
|
|
235
|
+
content: 'console.log("Hello World");',
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
type: "table",
|
|
239
|
+
content: {
|
|
240
|
+
type: "tableContent",
|
|
241
|
+
rows: [
|
|
242
|
+
{
|
|
243
|
+
cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]],
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]],
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
cells: [["Table Cell"], ["Table Cell"], ["Table Cell"]],
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
type: "image",
|
|
256
|
+
props: {
|
|
257
|
+
name: "1280px-Placeholder_view_vector.svg.png",
|
|
258
|
+
url: "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/Placeholder_view_vector.svg/1280px-Placeholder_view_vector.svg.png",
|
|
259
|
+
caption: "Placeholder",
|
|
260
|
+
showPreview: true,
|
|
261
|
+
previewWidth: 256,
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
type: "paragraph",
|
|
266
|
+
},
|
|
151
267
|
];
|
|
152
268
|
|
|
153
269
|
let editor: BlockNoteEditor<typeof schema.blockSchema>;
|
|
@@ -299,6 +415,16 @@ describe("Test ProseMirror selection clipboard HTML", () => {
|
|
|
299
415
|
createCopySelection: (doc) => TextSelection.create(doc, 277, 286),
|
|
300
416
|
createPasteSelection: (doc) => TextSelection.create(doc, 290, 299),
|
|
301
417
|
},
|
|
418
|
+
// Copy/paste basic blocks.
|
|
419
|
+
{
|
|
420
|
+
testName: "basicBlocks",
|
|
421
|
+
createCopySelection: (doc) => TextSelection.create(doc, 303, 558),
|
|
422
|
+
},
|
|
423
|
+
// Copy/paste basic blocks with props.
|
|
424
|
+
{
|
|
425
|
+
testName: "basicBlocksWithProps",
|
|
426
|
+
createCopySelection: (doc) => TextSelection.create(doc, 558, 813),
|
|
427
|
+
},
|
|
302
428
|
];
|
|
303
429
|
|
|
304
430
|
for (const testCase of testCases) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div data-page-break=""></div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="bn-block-group" data-node-type="blockGroup"><div class="bn-block-outer" data-node-type="blockOuter" data-id="1"><div class="bn-block" data-node-type="blockContainer" data-id="1"><div class="bn-block-content" data-content-type="pageBreak"><div class="bn-page-break" data-page-break=""></div></div></div></div></div>
|
|
File without changes
|
|
@@ -1605,6 +1605,22 @@ exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert
|
|
|
1605
1605
|
}
|
|
1606
1606
|
`;
|
|
1607
1607
|
|
|
1608
|
+
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert pageBreak/basic to/from prosemirror 1`] = `
|
|
1609
|
+
{
|
|
1610
|
+
"attrs": {
|
|
1611
|
+
"backgroundColor": "default",
|
|
1612
|
+
"id": "1",
|
|
1613
|
+
"textColor": "default",
|
|
1614
|
+
},
|
|
1615
|
+
"content": [
|
|
1616
|
+
{
|
|
1617
|
+
"type": "pageBreak",
|
|
1618
|
+
},
|
|
1619
|
+
],
|
|
1620
|
+
"type": "blockContainer",
|
|
1621
|
+
}
|
|
1622
|
+
`;
|
|
1623
|
+
|
|
1608
1624
|
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert paragraph/basic to/from prosemirror 1`] = `
|
|
1609
1625
|
{
|
|
1610
1626
|
"attrs": {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "1",
|
|
4
|
+
"type": "codeBlock",
|
|
5
|
+
"props": {
|
|
6
|
+
"language": "javascript"
|
|
7
|
+
},
|
|
8
|
+
"content": [
|
|
9
|
+
{
|
|
10
|
+
"type": "text",
|
|
11
|
+
"text": "console.log(\"Should default to JS\")",
|
|
12
|
+
"styles": {}
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"children": []
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "2",
|
|
19
|
+
"type": "codeBlock",
|
|
20
|
+
"props": {
|
|
21
|
+
"language": "typescript"
|
|
22
|
+
},
|
|
23
|
+
"content": [
|
|
24
|
+
{
|
|
25
|
+
"type": "text",
|
|
26
|
+
"text": "console.log(\"Should parse TS from data-language\")",
|
|
27
|
+
"styles": {}
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"children": []
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "3",
|
|
34
|
+
"type": "codeBlock",
|
|
35
|
+
"props": {
|
|
36
|
+
"language": "python"
|
|
37
|
+
},
|
|
38
|
+
"content": [
|
|
39
|
+
{
|
|
40
|
+
"type": "text",
|
|
41
|
+
"text": "print(\"Should parse Python from language- class\")",
|
|
42
|
+
"styles": {}
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"children": []
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "4",
|
|
49
|
+
"type": "codeBlock",
|
|
50
|
+
"props": {
|
|
51
|
+
"language": "typescript"
|
|
52
|
+
},
|
|
53
|
+
"content": [
|
|
54
|
+
{
|
|
55
|
+
"type": "text",
|
|
56
|
+
"text": "console.log(\"Should prioritize TS from data-language over language- class\")",
|
|
57
|
+
"styles": {}
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"children": []
|
|
61
|
+
}
|
|
62
|
+
]
|
|
@@ -516,4 +516,13 @@ With Hard Break</p>
|
|
|
516
516
|
|
|
517
517
|
await parseHTMLAndCompareSnapshots(html, "parse-google-docs-html");
|
|
518
518
|
});
|
|
519
|
+
|
|
520
|
+
it("Parse codeblocks", async () => {
|
|
521
|
+
const html = `<pre><code>console.log("Should default to JS")</code></pre>
|
|
522
|
+
<pre><code data-language="typescript">console.log("Should parse TS from data-language")</code></pre>
|
|
523
|
+
<pre><code class="language-python">print("Should parse Python from language- class")</code></pre>
|
|
524
|
+
<pre><code class="language-ruby" data-language="typescript">console.log("Should prioritize TS from data-language over language- class")</code></pre>`;
|
|
525
|
+
|
|
526
|
+
await parseHTMLAndCompareSnapshots(html, "parse-codeblocks");
|
|
527
|
+
});
|
|
519
528
|
});
|
|
@@ -6,16 +6,22 @@ import {
|
|
|
6
6
|
DefaultInlineContentSchema,
|
|
7
7
|
DefaultStyleSchema,
|
|
8
8
|
} from "../../../blocks/defaultBlocks.js";
|
|
9
|
+
import {
|
|
10
|
+
pageBreakSchema,
|
|
11
|
+
withPageBreak,
|
|
12
|
+
} from "../../../blocks/PageBreakBlockContent/schema.js";
|
|
9
13
|
import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js";
|
|
14
|
+
import { BlockNoteSchema } from "../../../editor/BlockNoteSchema.js";
|
|
10
15
|
|
|
11
16
|
export const defaultSchemaTestCases: EditorTestCases<
|
|
12
|
-
DefaultBlockSchema,
|
|
17
|
+
DefaultBlockSchema & typeof pageBreakSchema.blockSchema,
|
|
13
18
|
DefaultInlineContentSchema,
|
|
14
19
|
DefaultStyleSchema
|
|
15
20
|
> = {
|
|
16
21
|
name: "default schema",
|
|
17
22
|
createEditor: () => {
|
|
18
23
|
return BlockNoteEditor.create({
|
|
24
|
+
schema: withPageBreak(BlockNoteSchema.create()),
|
|
19
25
|
uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
20
26
|
});
|
|
21
27
|
},
|
|
@@ -202,6 +208,14 @@ export const defaultSchemaTestCases: EditorTestCases<
|
|
|
202
208
|
},
|
|
203
209
|
],
|
|
204
210
|
},
|
|
211
|
+
{
|
|
212
|
+
name: "pageBreak/basic",
|
|
213
|
+
blocks: [
|
|
214
|
+
{
|
|
215
|
+
type: "pageBreak",
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
},
|
|
205
219
|
{
|
|
206
220
|
name: "file/button",
|
|
207
221
|
blocks: [
|
|
@@ -25,6 +25,10 @@ interface CodeBlockOptions {
|
|
|
25
25
|
supportedLanguages: SupportedLanguageConfig[];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export const shikiParserSymbol = Symbol.for("blocknote.shikiParser");
|
|
29
|
+
export const shikiHighlighterPromiseSymbol = Symbol.for(
|
|
30
|
+
"blocknote.shikiHighlighterPromise"
|
|
31
|
+
);
|
|
28
32
|
export const defaultCodeBlockPropSchema = {
|
|
29
33
|
language: {
|
|
30
34
|
default: "javascript",
|
|
@@ -77,9 +81,10 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
77
81
|
const languages = classNames
|
|
78
82
|
.filter((className) => className.startsWith("language-"))
|
|
79
83
|
.map((className) => className.replace("language-", ""));
|
|
80
|
-
const [classLanguage] = languages;
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
if (languages.length > 0) {
|
|
86
|
+
language = languages[0].toLowerCase();
|
|
87
|
+
}
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
if (!language) {
|
|
@@ -93,6 +98,7 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
93
98
|
);
|
|
94
99
|
},
|
|
95
100
|
renderHTML: (attributes) => {
|
|
101
|
+
// TODO: Use `data-language="..."` instead for easier parsing
|
|
96
102
|
return attributes.language && attributes.language !== "text"
|
|
97
103
|
? {
|
|
98
104
|
class: `language-${attributes.language}`,
|
|
@@ -106,9 +112,11 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
106
112
|
return [
|
|
107
113
|
{
|
|
108
114
|
tag: "div[data-content-type=" + this.name + "]",
|
|
115
|
+
contentElement: "code",
|
|
109
116
|
},
|
|
110
117
|
{
|
|
111
118
|
tag: "pre",
|
|
119
|
+
contentElement: "code",
|
|
112
120
|
preserveWhitespace: "full",
|
|
113
121
|
},
|
|
114
122
|
];
|
|
@@ -195,19 +203,30 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
195
203
|
};
|
|
196
204
|
},
|
|
197
205
|
addProseMirrorPlugins() {
|
|
206
|
+
const supportedLanguages = this.options
|
|
207
|
+
.supportedLanguages as SupportedLanguageConfig[];
|
|
208
|
+
const globalThisForShiki = globalThis as {
|
|
209
|
+
[shikiHighlighterPromiseSymbol]?: Promise<Highlighter>;
|
|
210
|
+
[shikiParserSymbol]?: Parser;
|
|
211
|
+
};
|
|
212
|
+
|
|
198
213
|
let highlighter: Highlighter | undefined;
|
|
199
214
|
let parser: Parser | undefined;
|
|
200
215
|
|
|
201
|
-
const supportedLanguages = this.options
|
|
202
|
-
.supportedLanguages as SupportedLanguageConfig[];
|
|
203
216
|
const lazyParser: Parser = (options) => {
|
|
204
217
|
if (!highlighter) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
218
|
+
globalThisForShiki[shikiHighlighterPromiseSymbol] =
|
|
219
|
+
globalThisForShiki[shikiHighlighterPromiseSymbol] ||
|
|
220
|
+
createHighlighter({
|
|
221
|
+
themes: ["github-dark"],
|
|
222
|
+
langs: [],
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
return globalThisForShiki[shikiHighlighterPromiseSymbol].then(
|
|
226
|
+
(createdHighlighter) => {
|
|
227
|
+
highlighter = createdHighlighter;
|
|
228
|
+
}
|
|
229
|
+
);
|
|
211
230
|
}
|
|
212
231
|
|
|
213
232
|
const language = options.language;
|
|
@@ -223,7 +242,9 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
223
242
|
}
|
|
224
243
|
|
|
225
244
|
if (!parser) {
|
|
226
|
-
parser =
|
|
245
|
+
parser =
|
|
246
|
+
globalThisForShiki[shikiParserSymbol] || createParser(highlighter);
|
|
247
|
+
globalThisForShiki[shikiParserSymbol] = parser;
|
|
227
248
|
}
|
|
228
249
|
|
|
229
250
|
return parser(options);
|
|
@@ -124,15 +124,6 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
|
|
|
124
124
|
return [
|
|
125
125
|
{
|
|
126
126
|
tag: "div[data-content-type=" + this.name + "]",
|
|
127
|
-
getAttrs: (element) => {
|
|
128
|
-
if (typeof element === "string") {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return {
|
|
133
|
-
level: element.getAttribute("data-level"),
|
|
134
|
-
};
|
|
135
|
-
},
|
|
136
127
|
},
|
|
137
128
|
{
|
|
138
129
|
tag: "h1",
|
package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts
CHANGED
|
@@ -79,7 +79,7 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
79
79
|
return [
|
|
80
80
|
// Case for regular HTML list structure.
|
|
81
81
|
{
|
|
82
|
-
tag: "div[data-content-type=" + this.name + "]",
|
|
82
|
+
tag: "div[data-content-type=" + this.name + "]",
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
tag: "li",
|
package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts
CHANGED
|
@@ -118,7 +118,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
118
118
|
parseHTML() {
|
|
119
119
|
return [
|
|
120
120
|
{
|
|
121
|
-
tag: "div[data-content-type=" + this.name + "]",
|
|
121
|
+
tag: "div[data-content-type=" + this.name + "]",
|
|
122
122
|
},
|
|
123
123
|
// Checkbox only.
|
|
124
124
|
{
|
package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts
CHANGED
|
@@ -106,7 +106,7 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
106
106
|
parseHTML() {
|
|
107
107
|
return [
|
|
108
108
|
{
|
|
109
|
-
tag: "div[data-content-type=" + this.name + "]",
|
|
109
|
+
tag: "div[data-content-type=" + this.name + "]",
|
|
110
110
|
},
|
|
111
111
|
// Case for regular HTML list structure.
|
|
112
112
|
// (e.g.: when pasting from other apps)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createBlockSpec,
|
|
3
|
+
CustomBlockConfig,
|
|
4
|
+
Props,
|
|
5
|
+
} from "../../schema/index.js";
|
|
6
|
+
|
|
7
|
+
export const pageBreakConfig = {
|
|
8
|
+
type: "pageBreak" as const,
|
|
9
|
+
propSchema: {},
|
|
10
|
+
content: "none",
|
|
11
|
+
isFileBlock: false,
|
|
12
|
+
isSelectable: false,
|
|
13
|
+
} satisfies CustomBlockConfig;
|
|
14
|
+
export const pageBreakRender = () => {
|
|
15
|
+
const pageBreak = document.createElement("div");
|
|
16
|
+
|
|
17
|
+
pageBreak.className = "bn-page-break";
|
|
18
|
+
pageBreak.setAttribute("data-page-break", "");
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
dom: pageBreak,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export const pageBreakParse = (
|
|
25
|
+
element: HTMLElement
|
|
26
|
+
): Partial<Props<typeof pageBreakConfig.propSchema>> | undefined => {
|
|
27
|
+
if (element.tagName === "DIV" && element.hasAttribute("data-page-break")) {
|
|
28
|
+
return {
|
|
29
|
+
type: "pageBreak",
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return undefined;
|
|
34
|
+
};
|
|
35
|
+
export const pageBreakToExternalHTML = () => {
|
|
36
|
+
const pageBreak = document.createElement("div");
|
|
37
|
+
|
|
38
|
+
pageBreak.setAttribute("data-page-break", "");
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
dom: pageBreak,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const PageBreak = createBlockSpec(pageBreakConfig, {
|
|
46
|
+
render: pageBreakRender,
|
|
47
|
+
parse: pageBreakParse,
|
|
48
|
+
toExternalHTML: pageBreakToExternalHTML,
|
|
49
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
2
|
+
import { DefaultSuggestionItem } from "../../extensions/SuggestionMenu/DefaultSuggestionItem.js";
|
|
3
|
+
import { insertOrUpdateBlock } from "../../extensions/SuggestionMenu/getDefaultSlashMenuItems.js";
|
|
4
|
+
import {
|
|
5
|
+
BlockSchema,
|
|
6
|
+
InlineContentSchema,
|
|
7
|
+
StyleSchema,
|
|
8
|
+
} from "../../schema/index.js";
|
|
9
|
+
import { pageBreakSchema } from "./schema.js";
|
|
10
|
+
|
|
11
|
+
export function checkPageBreakBlocksInSchema<
|
|
12
|
+
I extends InlineContentSchema,
|
|
13
|
+
S extends StyleSchema
|
|
14
|
+
>(
|
|
15
|
+
editor: BlockNoteEditor<any, I, S>
|
|
16
|
+
): editor is BlockNoteEditor<typeof pageBreakSchema.blockSchema, I, S> {
|
|
17
|
+
return (
|
|
18
|
+
"pageBreak" in editor.schema.blockSchema &&
|
|
19
|
+
editor.schema.blockSchema["pageBreak"] ===
|
|
20
|
+
pageBreakSchema.blockSchema["pageBreak"]
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function getPageBreakSlashMenuItems<
|
|
25
|
+
BSchema extends BlockSchema,
|
|
26
|
+
I extends InlineContentSchema,
|
|
27
|
+
S extends StyleSchema
|
|
28
|
+
>(editor: BlockNoteEditor<BSchema, I, S>) {
|
|
29
|
+
const items: (Omit<DefaultSuggestionItem, "key"> & { key: "page_break" })[] =
|
|
30
|
+
[];
|
|
31
|
+
|
|
32
|
+
if (checkPageBreakBlocksInSchema(editor)) {
|
|
33
|
+
items.push({
|
|
34
|
+
...editor.dictionary.slash_menu.page_break,
|
|
35
|
+
onItemClick: () => {
|
|
36
|
+
insertOrUpdateBlock(editor, {
|
|
37
|
+
type: "pageBreak",
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
key: "page_break",
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return items;
|
|
45
|
+
}
|