@blocknote/core 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.js +2320 -1692
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +7 -7
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +3 -3
- package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraph.html +96 -0
- package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html +96 -0
- package/src/api/clipboard/__snapshots__/external/pasteImage.html +111 -0
- package/src/api/clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html +96 -0
- package/src/api/clipboard/__snapshots__/external/pasteTable.html +149 -0
- package/src/api/clipboard/__snapshots__/external/pasteTableInExistingTable.html +124 -0
- package/src/api/clipboard/__snapshots__/internal/basicBlocks.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/basicBlocksWithProps.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html +1 -0
- package/src/api/clipboard/clipboardExternal.test.ts +161 -0
- package/src/api/clipboard/{clipboard.test.ts → clipboardInternal.test.ts} +186 -38
- package/src/api/clipboard/testUtil.ts +27 -0
- package/src/api/clipboard/toClipboard/copyExtension.ts +1 -0
- package/src/api/exporters/html/__snapshots__/pageBreak/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/pageBreak/basic/internal.html +1 -0
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +3 -1
- package/src/api/exporters/markdown/__snapshots__/pageBreak/basic/markdown.md +0 -0
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +16 -0
- package/src/api/nodeConversions/nodeToBlock.ts +4 -1
- package/src/api/parsers/html/__snapshots__/parse-codeblocks.json +62 -0
- package/src/api/parsers/html/parseHTML.test.ts +9 -0
- package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +2 -2
- package/src/api/testUtil/cases/defaultSchema.ts +15 -1
- package/src/api/testUtil/partialBlockTestUtil.ts +4 -1
- package/src/blocks/CodeBlockContent/CodeBlockContent.ts +32 -11
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +3 -28
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +1 -1
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +4 -16
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +11 -3
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +26 -6
- package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +49 -0
- package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +45 -0
- package/src/blocks/PageBreakBlockContent/schema.ts +40 -0
- package/src/editor/Block.css +18 -4
- package/src/editor/BlockNoteEditor.test.ts +21 -1
- package/src/editor/BlockNoteEditor.ts +17 -0
- package/src/editor/BlockNoteExtensions.ts +111 -16
- package/src/editor/editor.css +28 -13
- package/src/editor/transformPasted.ts +57 -4
- package/src/extensions/SideMenu/SideMenuPlugin.ts +115 -23
- package/src/extensions/SideMenu/dragging.ts +0 -1
- package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +1 -1
- package/src/i18n/locales/ar.ts +6 -0
- package/src/i18n/locales/de.ts +6 -0
- package/src/i18n/locales/en.ts +6 -0
- package/src/i18n/locales/es.ts +6 -0
- package/src/i18n/locales/fr.ts +47 -17
- package/src/i18n/locales/hr.ts +72 -54
- package/src/i18n/locales/index.ts +1 -0
- package/src/i18n/locales/is.ts +6 -0
- package/src/i18n/locales/it.ts +315 -0
- package/src/i18n/locales/ja.ts +6 -0
- package/src/i18n/locales/ko.ts +6 -0
- package/src/i18n/locales/nl.ts +6 -0
- package/src/i18n/locales/pl.ts +6 -0
- package/src/i18n/locales/pt.ts +6 -0
- package/src/i18n/locales/ru.ts +6 -0
- package/src/i18n/locales/vi.ts +6 -0
- package/src/i18n/locales/zh.ts +6 -0
- package/src/index.ts +3 -0
- package/src/schema/blocks/createSpec.ts +1 -1
- package/src/schema/blocks/internal.ts +16 -6
- package/src/schema/inlineContent/internal.ts +4 -1
- package/src/schema/propTypes.ts +41 -18
- package/types/src/api/blockManipulation/setupTestEnv.d.ts +8 -0
- package/types/src/api/clipboard/clipboardInternal.test.d.ts +1 -0
- package/types/src/api/clipboard/testUtil.d.ts +509 -0
- package/types/src/api/testUtil/cases/customBlocks.d.ts +8 -0
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +8 -0
- package/types/src/api/testUtil/cases/customStyles.d.ts +8 -0
- package/types/src/api/testUtil/cases/defaultSchema.d.ts +2 -1
- package/types/src/blocks/CodeBlockContent/CodeBlockContent.d.ts +2 -0
- package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +12 -0
- package/types/src/blocks/PageBreakBlockContent/PageBreakBlockContent.d.ts +31 -0
- package/types/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.d.ts +8 -0
- package/types/src/blocks/PageBreakBlockContent/schema.d.ts +86 -0
- package/types/src/blocks/defaultBlocks.d.ts +16 -0
- package/types/src/editor/BlockNoteEditor.d.ts +15 -0
- package/types/src/editor/BlockNoteExtensions.d.ts +2 -0
- package/types/src/editor/transformPasted.d.ts +8 -4
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +25 -5
- package/types/src/extensions/SuggestionMenu/DefaultSuggestionItem.d.ts +1 -1
- package/types/src/i18n/locales/de.d.ts +6 -0
- package/types/src/i18n/locales/en.d.ts +6 -0
- package/types/src/i18n/locales/es.d.ts +6 -0
- package/types/src/i18n/locales/hr.d.ts +6 -0
- package/types/src/i18n/locales/index.d.ts +1 -0
- package/types/src/i18n/locales/it.d.ts +245 -0
- package/types/src/index.d.ts +3 -0
- package/types/src/schema/propTypes.d.ts +20 -2
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +0 -30
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js +0 -99
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js +0 -97
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js +0 -88
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js +0 -219
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js +0 -175
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js +0 -57
- package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +0 -5
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +0 -31
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +0 -71
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js +0 -157
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +0 -27
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +0 -67
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +0 -148
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js +0 -252
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js.map +0 -1
- package/dist/src/api/blockManipulation/getBlock/getBlock.js +0 -56
- package/dist/src/api/blockManipulation/getBlock/getBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/insertContentAt.js +0 -64
- package/dist/src/api/blockManipulation/insertContentAt.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/selection.js +0 -149
- package/dist/src/api/blockManipulation/selections/selection.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/selection.test.js +0 -39
- package/dist/src/api/blockManipulation/selections/selection.test.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +0 -79
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js +0 -33
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js.map +0 -1
- package/dist/src/api/blockManipulation/setupTestEnv.js +0 -172
- package/dist/src/api/blockManipulation/setupTestEnv.js.map +0 -1
- package/dist/src/api/clipboard/clipboard.test.js +0 -249
- package/dist/src/api/clipboard/clipboard.test.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +0 -8
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js +0 -38
- package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +0 -111
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js +0 -25
- package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/pasteExtension.js +0 -57
- package/dist/src/api/clipboard/fromClipboard/pasteExtension.js.map +0 -1
- package/dist/src/api/clipboard/toClipboard/copyExtension.js +0 -134
- package/dist/src/api/clipboard/toClipboard/copyExtension.js.map +0 -1
- package/dist/src/api/exporters/html/externalHTMLExporter.js +0 -35
- package/dist/src/api/exporters/html/externalHTMLExporter.js.map +0 -1
- package/dist/src/api/exporters/html/htmlConversion.test.js +0 -72
- package/dist/src/api/exporters/html/htmlConversion.test.js.map +0 -1
- package/dist/src/api/exporters/html/internalHTMLSerializer.js +0 -21
- package/dist/src/api/exporters/html/internalHTMLSerializer.js.map +0 -1
- package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js +0 -141
- package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js.map +0 -1
- package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js +0 -96
- package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js.map +0 -1
- package/dist/src/api/exporters/markdown/markdownExporter.js +0 -31
- package/dist/src/api/exporters/markdown/markdownExporter.js.map +0 -1
- package/dist/src/api/exporters/markdown/markdownExporter.test.js +0 -57
- package/dist/src/api/exporters/markdown/markdownExporter.test.js.map +0 -1
- package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js +0 -33
- package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js.map +0 -1
- package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js +0 -37
- package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js.map +0 -1
- package/dist/src/api/getBlockInfoFromPos.js +0 -165
- package/dist/src/api/getBlockInfoFromPos.js.map +0 -1
- package/dist/src/api/nodeConversions/blockToNode.js +0 -197
- package/dist/src/api/nodeConversions/blockToNode.js.map +0 -1
- package/dist/src/api/nodeConversions/fragmentToBlocks.js +0 -50
- package/dist/src/api/nodeConversions/fragmentToBlocks.js.map +0 -1
- package/dist/src/api/nodeConversions/nodeConversions.test.js +0 -54
- package/dist/src/api/nodeConversions/nodeConversions.test.js.map +0 -1
- package/dist/src/api/nodeConversions/nodeToBlock.js +0 -316
- package/dist/src/api/nodeConversions/nodeToBlock.js.map +0 -1
- package/dist/src/api/nodeUtil.js +0 -28
- package/dist/src/api/nodeUtil.js.map +0 -1
- package/dist/src/api/parsers/html/parseHTML.js +0 -19
- package/dist/src/api/parsers/html/parseHTML.js.map +0 -1
- package/dist/src/api/parsers/html/parseHTML.test.js +0 -470
- package/dist/src/api/parsers/html/parseHTML.test.js.map +0 -1
- package/dist/src/api/parsers/html/util/nestedLists.js +0 -106
- package/dist/src/api/parsers/html/util/nestedLists.js.map +0 -1
- package/dist/src/api/parsers/html/util/nestedLists.test.js +0 -166
- package/dist/src/api/parsers/html/util/nestedLists.test.js.map +0 -1
- package/dist/src/api/parsers/markdown/parseMarkdown.js +0 -52
- package/dist/src/api/parsers/markdown/parseMarkdown.js.map +0 -1
- package/dist/src/api/parsers/markdown/parseMarkdown.test.js +0 -112
- package/dist/src/api/parsers/markdown/parseMarkdown.test.js.map +0 -1
- package/dist/src/api/testUtil/cases/customBlocks.js +0 -313
- package/dist/src/api/testUtil/cases/customBlocks.js.map +0 -1
- package/dist/src/api/testUtil/cases/customInlineContent.js +0 -91
- package/dist/src/api/testUtil/cases/customInlineContent.js.map +0 -1
- package/dist/src/api/testUtil/cases/customStyles.js +0 -83
- package/dist/src/api/testUtil/cases/customStyles.js.map +0 -1
- package/dist/src/api/testUtil/cases/defaultSchema.js +0 -673
- package/dist/src/api/testUtil/cases/defaultSchema.js.map +0 -1
- package/dist/src/api/testUtil/index.js +0 -2
- package/dist/src/api/testUtil/index.js.map +0 -1
- package/dist/src/api/testUtil/partialBlockTestUtil.js +0 -114
- package/dist/src/api/testUtil/partialBlockTestUtil.js.map +0 -1
- package/dist/src/api/testUtil/paste.js +0 -29
- package/dist/src/api/testUtil/paste.js.map +0 -1
- package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js +0 -104
- package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +0 -1
- package/dist/src/blocks/AudioBlockContent/parseAudioElement.js +0 -5
- package/dist/src/blocks/AudioBlockContent/parseAudioElement.js.map +0 -1
- package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js +0 -281
- package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js.map +0 -1
- package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js +0 -110
- package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/FileBlockContent.js +0 -71
- package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js +0 -5
- package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js +0 -10
- package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js +0 -39
- package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js +0 -51
- package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js +0 -17
- package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js +0 -147
- package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js +0 -9
- package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js +0 -11
- package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js +0 -15
- package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js.map +0 -1
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +0 -145
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +0 -1
- package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js +0 -114
- package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +0 -1
- package/dist/src/blocks/ImageBlockContent/parseImageElement.js +0 -6
- package/dist/src/blocks/ImageBlockContent/parseImageElement.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +0 -113
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +0 -224
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +0 -45
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js +0 -58
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +0 -130
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +0 -1
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +0 -52
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +0 -1
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js +0 -129
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +0 -1
- package/dist/src/blocks/TableBlockContent/TableExtension.js +0 -64
- package/dist/src/blocks/TableBlockContent/TableExtension.js.map +0 -1
- package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js +0 -114
- package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +0 -1
- package/dist/src/blocks/VideoBlockContent/parseVideoElement.js +0 -6
- package/dist/src/blocks/VideoBlockContent/parseVideoElement.js.map +0 -1
- package/dist/src/blocks/defaultBlockHelpers.js +0 -50
- package/dist/src/blocks/defaultBlockHelpers.js.map +0 -1
- package/dist/src/blocks/defaultBlockTypeGuards.js +0 -40
- package/dist/src/blocks/defaultBlockTypeGuards.js.map +0 -1
- package/dist/src/blocks/defaultBlocks.js +0 -50
- package/dist/src/blocks/defaultBlocks.js.map +0 -1
- package/dist/src/blocks/defaultProps.js +0 -19
- package/dist/src/blocks/defaultProps.js.map +0 -1
- package/dist/src/editor/BlockNoteEditor.js +0 -751
- package/dist/src/editor/BlockNoteEditor.js.map +0 -1
- package/dist/src/editor/BlockNoteEditor.test.js +0 -65
- package/dist/src/editor/BlockNoteEditor.test.js.map +0 -1
- package/dist/src/editor/BlockNoteExtensions.js +0 -192
- package/dist/src/editor/BlockNoteExtensions.js.map +0 -1
- package/dist/src/editor/BlockNoteSchema.js +0 -38
- package/dist/src/editor/BlockNoteSchema.js.map +0 -1
- package/dist/src/editor/BlockNoteTipTapEditor.js +0 -169
- package/dist/src/editor/BlockNoteTipTapEditor.js.map +0 -1
- package/dist/src/editor/cursorPositionTypes.js +0 -2
- package/dist/src/editor/cursorPositionTypes.js.map +0 -1
- package/dist/src/editor/defaultColors.js +0 -77
- package/dist/src/editor/defaultColors.js.map +0 -1
- package/dist/src/editor/selectionTypes.js +0 -2
- package/dist/src/editor/selectionTypes.js.map +0 -1
- package/dist/src/editor/transformPasted.js +0 -79
- package/dist/src/editor/transformPasted.js.map +0 -1
- package/dist/src/exporter/Exporter.js +0 -36
- package/dist/src/exporter/Exporter.js.map +0 -1
- package/dist/src/exporter/index.js +0 -3
- package/dist/src/exporter/index.js.map +0 -1
- package/dist/src/exporter/mapping.js +0 -12
- package/dist/src/exporter/mapping.js.map +0 -1
- package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js +0 -30
- package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js.map +0 -1
- package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js +0 -39
- package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js.map +0 -1
- package/dist/src/extensions/FilePanel/FilePanelPlugin.js +0 -131
- package/dist/src/extensions/FilePanel/FilePanelPlugin.js.map +0 -1
- package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +0 -197
- package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +0 -1
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +0 -341
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +0 -1
- package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +0 -251
- package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +0 -1
- package/dist/src/extensions/LinkToolbar/protocols.js +0 -14
- package/dist/src/extensions/LinkToolbar/protocols.js.map +0 -1
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +0 -54
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +0 -1
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +0 -90
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +0 -1
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +0 -187
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +0 -1
- package/dist/src/extensions/SideMenu/MultipleNodeSelection.js +0 -68
- package/dist/src/extensions/SideMenu/MultipleNodeSelection.js.map +0 -1
- package/dist/src/extensions/SideMenu/SideMenuPlugin.js +0 -347
- package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +0 -1
- package/dist/src/extensions/SideMenu/dragging.js +0 -135
- package/dist/src/extensions/SideMenu/dragging.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js +0 -2
- package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js +0 -2
- package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js +0 -245
- package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js +0 -26
- package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js +0 -241
- package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js.map +0 -1
- package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +0 -579
- package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +0 -1
- package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js +0 -36
- package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js.map +0 -1
- package/dist/src/extensions/TextColor/TextColorExtension.js +0 -29
- package/dist/src/extensions/TextColor/TextColorExtension.js.map +0 -1
- package/dist/src/extensions/TextColor/TextColorMark.js +0 -37
- package/dist/src/extensions/TextColor/TextColorMark.js.map +0 -1
- package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js +0 -58
- package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js.map +0 -1
- package/dist/src/extensions/UniqueID/UniqueID.js +0 -283
- package/dist/src/extensions/UniqueID/UniqueID.js.map +0 -1
- package/dist/src/extensions/getDraggableBlockFromElement.js +0 -13
- package/dist/src/extensions/getDraggableBlockFromElement.js.map +0 -1
- package/dist/src/extensions-shared/UiElementPosition.js +0 -2
- package/dist/src/extensions-shared/UiElementPosition.js.map +0 -1
- package/dist/src/i18n/dictionary.js +0 -4
- package/dist/src/i18n/dictionary.js.map +0 -1
- package/dist/src/i18n/locales/ar.js +0 -298
- package/dist/src/i18n/locales/ar.js.map +0 -1
- package/dist/src/i18n/locales/de.js +0 -313
- package/dist/src/i18n/locales/de.js.map +0 -1
- package/dist/src/i18n/locales/en.js +0 -314
- package/dist/src/i18n/locales/en.js.map +0 -1
- package/dist/src/i18n/locales/es.js +0 -312
- package/dist/src/i18n/locales/es.js.map +0 -1
- package/dist/src/i18n/locales/fr.js +0 -313
- package/dist/src/i18n/locales/fr.js.map +0 -1
- package/dist/src/i18n/locales/hr.js +0 -308
- package/dist/src/i18n/locales/hr.js.map +0 -1
- package/dist/src/i18n/locales/index.js +0 -16
- package/dist/src/i18n/locales/index.js.map +0 -1
- package/dist/src/i18n/locales/is.js +0 -305
- package/dist/src/i18n/locales/is.js.map +0 -1
- package/dist/src/i18n/locales/ja.js +0 -333
- package/dist/src/i18n/locales/ja.js.map +0 -1
- package/dist/src/i18n/locales/ko.js +0 -326
- package/dist/src/i18n/locales/ko.js.map +0 -1
- package/dist/src/i18n/locales/nl.js +0 -313
- package/dist/src/i18n/locales/nl.js.map +0 -1
- package/dist/src/i18n/locales/pl.js +0 -297
- package/dist/src/i18n/locales/pl.js.map +0 -1
- package/dist/src/i18n/locales/pt.js +0 -305
- package/dist/src/i18n/locales/pt.js.map +0 -1
- package/dist/src/i18n/locales/ru.js +0 -340
- package/dist/src/i18n/locales/ru.js.map +0 -1
- package/dist/src/i18n/locales/vi.js +0 -312
- package/dist/src/i18n/locales/vi.js.map +0 -1
- package/dist/src/i18n/locales/zh.js +0 -346
- package/dist/src/i18n/locales/zh.js.map +0 -1
- package/dist/src/index.js +0 -63
- package/dist/src/index.js.map +0 -1
- package/dist/src/pm-nodes/BlockContainer.js +0 -72
- package/dist/src/pm-nodes/BlockContainer.js.map +0 -1
- package/dist/src/pm-nodes/BlockGroup.js +0 -43
- package/dist/src/pm-nodes/BlockGroup.js.map +0 -1
- package/dist/src/pm-nodes/Doc.js +0 -7
- package/dist/src/pm-nodes/Doc.js.map +0 -1
- package/dist/src/pm-nodes/index.js +0 -4
- package/dist/src/pm-nodes/index.js.map +0 -1
- package/dist/src/schema/blocks/createSpec.js +0 -126
- package/dist/src/schema/blocks/createSpec.js.map +0 -1
- package/dist/src/schema/blocks/internal.js +0 -147
- package/dist/src/schema/blocks/internal.js.map +0 -1
- package/dist/src/schema/blocks/types.js +0 -2
- package/dist/src/schema/blocks/types.js.map +0 -1
- package/dist/src/schema/index.js +0 -11
- package/dist/src/schema/index.js.map +0 -1
- package/dist/src/schema/inlineContent/createSpec.js +0 -64
- package/dist/src/schema/inlineContent/createSpec.js.map +0 -1
- package/dist/src/schema/inlineContent/internal.js +0 -52
- package/dist/src/schema/inlineContent/internal.js.map +0 -1
- package/dist/src/schema/inlineContent/types.js +0 -10
- package/dist/src/schema/inlineContent/types.js.map +0 -1
- package/dist/src/schema/propTypes.js +0 -2
- package/dist/src/schema/propTypes.js.map +0 -1
- package/dist/src/schema/styles/createSpec.js +0 -48
- package/dist/src/schema/styles/createSpec.js.map +0 -1
- package/dist/src/schema/styles/internal.js +0 -53
- package/dist/src/schema/styles/internal.js.map +0 -1
- package/dist/src/schema/styles/types.js +0 -2
- package/dist/src/schema/styles/types.js.map +0 -1
- package/dist/src/util/EventEmitter.js +0 -33
- package/dist/src/util/EventEmitter.js.map +0 -1
- package/dist/src/util/browser.js +0 -17
- package/dist/src/util/browser.js.map +0 -1
- package/dist/src/util/combineByGroup.js +0 -20
- package/dist/src/util/combineByGroup.js.map +0 -1
- package/dist/src/util/esmDependencies.js +0 -35
- package/dist/src/util/esmDependencies.js.map +0 -1
- package/dist/src/util/string.js +0 -14
- package/dist/src/util/string.js.map +0 -1
- package/dist/src/util/typescript.js +0 -12
- package/dist/src/util/typescript.js.map +0 -1
- /package/src/api/clipboard/__snapshots__/{childToParent.html → internal/childToParent.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{childrenToNextParent.html → internal/childrenToNextParent.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{childrenToNextParentsChildren.html → internal/childrenToNextParentsChildren.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{image.html → internal/image.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{multipleChildren.html → internal/multipleChildren.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{multipleStyledText.html → internal/multipleStyledText.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{nestedImage.html → internal/nestedImage.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{partialChildToParent.html → internal/partialChildToParent.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{styledText.html → internal/styledText.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{tableAllCells.html → internal/tableAllCells.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{tableCell.html → internal/tableCell.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{tableCellText.html → internal/tableCellText.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{tableRow.html → internal/tableRow.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{unstyledText.html → internal/unstyledText.html} +0 -0
- /package/types/src/api/clipboard/{clipboard.test.d.ts → clipboardExternal.test.d.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nestedLists.js","sourceRoot":"","sources":["../../../../../../src/api/parsers/html/util/nestedLists.ts"],"names":[],"mappings":"AAAA,SAAS,aAAa,CAAC,IAAa;IAClC,OAA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K,QAAQ,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACnD,OAAO,CAAC,SAAS,GAAG,aAAa,CAAC;QAClC,aAAa,GAAG,OAAO,CAAC;IAC1B,CAAC;IACD,uBAAuB,CAAC,aAAa,CAAC,CAAC;IACvC,YAAY,CAAC,aAAa,CAAC,CAAC;IAC5B,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { initializeESMDependencies } from "../../../../util/esmDependencies.js";
|
|
3
|
-
import { nestedListsToBlockNoteStructure } from "./nestedLists.js";
|
|
4
|
-
async function testHTML(html) {
|
|
5
|
-
const deps = await initializeESMDependencies();
|
|
6
|
-
const htmlNode = nestedListsToBlockNoteStructure(html);
|
|
7
|
-
const pretty = await deps.unified
|
|
8
|
-
.unified()
|
|
9
|
-
.use(deps.rehypeParse.default, { fragment: true })
|
|
10
|
-
.use(deps.rehypeFormat.default)
|
|
11
|
-
.use(deps.rehypeStringify.default)
|
|
12
|
-
.process(htmlNode.innerHTML);
|
|
13
|
-
expect(pretty.value).toMatchSnapshot();
|
|
14
|
-
}
|
|
15
|
-
describe("Lift nested lists", () => {
|
|
16
|
-
it("Lifts nested bullet lists", async () => {
|
|
17
|
-
const html = `<ul>
|
|
18
|
-
<li>
|
|
19
|
-
Bullet List Item 1
|
|
20
|
-
<ul>
|
|
21
|
-
<li>
|
|
22
|
-
Nested Bullet List Item 1
|
|
23
|
-
</li>
|
|
24
|
-
<li>
|
|
25
|
-
Nested Bullet List Item 2
|
|
26
|
-
</li>
|
|
27
|
-
</ul>
|
|
28
|
-
</li>
|
|
29
|
-
<li>
|
|
30
|
-
Bullet List Item 2
|
|
31
|
-
</li>
|
|
32
|
-
</ul>`;
|
|
33
|
-
await testHTML(html);
|
|
34
|
-
});
|
|
35
|
-
it("Lifts nested bullet lists without li", async () => {
|
|
36
|
-
const html = `<ul>
|
|
37
|
-
Bullet List Item 1
|
|
38
|
-
<ul>
|
|
39
|
-
<li>
|
|
40
|
-
Nested Bullet List Item 1
|
|
41
|
-
</li>
|
|
42
|
-
<li>
|
|
43
|
-
Nested Bullet List Item 2
|
|
44
|
-
</li>
|
|
45
|
-
</ul>
|
|
46
|
-
<li>
|
|
47
|
-
Bullet List Item 2
|
|
48
|
-
</li>
|
|
49
|
-
</ul>`;
|
|
50
|
-
await testHTML(html);
|
|
51
|
-
});
|
|
52
|
-
it("Lifts nested bullet lists with content after nested list", async () => {
|
|
53
|
-
const html = `<ul>
|
|
54
|
-
<li>
|
|
55
|
-
Bullet List Item 1
|
|
56
|
-
<ul>
|
|
57
|
-
<li>
|
|
58
|
-
Nested Bullet List Item 1
|
|
59
|
-
</li>
|
|
60
|
-
<li>
|
|
61
|
-
Nested Bullet List Item 2
|
|
62
|
-
</li>
|
|
63
|
-
</ul>
|
|
64
|
-
More content in list item 1
|
|
65
|
-
</li>
|
|
66
|
-
<li>
|
|
67
|
-
Bullet List Item 2
|
|
68
|
-
</li>
|
|
69
|
-
</ul>`;
|
|
70
|
-
await testHTML(html);
|
|
71
|
-
});
|
|
72
|
-
it("Lifts multiple bullet lists", async () => {
|
|
73
|
-
const html = `<ul>
|
|
74
|
-
<li>
|
|
75
|
-
Bullet List Item 1
|
|
76
|
-
<ul>
|
|
77
|
-
<li>
|
|
78
|
-
Nested Bullet List Item 1
|
|
79
|
-
</li>
|
|
80
|
-
<li>
|
|
81
|
-
Nested Bullet List Item 2
|
|
82
|
-
</li>
|
|
83
|
-
</ul>
|
|
84
|
-
<ul>
|
|
85
|
-
<li>
|
|
86
|
-
Nested Bullet List Item 3
|
|
87
|
-
</li>
|
|
88
|
-
<li>
|
|
89
|
-
Nested Bullet List Item 4
|
|
90
|
-
</li>
|
|
91
|
-
</ul>
|
|
92
|
-
</li>
|
|
93
|
-
<li>
|
|
94
|
-
Bullet List Item 2
|
|
95
|
-
</li>
|
|
96
|
-
</ul>`;
|
|
97
|
-
await testHTML(html);
|
|
98
|
-
});
|
|
99
|
-
it("Lifts multiple bullet lists with content in between", async () => {
|
|
100
|
-
const html = `<ul>
|
|
101
|
-
<li>
|
|
102
|
-
Bullet List Item 1
|
|
103
|
-
<ul>
|
|
104
|
-
<li>
|
|
105
|
-
Nested Bullet List Item 1
|
|
106
|
-
</li>
|
|
107
|
-
<li>
|
|
108
|
-
Nested Bullet List Item 2
|
|
109
|
-
</li>
|
|
110
|
-
</ul>
|
|
111
|
-
In between content
|
|
112
|
-
<ul>
|
|
113
|
-
<li>
|
|
114
|
-
Nested Bullet List Item 3
|
|
115
|
-
</li>
|
|
116
|
-
<li>
|
|
117
|
-
Nested Bullet List Item 4
|
|
118
|
-
</li>
|
|
119
|
-
</ul>
|
|
120
|
-
</li>
|
|
121
|
-
<li>
|
|
122
|
-
Bullet List Item 2
|
|
123
|
-
</li>
|
|
124
|
-
</ul>`;
|
|
125
|
-
await testHTML(html);
|
|
126
|
-
});
|
|
127
|
-
it("Lifts nested numbered lists", async () => {
|
|
128
|
-
const html = `<ol>
|
|
129
|
-
<li>
|
|
130
|
-
Numbered List Item 1
|
|
131
|
-
<ol>
|
|
132
|
-
<li>
|
|
133
|
-
Nested Numbered List Item 1
|
|
134
|
-
</li>
|
|
135
|
-
<li>
|
|
136
|
-
Nested Numbered List Item 2
|
|
137
|
-
</li>
|
|
138
|
-
</ol>
|
|
139
|
-
</li>
|
|
140
|
-
<li>
|
|
141
|
-
Numbered List Item 2
|
|
142
|
-
</li>
|
|
143
|
-
</ol>`;
|
|
144
|
-
await testHTML(html);
|
|
145
|
-
});
|
|
146
|
-
it("Lifts nested mixed lists", async () => {
|
|
147
|
-
const html = `<ol>
|
|
148
|
-
<li>
|
|
149
|
-
Numbered List Item 1
|
|
150
|
-
<ul>
|
|
151
|
-
<li>
|
|
152
|
-
Bullet List Item 1
|
|
153
|
-
</li>
|
|
154
|
-
<li>
|
|
155
|
-
Bullet List Item 2
|
|
156
|
-
</li>
|
|
157
|
-
</ul>
|
|
158
|
-
</li>
|
|
159
|
-
<li>
|
|
160
|
-
Numbered List Item 2
|
|
161
|
-
</li>
|
|
162
|
-
</ol>`;
|
|
163
|
-
await testHTML(html);
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
//# sourceMappingURL=nestedLists.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nestedLists.test.js","sourceRoot":"","sources":["../../../../../../src/api/parsers/html/util/nestedLists.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AAEnE,KAAK,UAAU,QAAQ,CAAC,IAAY;IAClC,MAAM,IAAI,GAAG,MAAM,yBAAyB,EAAE,CAAC;IAE/C,MAAM,QAAQ,GAAG,+BAA+B,CAAC,IAAI,CAAC,CAAC;IAEvD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO;SAC9B,OAAO,EAAE;SACT,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SACjD,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;SAC9B,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;SACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAE/B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,eAAe,EAAE,CAAC;AACzC,CAAC;AAED,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;OAeV,CAAC;QACJ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Blocks } from "../html/parseHTML.js";
|
|
3
|
-
// modified version of https://github.com/syntax-tree/mdast-util-to-hast/blob/main/lib/handlers/code.js
|
|
4
|
-
// that outputs a data-language attribute instead of a CSS class (e.g.: language-typescript)
|
|
5
|
-
function code(state, node) {
|
|
6
|
-
const value = node.value ? node.value : "";
|
|
7
|
-
/** @type {Properties} */
|
|
8
|
-
const properties = {};
|
|
9
|
-
if (node.lang) {
|
|
10
|
-
// changed line
|
|
11
|
-
properties["data-language"] = node.lang;
|
|
12
|
-
}
|
|
13
|
-
// Create `<code>`.
|
|
14
|
-
/** @type {Element} */
|
|
15
|
-
let result = {
|
|
16
|
-
type: "element",
|
|
17
|
-
tagName: "code",
|
|
18
|
-
properties,
|
|
19
|
-
children: [{ type: "text", value }],
|
|
20
|
-
};
|
|
21
|
-
if (node.meta) {
|
|
22
|
-
result.data = { meta: node.meta };
|
|
23
|
-
}
|
|
24
|
-
state.patch(node, result);
|
|
25
|
-
result = state.applyData(node, result);
|
|
26
|
-
// Create `<pre>`.
|
|
27
|
-
result = {
|
|
28
|
-
type: "element",
|
|
29
|
-
tagName: "pre",
|
|
30
|
-
properties: {},
|
|
31
|
-
children: [result],
|
|
32
|
-
};
|
|
33
|
-
state.patch(node, result);
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
export async function markdownToBlocks(markdown, blockSchema, icSchema, styleSchema, pmSchema) {
|
|
37
|
-
const deps = await initializeESMDependencies();
|
|
38
|
-
const htmlString = deps.unified
|
|
39
|
-
.unified()
|
|
40
|
-
.use(deps.remarkParse.default)
|
|
41
|
-
.use(deps.remarkGfm.default)
|
|
42
|
-
.use(deps.remarkRehype.default, {
|
|
43
|
-
handlers: {
|
|
44
|
-
...deps.remarkRehype.defaultHandlers,
|
|
45
|
-
code,
|
|
46
|
-
},
|
|
47
|
-
})
|
|
48
|
-
.use(deps.rehypeStringify.default)
|
|
49
|
-
.processSync(markdown);
|
|
50
|
-
return HTMLToBlocks(htmlString.value, blockSchema, icSchema, styleSchema, pmSchema);
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=parseMarkdown.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseMarkdown.js","sourceRoot":"","sources":["../../../../../src/api/parsers/markdown/parseMarkdown.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,uGAAuG;AACvG,4FAA4F;AAC5F,SAAS,IAAI,CAAC,KAAU,EAAE,IAAS;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,yBAAyB;IACzB,MAAM,UAAU,GAAQ,EAAE,CAAC;IAE3B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,eAAe;QACf,UAAU,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;IAC1C,CAAC;IAED,mBAAmB;IACnB,sBAAsB;IACtB,IAAI,MAAM,GAAQ;QAChB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,MAAM;QACf,UAAU;QACV,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;KACpC,CAAC;IAEF,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,MAAM,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1B,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAEvC,kBAAkB;IAClB,MAAM,GAAG;QACP,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB,CAAC;IACF,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAKpC,QAAgB,EAChB,WAAoB,EACpB,QAAW,EACX,WAAc,EACd,QAAgB;IAEhB,MAAM,IAAI,GAAG,MAAM,yBAAyB,EAAE,CAAC;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO;SAC5B,OAAO,EAAE;SACT,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;SAC7B,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC3B,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;QAC9B,QAAQ,EAAE;YACR,GAAI,IAAI,CAAC,YAAY,CAAC,eAAuB;YAC7C,IAAI;SACL;KACF,CAAC;SACD,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;SACjC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAEzB,OAAO,YAAY,CACjB,UAAU,CAAC,KAAe,EAC1B,WAAW,EACX,QAAQ,EACR,WAAW,EACX,QAAQ,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { BlockNoteEditor } from "../../../index.js";
|
|
3
|
-
import { doPaste } from "../../testUtil/paste.js";
|
|
4
|
-
async function parseMarkdownAndCompareSnapshots(md, snapshotName) {
|
|
5
|
-
const editor = BlockNoteEditor.create();
|
|
6
|
-
const div = document.createElement("div");
|
|
7
|
-
editor.mount(div);
|
|
8
|
-
const blocks = await editor.tryParseMarkdownToBlocks(md);
|
|
9
|
-
const snapshotPath = "./__snapshots__/" + snapshotName + ".json";
|
|
10
|
-
expect(JSON.stringify(blocks, undefined, 2)).toMatchFileSnapshot(snapshotPath);
|
|
11
|
-
if (!editor.prosemirrorView) {
|
|
12
|
-
throw new Error("Editor view not initialized.");
|
|
13
|
-
}
|
|
14
|
-
doPaste(editor.prosemirrorView, md, null, true, new ClipboardEvent("paste"));
|
|
15
|
-
const pastedSnapshotPath = "./__snapshots__/pasted/" + snapshotName + ".json";
|
|
16
|
-
expect(JSON.stringify(editor.document, undefined, 2)).toMatchFileSnapshot(pastedSnapshotPath);
|
|
17
|
-
editor.mount(undefined);
|
|
18
|
-
}
|
|
19
|
-
describe("Parse Markdown", () => {
|
|
20
|
-
it("Convert non-nested Markdown to blocks", async () => {
|
|
21
|
-
const markdown = `# Heading
|
|
22
|
-
|
|
23
|
-
Paragraph
|
|
24
|
-
|
|
25
|
-
* Bullet List Item
|
|
26
|
-
|
|
27
|
-
1. Numbered List Item
|
|
28
|
-
`;
|
|
29
|
-
await parseMarkdownAndCompareSnapshots(markdown, "non-nested");
|
|
30
|
-
});
|
|
31
|
-
// Failing due to nested block parsing bug.
|
|
32
|
-
it("Convert nested Markdown to blocks", async () => {
|
|
33
|
-
const markdown = `# Heading
|
|
34
|
-
|
|
35
|
-
Paragraph
|
|
36
|
-
|
|
37
|
-
* Bullet List Item
|
|
38
|
-
|
|
39
|
-
1. Numbered List Item
|
|
40
|
-
`;
|
|
41
|
-
await parseMarkdownAndCompareSnapshots(markdown, "nested");
|
|
42
|
-
});
|
|
43
|
-
it("Convert styled Markdown to blocks", async () => {
|
|
44
|
-
const markdown = `**Bold** *Italic* ~~Strikethrough~~ ***Multiple***`;
|
|
45
|
-
await parseMarkdownAndCompareSnapshots(markdown, "styled");
|
|
46
|
-
});
|
|
47
|
-
it("Convert complex Markdown to blocks", async () => {
|
|
48
|
-
const markdown = `# Heading 1
|
|
49
|
-
|
|
50
|
-
## Heading 2
|
|
51
|
-
|
|
52
|
-
### Heading 3
|
|
53
|
-
|
|
54
|
-
Paragraph
|
|
55
|
-
|
|
56
|
-
P**ara***grap*h
|
|
57
|
-
|
|
58
|
-
P*ara*~~grap~~h
|
|
59
|
-
|
|
60
|
-
* Bullet List Item
|
|
61
|
-
|
|
62
|
-
* Bullet List Item
|
|
63
|
-
|
|
64
|
-
* Bullet List Item
|
|
65
|
-
|
|
66
|
-
* Bullet List Item
|
|
67
|
-
|
|
68
|
-
Paragraph
|
|
69
|
-
|
|
70
|
-
1. Numbered List Item
|
|
71
|
-
|
|
72
|
-
2. Numbered List Item
|
|
73
|
-
|
|
74
|
-
3. Numbered List Item
|
|
75
|
-
|
|
76
|
-
1. Numbered List Item
|
|
77
|
-
|
|
78
|
-
* Bullet List Item
|
|
79
|
-
|
|
80
|
-
* Bullet List Item
|
|
81
|
-
|
|
82
|
-
* Bullet List Item`;
|
|
83
|
-
await parseMarkdownAndCompareSnapshots(markdown, "complex");
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
describe("Issue 226", () => {
|
|
87
|
-
it("Case 1", async () => {
|
|
88
|
-
const markdown = `
|
|
89
|
-
- 📝 item1
|
|
90
|
-
- ⚙️ item2
|
|
91
|
-
- 🔗 item3
|
|
92
|
-
|
|
93
|
-
# h1
|
|
94
|
-
`;
|
|
95
|
-
await parseMarkdownAndCompareSnapshots(markdown, "issue-226-1");
|
|
96
|
-
});
|
|
97
|
-
it("Case 2", async () => {
|
|
98
|
-
const markdown = `* a
|
|
99
|
-
* b
|
|
100
|
-
* c
|
|
101
|
-
* d
|
|
102
|
-
|
|
103
|
-
anything
|
|
104
|
-
|
|
105
|
-
[a link](http://example.com)
|
|
106
|
-
|
|
107
|
-
* another
|
|
108
|
-
* list`;
|
|
109
|
-
await parseMarkdownAndCompareSnapshots(markdown, "issue-226-2");
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
//# sourceMappingURL=parseMarkdown.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseMarkdown.test.js","sourceRoot":"","sources":["../../../../../src/api/parsers/markdown/parseMarkdown.test.ts"],"names":[],"mappings":"AAAA,OAAO,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ONLY } from "../../../blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js";
|
|
2
|
-
import { imagePropSchema, imageRender, } from "../../../blocks/ImageBlockContent/ImageBlockContent.js";
|
|
3
|
-
import { defaultBlockSpecs, } from "../../../blocks/defaultBlocks.js";
|
|
4
|
-
import { defaultProps } from "../../../blocks/defaultProps.js";
|
|
5
|
-
import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js";
|
|
6
|
-
import { BlockNoteSchema } from "../../../editor/BlockNoteSchema.js";
|
|
7
|
-
import { createBlockSpec } from "../../../schema/index.js";
|
|
8
|
-
// This is a modified version of the default image block that does not implement
|
|
9
|
-
// a `toExternalHTML` function. It's used to test if the custom serializer by
|
|
10
|
-
// default serializes custom blocks using their `render` function.
|
|
11
|
-
const SimpleImage = createBlockSpec({
|
|
12
|
-
type: "simpleImage",
|
|
13
|
-
propSchema: imagePropSchema,
|
|
14
|
-
content: "none",
|
|
15
|
-
}, {
|
|
16
|
-
render: (block, editor) => imageRender(block, editor),
|
|
17
|
-
});
|
|
18
|
-
const CustomParagraph = createBlockSpec({
|
|
19
|
-
type: "customParagraph",
|
|
20
|
-
propSchema: defaultProps,
|
|
21
|
-
content: "inline",
|
|
22
|
-
}, {
|
|
23
|
-
render: () => {
|
|
24
|
-
const paragraph = document.createElement("p");
|
|
25
|
-
paragraph.className = "custom-paragraph";
|
|
26
|
-
return {
|
|
27
|
-
dom: paragraph,
|
|
28
|
-
contentDOM: paragraph,
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
toExternalHTML: () => {
|
|
32
|
-
const paragraph = document.createElement("p");
|
|
33
|
-
paragraph.className = "custom-paragraph";
|
|
34
|
-
paragraph.innerHTML = "Hello World";
|
|
35
|
-
return {
|
|
36
|
-
dom: paragraph,
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
const SimpleCustomParagraph = createBlockSpec({
|
|
41
|
-
type: "simpleCustomParagraph",
|
|
42
|
-
propSchema: defaultProps,
|
|
43
|
-
content: "inline",
|
|
44
|
-
}, {
|
|
45
|
-
render: () => {
|
|
46
|
-
const paragraph = document.createElement("p");
|
|
47
|
-
paragraph.className = "simple-custom-paragraph";
|
|
48
|
-
return {
|
|
49
|
-
dom: paragraph,
|
|
50
|
-
contentDOM: paragraph,
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
const schema = BlockNoteSchema.create({
|
|
55
|
-
blockSpecs: {
|
|
56
|
-
...defaultBlockSpecs,
|
|
57
|
-
simpleImage: SimpleImage,
|
|
58
|
-
customParagraph: CustomParagraph,
|
|
59
|
-
simpleCustomParagraph: SimpleCustomParagraph,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
export const customBlocksTestCases = {
|
|
63
|
-
name: "custom blocks schema",
|
|
64
|
-
createEditor: () => {
|
|
65
|
-
return BlockNoteEditor.create({
|
|
66
|
-
schema,
|
|
67
|
-
uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
documents: [
|
|
71
|
-
// Because images need to fetch the download URL async, their output HTML is
|
|
72
|
-
// initially rendered without a `src` attribute, which is reflected in the
|
|
73
|
-
// tests.
|
|
74
|
-
{
|
|
75
|
-
name: "simpleImage/button",
|
|
76
|
-
blocks: [
|
|
77
|
-
{
|
|
78
|
-
type: "simpleImage",
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: "simpleImage/basic",
|
|
84
|
-
blocks: [
|
|
85
|
-
{
|
|
86
|
-
type: "simpleImage",
|
|
87
|
-
props: {
|
|
88
|
-
name: "example",
|
|
89
|
-
url: "exampleURL",
|
|
90
|
-
caption: "Caption",
|
|
91
|
-
previewWidth: 256,
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: "simpleImage/noName",
|
|
98
|
-
blocks: [
|
|
99
|
-
{
|
|
100
|
-
type: "simpleImage",
|
|
101
|
-
props: {
|
|
102
|
-
url: "exampleURL",
|
|
103
|
-
caption: "Caption",
|
|
104
|
-
previewWidth: 256,
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: "simpleImage/noCaption",
|
|
111
|
-
blocks: [
|
|
112
|
-
{
|
|
113
|
-
type: "simpleImage",
|
|
114
|
-
props: {
|
|
115
|
-
name: "example",
|
|
116
|
-
url: "exampleURL",
|
|
117
|
-
previewWidth: 256,
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
name: "simpleImage/noPreview",
|
|
124
|
-
blocks: [
|
|
125
|
-
{
|
|
126
|
-
type: "simpleImage",
|
|
127
|
-
props: {
|
|
128
|
-
name: "example",
|
|
129
|
-
url: "exampleURL",
|
|
130
|
-
caption: "Caption",
|
|
131
|
-
showPreview: false,
|
|
132
|
-
previewWidth: 256,
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: "simpleImage/nested",
|
|
139
|
-
blocks: [
|
|
140
|
-
{
|
|
141
|
-
type: "simpleImage",
|
|
142
|
-
props: {
|
|
143
|
-
name: "example",
|
|
144
|
-
url: "exampleURL",
|
|
145
|
-
caption: "Caption",
|
|
146
|
-
previewWidth: 256,
|
|
147
|
-
},
|
|
148
|
-
children: [
|
|
149
|
-
{
|
|
150
|
-
type: "simpleImage",
|
|
151
|
-
props: {
|
|
152
|
-
name: "example",
|
|
153
|
-
url: "exampleURL",
|
|
154
|
-
caption: "Caption",
|
|
155
|
-
previewWidth: 256,
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
name: "customParagraph/basic",
|
|
164
|
-
blocks: [
|
|
165
|
-
{
|
|
166
|
-
type: "customParagraph",
|
|
167
|
-
content: "Custom Paragraph",
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
name: "customParagraph/styled",
|
|
173
|
-
blocks: [
|
|
174
|
-
{
|
|
175
|
-
type: "customParagraph",
|
|
176
|
-
props: {
|
|
177
|
-
textAlignment: "center",
|
|
178
|
-
textColor: "orange",
|
|
179
|
-
backgroundColor: "pink",
|
|
180
|
-
},
|
|
181
|
-
content: [
|
|
182
|
-
{
|
|
183
|
-
type: "text",
|
|
184
|
-
styles: {},
|
|
185
|
-
text: "Plain ",
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
type: "text",
|
|
189
|
-
styles: {
|
|
190
|
-
textColor: "red",
|
|
191
|
-
},
|
|
192
|
-
text: "Red Text ",
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
type: "text",
|
|
196
|
-
styles: {
|
|
197
|
-
backgroundColor: "blue",
|
|
198
|
-
},
|
|
199
|
-
text: "Blue Background ",
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
type: "text",
|
|
203
|
-
styles: {
|
|
204
|
-
textColor: "red",
|
|
205
|
-
backgroundColor: "blue",
|
|
206
|
-
},
|
|
207
|
-
text: "Mixed Colors",
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
|
-
},
|
|
211
|
-
],
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
name: "customParagraph/nested",
|
|
215
|
-
blocks: [
|
|
216
|
-
{
|
|
217
|
-
type: "customParagraph",
|
|
218
|
-
content: "Custom Paragraph",
|
|
219
|
-
children: [
|
|
220
|
-
{
|
|
221
|
-
type: "customParagraph",
|
|
222
|
-
content: "Nested Custom Paragraph 1",
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
type: "customParagraph",
|
|
226
|
-
content: "Nested Custom Paragraph 2",
|
|
227
|
-
},
|
|
228
|
-
],
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
name: "customParagraph/lineBreaks",
|
|
234
|
-
blocks: [
|
|
235
|
-
{
|
|
236
|
-
type: "customParagraph",
|
|
237
|
-
content: "Line 1\nLine 2",
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
name: "simpleCustomParagraph/basic",
|
|
243
|
-
blocks: [
|
|
244
|
-
{
|
|
245
|
-
type: "simpleCustomParagraph",
|
|
246
|
-
content: "Custom Paragraph",
|
|
247
|
-
},
|
|
248
|
-
],
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
name: "simpleCustomParagraph/styled",
|
|
252
|
-
blocks: [
|
|
253
|
-
{
|
|
254
|
-
type: "simpleCustomParagraph",
|
|
255
|
-
props: {
|
|
256
|
-
textAlignment: "center",
|
|
257
|
-
textColor: "orange",
|
|
258
|
-
backgroundColor: "pink",
|
|
259
|
-
},
|
|
260
|
-
content: [
|
|
261
|
-
{
|
|
262
|
-
type: "text",
|
|
263
|
-
styles: {},
|
|
264
|
-
text: "Plain ",
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
type: "text",
|
|
268
|
-
styles: {
|
|
269
|
-
textColor: "red",
|
|
270
|
-
},
|
|
271
|
-
text: "Red Text ",
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
type: "text",
|
|
275
|
-
styles: {
|
|
276
|
-
backgroundColor: "blue",
|
|
277
|
-
},
|
|
278
|
-
text: "Blue Background ",
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
type: "text",
|
|
282
|
-
styles: {
|
|
283
|
-
textColor: "red",
|
|
284
|
-
backgroundColor: "blue",
|
|
285
|
-
},
|
|
286
|
-
text: "Mixed Colors",
|
|
287
|
-
},
|
|
288
|
-
],
|
|
289
|
-
},
|
|
290
|
-
],
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
name: "simpleCustomParagraph/nested",
|
|
294
|
-
blocks: [
|
|
295
|
-
{
|
|
296
|
-
type: "simpleCustomParagraph",
|
|
297
|
-
content: "Custom Paragraph",
|
|
298
|
-
children: [
|
|
299
|
-
{
|
|
300
|
-
type: "simpleCustomParagraph",
|
|
301
|
-
content: "Nested Custom Paragraph 1",
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
type: "simpleCustomParagraph",
|
|
305
|
-
content: "Nested Custom Paragraph 2",
|
|
306
|
-
},
|
|
307
|
-
],
|
|
308
|
-
},
|
|
309
|
-
],
|
|
310
|
-
},
|
|
311
|
-
],
|
|
312
|
-
};
|
|
313
|
-
//# sourceMappingURL=customBlocks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customBlocks.js","sourceRoot":"","sources":["../../../../../src/api/testUtil/cases/customBlocks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,+BAA+B,EAAE,MAAM,qEAAqE,CAAC;AACtH,OAAO,EACL,eAAe,EACf,WAAW,GACZ,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAGL,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,gFAAgF;AAChF,6EAA6E;AAC7E,kEAAkE;AAClE,MAAM,WAAW,GAAG,eAAe,CACjC;IACE,IAAI,EAAE,aAAa;IACnB,UAAU,EAAE,eAAe;IAC3B,OAAO,EAAE,MAAM;CAChB,EACD;IACE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,KAAY,EAAE,MAAa,CAAC;CACpE,CACF,CAAC;AAEF,MAAM,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