@contentful/field-editor-rich-text 3.16.7 → 3.16.10
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/cjs/ContentfulEditorProvider.js +8 -8
- package/dist/cjs/RichTextEditor.js +20 -22
- package/dist/cjs/RichTextEditor.styles.js +1 -2
- package/dist/cjs/SdkProvider.js +5 -7
- package/dist/cjs/SyncEditorChanges.js +6 -15
- package/dist/cjs/Toolbar/_tests_/toolbar.test.js +15 -17
- package/dist/cjs/Toolbar/components/EmbedEntityWidget.js +9 -13
- package/dist/cjs/Toolbar/components/EmbeddedEntityDropdownButton.js +8 -10
- package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +2 -2
- package/dist/cjs/Toolbar/index.js +30 -33
- package/dist/cjs/__fixtures__/FakeSdk.js +3 -3
- package/dist/cjs/__fixtures__/asset/index.js +10 -10
- package/dist/cjs/__fixtures__/content-type/index.js +1 -1
- package/dist/cjs/__fixtures__/entry/index.js +7 -7
- package/dist/cjs/__fixtures__/fixtures.js +6 -8
- package/dist/cjs/__fixtures__/locale/index.js +2 -2
- package/dist/cjs/__fixtures__/space/index.js +1 -1
- package/dist/cjs/constants/Schema.js +0 -1
- package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +38 -43
- package/dist/cjs/dialogs/openRichTextDialog.js +4 -6
- package/dist/cjs/dialogs/renderRichTextDialog.js +4 -6
- package/dist/cjs/helpers/__tests__/removeInternalMarks.test.js +10 -10
- package/dist/cjs/helpers/callbacks.js +3 -3
- package/dist/cjs/helpers/config.js +2 -2
- package/dist/cjs/helpers/editor.js +44 -53
- package/dist/cjs/helpers/environment.js +3 -3
- package/dist/cjs/helpers/formatDateAndTime.js +4 -5
- package/dist/cjs/helpers/getAllowedResourcesForNodeType.js +5 -22
- package/dist/cjs/helpers/getLinkedContentTypeIdsForNodeType.js +5 -29
- package/dist/cjs/helpers/nodeFactory.js +6 -6
- package/dist/cjs/helpers/sdkNavigatorSlideIn.js +6 -14
- package/dist/cjs/helpers/sdkNavigatorSlideIn.spec.js +2 -3
- package/dist/cjs/helpers/toSlateValue.js +3 -14
- package/dist/cjs/helpers/transformers.js +5 -5
- package/dist/cjs/helpers/validations.js +9 -12
- package/dist/cjs/index.js +5 -7
- package/dist/cjs/internal/constants.js +2 -4
- package/dist/cjs/internal/hooks.js +7 -9
- package/dist/cjs/internal/misc.js +12 -15
- package/dist/cjs/internal/queries.js +108 -115
- package/dist/cjs/internal/transforms.js +48 -51
- package/dist/cjs/internal/types/editor.js +1 -3
- package/dist/cjs/plugins/Break/createExitBreakPlugin.test.js +3 -4
- package/dist/cjs/plugins/Break/createResetNodePlugin.js +0 -1
- package/dist/cjs/plugins/Break/createSoftBreakPlugin.test.js +3 -3
- package/dist/cjs/plugins/CommandPalette/components/CommandList.js +33 -35
- package/dist/cjs/plugins/CommandPalette/components/CommandList.styles.js +1 -1
- package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +5 -7
- package/dist/cjs/plugins/CommandPalette/hooks/useCommandList.js +3 -7
- package/dist/cjs/plugins/CommandPalette/onKeyDown.js +1 -6
- package/dist/cjs/plugins/CommandPalette/onKeyDown.spec.js +4 -6
- package/dist/cjs/plugins/CommandPalette/useCommands.js +3 -3
- package/dist/cjs/plugins/CommandPalette/utils/fetchEntries.js +0 -2
- package/dist/cjs/plugins/CommandPalette/utils/trimLeadingSlash.js +1 -6
- package/dist/cjs/plugins/DragAndDrop/index.js +1 -9
- package/dist/cjs/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +8 -10
- package/dist/cjs/plugins/EmbeddedEntityBlock/index.js +3 -3
- package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +17 -19
- package/dist/cjs/plugins/EmbeddedEntityInline/LinkedEntityInline.js +7 -9
- package/dist/cjs/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +5 -5
- package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +11 -13
- package/dist/cjs/plugins/EmbeddedResourceInline/LinkedResourceInline.js +5 -5
- package/dist/cjs/plugins/Heading/__tests__/createHeadingPlugin.test.js +32 -32
- package/dist/cjs/plugins/Heading/components/Heading.js +10 -13
- package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +29 -23
- package/dist/cjs/plugins/Heading/createHeadingPlugin.js +2 -7
- package/dist/cjs/plugins/Hr/index.js +14 -19
- package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +28 -32
- package/dist/cjs/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
- package/dist/cjs/plugins/Hyperlink/components/EntityHyperlink.js +8 -10
- package/dist/cjs/plugins/Hyperlink/components/LinkPopover.js +17 -23
- package/dist/cjs/plugins/Hyperlink/components/ResourceHyperlink.js +8 -10
- package/dist/cjs/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +4 -6
- package/dist/cjs/plugins/Hyperlink/components/UrlHyperlink.js +6 -8
- package/dist/cjs/plugins/Hyperlink/components/linkHandlers.js +3 -3
- package/dist/cjs/plugins/Hyperlink/components/styles.js +1 -1
- package/dist/cjs/plugins/Hyperlink/createHyperlinkPlugin.js +4 -10
- package/dist/cjs/plugins/Hyperlink/useEntityInfo.js +3 -6
- package/dist/cjs/plugins/Hyperlink/useResourceEntityInfo.js +4 -6
- package/dist/cjs/plugins/Hyperlink/utils.js +4 -4
- package/dist/cjs/plugins/List/__tests__/createListPlugin.test.js +13 -13
- package/dist/cjs/plugins/List/__tests__/insertListBreak.test.js +25 -29
- package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +22 -22
- package/dist/cjs/plugins/List/components/List.js +7 -9
- package/dist/cjs/plugins/List/components/ListItem.js +4 -6
- package/dist/cjs/plugins/List/components/ToolbarListButton.js +5 -7
- package/dist/cjs/plugins/List/createListPlugin.js +0 -4
- package/dist/cjs/plugins/List/insertListBreak.js +4 -13
- package/dist/cjs/plugins/List/insertListFragment.js +5 -18
- package/dist/cjs/plugins/List/onKeyDownList.js +6 -8
- package/dist/cjs/plugins/List/transforms/insertListItem.js +2 -17
- package/dist/cjs/plugins/List/transforms/moveListItemDown.js +2 -8
- package/dist/cjs/plugins/List/transforms/moveListItems.js +2 -7
- package/dist/cjs/plugins/List/transforms/moveListItems.test.js +14 -15
- package/dist/cjs/plugins/List/transforms/toggleList.js +3 -8
- package/dist/cjs/plugins/List/transforms/toggleList.spec.js +28 -28
- package/dist/cjs/plugins/List/transforms/unwrapList.js +2 -7
- package/dist/cjs/plugins/List/utils.js +11 -12
- package/dist/cjs/plugins/List/withList.js +2 -6
- package/dist/cjs/plugins/Marks/Bold.js +7 -9
- package/dist/cjs/plugins/Marks/Code.js +7 -15
- package/dist/cjs/plugins/Marks/Italic.js +7 -9
- package/dist/cjs/plugins/Marks/Subscript.js +8 -10
- package/dist/cjs/plugins/Marks/Superscript.js +8 -10
- package/dist/cjs/plugins/Marks/Underline.js +4 -6
- package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +7 -9
- package/dist/cjs/plugins/Marks/helpers.js +5 -5
- package/dist/cjs/plugins/Normalizer/baseRules.js +0 -2
- package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
- package/dist/cjs/plugins/Normalizer/utils.js +3 -4
- package/dist/cjs/plugins/Normalizer/withNormalizer.js +3 -23
- package/dist/cjs/plugins/Paragraph/Paragraph.js +4 -6
- package/dist/cjs/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +32 -32
- package/dist/cjs/plugins/Paragraph/createParagraphPlugin.js +2 -3
- package/dist/cjs/plugins/PasteHTML/createPasteHTMLPlugin.js +6 -9
- package/dist/cjs/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +0 -2
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeAnchors.js +0 -9
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeHTML.js +2 -17
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeSheets.js +1 -13
- package/dist/cjs/plugins/Quote/__test__/createQuotePlugin.test.js +21 -21
- package/dist/cjs/plugins/Quote/components/Quote.js +4 -6
- package/dist/cjs/plugins/Quote/components/ToolbarQuoteButton.js +4 -6
- package/dist/cjs/plugins/Quote/createQuotePlugin.js +0 -1
- package/dist/cjs/plugins/Quote/toggleQuote.js +5 -5
- package/dist/cjs/plugins/Quote/withQuote.js +2 -4
- package/dist/cjs/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +0 -1
- package/dist/cjs/plugins/Table/__tests__/createTablePlugin.test.js +22 -22
- package/dist/cjs/plugins/Table/__tests__/helpers.test.js +4 -4
- package/dist/cjs/plugins/Table/actions/addColumn.js +4 -5
- package/dist/cjs/plugins/Table/actions/addRow.js +3 -6
- package/dist/cjs/plugins/Table/components/Cell.js +5 -7
- package/dist/cjs/plugins/Table/components/HeaderCell.js +5 -7
- package/dist/cjs/plugins/Table/components/Row.js +4 -6
- package/dist/cjs/plugins/Table/components/Table.js +6 -8
- package/dist/cjs/plugins/Table/components/TableActions.js +16 -19
- package/dist/cjs/plugins/Table/components/ToolbarButton.js +4 -7
- package/dist/cjs/plugins/Table/createTablePlugin.js +1 -11
- package/dist/cjs/plugins/Table/helpers.js +12 -16
- package/dist/cjs/plugins/Table/insertTableFragment.js +2 -15
- package/dist/cjs/plugins/Table/onKeyDownTable.js +3 -11
- package/dist/cjs/plugins/Table/tableTracking.js +6 -6
- package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +17 -19
- package/dist/cjs/plugins/Text/createTextPlugin.js +5 -22
- package/dist/cjs/plugins/Tracking/createTrackingPlugin.js +4 -5
- package/dist/cjs/plugins/Tracking/utils.js +3 -6
- package/dist/cjs/plugins/Voids/createVoidsPlugin.js +0 -5
- package/dist/cjs/plugins/Voids/transformVoid.js +0 -1
- package/dist/cjs/plugins/index.js +3 -15
- package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +10 -12
- package/dist/cjs/plugins/shared/EmbeddedBlockUtil.js +6 -16
- package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +8 -10
- package/dist/cjs/plugins/shared/EmbeddedInlineUtil.js +5 -9
- package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +11 -13
- package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +12 -14
- package/dist/cjs/plugins/shared/FetchingWrappedResourceCard.js +11 -14
- package/dist/cjs/plugins/shared/LinkedBlockWrapper.js +4 -8
- package/dist/cjs/plugins/shared/LinkedInlineWrapper.js +6 -10
- package/dist/cjs/plugins/shared/ResourceNewBadge.js +3 -5
- package/dist/cjs/plugins/shared/ToolbarButton.js +6 -8
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +5 -10
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +6 -11
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +13 -15
- package/dist/cjs/plugins/shared/utils.js +1 -4
- package/dist/cjs/test-utils/assertOutput.js +0 -1
- package/dist/cjs/test-utils/hyperscript.d.js +0 -1
- package/dist/cjs/test-utils/randomId.js +1 -3
- package/dist/cjs/test-utils/validation.js +5 -8
- package/dist/esm/ContentfulEditorProvider.js +1 -4
- package/dist/esm/RichTextEditor.js +13 -13
- package/dist/esm/RichTextEditor.styles.js +0 -1
- package/dist/esm/SdkProvider.js +2 -2
- package/dist/esm/SyncEditorChanges.js +3 -18
- package/dist/esm/Toolbar/_tests_/toolbar.test.js +12 -12
- package/dist/esm/Toolbar/components/EmbedEntityWidget.js +7 -9
- package/dist/esm/Toolbar/components/EmbeddedEntityDropdownButton.js +6 -6
- package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +1 -1
- package/dist/esm/Toolbar/index.js +27 -28
- package/dist/esm/__fixtures__/FakeSdk.js +3 -3
- package/dist/esm/constants/Schema.js +0 -1
- package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +31 -34
- package/dist/esm/dialogs/openRichTextDialog.js +2 -2
- package/dist/esm/dialogs/renderRichTextDialog.js +2 -2
- package/dist/esm/helpers/__tests__/removeInternalMarks.test.js +10 -10
- package/dist/esm/helpers/callbacks.js +1 -1
- package/dist/esm/helpers/config.js +1 -9
- package/dist/esm/helpers/editor.js +6 -22
- package/dist/esm/helpers/extractNodes.js +1 -3
- package/dist/esm/helpers/formatDateAndTime.js +2 -11
- package/dist/esm/helpers/getAllowedResourcesForNodeType.js +2 -19
- package/dist/esm/helpers/getLinkedContentTypeIdsForNodeType.js +2 -26
- package/dist/esm/helpers/sdkNavigatorSlideIn.js +6 -20
- package/dist/esm/helpers/sdkNavigatorSlideIn.spec.js +0 -1
- package/dist/esm/helpers/toSlateValue.js +3 -17
- package/dist/esm/helpers/validations.js +1 -5
- package/dist/esm/internal/misc.js +2 -23
- package/dist/esm/internal/queries.js +2 -11
- package/dist/esm/internal/transforms.js +3 -14
- package/dist/esm/internal/types/editor.js +1 -3
- package/dist/esm/plugins/Break/createExitBreakPlugin.test.js +3 -4
- package/dist/esm/plugins/Break/createResetNodePlugin.js +0 -1
- package/dist/esm/plugins/Break/createSoftBreakPlugin.test.js +3 -3
- package/dist/esm/plugins/CommandPalette/components/CommandList.js +30 -30
- package/dist/esm/plugins/CommandPalette/components/CommandPrompt.js +2 -2
- package/dist/esm/plugins/CommandPalette/createCommandPalettePlugin.js +1 -11
- package/dist/esm/plugins/CommandPalette/hooks/useCommandList.js +0 -2
- package/dist/esm/plugins/CommandPalette/onKeyDown.js +0 -5
- package/dist/esm/plugins/CommandPalette/onKeyDown.spec.js +2 -2
- package/dist/esm/plugins/CommandPalette/useCommands.js +3 -3
- package/dist/esm/plugins/CommandPalette/utils/fetchEntries.js +0 -2
- package/dist/esm/plugins/CommandPalette/utils/trimLeadingSlash.js +1 -6
- package/dist/esm/plugins/DragAndDrop/index.js +1 -9
- package/dist/esm/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +6 -6
- package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +14 -14
- package/dist/esm/plugins/EmbeddedEntityInline/LinkedEntityInline.js +5 -5
- package/dist/esm/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +4 -4
- package/dist/esm/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +9 -9
- package/dist/esm/plugins/EmbeddedResourceInline/LinkedResourceInline.js +4 -4
- package/dist/esm/plugins/Heading/__tests__/createHeadingPlugin.test.js +32 -32
- package/dist/esm/plugins/Heading/components/Heading.js +7 -8
- package/dist/esm/plugins/Heading/components/ToolbarHeadingButton.js +26 -18
- package/dist/esm/plugins/Heading/createHeadingPlugin.js +1 -6
- package/dist/esm/plugins/Hr/index.js +5 -8
- package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +23 -25
- package/dist/esm/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
- package/dist/esm/plugins/Hyperlink/components/EntityHyperlink.js +6 -6
- package/dist/esm/plugins/Hyperlink/components/LinkPopover.js +15 -19
- package/dist/esm/plugins/Hyperlink/components/ResourceHyperlink.js +6 -6
- package/dist/esm/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +2 -2
- package/dist/esm/plugins/Hyperlink/components/UrlHyperlink.js +4 -4
- package/dist/esm/plugins/Hyperlink/createHyperlinkPlugin.js +1 -5
- package/dist/esm/plugins/Hyperlink/useEntityInfo.js +3 -6
- package/dist/esm/plugins/Hyperlink/useResourceEntityInfo.js +2 -2
- package/dist/esm/plugins/Hyperlink/utils.js +1 -1
- package/dist/esm/plugins/List/__tests__/createListPlugin.test.js +13 -13
- package/dist/esm/plugins/List/__tests__/insertListBreak.test.js +25 -29
- package/dist/esm/plugins/List/__tests__/insertListFragment.test.js +22 -22
- package/dist/esm/plugins/List/components/List.js +1 -1
- package/dist/esm/plugins/List/components/ListItem.js +1 -1
- package/dist/esm/plugins/List/components/ToolbarListButton.js +3 -3
- package/dist/esm/plugins/List/createListPlugin.js +0 -4
- package/dist/esm/plugins/List/insertListBreak.js +4 -13
- package/dist/esm/plugins/List/insertListFragment.js +5 -18
- package/dist/esm/plugins/List/onKeyDownList.js +5 -7
- package/dist/esm/plugins/List/transforms/insertListItem.js +3 -20
- package/dist/esm/plugins/List/transforms/moveListItemDown.js +2 -8
- package/dist/esm/plugins/List/transforms/moveListItems.js +2 -7
- package/dist/esm/plugins/List/transforms/moveListItems.test.js +14 -15
- package/dist/esm/plugins/List/transforms/toggleList.js +3 -8
- package/dist/esm/plugins/List/transforms/toggleList.spec.js +28 -28
- package/dist/esm/plugins/List/transforms/unwrapList.js +2 -7
- package/dist/esm/plugins/List/utils.js +2 -7
- package/dist/esm/plugins/List/withList.js +2 -6
- package/dist/esm/plugins/Marks/Bold.js +2 -2
- package/dist/esm/plugins/Marks/Code.js +2 -8
- package/dist/esm/plugins/Marks/Italic.js +2 -2
- package/dist/esm/plugins/Marks/Subscript.js +2 -2
- package/dist/esm/plugins/Marks/Superscript.js +2 -2
- package/dist/esm/plugins/Marks/Underline.js +2 -2
- package/dist/esm/plugins/Marks/components/MarkToolbarButton.js +4 -4
- package/dist/esm/plugins/Marks/helpers.js +1 -1
- package/dist/esm/plugins/Normalizer/baseRules.js +0 -4
- package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
- package/dist/esm/plugins/Normalizer/utils.js +0 -1
- package/dist/esm/plugins/Normalizer/withNormalizer.js +2 -22
- package/dist/esm/plugins/Paragraph/Paragraph.js +1 -1
- package/dist/esm/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +32 -32
- package/dist/esm/plugins/Paragraph/createParagraphPlugin.js +1 -2
- package/dist/esm/plugins/PasteHTML/createPasteHTMLPlugin.js +3 -9
- package/dist/esm/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +0 -2
- package/dist/esm/plugins/PasteHTML/utils/sanitizeAnchors.js +1 -27
- package/dist/esm/plugins/PasteHTML/utils/sanitizeHTML.js +2 -17
- package/dist/esm/plugins/PasteHTML/utils/sanitizeSheets.js +1 -13
- package/dist/esm/plugins/Quote/__test__/createQuotePlugin.test.js +21 -21
- package/dist/esm/plugins/Quote/components/Quote.js +1 -1
- package/dist/esm/plugins/Quote/components/ToolbarQuoteButton.js +2 -2
- package/dist/esm/plugins/Quote/createQuotePlugin.js +0 -1
- package/dist/esm/plugins/Quote/shouldResetQuote.js +1 -6
- package/dist/esm/plugins/Quote/toggleQuote.js +1 -1
- package/dist/esm/plugins/Quote/withQuote.js +2 -4
- package/dist/esm/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +0 -1
- package/dist/esm/plugins/Table/__tests__/createTablePlugin.test.js +22 -22
- package/dist/esm/plugins/Table/__tests__/helpers.test.js +4 -4
- package/dist/esm/plugins/Table/actions/addColumn.js +1 -2
- package/dist/esm/plugins/Table/actions/addRow.js +0 -3
- package/dist/esm/plugins/Table/components/Cell.js +2 -2
- package/dist/esm/plugins/Table/components/HeaderCell.js +2 -2
- package/dist/esm/plugins/Table/components/Row.js +1 -1
- package/dist/esm/plugins/Table/components/Table.js +3 -3
- package/dist/esm/plugins/Table/components/TableActions.js +11 -12
- package/dist/esm/plugins/Table/components/ToolbarButton.js +2 -3
- package/dist/esm/plugins/Table/createTablePlugin.js +1 -11
- package/dist/esm/plugins/Table/helpers.js +1 -10
- package/dist/esm/plugins/Table/insertTableFragment.js +2 -15
- package/dist/esm/plugins/Table/onKeyDownTable.js +3 -11
- package/dist/esm/plugins/Table/tableTracking.js +6 -6
- package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +17 -19
- package/dist/esm/plugins/Text/createTextPlugin.js +5 -22
- package/dist/esm/plugins/Tracking/createTrackingPlugin.js +1 -2
- package/dist/esm/plugins/Tracking/utils.js +0 -1
- package/dist/esm/plugins/Voids/createVoidsPlugin.js +0 -5
- package/dist/esm/plugins/Voids/transformVoid.js +1 -4
- package/dist/esm/plugins/index.js +0 -12
- package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +5 -5
- package/dist/esm/plugins/shared/EmbeddedBlockUtil.js +5 -15
- package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +5 -5
- package/dist/esm/plugins/shared/EmbeddedInlineUtil.js +4 -8
- package/dist/esm/plugins/shared/FetchingWrappedAssetCard.js +8 -8
- package/dist/esm/plugins/shared/FetchingWrappedEntryCard.js +9 -9
- package/dist/esm/plugins/shared/FetchingWrappedResourceCard.js +8 -9
- package/dist/esm/plugins/shared/LinkedBlockWrapper.js +3 -7
- package/dist/esm/plugins/shared/LinkedInlineWrapper.js +3 -5
- package/dist/esm/plugins/shared/ResourceNewBadge.js +1 -1
- package/dist/esm/plugins/shared/ToolbarButton.js +3 -3
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +2 -5
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +2 -5
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +8 -8
- package/dist/esm/plugins/shared/utils.js +1 -4
- package/dist/esm/test-utils/assertOutput.js +0 -1
- package/dist/esm/test-utils/hyperscript.d.js +0 -1
- package/dist/esm/test-utils/jsx.js +1 -5
- package/dist/esm/test-utils/randomId.js +1 -3
- package/dist/esm/test-utils/setEmptyDataAttribute.js +1 -4
- package/dist/esm/test-utils/validation.js +4 -7
- package/dist/types/RichTextEditor.d.ts +2 -3
- package/dist/types/Toolbar/components/EmbedEntityWidget.d.ts +1 -2
- package/dist/types/Toolbar/components/EmbeddedEntityDropdownButton.d.ts +1 -1
- package/dist/types/Toolbar/components/StickyToolbarWrapper.d.ts +2 -2
- package/dist/types/Toolbar/index.d.ts +1 -2
- package/dist/types/dialogs/HypelinkDialog/HyperlinkDialog.d.ts +4 -4
- package/dist/types/dialogs/renderRichTextDialog.d.ts +1 -2
- package/dist/types/plugins/CommandPalette/components/CommandList.d.ts +1 -2
- package/dist/types/plugins/CommandPalette/components/CommandPrompt.d.ts +1 -2
- package/dist/types/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +1 -2
- package/dist/types/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +1 -1
- package/dist/types/plugins/EmbeddedEntityInline/LinkedEntityInline.d.ts +1 -2
- package/dist/types/plugins/EmbeddedResourceBlock/LinkedResourceBlock.d.ts +1 -2
- package/dist/types/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.d.ts +1 -1
- package/dist/types/plugins/EmbeddedResourceInline/LinkedResourceInline.d.ts +1 -2
- package/dist/types/plugins/Heading/components/Heading.d.ts +6 -6
- package/dist/types/plugins/Heading/components/ToolbarHeadingButton.d.ts +1 -2
- package/dist/types/plugins/Hr/index.d.ts +2 -2
- package/dist/types/plugins/Hyperlink/HyperlinkModal.d.ts +1 -2
- package/dist/types/plugins/Hyperlink/components/EntityHyperlink.d.ts +1 -2
- package/dist/types/plugins/Hyperlink/components/LinkPopover.d.ts +1 -1
- package/dist/types/plugins/Hyperlink/components/ResourceHyperlink.d.ts +1 -2
- package/dist/types/plugins/Hyperlink/components/ToolbarHyperlinkButton.d.ts +1 -2
- package/dist/types/plugins/Hyperlink/components/UrlHyperlink.d.ts +1 -2
- package/dist/types/plugins/List/components/List.d.ts +2 -3
- package/dist/types/plugins/List/components/ListItem.d.ts +1 -2
- package/dist/types/plugins/List/components/ToolbarListButton.d.ts +1 -2
- package/dist/types/plugins/Marks/Bold.d.ts +2 -3
- package/dist/types/plugins/Marks/Code.d.ts +3 -4
- package/dist/types/plugins/Marks/Italic.d.ts +2 -3
- package/dist/types/plugins/Marks/Subscript.d.ts +3 -4
- package/dist/types/plugins/Marks/Superscript.d.ts +3 -4
- package/dist/types/plugins/Marks/Underline.d.ts +2 -3
- package/dist/types/plugins/Marks/components/MarkToolbarButton.d.ts +1 -1
- package/dist/types/plugins/Paragraph/Paragraph.d.ts +1 -2
- package/dist/types/plugins/Quote/components/Quote.d.ts +1 -2
- package/dist/types/plugins/Quote/components/ToolbarQuoteButton.d.ts +1 -2
- package/dist/types/plugins/Table/components/Cell.d.ts +1 -2
- package/dist/types/plugins/Table/components/HeaderCell.d.ts +1 -2
- package/dist/types/plugins/Table/components/Row.d.ts +1 -2
- package/dist/types/plugins/Table/components/Table.d.ts +1 -2
- package/dist/types/plugins/Table/components/TableActions.d.ts +1 -2
- package/dist/types/plugins/Table/components/ToolbarButton.d.ts +1 -2
- package/dist/types/plugins/shared/EmbeddedBlockToolbarIcon.d.ts +1 -2
- package/dist/types/plugins/shared/EmbeddedInlineToolbarIcon.d.ts +1 -2
- package/dist/types/plugins/shared/FetchingWrappedAssetCard.d.ts +1 -2
- package/dist/types/plugins/shared/FetchingWrappedEntryCard.d.ts +1 -2
- package/dist/types/plugins/shared/FetchingWrappedResourceCard.d.ts +1 -2
- package/dist/types/plugins/shared/LinkedBlockWrapper.d.ts +1 -1
- package/dist/types/plugins/shared/LinkedInlineWrapper.d.ts +1 -1
- package/dist/types/plugins/shared/ResourceNewBadge.d.ts +1 -2
- package/dist/types/plugins/shared/ToolbarButton.d.ts +1 -2
- package/package.json +8 -5
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Credit: Copied & modified version from Plate's list plugin to support
|
|
3
|
-
* list items with multiple children.
|
|
4
|
-
*
|
|
5
|
-
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
6
|
-
*/ "use strict";
|
|
1
|
+
"use strict";
|
|
7
2
|
Object.defineProperty(exports, "__esModule", {
|
|
8
3
|
value: true
|
|
9
4
|
});
|
|
@@ -22,11 +17,9 @@ const listBreak = (editor)=>{
|
|
|
22
17
|
if (!editor.selection) return false;
|
|
23
18
|
const res = (0, _platelist.getListItemEntry)(editor, {});
|
|
24
19
|
let moved;
|
|
25
|
-
// If selection is in a li
|
|
26
20
|
if (res) {
|
|
27
|
-
const { list, listItem
|
|
21
|
+
const { list , listItem } = res;
|
|
28
22
|
const childNode = listItem[0].children[0];
|
|
29
|
-
// If selected li is empty, move it up.
|
|
30
23
|
if ((0, _platecommon.isBlockAboveEmpty)(editor) && listItem[0].children.length === 1 && _richtexttypes.TEXT_CONTAINERS.includes(childNode.type)) {
|
|
31
24
|
moved = (0, _platelist.moveListItemUp)(editor, {
|
|
32
25
|
list,
|
|
@@ -52,16 +45,14 @@ const listBreak = (editor)=>{
|
|
|
52
45
|
if (didReset) {
|
|
53
46
|
return true;
|
|
54
47
|
}
|
|
55
|
-
|
|
56
|
-
* If selection is in li > p, insert li.
|
|
57
|
-
*/ if (!moved) {
|
|
48
|
+
if (!moved) {
|
|
58
49
|
const inserted = (0, _insertListItem.insertListItem)(editor);
|
|
59
50
|
if (inserted) return true;
|
|
60
51
|
}
|
|
61
52
|
return false;
|
|
62
53
|
};
|
|
63
54
|
const insertListBreak = (editor)=>{
|
|
64
|
-
const { insertBreak
|
|
55
|
+
const { insertBreak } = editor;
|
|
65
56
|
return ()=>{
|
|
66
57
|
if (listBreak(editor)) return;
|
|
67
58
|
insertBreak();
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Credit: Modified version of Plate's list plugin
|
|
3
|
-
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4
|
-
*/ "use strict";
|
|
1
|
+
"use strict";
|
|
5
2
|
Object.defineProperty(exports, "__esModule", {
|
|
6
3
|
value: true
|
|
7
4
|
});
|
|
@@ -29,26 +26,19 @@ const isListRoot = (node)=>[
|
|
|
29
26
|
_richtexttypes.BLOCKS.UL_LIST,
|
|
30
27
|
_richtexttypes.BLOCKS.OL_LIST
|
|
31
28
|
].includes(node.type);
|
|
32
|
-
|
|
33
|
-
* Removes the "empty" leading lis. Empty in this context means lis only with other lis as children.
|
|
34
|
-
*
|
|
35
|
-
* @returns If argument is not a list root, returns it, otherwise returns ul[] or li[].
|
|
36
|
-
*/ const trimList = (listRoot)=>{
|
|
29
|
+
const trimList = (listRoot)=>{
|
|
37
30
|
if (!isListRoot(listRoot)) {
|
|
38
31
|
return [
|
|
39
32
|
listRoot
|
|
40
33
|
];
|
|
41
34
|
}
|
|
42
35
|
const textEntries = Array.from((0, _queries.getNodeTexts)(listRoot));
|
|
43
|
-
const commonAncestorEntry = textEntries.reduce((commonAncestor, textEntry)=>(0, _queries.isAncestorPath)(commonAncestor[1], textEntry[1]) ? commonAncestor : (0, _queries.getCommonNode)(listRoot, textEntry[1], commonAncestor[1]),
|
|
44
|
-
getFirstAncestorOfType(listRoot, textEntries[0]));
|
|
36
|
+
const commonAncestorEntry = textEntries.reduce((commonAncestor, textEntry)=>(0, _queries.isAncestorPath)(commonAncestor[1], textEntry[1]) ? commonAncestor : (0, _queries.getCommonNode)(listRoot, textEntry[1], commonAncestor[1]), getFirstAncestorOfType(listRoot, textEntries[0]));
|
|
45
37
|
return isListRoot(commonAncestorEntry[0]) ? commonAncestorEntry[0].children : [
|
|
46
38
|
commonAncestorEntry[0]
|
|
47
39
|
];
|
|
48
40
|
};
|
|
49
|
-
|
|
50
|
-
* Removes leading li when pasting a single li with a single child.
|
|
51
|
-
*/ const trimLiWrapper = (nodes)=>{
|
|
41
|
+
const trimLiWrapper = (nodes)=>{
|
|
52
42
|
if (nodes.length !== 1) {
|
|
53
43
|
return nodes;
|
|
54
44
|
}
|
|
@@ -69,7 +59,7 @@ const unwrapTextContainerAtStart = (nodes)=>{
|
|
|
69
59
|
return nodes;
|
|
70
60
|
};
|
|
71
61
|
const insertListFragment = (editor)=>{
|
|
72
|
-
const { insertFragment
|
|
62
|
+
const { insertFragment } = editor;
|
|
73
63
|
return (fragment)=>{
|
|
74
64
|
if (!editor.selection) {
|
|
75
65
|
return;
|
|
@@ -88,9 +78,6 @@ const insertListFragment = (editor)=>{
|
|
|
88
78
|
}
|
|
89
79
|
const inlines = nodes.slice(0, firstBlockIndex);
|
|
90
80
|
const blocks = nodes.slice(firstBlockIndex);
|
|
91
|
-
// Two calls to insertNodes are required here. Otherwise, all blocks
|
|
92
|
-
// after a text or inline element occurrence will be unwrapped for
|
|
93
|
-
// some reason.
|
|
94
81
|
(0, _transforms.insertNodes)(editor, inlines, {
|
|
95
82
|
at: editor.selection,
|
|
96
83
|
select: true
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Credit: Modified version of Plate's list plugin
|
|
3
|
-
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4
|
-
*/ "use strict";
|
|
1
|
+
"use strict";
|
|
5
2
|
Object.defineProperty(exports, "__esModule", {
|
|
6
3
|
value: true
|
|
7
4
|
});
|
|
@@ -11,8 +8,7 @@ Object.defineProperty(exports, "onKeyDownList", {
|
|
|
11
8
|
return onKeyDownList;
|
|
12
9
|
}
|
|
13
10
|
});
|
|
14
|
-
const _ishotkey =
|
|
15
|
-
const _castArray = /*#__PURE__*/ _interop_require_default(require("lodash/castArray"));
|
|
11
|
+
const _ishotkey = _interop_require_default(require("is-hotkey"));
|
|
16
12
|
const _queries = require("../../internal/queries");
|
|
17
13
|
const _moveListItems = require("./transforms/moveListItems");
|
|
18
14
|
const _toggleList = require("./transforms/toggleList");
|
|
@@ -21,7 +17,7 @@ function _interop_require_default(obj) {
|
|
|
21
17
|
default: obj
|
|
22
18
|
};
|
|
23
19
|
}
|
|
24
|
-
const onKeyDownList = (editor, { type, options: { hotkey
|
|
20
|
+
const onKeyDownList = (editor, { type , options: { hotkey } })=>(e)=>{
|
|
25
21
|
if (e.key === 'Tab' && editor.selection) {
|
|
26
22
|
const listSelected = (0, _queries.getAboveNode)(editor, {
|
|
27
23
|
at: editor.selection,
|
|
@@ -38,7 +34,9 @@ const onKeyDownList = (editor, { type, options: { hotkey } })=>(e)=>{
|
|
|
38
34
|
}
|
|
39
35
|
}
|
|
40
36
|
if (!hotkey) return;
|
|
41
|
-
const hotkeys =
|
|
37
|
+
const hotkeys = Array.isArray(hotkey) ? hotkey : [
|
|
38
|
+
hotkey
|
|
39
|
+
];
|
|
42
40
|
for (const _hotkey of hotkeys){
|
|
43
41
|
if ((0, _ishotkey.default)(_hotkey)(e)) {
|
|
44
42
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -12,9 +12,7 @@ const _richtexttypes = require("@contentful/rich-text-types");
|
|
|
12
12
|
const _internal = require("../../../internal");
|
|
13
13
|
const _queries = require("../../../internal/queries");
|
|
14
14
|
const _transforms = require("../../../internal/transforms");
|
|
15
|
-
|
|
16
|
-
* Build a new list item node while preserving marks
|
|
17
|
-
*/ const emptyListItemNode = (editor, withChildren = false)=>{
|
|
15
|
+
const emptyListItemNode = (editor, withChildren = false)=>{
|
|
18
16
|
let children = [];
|
|
19
17
|
if (withChildren) {
|
|
20
18
|
const marks = (0, _queries.getMarks)(editor) || {};
|
|
@@ -41,7 +39,6 @@ const insertListItem = (editor)=>{
|
|
|
41
39
|
if (!editor.selection) {
|
|
42
40
|
return false;
|
|
43
41
|
}
|
|
44
|
-
// Naming it paragraph for simplicity but can be a heading as well
|
|
45
42
|
const paragraph = (0, _queries.getAboveNode)(editor, {
|
|
46
43
|
match: {
|
|
47
44
|
type: _richtexttypes.TEXT_CONTAINERS
|
|
@@ -59,33 +56,23 @@ const insertListItem = (editor)=>{
|
|
|
59
56
|
if (listItemNode.type !== _richtexttypes.BLOCKS.LIST_ITEM) {
|
|
60
57
|
return false;
|
|
61
58
|
}
|
|
62
|
-
// We are in a li>p (or heading)
|
|
63
59
|
(0, _internal.withoutNormalizing)(editor, ()=>{
|
|
64
60
|
if (!editor.selection) {
|
|
65
61
|
return;
|
|
66
62
|
}
|
|
67
|
-
// Check the cursor position in the current paragraph
|
|
68
63
|
const isAtStart = (0, _queries.isSelectionAtBlockStart)(editor);
|
|
69
64
|
const isAtEnd = (0, _queries.isSelectionAtBlockEnd)(editor);
|
|
70
65
|
const isAtStartOfListItem = isAtStart && (0, _queries.isFirstChildPath)(paragraphPath);
|
|
71
66
|
const shouldSplit = !isAtStart && !isAtEnd;
|
|
72
|
-
// Split the current paragraph content if necessary
|
|
73
67
|
if (shouldSplit) {
|
|
74
68
|
(0, _transforms.splitNodes)(editor);
|
|
75
69
|
}
|
|
76
|
-
// Insert the new li
|
|
77
70
|
const newListItemPath = isAtStartOfListItem ? listItemPath : (0, _queries.getNextPath)(listItemPath);
|
|
78
|
-
(0, _transforms.insertNodes)(editor,
|
|
79
|
-
// paragraphs over there.
|
|
80
|
-
emptyListItemNode(editor, !shouldSplit), {
|
|
71
|
+
(0, _transforms.insertNodes)(editor, emptyListItemNode(editor, !shouldSplit), {
|
|
81
72
|
at: newListItemPath
|
|
82
73
|
});
|
|
83
|
-
// Move children *after* selection to the new li
|
|
84
74
|
const fromPath = isAtStart ? paragraphPath : (0, _queries.getNextPath)(paragraphPath);
|
|
85
75
|
const fromStartIndex = fromPath[fromPath.length - 1] || 0;
|
|
86
|
-
// On split we don't add paragraph to the new li so we move
|
|
87
|
-
// content to the very beginning. Otherwise, account for the empty
|
|
88
|
-
// paragraph at the beginning by moving the content after
|
|
89
76
|
const toPath = newListItemPath.concat([
|
|
90
77
|
shouldSplit ? 0 : 1
|
|
91
78
|
]);
|
|
@@ -96,12 +83,10 @@ const insertListItem = (editor)=>{
|
|
|
96
83
|
fromStartIndex
|
|
97
84
|
});
|
|
98
85
|
}
|
|
99
|
-
// Move cursor to the start of the new li
|
|
100
86
|
(0, _transforms.select)(editor, newListItemPath);
|
|
101
87
|
(0, _transforms.collapseSelection)(editor, {
|
|
102
88
|
edge: 'start'
|
|
103
89
|
});
|
|
104
90
|
});
|
|
105
|
-
// Returning True skips processing other editor.insertBreak handlers
|
|
106
91
|
return true;
|
|
107
92
|
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Credit: Modified version of Plate's list plugin
|
|
3
|
-
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4
|
-
*/ "use strict";
|
|
1
|
+
"use strict";
|
|
5
2
|
Object.defineProperty(exports, "__esModule", {
|
|
6
3
|
value: true
|
|
7
4
|
});
|
|
@@ -15,7 +12,7 @@ const _platelist = require("@udecode/plate-list");
|
|
|
15
12
|
const _internal = require("../../../internal");
|
|
16
13
|
const _queries = require("../../../internal/queries");
|
|
17
14
|
const _transforms = require("../../../internal/transforms");
|
|
18
|
-
const moveListItemDown = (editor, { list, listItem
|
|
15
|
+
const moveListItemDown = (editor, { list , listItem })=>{
|
|
19
16
|
const [listNode] = list;
|
|
20
17
|
const [, listItemPath] = listItem;
|
|
21
18
|
let previousListItemPath;
|
|
@@ -24,7 +21,6 @@ const moveListItemDown = (editor, { list, listItem })=>{
|
|
|
24
21
|
} catch (e) {
|
|
25
22
|
return;
|
|
26
23
|
}
|
|
27
|
-
// Previous sibling is the new parent
|
|
28
24
|
const previousSiblingItem = (0, _queries.getNodeEntry)(editor, previousListItemPath);
|
|
29
25
|
if (previousSiblingItem) {
|
|
30
26
|
const [, previousPath] = previousSiblingItem;
|
|
@@ -34,7 +30,6 @@ const moveListItemDown = (editor, { list, listItem })=>{
|
|
|
34
30
|
const newPath = (0, _queries.getNextPath)((0, _queries.getLastChildPath)(subList ?? previousSiblingItem));
|
|
35
31
|
(0, _internal.withoutNormalizing)(editor, ()=>{
|
|
36
32
|
if (!subList) {
|
|
37
|
-
// Create new sub-list
|
|
38
33
|
(0, _transforms.wrapNodes)(editor, {
|
|
39
34
|
type: listNode.type,
|
|
40
35
|
children: [],
|
|
@@ -43,7 +38,6 @@ const moveListItemDown = (editor, { list, listItem })=>{
|
|
|
43
38
|
at: listItemPath
|
|
44
39
|
});
|
|
45
40
|
}
|
|
46
|
-
// Move the current item to the sub-list
|
|
47
41
|
(0, _transforms.moveNodes)(editor, {
|
|
48
42
|
at: listItemPath,
|
|
49
43
|
to: newPath
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Credit: Modified version of Plate's list plugin
|
|
3
|
-
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4
|
-
*/ "use strict";
|
|
1
|
+
"use strict";
|
|
5
2
|
Object.defineProperty(exports, "__esModule", {
|
|
6
3
|
value: true
|
|
7
4
|
});
|
|
@@ -15,19 +12,17 @@ const _platelist = require("@udecode/plate-list");
|
|
|
15
12
|
const _internal = require("../../../internal");
|
|
16
13
|
const _queries = require("../../../internal/queries");
|
|
17
14
|
const _moveListItemDown = require("./moveListItemDown");
|
|
18
|
-
const moveListItems = (editor, { increase =
|
|
15
|
+
const moveListItems = (editor, { increase =true , at =editor.selection ?? undefined } = {})=>{
|
|
19
16
|
const _nodes = (0, _queries.getNodeEntries)(editor, {
|
|
20
17
|
at,
|
|
21
18
|
match: {
|
|
22
19
|
type: (0, _queries.getPluginType)(editor, _platelist.ELEMENT_LIC)
|
|
23
20
|
}
|
|
24
21
|
});
|
|
25
|
-
// Get the selected lic
|
|
26
22
|
const lics = Array.from(_nodes);
|
|
27
23
|
if (!lics.length) return;
|
|
28
24
|
const highestLicPaths = [];
|
|
29
25
|
const highestLicPathRefs = [];
|
|
30
|
-
// Filter out the nested lic, we just need to move the highest ones
|
|
31
26
|
lics.forEach((lic)=>{
|
|
32
27
|
const licPath = lic[1];
|
|
33
28
|
const liPath = (0, _queries.getParentPath)(licPath);
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
const _testutils = require("../../../test-utils");
|
|
6
6
|
const _moveListItems = require("./moveListItems");
|
|
7
7
|
describe('moving list items (up/down)', ()=>{
|
|
8
|
-
const renderEditor = (children)
|
|
8
|
+
const renderEditor = (children)=>(0, _testutils.jsx)("editor", null, children, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
9
9
|
const assertTab = (t, shift = false)=>{
|
|
10
10
|
test(t.title, ()=>{
|
|
11
|
-
const { editor
|
|
11
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
12
12
|
input: renderEditor(t.input)
|
|
13
13
|
});
|
|
14
|
-
// Equivalent of pressing (SHIFT+)TAB
|
|
15
14
|
(0, _moveListItems.moveListItems)(editor, {
|
|
16
15
|
increase: !shift
|
|
17
16
|
});
|
|
@@ -24,37 +23,37 @@ describe('moving list items (up/down)', ()=>{
|
|
|
24
23
|
const tests = [
|
|
25
24
|
{
|
|
26
25
|
title: 'single paragraph',
|
|
27
|
-
input:
|
|
28
|
-
expected:
|
|
26
|
+
input: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null)))),
|
|
27
|
+
expected: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null))))))
|
|
29
28
|
},
|
|
30
29
|
{
|
|
31
30
|
title: 'multiple paragraphs',
|
|
32
|
-
input:
|
|
33
|
-
expected:
|
|
31
|
+
input: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hp", null, "p2")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p3", (0, _testutils.jsx)("cursor", null)))),
|
|
32
|
+
expected: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hp", null, "p2"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p3", (0, _testutils.jsx)("cursor", null))))))
|
|
34
33
|
},
|
|
35
34
|
{
|
|
36
35
|
title: 'multiple elements',
|
|
37
|
-
input:
|
|
36
|
+
input: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "a"), (0, _testutils.jsx)("hp", null, "b"), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "quote"))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "c", (0, _testutils.jsx)("cursor", null)), (0, _testutils.jsx)("hp", null, "d"), (0, _testutils.jsx)("hembed", {
|
|
38
37
|
type: "Asset",
|
|
39
38
|
id: "asset-id"
|
|
40
39
|
}))),
|
|
41
|
-
expected:
|
|
40
|
+
expected: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "a"), (0, _testutils.jsx)("hp", null, "b"), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "quote")), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "c", (0, _testutils.jsx)("cursor", null)), (0, _testutils.jsx)("hp", null, "d"), (0, _testutils.jsx)("hembed", {
|
|
42
41
|
type: "Asset",
|
|
43
42
|
id: "asset-id"
|
|
44
43
|
})))))
|
|
45
44
|
},
|
|
46
45
|
{
|
|
47
46
|
title: 'with a sub-list',
|
|
48
|
-
input:
|
|
49
|
-
expected:
|
|
47
|
+
input: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "sub p1")))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null)))),
|
|
48
|
+
expected: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "sub p1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null))))))
|
|
50
49
|
},
|
|
51
50
|
{
|
|
52
51
|
title: 'with a sub-list as non-last child',
|
|
53
|
-
input:
|
|
52
|
+
input: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "sub p1"))), (0, _testutils.jsx)("hembed", {
|
|
54
53
|
type: "Entry",
|
|
55
54
|
id: "entry-id"
|
|
56
|
-
})),
|
|
57
|
-
expected:
|
|
55
|
+
})), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null)))),
|
|
56
|
+
expected: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "sub p1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null)))), (0, _testutils.jsx)("hembed", {
|
|
58
57
|
type: "Entry",
|
|
59
58
|
id: "entry-id"
|
|
60
59
|
})))
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Credit: Modified version of Plate's list plugin
|
|
3
|
-
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4
|
-
*/ "use strict";
|
|
1
|
+
"use strict";
|
|
5
2
|
Object.defineProperty(exports, "__esModule", {
|
|
6
3
|
value: true
|
|
7
4
|
});
|
|
@@ -22,15 +19,14 @@ const listTypes = [
|
|
|
22
19
|
_richtexttypes.BLOCKS.UL_LIST,
|
|
23
20
|
_richtexttypes.BLOCKS.OL_LIST
|
|
24
21
|
];
|
|
25
|
-
const toggleList = (editor, { type
|
|
22
|
+
const toggleList = (editor, { type })=>(0, _internal.withoutNormalizing)(editor, ()=>{
|
|
26
23
|
if (!editor.selection) {
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
26
|
if ((0, _queries.isRangeCollapsed)(editor.selection) || !(0, _queries.isRangeAcrossBlocks)(editor)) {
|
|
30
|
-
// selection is collapsed
|
|
31
27
|
const res = (0, _platelist.getListItemEntry)(editor);
|
|
32
28
|
if (res) {
|
|
33
|
-
const { list
|
|
29
|
+
const { list } = res;
|
|
34
30
|
if (list[0].type !== type) {
|
|
35
31
|
(0, _transforms.setNodes)(editor, {
|
|
36
32
|
type
|
|
@@ -68,7 +64,6 @@ const toggleList = (editor, { type })=>(0, _internal.withoutNormalizing)(editor,
|
|
|
68
64
|
}
|
|
69
65
|
}
|
|
70
66
|
} else {
|
|
71
|
-
// selection is a range
|
|
72
67
|
const [startPoint, endPoint] = (0, _queries.getRangeEdges)(editor.selection);
|
|
73
68
|
const commonEntry = (0, _queries.getCommonNode)(editor, startPoint.path, endPoint.path);
|
|
74
69
|
if (listTypes.includes(commonEntry[0].type) || commonEntry[0].type === _richtexttypes.BLOCKS.LIST_ITEM) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
@@ -7,9 +7,9 @@ const _testutils = require("../../../test-utils");
|
|
|
7
7
|
const _toggleList = require("./toggleList");
|
|
8
8
|
describe('toggle on', ()=>{
|
|
9
9
|
it('should turn a p to list', ()=>{
|
|
10
|
-
const input =
|
|
11
|
-
const expected =
|
|
12
|
-
const { editor
|
|
10
|
+
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "1", (0, _testutils.jsx)("cursor", null)));
|
|
11
|
+
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1", (0, _testutils.jsx)("cursor", null)))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
12
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
13
13
|
input
|
|
14
14
|
});
|
|
15
15
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -21,9 +21,9 @@ describe('toggle on', ()=>{
|
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
it('should turn a p with a selection to list', ()=>{
|
|
24
|
-
const input =
|
|
25
|
-
const expected =
|
|
26
|
-
const { editor
|
|
24
|
+
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "Planetas ", (0, _testutils.jsx)("anchor", null), "mori in", (0, _testutils.jsx)("focus", null), " gandavum!"));
|
|
25
|
+
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Planetas ", (0, _testutils.jsx)("anchor", null), "mori in", (0, _testutils.jsx)("focus", null), " gandavum!"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
26
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
27
27
|
input
|
|
28
28
|
});
|
|
29
29
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -35,9 +35,9 @@ describe('toggle on', ()=>{
|
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
it('should turn multiple p to list', ()=>{
|
|
38
|
-
const input =
|
|
39
|
-
const expected =
|
|
40
|
-
const { editor
|
|
38
|
+
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hp", null, "2"), (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)));
|
|
39
|
+
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "2")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
40
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
41
41
|
input
|
|
42
42
|
});
|
|
43
43
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -51,9 +51,9 @@ describe('toggle on', ()=>{
|
|
|
51
51
|
});
|
|
52
52
|
describe('toggle off', ()=>{
|
|
53
53
|
it('should split a simple list to two', ()=>{
|
|
54
|
-
const input =
|
|
55
|
-
const expected =
|
|
56
|
-
const { editor
|
|
54
|
+
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "2", (0, _testutils.jsx)("cursor", null))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3"))));
|
|
55
|
+
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"))), (0, _testutils.jsx)("hp", null, "2", (0, _testutils.jsx)("cursor", null)), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
56
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
57
57
|
input
|
|
58
58
|
});
|
|
59
59
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -65,9 +65,9 @@ describe('toggle off', ()=>{
|
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
it('should split a nested list', ()=>{
|
|
68
|
-
const input =
|
|
69
|
-
const expected =
|
|
70
|
-
const { editor
|
|
68
|
+
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "12", (0, _testutils.jsx)("cursor", null))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "13"))))));
|
|
69
|
+
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11"))))), (0, _testutils.jsx)("hp", null, "12", (0, _testutils.jsx)("cursor", null)), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "13"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
70
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
71
71
|
input
|
|
72
72
|
});
|
|
73
73
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -79,9 +79,9 @@ describe('toggle off', ()=>{
|
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
81
|
it('should turn a list to multiple p', ()=>{
|
|
82
|
-
const input =
|
|
83
|
-
const expected =
|
|
84
|
-
const { editor
|
|
82
|
+
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "2")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)))));
|
|
83
|
+
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hp", null, "2"), (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)));
|
|
84
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
85
85
|
input
|
|
86
86
|
});
|
|
87
87
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -95,9 +95,9 @@ describe('toggle off', ()=>{
|
|
|
95
95
|
});
|
|
96
96
|
describe('toggle over', ()=>{
|
|
97
97
|
it('should toggle different list types', ()=>{
|
|
98
|
-
const input =
|
|
99
|
-
const expected =
|
|
100
|
-
const { editor
|
|
98
|
+
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1", (0, _testutils.jsx)("cursor", null)))));
|
|
99
|
+
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
100
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
101
101
|
input
|
|
102
102
|
});
|
|
103
103
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -109,9 +109,9 @@ describe('toggle over', ()=>{
|
|
|
109
109
|
});
|
|
110
110
|
});
|
|
111
111
|
it('should only toggle the nested list', ()=>{
|
|
112
|
-
const input =
|
|
113
|
-
const expected =
|
|
114
|
-
const { editor
|
|
112
|
+
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("cursor", null)))))));
|
|
113
|
+
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("cursor", null)))))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
114
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
115
115
|
input
|
|
116
116
|
});
|
|
117
117
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -123,9 +123,9 @@ describe('toggle over', ()=>{
|
|
|
123
123
|
});
|
|
124
124
|
});
|
|
125
125
|
it('should only toggle everything that is selected', ()=>{
|
|
126
|
-
const input =
|
|
127
|
-
const expected =
|
|
128
|
-
const { editor
|
|
126
|
+
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("focus", null)))))));
|
|
127
|
+
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("focus", null)))))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
128
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
129
129
|
input
|
|
130
130
|
});
|
|
131
131
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Credit: Modified version of Plate's list plugin
|
|
3
|
-
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4
|
-
*/ "use strict";
|
|
1
|
+
"use strict";
|
|
5
2
|
Object.defineProperty(exports, "__esModule", {
|
|
6
3
|
value: true
|
|
7
4
|
});
|
|
@@ -21,17 +18,15 @@ function hasUnliftedListItems(editor, at) {
|
|
|
21
18
|
match: (node, path)=>(0, _queries.isElement)(node) && node.type === _richtexttypes.BLOCKS.LIST_ITEM && path.length >= 2
|
|
22
19
|
}).next().done;
|
|
23
20
|
}
|
|
24
|
-
const unwrapList = (editor, { at
|
|
21
|
+
const unwrapList = (editor, { at } = {})=>{
|
|
25
22
|
(0, _internal.withoutNormalizing)(editor, ()=>{
|
|
26
23
|
do {
|
|
27
|
-
// lift list items to the root level
|
|
28
24
|
(0, _transforms.liftNodes)(editor, {
|
|
29
25
|
at,
|
|
30
26
|
match: (node)=>(0, _queries.isElement)(node) && node.type === _richtexttypes.BLOCKS.LIST_ITEM,
|
|
31
27
|
mode: 'lowest'
|
|
32
28
|
});
|
|
33
29
|
}while (!hasUnliftedListItems(editor, at))
|
|
34
|
-
// finally unwrap all lifted items
|
|
35
30
|
(0, _transforms.unwrapNodes)(editor, {
|
|
36
31
|
at,
|
|
37
32
|
match: {
|
|
@@ -9,26 +9,26 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
firstNodeIsNotList: function() {
|
|
13
|
-
return firstNodeIsNotList;
|
|
14
|
-
},
|
|
15
12
|
hasListAsDirectParent: function() {
|
|
16
13
|
return hasListAsDirectParent;
|
|
17
14
|
},
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
isListTypeActive: function() {
|
|
22
|
-
return isListTypeActive;
|
|
15
|
+
normalizeOrphanedListItem: function() {
|
|
16
|
+
return normalizeOrphanedListItem;
|
|
23
17
|
},
|
|
24
18
|
isNonEmptyListItem: function() {
|
|
25
19
|
return isNonEmptyListItem;
|
|
26
20
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
21
|
+
firstNodeIsNotList: function() {
|
|
22
|
+
return firstNodeIsNotList;
|
|
23
|
+
},
|
|
24
|
+
insertParagraphAsChild: function() {
|
|
25
|
+
return insertParagraphAsChild;
|
|
29
26
|
},
|
|
30
27
|
replaceNodeWithListItems: function() {
|
|
31
28
|
return replaceNodeWithListItems;
|
|
29
|
+
},
|
|
30
|
+
isListTypeActive: function() {
|
|
31
|
+
return isListTypeActive;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
@@ -98,7 +98,7 @@ const replaceNodeWithListItems = (editor, entry)=>{
|
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
100
|
const isListTypeActive = (editor, type)=>{
|
|
101
|
-
const { selection
|
|
101
|
+
const { selection } = editor;
|
|
102
102
|
if (!selection) {
|
|
103
103
|
return false;
|
|
104
104
|
}
|
|
@@ -109,7 +109,6 @@ const isListTypeActive = (editor, type)=>{
|
|
|
109
109
|
return true;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
// Lists can be nested. Here, we take the list type at the lowest level
|
|
113
112
|
const listNode = (0, _queries.getBlockAbove)(editor, {
|
|
114
113
|
match: {
|
|
115
114
|
type: [
|