@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
package/dist/src/api/nodeUtil.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get a TipTap node by id
|
|
3
|
-
*/
|
|
4
|
-
export function getNodeById(id, doc) {
|
|
5
|
-
let targetNode = undefined;
|
|
6
|
-
let posBeforeNode = undefined;
|
|
7
|
-
doc.firstChild.descendants((node, pos) => {
|
|
8
|
-
// Skips traversing nodes after node with target ID has been found.
|
|
9
|
-
if (targetNode) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
// Keeps traversing nodes if block with target ID has not been found.
|
|
13
|
-
if (!node.type.isInGroup("bnBlock") || node.attrs.id !== id) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
targetNode = node;
|
|
17
|
-
posBeforeNode = pos + 1;
|
|
18
|
-
return false;
|
|
19
|
-
});
|
|
20
|
-
if (targetNode === undefined || posBeforeNode === undefined) {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
node: targetNode,
|
|
25
|
-
posBeforeNode: posBeforeNode,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=nodeUtil.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeUtil.js","sourceRoot":"","sources":["../../../src/api/nodeUtil.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,EAAU,EACV,GAAS;IAET,IAAI,UAAU,GAAqB,SAAS,CAAC;IAC7C,IAAI,aAAa,GAAuB,SAAS,CAAC;IAElD,GAAG,CAAC,UAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QACxC,mEAAmE;QACnE,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;QAED,qEAAqE;QACrE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;YAC5D,OAAO,IAAI,CAAC;QACd,CAAC;QAED,UAAU,GAAG,IAAI,CAAC;QAClB,aAAa,GAAG,GAAG,GAAG,CAAC,CAAC;QAExB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,KAAK,SAAS,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAC5D,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,aAAa,EAAE,aAAa;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { DOMParser } from "prosemirror-model";
|
|
2
|
-
import { nodeToBlock } from "../../nodeConversions/nodeToBlock.js";
|
|
3
|
-
import { nestedListsToBlockNoteStructure } from "./util/nestedLists.js";
|
|
4
|
-
export async function HTMLToBlocks(html, blockSchema, icSchema, styleSchema, pmSchema) {
|
|
5
|
-
const htmlNode = nestedListsToBlockNoteStructure(html);
|
|
6
|
-
const parser = DOMParser.fromSchema(pmSchema);
|
|
7
|
-
// Other approach might be to use
|
|
8
|
-
// const doc = pmSchema.nodes["doc"].createAndFill()!;
|
|
9
|
-
// and context: doc.resolve(3),
|
|
10
|
-
const parentNode = parser.parse(htmlNode, {
|
|
11
|
-
topNode: pmSchema.nodes["blockGroup"].create(),
|
|
12
|
-
});
|
|
13
|
-
const blocks = [];
|
|
14
|
-
for (let i = 0; i < parentNode.childCount; i++) {
|
|
15
|
-
blocks.push(nodeToBlock(parentNode.child(i), blockSchema, icSchema, styleSchema));
|
|
16
|
-
}
|
|
17
|
-
return blocks;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=parseHTML.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseHTML.js","sourceRoot":"","sources":["../../../../../src/api/parsers/html/parseHTML.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,mBAAmB,CAAC;AAQtD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,MAAM,CAAC,KAAK,UAAU,YAAY,CAKhC,IAAY,EACZ,WAAoB,EACpB,QAAW,EACX,WAAc,EACd,QAAgB;IAEhB,MAAM,QAAQ,GAAG,+BAA+B,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAE9C,iCAAiC;IACjC,sDAAsD;IACtD,+BAA+B;IAE/B,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE;QACxC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE;KAC/C,CAAC,CAAC;IAEH,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/C,MAAM,CAAC,IAAI,CACT,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC,CACrE,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
import * as pmView from "prosemirror-view";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { BlockNoteEditor } from "../../../index.js";
|
|
4
|
-
import { nestedListsToBlockNoteStructure } from "./util/nestedLists.js";
|
|
5
|
-
async function parseHTMLAndCompareSnapshots(html, snapshotName) {
|
|
6
|
-
const editor = BlockNoteEditor.create();
|
|
7
|
-
const div = document.createElement("div");
|
|
8
|
-
editor.mount(div);
|
|
9
|
-
const blocks = await editor.tryParseHTMLToBlocks(html);
|
|
10
|
-
const snapshotPath = "./__snapshots__/" + snapshotName + ".json";
|
|
11
|
-
expect(JSON.stringify(blocks, undefined, 2)).toMatchFileSnapshot(snapshotPath);
|
|
12
|
-
// Now, we also want to test actually pasting in the editor, and not just calling
|
|
13
|
-
// tryParseHTMLToBlocks directly.
|
|
14
|
-
// The reason is that the prosemirror logic for pasting can be a bit different, because
|
|
15
|
-
// it's related to the context of where the user is pasting exactly (selection)
|
|
16
|
-
//
|
|
17
|
-
// The internal difference come that in tryParseHTMLToBlocks, we use DOMParser.parse,
|
|
18
|
-
// while when pasting, Prosemirror uses DOMParser.parseSlice, and then tries to fit the
|
|
19
|
-
// slice in the document. This fitting might change the structure / interpretation of the pasted blocks
|
|
20
|
-
// Simulate a paste event (this uses DOMParser.parseSlice internally)
|
|
21
|
-
window.__TEST_OPTIONS.mockID = 0; // reset id counter
|
|
22
|
-
const htmlNode = nestedListsToBlockNoteStructure(html);
|
|
23
|
-
const slice = pmView.__parseFromClipboard(editor.prosemirrorView, "", htmlNode.innerHTML, false, editor._tiptapEditor.state.selection.$from);
|
|
24
|
-
editor.dispatch(editor._tiptapEditor.state.tr.replaceSelection(slice));
|
|
25
|
-
// alternative paste simulation doesn't work in a non-browser vitest env
|
|
26
|
-
// editor._tiptapEditor.view.pasteHTML(html, {
|
|
27
|
-
// preventDefault: () => {
|
|
28
|
-
// // noop
|
|
29
|
-
// },
|
|
30
|
-
// clipboardData: {
|
|
31
|
-
// types: ["text/html"],
|
|
32
|
-
// getData: () => html,
|
|
33
|
-
// },
|
|
34
|
-
// } as any);
|
|
35
|
-
const pastedBlocks = editor.document;
|
|
36
|
-
pastedBlocks.pop(); // trailing paragraph
|
|
37
|
-
expect(pastedBlocks).toStrictEqual(blocks);
|
|
38
|
-
editor.mount(undefined);
|
|
39
|
-
}
|
|
40
|
-
describe("Parse HTML", () => {
|
|
41
|
-
it("Parse basic block types", async () => {
|
|
42
|
-
const html = `<h1>Heading 1</h1>
|
|
43
|
-
<h2>Heading 2</h2>
|
|
44
|
-
<h3>Heading 3</h3>
|
|
45
|
-
<p>Paragraph</p>
|
|
46
|
-
<figure><img src="exampleURL" /><figcaption>Image Caption</figcaption></figure>
|
|
47
|
-
<p>None <strong>Bold </strong><em>Italic </em><u>Underline </u><s>Strikethrough </s><strong><em><s><u>All</u></s></em></strong></p>`;
|
|
48
|
-
await parseHTMLAndCompareSnapshots(html, "parse-basic-block-types");
|
|
49
|
-
});
|
|
50
|
-
it("list test", async () => {
|
|
51
|
-
const html = `<ul>
|
|
52
|
-
<li>First</li>
|
|
53
|
-
<li>Second</li>
|
|
54
|
-
<li>Third</li>
|
|
55
|
-
<li>
|
|
56
|
-
<input type="checkbox">
|
|
57
|
-
Fourth
|
|
58
|
-
</li>
|
|
59
|
-
<li>
|
|
60
|
-
<input type="checkbox">
|
|
61
|
-
Fifth
|
|
62
|
-
</li>
|
|
63
|
-
<li>Five Parent
|
|
64
|
-
<ul>
|
|
65
|
-
<li>Child 1</li>
|
|
66
|
-
<li>Child 2</li>
|
|
67
|
-
<li>
|
|
68
|
-
<input type="checkbox">
|
|
69
|
-
Child 3
|
|
70
|
-
</li>
|
|
71
|
-
<li>
|
|
72
|
-
<input type="checkbox">
|
|
73
|
-
Child 4
|
|
74
|
-
</li>
|
|
75
|
-
</ul>
|
|
76
|
-
</li>
|
|
77
|
-
</ul>`;
|
|
78
|
-
await parseHTMLAndCompareSnapshots(html, "list-test");
|
|
79
|
-
});
|
|
80
|
-
it("Parse nested lists", async () => {
|
|
81
|
-
const html = `<ul>
|
|
82
|
-
<li>Bullet List Item</li>
|
|
83
|
-
<li>Bullet List Item
|
|
84
|
-
<ul>
|
|
85
|
-
<li>Nested Bullet List Item</li>
|
|
86
|
-
<li>Nested Bullet List Item</li>
|
|
87
|
-
</ul>
|
|
88
|
-
</li>
|
|
89
|
-
<li>Bullet List Item</li>
|
|
90
|
-
</ul>
|
|
91
|
-
<ol>
|
|
92
|
-
<li>Numbered List Item</li>
|
|
93
|
-
<li>Numbered List Item
|
|
94
|
-
<ol>
|
|
95
|
-
<li>Nested Numbered List Item</li>
|
|
96
|
-
<li>Nested Numbered List Item</li>
|
|
97
|
-
</ol>
|
|
98
|
-
</li>
|
|
99
|
-
<li>Numbered List Item</li>
|
|
100
|
-
</ol>
|
|
101
|
-
<ul>
|
|
102
|
-
<li>
|
|
103
|
-
<input type="checkbox">
|
|
104
|
-
Check List Item
|
|
105
|
-
</li>
|
|
106
|
-
<li>
|
|
107
|
-
<input type="checkbox">
|
|
108
|
-
Check List Item
|
|
109
|
-
<ul>
|
|
110
|
-
<li>
|
|
111
|
-
<input type="checkbox">
|
|
112
|
-
Nested Check List Item
|
|
113
|
-
</li>
|
|
114
|
-
<li>
|
|
115
|
-
<input type="checkbox">
|
|
116
|
-
Nested Check List Item
|
|
117
|
-
</li>
|
|
118
|
-
</ul>
|
|
119
|
-
</li>
|
|
120
|
-
<li>
|
|
121
|
-
<input type="checkbox">
|
|
122
|
-
Nested Check List Item
|
|
123
|
-
</li>
|
|
124
|
-
</ul>`;
|
|
125
|
-
await parseHTMLAndCompareSnapshots(html, "parse-nested-lists");
|
|
126
|
-
});
|
|
127
|
-
it("Parse nested lists with paragraphs", async () => {
|
|
128
|
-
const html = `<ul>
|
|
129
|
-
<li>
|
|
130
|
-
<p>Bullet List Item</p>
|
|
131
|
-
</li>
|
|
132
|
-
<li>
|
|
133
|
-
<p>Bullet List Item</p>
|
|
134
|
-
<ul>
|
|
135
|
-
<li>
|
|
136
|
-
<p>Nested Bullet List Item</p>
|
|
137
|
-
</li>
|
|
138
|
-
<li>
|
|
139
|
-
<p>Nested Bullet List Item</p>
|
|
140
|
-
</li>
|
|
141
|
-
</ul>
|
|
142
|
-
</li>
|
|
143
|
-
<li>
|
|
144
|
-
<p>Bullet List Item</p>
|
|
145
|
-
</li>
|
|
146
|
-
</ul>
|
|
147
|
-
<ol>
|
|
148
|
-
<li>
|
|
149
|
-
<p>Numbered List Item</p>
|
|
150
|
-
</li>
|
|
151
|
-
<li>
|
|
152
|
-
<p>Numbered List Item</p>
|
|
153
|
-
<ol>
|
|
154
|
-
<li>
|
|
155
|
-
<p>Nested Numbered List Item</p>
|
|
156
|
-
</li>
|
|
157
|
-
<li>
|
|
158
|
-
<p>Nested Numbered List Item</p>
|
|
159
|
-
</li>
|
|
160
|
-
</ol>
|
|
161
|
-
</li>
|
|
162
|
-
<li>
|
|
163
|
-
<p>Numbered List Item</p>
|
|
164
|
-
</li>
|
|
165
|
-
</ol>
|
|
166
|
-
<ul>
|
|
167
|
-
<li>
|
|
168
|
-
<input type="checkbox">
|
|
169
|
-
<p>Checked List Item</p>
|
|
170
|
-
</li>
|
|
171
|
-
<li>
|
|
172
|
-
<input type="checkbox">
|
|
173
|
-
<p>Checked List Item</p>
|
|
174
|
-
<ul>
|
|
175
|
-
<li>
|
|
176
|
-
<input type="checkbox">
|
|
177
|
-
<p>Nested Checked List Item</p>
|
|
178
|
-
</li>
|
|
179
|
-
<li>
|
|
180
|
-
<label><input type="checkbox"></label>
|
|
181
|
-
<p>Nested Checked List Item</p>
|
|
182
|
-
</li>
|
|
183
|
-
</ul>
|
|
184
|
-
</li>
|
|
185
|
-
<li>
|
|
186
|
-
<input type="checkbox">
|
|
187
|
-
<p>Checked List Item</p>
|
|
188
|
-
</li>
|
|
189
|
-
</ul>`;
|
|
190
|
-
await parseHTMLAndCompareSnapshots(html, "parse-nested-lists-with-paragraphs");
|
|
191
|
-
});
|
|
192
|
-
it("Parse mixed nested lists", async () => {
|
|
193
|
-
const html = `<ul>
|
|
194
|
-
<li>Bullet List Item</li>
|
|
195
|
-
<li>Bullet List Item
|
|
196
|
-
<ol>
|
|
197
|
-
<li>Nested Numbered List Item</li>
|
|
198
|
-
<li>Nested Numbered List Item</li>
|
|
199
|
-
</ol>
|
|
200
|
-
</li>
|
|
201
|
-
<li>Bullet List Item</li>
|
|
202
|
-
</ul>
|
|
203
|
-
<ol>
|
|
204
|
-
<li>Numbered List Item</li>
|
|
205
|
-
<li>Numbered List Item
|
|
206
|
-
<ul>
|
|
207
|
-
<li>
|
|
208
|
-
<input type="checkbox" checked>
|
|
209
|
-
Nested Check List Item
|
|
210
|
-
</li>
|
|
211
|
-
<li>
|
|
212
|
-
<input type="checkbox">
|
|
213
|
-
Nested Check List Item
|
|
214
|
-
</li>
|
|
215
|
-
</ul>
|
|
216
|
-
</li>
|
|
217
|
-
<li>Numbered List Item</li>
|
|
218
|
-
</ol>
|
|
219
|
-
<ul>
|
|
220
|
-
<li>
|
|
221
|
-
<input type="checkbox" checked>
|
|
222
|
-
Check List Item
|
|
223
|
-
</li>
|
|
224
|
-
<li>
|
|
225
|
-
<input type="checkbox">
|
|
226
|
-
Check List Item
|
|
227
|
-
<ul>
|
|
228
|
-
<li>Nested Bullet List Item</li>
|
|
229
|
-
<li>Nested Bullet List Item</li>
|
|
230
|
-
</ul>
|
|
231
|
-
</li>
|
|
232
|
-
<li>
|
|
233
|
-
<input type="checkbox" checked>
|
|
234
|
-
Nested Check List Item
|
|
235
|
-
</li>
|
|
236
|
-
</ul>`;
|
|
237
|
-
await parseHTMLAndCompareSnapshots(html, "parse-mixed-nested-lists");
|
|
238
|
-
});
|
|
239
|
-
it("Parse divs", async () => {
|
|
240
|
-
const html = `<div>Single Div</div>
|
|
241
|
-
<div>
|
|
242
|
-
Div
|
|
243
|
-
<div>Nested Div</div>
|
|
244
|
-
<div>Nested Div</div>
|
|
245
|
-
</div>
|
|
246
|
-
<div>Single Div 2</div>
|
|
247
|
-
<div>
|
|
248
|
-
<div>Nested Div</div>
|
|
249
|
-
<div>Nested Div</div>
|
|
250
|
-
</div>`;
|
|
251
|
-
await parseHTMLAndCompareSnapshots(html, "parse-divs");
|
|
252
|
-
});
|
|
253
|
-
it("Parse two divs", async () => {
|
|
254
|
-
const html = `<div>Single Div</div><div>second Div</div>`;
|
|
255
|
-
await parseHTMLAndCompareSnapshots(html, "parse-two-divs");
|
|
256
|
-
});
|
|
257
|
-
it("Parse image in paragraph", async () => {
|
|
258
|
-
const html = `<p>
|
|
259
|
-
<img src="exampleURL">
|
|
260
|
-
</p>`;
|
|
261
|
-
await parseHTMLAndCompareSnapshots(html, "parse-image-in-paragraph");
|
|
262
|
-
});
|
|
263
|
-
it("Parse fake image caption", async () => {
|
|
264
|
-
const html = `<div>
|
|
265
|
-
<img src="exampleURL">
|
|
266
|
-
<p>Image Caption</p>
|
|
267
|
-
</div>`;
|
|
268
|
-
await parseHTMLAndCompareSnapshots(html, "parse-fake-image-caption");
|
|
269
|
-
});
|
|
270
|
-
// TODO: this one fails
|
|
271
|
-
it.skip("Parse deep nested content", async () => {
|
|
272
|
-
const html = `<div>
|
|
273
|
-
Outer 1 Div Before
|
|
274
|
-
<div>
|
|
275
|
-
Outer 2 Div Before
|
|
276
|
-
<div>
|
|
277
|
-
Outer 3 Div Before
|
|
278
|
-
<div>
|
|
279
|
-
Outer 4 Div Before
|
|
280
|
-
<h1>Heading 1</h1>
|
|
281
|
-
<h2>Heading 2</h2>
|
|
282
|
-
<h3>Heading 3</h3>
|
|
283
|
-
<p>Paragraph</p>
|
|
284
|
-
<figure><img src="exampleURL"><figcaption>Image Caption</figcaption></figure>
|
|
285
|
-
<p><strong>Bold</strong> <em>Italic</em> <u>Underline</u> <s>Strikethrough</s> <strong><em><s><u>All</u></s></em></strong></p>
|
|
286
|
-
Outer 4 Div After
|
|
287
|
-
</div>
|
|
288
|
-
Outer 3 Div After
|
|
289
|
-
</div>
|
|
290
|
-
Outer 2 Div After
|
|
291
|
-
</div>
|
|
292
|
-
Outer 1 Div After
|
|
293
|
-
</div>`;
|
|
294
|
-
await parseHTMLAndCompareSnapshots(html, "parse-deep-nested-content");
|
|
295
|
-
});
|
|
296
|
-
it("Parse div with inline content and nested blocks", async () => {
|
|
297
|
-
const html = `<div>
|
|
298
|
-
None <strong>Bold </strong><em>Italic </em><u>Underline </u><s>Strikethrough </s><strong><em><s><u>All</u></s></em></strong>
|
|
299
|
-
<div>Nested Div</div>
|
|
300
|
-
<p>Nested Paragraph</p>
|
|
301
|
-
</div>`;
|
|
302
|
-
await parseHTMLAndCompareSnapshots(html, "parse-div-with-inline-content");
|
|
303
|
-
});
|
|
304
|
-
it("Parse Notion HTML", async () => {
|
|
305
|
-
// A few notes on Notion output HTML:
|
|
306
|
-
// - Does not preserve text/background colors
|
|
307
|
-
// - Does not preserve non-list-item block nesting
|
|
308
|
-
// - Hard breaks are represented using white space, not `<br>` elements
|
|
309
|
-
// - Images are converted to links with a "!" at the start
|
|
310
|
-
// - Cells in first row of a table are converted to `th` elements, regardless
|
|
311
|
-
// of if the row is set as a header row
|
|
312
|
-
const html = `<meta charset='utf-8'><h1>Heading 1</h1>
|
|
313
|
-
<h2>Heading 2</h2>
|
|
314
|
-
<h3>Heading 3</h3>
|
|
315
|
-
<p>Paragraph 1</p>
|
|
316
|
-
<p>Nested Paragraph 1</p>
|
|
317
|
-
<p>Nested Paragraph 2</p>
|
|
318
|
-
<p>Paragraph
|
|
319
|
-
With Hard Break</p>
|
|
320
|
-
<p><strong>Bold</strong> <em>Italic</em> Underline <s>Strikethrough</s> <em><strong><s>All</s></strong></em></p>
|
|
321
|
-
<ul>
|
|
322
|
-
<li>Bullet List Item 1
|
|
323
|
-
<ul>
|
|
324
|
-
<li>Nested Bullet List Item 1
|
|
325
|
-
<ol>
|
|
326
|
-
<li>Nested Numbered List Item 1</li>
|
|
327
|
-
<li>Nested Numbered List Item 2</li>
|
|
328
|
-
</ol>
|
|
329
|
-
</li>
|
|
330
|
-
<li>Nested Bullet List Item 2</li>
|
|
331
|
-
</ul>
|
|
332
|
-
</li>
|
|
333
|
-
<li>Bullet List Item 2</li>
|
|
334
|
-
</ul>
|
|
335
|
-
<ol>
|
|
336
|
-
<li>Numbered List Item 1</li>
|
|
337
|
-
<li>Numbered List Item 2</li>
|
|
338
|
-
</ol>
|
|
339
|
-
<p>Background Color Paragraph</p>
|
|
340
|
-
<p>!<a href="https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg">https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg</a></p>
|
|
341
|
-
<table>
|
|
342
|
-
<thead>
|
|
343
|
-
<tr>
|
|
344
|
-
<th>Cell 1</th>
|
|
345
|
-
<th>Cell 2</th>
|
|
346
|
-
<th>Cell 3</th>
|
|
347
|
-
</tr>
|
|
348
|
-
</thead>
|
|
349
|
-
<tbody>
|
|
350
|
-
<tr>
|
|
351
|
-
<td>Cell 4</td>
|
|
352
|
-
<td>Cell 5</td>
|
|
353
|
-
<td>Cell 6</td>
|
|
354
|
-
</tr>
|
|
355
|
-
<tr>
|
|
356
|
-
<td>Cell 7</td>
|
|
357
|
-
<td>Cell 8</td>
|
|
358
|
-
<td>Cell 9</td>
|
|
359
|
-
</tr>
|
|
360
|
-
</tbody>
|
|
361
|
-
</table>
|
|
362
|
-
<p>Paragraph</p>
|
|
363
|
-
<!-- notionvc: 7cb7968f-b969-4795-af7a-d41b5481c675 -->`;
|
|
364
|
-
await parseHTMLAndCompareSnapshots(html, "parse-notion-html");
|
|
365
|
-
});
|
|
366
|
-
// Currently breaking, seems related to parsing `</br>` elements
|
|
367
|
-
it.skip("Parse Google Docs HTML", async () => {
|
|
368
|
-
// A few notes on Google Docs output HTML:
|
|
369
|
-
// - All inline markup is represented as `<span>` elements with inline
|
|
370
|
-
// styles (bold, italic, etc.)
|
|
371
|
-
// - The nested list structure is not valid, i.e. `<ul/ol>` elements are not
|
|
372
|
-
// placed within `<li>` elements
|
|
373
|
-
// - Images are wrapped in two spans and a paragraph
|
|
374
|
-
// - Everything is nested within a `<b>` element
|
|
375
|
-
const html = `<meta charset='utf-8'>
|
|
376
|
-
<meta charset="utf-8">
|
|
377
|
-
<b style="font-weight:normal;" id="docs-internal-guid-fdf86189-7fff-f50a-2bef-c048469db8a9">
|
|
378
|
-
<h1 dir="ltr" style="line-height:1.38;margin-left: 18pt;text-indent: -18pt;margin-top:24pt;margin-bottom:6pt;padding:0pt 0pt 0pt 18pt;"><span style="font-size:23pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Heading 1</span></h1>
|
|
379
|
-
<h2 dir="ltr" style="line-height:1.38;margin-left: 18pt;text-indent: -18pt;margin-top:18pt;margin-bottom:4pt;padding:0pt 0pt 0pt 18pt;"><span style="font-size:17pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Heading 2</span></h2>
|
|
380
|
-
<h3 dir="ltr" style="line-height:1.38;margin-left: 18pt;text-indent: -18pt;margin-top:14pt;margin-bottom:4pt;padding:0pt 0pt 0pt 18pt;"><span style="font-size:13pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Heading 3</span></h3>
|
|
381
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Paragraph 1</span></p>
|
|
382
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Paragraph 2</span></p>
|
|
383
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Paragraph 3</span></p>
|
|
384
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Paragraph With </span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"><br /></span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Hard Break</span></p>
|
|
385
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Bold</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"> </span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:italic;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Italic</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"> Underline </span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:line-through;-webkit-text-decoration-skip:none;text-decoration-skip-ink:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Strikethrough</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"> </span><span style="font-size:11pt;font-family:Arial,sans-serif;color:#ff0000;background-color:transparent;font-weight:700;font-style:italic;font-variant:normal;text-decoration:line-through;-webkit-text-decoration-skip:none;text-decoration-skip-ink:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">All</span></p>
|
|
386
|
-
<ul style="margin-top:0;margin-bottom:0;padding-inline-start:48px;">
|
|
387
|
-
<li dir="ltr" style="list-style-type:disc;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="1">
|
|
388
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Bullet List Item 1</span></p>
|
|
389
|
-
</li>
|
|
390
|
-
<ul style="margin-top:0;margin-bottom:0;padding-inline-start:48px;">
|
|
391
|
-
<li dir="ltr" style="list-style-type:circle;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="2">
|
|
392
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Nested Bullet List Item 1</span></p>
|
|
393
|
-
</li>
|
|
394
|
-
<ol style="margin-top:0;margin-bottom:0;padding-inline-start:48px;">
|
|
395
|
-
<li dir="ltr" style="list-style-type:decimal;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="3">
|
|
396
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Nested Numbered List Item 1</span></p>
|
|
397
|
-
</li>
|
|
398
|
-
<li dir="ltr" style="list-style-type:decimal;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="3">
|
|
399
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Nested Numbered List Item 2</span></p>
|
|
400
|
-
</li>
|
|
401
|
-
</ol>
|
|
402
|
-
<li dir="ltr" style="list-style-type:circle;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="2">
|
|
403
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Nested Bullet List Item 2</span></p>
|
|
404
|
-
</li>
|
|
405
|
-
</ul>
|
|
406
|
-
<li dir="ltr" style="list-style-type:disc;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="1">
|
|
407
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Bullet List Item 2</span></p>
|
|
408
|
-
</li>
|
|
409
|
-
</ul>
|
|
410
|
-
<ol style="margin-top:0;margin-bottom:0;padding-inline-start:48px;">
|
|
411
|
-
<li dir="ltr" style="list-style-type:decimal;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="1">
|
|
412
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Numbered List Item 1</span></p>
|
|
413
|
-
</li>
|
|
414
|
-
<li dir="ltr" style="list-style-type:decimal;font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;" aria-level="1">
|
|
415
|
-
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:12pt;" role="presentation"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Numbered List Item 2</span></p>
|
|
416
|
-
</li>
|
|
417
|
-
</ol>
|
|
418
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"><span style="border:none;display:inline-block;overflow:hidden;width:447px;height:301px;"><img src="https://lh7-us.googleusercontent.com/SGyYp6hfLvNkli62NKFJB6NQz-fNa2Sjy8QxfUuqipW--qCCXmCz-dJmeZUGaDXIF9TEZHzbhNJsw4_w-B09eaFOn0oUChKsrSt3cwAIFu6d4SoSjHTR_DRTPr415_P7an7Lue-EwlUcVBk1WCzcoVQ" width="447" height="301" style="margin-left:0px;margin-top:0px;" /></span></span></p>
|
|
419
|
-
<br />
|
|
420
|
-
<div dir="ltr" style="margin-left:0pt;" align="left">
|
|
421
|
-
<table style="border:none;border-collapse:collapse;table-layout:fixed;width:468pt">
|
|
422
|
-
<colgroup>
|
|
423
|
-
<col />
|
|
424
|
-
<col />
|
|
425
|
-
<col />
|
|
426
|
-
</colgroup>
|
|
427
|
-
<tbody>
|
|
428
|
-
<tr style="height:0pt">
|
|
429
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
430
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 1</span></p>
|
|
431
|
-
</td>
|
|
432
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
433
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 2</span></p>
|
|
434
|
-
</td>
|
|
435
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
436
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 3</span></p>
|
|
437
|
-
</td>
|
|
438
|
-
</tr>
|
|
439
|
-
<tr style="height:0pt">
|
|
440
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
441
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 4</span></p>
|
|
442
|
-
</td>
|
|
443
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
444
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 5</span></p>
|
|
445
|
-
</td>
|
|
446
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
447
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 6</span></p>
|
|
448
|
-
</td>
|
|
449
|
-
</tr>
|
|
450
|
-
<tr style="height:0pt">
|
|
451
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
452
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 7</span></p>
|
|
453
|
-
</td>
|
|
454
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
455
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 8</span></p>
|
|
456
|
-
</td>
|
|
457
|
-
<td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;">
|
|
458
|
-
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Cell 9</span></p>
|
|
459
|
-
</td>
|
|
460
|
-
</tr>
|
|
461
|
-
</tbody>
|
|
462
|
-
</table>
|
|
463
|
-
</div>
|
|
464
|
-
<p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Paragraph</span></p>
|
|
465
|
-
</b>
|
|
466
|
-
<br class="Apple-interchange-newline">`;
|
|
467
|
-
await parseHTMLAndCompareSnapshots(html, "parse-google-docs-html");
|
|
468
|
-
});
|
|
469
|
-
});
|
|
470
|
-
//# sourceMappingURL=parseHTML.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseHTML.test.js","sourceRoot":"","sources":["../../../../../src/api/parsers/html/parseHTML.test.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
function getChildIndex(node) {
|
|
2
|
-
return Array.prototype.indexOf.call(node.parentElement.childNodes, node);
|
|
3
|
-
}
|
|
4
|
-
function isWhitespaceNode(node) {
|
|
5
|
-
return node.nodeType === 3 && !/\S/.test(node.nodeValue || "");
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Step 1, Turns:
|
|
9
|
-
*
|
|
10
|
-
* <ul>
|
|
11
|
-
* <li>item</li>
|
|
12
|
-
* <li>
|
|
13
|
-
* <ul>
|
|
14
|
-
* <li>...</li>
|
|
15
|
-
* <li>...</li>
|
|
16
|
-
* </ul>
|
|
17
|
-
* </li>
|
|
18
|
-
*
|
|
19
|
-
* Into:
|
|
20
|
-
* <ul>
|
|
21
|
-
* <li>item</li>
|
|
22
|
-
* <ul>
|
|
23
|
-
* <li>...</li>
|
|
24
|
-
* <li>...</li>
|
|
25
|
-
* </ul>
|
|
26
|
-
* </ul>
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
function liftNestedListsToParent(element) {
|
|
30
|
-
element.querySelectorAll("li > ul, li > ol").forEach((list) => {
|
|
31
|
-
const index = getChildIndex(list);
|
|
32
|
-
const parentListItem = list.parentElement;
|
|
33
|
-
const siblingsAfter = Array.from(parentListItem.childNodes).slice(index + 1);
|
|
34
|
-
list.remove();
|
|
35
|
-
siblingsAfter.forEach((sibling) => {
|
|
36
|
-
sibling.remove();
|
|
37
|
-
});
|
|
38
|
-
parentListItem.insertAdjacentElement("afterend", list);
|
|
39
|
-
siblingsAfter.reverse().forEach((sibling) => {
|
|
40
|
-
if (isWhitespaceNode(sibling)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const siblingContainer = document.createElement("li");
|
|
44
|
-
siblingContainer.append(sibling);
|
|
45
|
-
list.insertAdjacentElement("afterend", siblingContainer);
|
|
46
|
-
});
|
|
47
|
-
if (parentListItem.childNodes.length === 0) {
|
|
48
|
-
parentListItem.remove();
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Step 2, Turns (output of liftNestedListsToParent):
|
|
54
|
-
*
|
|
55
|
-
* <li>item</li>
|
|
56
|
-
* <ul>
|
|
57
|
-
* <li>...</li>
|
|
58
|
-
* <li>...</li>
|
|
59
|
-
* </ul>
|
|
60
|
-
*
|
|
61
|
-
* Into:
|
|
62
|
-
* <div>
|
|
63
|
-
* <li>item</li>
|
|
64
|
-
* <div data-node-type="blockGroup">
|
|
65
|
-
* <ul>
|
|
66
|
-
* <li>...</li>
|
|
67
|
-
* <li>...</li>
|
|
68
|
-
* </ul>
|
|
69
|
-
* </div>
|
|
70
|
-
* </div>
|
|
71
|
-
*
|
|
72
|
-
* This resulting format is parsed
|
|
73
|
-
*/
|
|
74
|
-
function createGroups(element) {
|
|
75
|
-
element.querySelectorAll("li + ul, li + ol").forEach((list) => {
|
|
76
|
-
const listItem = list.previousElementSibling;
|
|
77
|
-
const blockContainer = document.createElement("div");
|
|
78
|
-
listItem.insertAdjacentElement("afterend", blockContainer);
|
|
79
|
-
blockContainer.append(listItem);
|
|
80
|
-
const blockGroup = document.createElement("div");
|
|
81
|
-
blockGroup.setAttribute("data-node-type", "blockGroup");
|
|
82
|
-
blockContainer.append(blockGroup);
|
|
83
|
-
while (blockContainer.nextElementSibling?.nodeName === "UL" ||
|
|
84
|
-
blockContainer.nextElementSibling?.nodeName === "OL") {
|
|
85
|
-
blockGroup.append(blockContainer.nextElementSibling);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
// prevent XSS, similar to https://github.com/ProseMirror/prosemirror-view/blob/1251b2b412656a2a06263e4187574beb43651273/src/clipboard.ts#L204
|
|
90
|
-
// https://github.com/TypeCellOS/BlockNote/issues/601
|
|
91
|
-
let _detachedDoc = null;
|
|
92
|
-
function detachedDoc() {
|
|
93
|
-
return (_detachedDoc ||
|
|
94
|
-
(_detachedDoc = document.implementation.createHTMLDocument("title")));
|
|
95
|
-
}
|
|
96
|
-
export function nestedListsToBlockNoteStructure(elementOrHTML) {
|
|
97
|
-
if (typeof elementOrHTML === "string") {
|
|
98
|
-
const element = detachedDoc().createElement("div");
|
|
99
|
-
element.innerHTML = elementOrHTML;
|
|
100
|
-
elementOrHTML = element;
|
|
101
|
-
}
|
|
102
|
-
liftNestedListsToParent(elementOrHTML);
|
|
103
|
-
createGroups(elementOrHTML);
|
|
104
|
-
return elementOrHTML;
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=nestedLists.js.map
|