@contentful/field-editor-rich-text 3.14.3 → 3.15.1
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 +22 -20
- package/dist/cjs/RichTextEditor.styles.js +2 -1
- package/dist/cjs/SdkProvider.js +7 -5
- package/dist/cjs/SyncEditorChanges.js +15 -6
- package/dist/cjs/Toolbar/_tests_/toolbar.test.js +17 -15
- package/dist/cjs/Toolbar/components/EmbedEntityWidget.js +14 -10
- package/dist/cjs/Toolbar/components/EmbeddedEntityDropdownButton.js +10 -8
- package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +2 -2
- package/dist/cjs/Toolbar/index.js +33 -30
- 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 +8 -6
- package/dist/cjs/__fixtures__/locale/index.js +2 -2
- package/dist/cjs/__fixtures__/space/index.js +1 -1
- package/dist/cjs/constants/Schema.js +1 -0
- package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +43 -38
- package/dist/cjs/dialogs/openRichTextDialog.js +6 -4
- package/dist/cjs/dialogs/renderRichTextDialog.js +6 -4
- 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 +53 -44
- package/dist/cjs/helpers/environment.js +3 -3
- package/dist/cjs/helpers/formatDateAndTime.js +5 -4
- package/dist/cjs/helpers/getAllowedResourcesForNodeType.js +22 -5
- package/dist/cjs/helpers/getLinkedContentTypeIdsForNodeType.js +29 -5
- package/dist/cjs/helpers/nodeFactory.js +6 -6
- package/dist/cjs/helpers/sdkNavigatorSlideIn.js +14 -6
- package/dist/cjs/helpers/sdkNavigatorSlideIn.spec.js +3 -2
- package/dist/cjs/helpers/toSlateValue.js +14 -3
- package/dist/cjs/helpers/transformers.js +5 -5
- package/dist/cjs/helpers/validations.js +12 -9
- package/dist/cjs/index.js +7 -5
- package/dist/cjs/internal/constants.js +4 -2
- package/dist/cjs/internal/hooks.js +8 -6
- package/dist/cjs/internal/misc.js +15 -12
- package/dist/cjs/internal/queries.js +115 -108
- package/dist/cjs/internal/transforms.js +51 -48
- package/dist/cjs/internal/types/editor.js +3 -1
- package/dist/cjs/plugins/Break/createExitBreakPlugin.test.js +4 -3
- package/dist/cjs/plugins/Break/createResetNodePlugin.js +1 -0
- package/dist/cjs/plugins/Break/createSoftBreakPlugin.test.js +3 -3
- package/dist/cjs/plugins/CommandPalette/components/CommandList.js +35 -33
- package/dist/cjs/plugins/CommandPalette/components/CommandList.styles.js +1 -1
- package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +7 -5
- package/dist/cjs/plugins/CommandPalette/hooks/useCommandList.js +7 -3
- package/dist/cjs/plugins/CommandPalette/onKeyDown.js +6 -1
- package/dist/cjs/plugins/CommandPalette/onKeyDown.spec.js +6 -4
- package/dist/cjs/plugins/CommandPalette/useCommands.js +3 -3
- package/dist/cjs/plugins/CommandPalette/utils/fetchEntries.js +2 -0
- package/dist/cjs/plugins/CommandPalette/utils/trimLeadingSlash.js +6 -1
- package/dist/cjs/plugins/DragAndDrop/index.js +9 -1
- package/dist/cjs/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +10 -8
- package/dist/cjs/plugins/EmbeddedEntityBlock/index.js +3 -3
- package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +19 -17
- package/dist/cjs/plugins/EmbeddedEntityInline/LinkedEntityInline.js +9 -7
- package/dist/cjs/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +5 -5
- package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +17 -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 +13 -10
- package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +19 -11
- package/dist/cjs/plugins/Heading/createHeadingPlugin.js +7 -2
- package/dist/cjs/plugins/Hr/index.js +19 -14
- package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +32 -28
- package/dist/cjs/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
- package/dist/cjs/plugins/Hyperlink/components/EntityHyperlink.js +8 -6
- package/dist/cjs/plugins/Hyperlink/components/ResourceHyperlink.js +8 -6
- package/dist/cjs/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +6 -4
- package/dist/cjs/plugins/Hyperlink/components/UrlHyperlink.js +7 -5
- package/dist/cjs/plugins/Hyperlink/components/styles.js +1 -1
- package/dist/cjs/plugins/Hyperlink/createHyperlinkPlugin.js +10 -4
- package/dist/cjs/plugins/Hyperlink/useEntityInfo.js +6 -3
- package/dist/cjs/plugins/Hyperlink/useResourceEntityInfo.js +7 -5
- package/dist/cjs/plugins/Hyperlink/utils.js +6 -14
- package/dist/cjs/plugins/List/__tests__/createListPlugin.test.js +13 -13
- package/dist/cjs/plugins/List/__tests__/insertListBreak.test.js +29 -25
- package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +22 -22
- package/dist/cjs/plugins/List/components/List.js +9 -7
- package/dist/cjs/plugins/List/components/ListItem.js +6 -4
- package/dist/cjs/plugins/List/components/ToolbarListButton.js +7 -5
- package/dist/cjs/plugins/List/createListPlugin.js +4 -0
- package/dist/cjs/plugins/List/insertListBreak.js +13 -4
- package/dist/cjs/plugins/List/insertListFragment.js +18 -5
- package/dist/cjs/plugins/List/onKeyDownList.js +7 -4
- package/dist/cjs/plugins/List/transforms/insertListItem.js +17 -2
- package/dist/cjs/plugins/List/transforms/moveListItemDown.js +8 -2
- package/dist/cjs/plugins/List/transforms/moveListItems.js +7 -2
- package/dist/cjs/plugins/List/transforms/moveListItems.test.js +15 -14
- package/dist/cjs/plugins/List/transforms/toggleList.js +8 -3
- package/dist/cjs/plugins/List/transforms/toggleList.spec.js +28 -28
- package/dist/cjs/plugins/List/transforms/unwrapList.js +7 -2
- package/dist/cjs/plugins/List/utils.js +12 -11
- package/dist/cjs/plugins/List/withList.js +6 -2
- package/dist/cjs/plugins/Marks/Bold.js +9 -7
- package/dist/cjs/plugins/Marks/Code.js +15 -7
- package/dist/cjs/plugins/Marks/Italic.js +9 -7
- package/dist/cjs/plugins/Marks/Subscript.js +10 -8
- package/dist/cjs/plugins/Marks/Superscript.js +10 -8
- package/dist/cjs/plugins/Marks/Underline.js +6 -4
- package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +9 -7
- package/dist/cjs/plugins/Marks/helpers.js +5 -5
- package/dist/cjs/plugins/Normalizer/baseRules.js +2 -0
- package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
- package/dist/cjs/plugins/Normalizer/utils.js +4 -3
- package/dist/cjs/plugins/Normalizer/withNormalizer.js +23 -3
- package/dist/cjs/plugins/Paragraph/Paragraph.js +6 -4
- package/dist/cjs/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +32 -32
- package/dist/cjs/plugins/Paragraph/createParagraphPlugin.js +3 -2
- package/dist/cjs/plugins/PasteHTML/createPasteHTMLPlugin.js +9 -6
- package/dist/cjs/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +2 -0
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeAnchors.js +9 -0
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeHTML.js +17 -2
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeSheets.js +13 -1
- package/dist/cjs/plugins/Quote/__test__/createQuotePlugin.test.js +21 -21
- package/dist/cjs/plugins/Quote/components/Quote.js +6 -4
- package/dist/cjs/plugins/Quote/components/ToolbarQuoteButton.js +6 -4
- package/dist/cjs/plugins/Quote/createQuotePlugin.js +1 -0
- package/dist/cjs/plugins/Quote/toggleQuote.js +5 -5
- package/dist/cjs/plugins/Quote/withQuote.js +4 -2
- package/dist/cjs/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +1 -0
- 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 +5 -4
- package/dist/cjs/plugins/Table/actions/addRow.js +6 -3
- package/dist/cjs/plugins/Table/components/Cell.js +7 -5
- package/dist/cjs/plugins/Table/components/HeaderCell.js +7 -5
- package/dist/cjs/plugins/Table/components/Row.js +6 -4
- package/dist/cjs/plugins/Table/components/Table.js +8 -6
- package/dist/cjs/plugins/Table/components/TableActions.js +19 -16
- package/dist/cjs/plugins/Table/components/ToolbarButton.js +7 -4
- package/dist/cjs/plugins/Table/createTablePlugin.js +11 -1
- package/dist/cjs/plugins/Table/helpers.js +16 -12
- package/dist/cjs/plugins/Table/insertTableFragment.js +15 -2
- package/dist/cjs/plugins/Table/onKeyDownTable.js +10 -2
- package/dist/cjs/plugins/Table/tableTracking.js +6 -6
- package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +19 -17
- package/dist/cjs/plugins/Text/createTextPlugin.js +22 -5
- package/dist/cjs/plugins/Tracking/createTrackingPlugin.js +5 -4
- package/dist/cjs/plugins/Tracking/utils.js +6 -3
- package/dist/cjs/plugins/Voids/createVoidsPlugin.js +5 -0
- package/dist/cjs/plugins/Voids/transformVoid.js +1 -0
- package/dist/cjs/plugins/index.js +15 -3
- package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +12 -10
- package/dist/cjs/plugins/shared/EmbeddedBlockUtil.js +16 -6
- package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +10 -8
- package/dist/cjs/plugins/shared/EmbeddedInlineUtil.js +9 -5
- package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +13 -11
- package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +14 -12
- package/dist/cjs/plugins/shared/FetchingWrappedResourceCard.js +14 -11
- package/dist/cjs/plugins/shared/LinkedBlockWrapper.js +8 -4
- package/dist/cjs/plugins/shared/LinkedInlineWrapper.js +10 -6
- package/dist/cjs/plugins/shared/ResourceNewBadge.js +5 -3
- package/dist/cjs/plugins/shared/ToolbarButton.js +8 -6
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +10 -5
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +11 -6
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +15 -13
- package/dist/cjs/plugins/shared/utils.js +20 -3
- package/dist/cjs/test-utils/assertOutput.js +1 -0
- package/dist/cjs/test-utils/hyperscript.d.js +1 -0
- package/dist/cjs/test-utils/randomId.js +3 -1
- package/dist/cjs/test-utils/validation.js +8 -5
- package/dist/esm/ContentfulEditorProvider.js +4 -1
- package/dist/esm/RichTextEditor.js +13 -13
- package/dist/esm/RichTextEditor.styles.js +1 -0
- package/dist/esm/SdkProvider.js +2 -2
- package/dist/esm/SyncEditorChanges.js +18 -3
- package/dist/esm/Toolbar/_tests_/toolbar.test.js +12 -12
- package/dist/esm/Toolbar/components/EmbedEntityWidget.js +10 -8
- package/dist/esm/Toolbar/components/EmbeddedEntityDropdownButton.js +6 -6
- package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +1 -1
- package/dist/esm/Toolbar/index.js +28 -27
- package/dist/esm/__fixtures__/FakeSdk.js +3 -3
- package/dist/esm/constants/Schema.js +1 -0
- package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +34 -31
- 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 +9 -1
- package/dist/esm/helpers/editor.js +22 -6
- package/dist/esm/helpers/extractNodes.js +3 -1
- package/dist/esm/helpers/formatDateAndTime.js +11 -2
- package/dist/esm/helpers/getAllowedResourcesForNodeType.js +19 -2
- package/dist/esm/helpers/getLinkedContentTypeIdsForNodeType.js +26 -2
- package/dist/esm/helpers/sdkNavigatorSlideIn.js +20 -6
- package/dist/esm/helpers/sdkNavigatorSlideIn.spec.js +1 -0
- package/dist/esm/helpers/toSlateValue.js +17 -3
- package/dist/esm/helpers/validations.js +5 -1
- package/dist/esm/internal/misc.js +23 -2
- package/dist/esm/internal/queries.js +11 -2
- package/dist/esm/internal/transforms.js +14 -3
- package/dist/esm/internal/types/editor.js +3 -1
- package/dist/esm/plugins/Break/createExitBreakPlugin.test.js +4 -3
- package/dist/esm/plugins/Break/createResetNodePlugin.js +1 -0
- 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 +11 -1
- package/dist/esm/plugins/CommandPalette/hooks/useCommandList.js +2 -0
- package/dist/esm/plugins/CommandPalette/onKeyDown.js +5 -0
- 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 +2 -0
- package/dist/esm/plugins/CommandPalette/utils/trimLeadingSlash.js +6 -1
- package/dist/esm/plugins/DragAndDrop/index.js +9 -1
- 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 +13 -11
- 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 +8 -7
- package/dist/esm/plugins/Heading/components/ToolbarHeadingButton.js +14 -8
- package/dist/esm/plugins/Heading/createHeadingPlugin.js +6 -1
- package/dist/esm/plugins/Hr/index.js +8 -5
- package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +25 -23
- package/dist/esm/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
- package/dist/esm/plugins/Hyperlink/components/EntityHyperlink.js +4 -4
- package/dist/esm/plugins/Hyperlink/components/ResourceHyperlink.js +4 -4
- package/dist/esm/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +2 -2
- package/dist/esm/plugins/Hyperlink/components/UrlHyperlink.js +3 -3
- package/dist/esm/plugins/Hyperlink/createHyperlinkPlugin.js +5 -1
- package/dist/esm/plugins/Hyperlink/useEntityInfo.js +6 -3
- package/dist/esm/plugins/Hyperlink/useResourceEntityInfo.js +3 -3
- package/dist/esm/plugins/Hyperlink/utils.js +2 -7
- package/dist/esm/plugins/List/__tests__/createListPlugin.test.js +13 -13
- package/dist/esm/plugins/List/__tests__/insertListBreak.test.js +29 -25
- 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 +4 -0
- package/dist/esm/plugins/List/insertListBreak.js +13 -4
- package/dist/esm/plugins/List/insertListFragment.js +18 -5
- package/dist/esm/plugins/List/onKeyDownList.js +5 -2
- package/dist/esm/plugins/List/transforms/insertListItem.js +20 -3
- package/dist/esm/plugins/List/transforms/moveListItemDown.js +8 -2
- package/dist/esm/plugins/List/transforms/moveListItems.js +7 -2
- package/dist/esm/plugins/List/transforms/moveListItems.test.js +15 -14
- package/dist/esm/plugins/List/transforms/toggleList.js +8 -3
- package/dist/esm/plugins/List/transforms/toggleList.spec.js +28 -28
- package/dist/esm/plugins/List/transforms/unwrapList.js +7 -2
- package/dist/esm/plugins/List/utils.js +7 -2
- package/dist/esm/plugins/List/withList.js +6 -2
- package/dist/esm/plugins/Marks/Bold.js +2 -2
- package/dist/esm/plugins/Marks/Code.js +8 -2
- 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 +4 -0
- package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
- package/dist/esm/plugins/Normalizer/utils.js +1 -0
- package/dist/esm/plugins/Normalizer/withNormalizer.js +22 -2
- 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 +2 -1
- package/dist/esm/plugins/PasteHTML/createPasteHTMLPlugin.js +9 -3
- package/dist/esm/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +2 -0
- package/dist/esm/plugins/PasteHTML/utils/sanitizeAnchors.js +27 -1
- package/dist/esm/plugins/PasteHTML/utils/sanitizeHTML.js +17 -2
- package/dist/esm/plugins/PasteHTML/utils/sanitizeSheets.js +13 -1
- 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 +1 -0
- package/dist/esm/plugins/Quote/shouldResetQuote.js +6 -1
- package/dist/esm/plugins/Quote/toggleQuote.js +1 -1
- package/dist/esm/plugins/Quote/withQuote.js +4 -2
- package/dist/esm/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +1 -0
- 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 +2 -1
- package/dist/esm/plugins/Table/actions/addRow.js +3 -0
- 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 +12 -11
- package/dist/esm/plugins/Table/components/ToolbarButton.js +3 -2
- package/dist/esm/plugins/Table/createTablePlugin.js +11 -1
- package/dist/esm/plugins/Table/helpers.js +10 -1
- package/dist/esm/plugins/Table/insertTableFragment.js +15 -2
- package/dist/esm/plugins/Table/onKeyDownTable.js +10 -2
- package/dist/esm/plugins/Table/tableTracking.js +6 -6
- package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +19 -17
- package/dist/esm/plugins/Text/createTextPlugin.js +22 -5
- package/dist/esm/plugins/Tracking/createTrackingPlugin.js +2 -1
- package/dist/esm/plugins/Tracking/utils.js +1 -0
- package/dist/esm/plugins/Voids/createVoidsPlugin.js +5 -0
- package/dist/esm/plugins/Voids/transformVoid.js +4 -1
- package/dist/esm/plugins/index.js +12 -0
- package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +5 -5
- package/dist/esm/plugins/shared/EmbeddedBlockUtil.js +15 -5
- package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +5 -5
- package/dist/esm/plugins/shared/EmbeddedInlineUtil.js +8 -4
- 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 +9 -8
- package/dist/esm/plugins/shared/LinkedBlockWrapper.js +7 -3
- package/dist/esm/plugins/shared/LinkedInlineWrapper.js +5 -3
- 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 +5 -2
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +5 -2
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +8 -8
- package/dist/esm/plugins/shared/utils.js +9 -0
- package/dist/esm/test-utils/assertOutput.js +1 -0
- package/dist/esm/test-utils/hyperscript.d.js +1 -0
- package/dist/esm/test-utils/jsx.js +5 -1
- package/dist/esm/test-utils/randomId.js +3 -1
- package/dist/esm/test-utils/setEmptyDataAttribute.js +4 -1
- package/dist/esm/test-utils/validation.js +7 -4
- package/dist/types/plugins/Hyperlink/utils.d.ts +0 -1
- package/dist/types/plugins/shared/utils.d.ts +1 -0
- package/package.json +2 -2
|
@@ -4,8 +4,12 @@ import equal from 'fast-deep-equal';
|
|
|
4
4
|
import { createOnChangeCallback } from './helpers/callbacks';
|
|
5
5
|
import { usePlateSelectors } from './internal/hooks';
|
|
6
6
|
import { setEditorValue } from './internal/transforms';
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A hook responsible for keeping the editor state in sync with incoming
|
|
9
|
+
* changes (aka. external updates
|
|
10
|
+
*/ const useAcceptIncomingChanges = (incomingValue)=>{
|
|
8
11
|
const editor = usePlateSelectors().editor();
|
|
12
|
+
// Cache latest editor value to avoid unnecessary updates
|
|
9
13
|
const lastIncomingValue = React.useRef(incomingValue);
|
|
10
14
|
React.useEffect(()=>{
|
|
11
15
|
if (equal(lastIncomingValue.current, incomingValue)) {
|
|
@@ -18,13 +22,16 @@ const useAcceptIncomingChanges = (incomingValue)=>{
|
|
|
18
22
|
incomingValue
|
|
19
23
|
]);
|
|
20
24
|
};
|
|
21
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Attaches a custom onChange callback that
|
|
27
|
+
*/ const useOnValueChanged = (onChange)=>{
|
|
22
28
|
const editor = usePlateSelectors().editor();
|
|
23
29
|
const setEditorOnChange = usePlateActions().onChange();
|
|
24
30
|
React.useEffect(()=>{
|
|
25
31
|
const cb = createOnChangeCallback(onChange);
|
|
26
32
|
setEditorOnChange({
|
|
27
33
|
fn: (document)=>{
|
|
34
|
+
// Skip irrelevant events e.g. mouse selection
|
|
28
35
|
const operations = editor?.operations.filter((op)=>{
|
|
29
36
|
return op.type !== 'set_selection';
|
|
30
37
|
});
|
|
@@ -40,7 +47,15 @@ const useOnValueChanged = (onChange)=>{
|
|
|
40
47
|
setEditorOnChange
|
|
41
48
|
]);
|
|
42
49
|
};
|
|
43
|
-
|
|
50
|
+
/**
|
|
51
|
+
* A void component that's responsible for keeping the editor
|
|
52
|
+
* state in sync with incoming changes (aka. external updates) and
|
|
53
|
+
* triggering onChange events.
|
|
54
|
+
*
|
|
55
|
+
* This component is a hack to work around the limitation of Plate v17+
|
|
56
|
+
* where we can no longer access the editor instance outside the Plate
|
|
57
|
+
* provider.
|
|
58
|
+
*/ export const SyncEditorChanges = ({ incomingValue, onChange })=>{
|
|
44
59
|
useAcceptIncomingChanges(incomingValue);
|
|
45
60
|
useOnValueChanged(onChange);
|
|
46
61
|
return null;
|
|
@@ -37,13 +37,13 @@ describe('Toolbar', ()=>{
|
|
|
37
37
|
test('everything on the toolbar should be disabled', async ()=>{
|
|
38
38
|
const sdk = mockSdk();
|
|
39
39
|
const id = getContentfulEditorId(sdk);
|
|
40
|
-
const { getByTestId
|
|
40
|
+
const { getByTestId } = render(/*#__PURE__*/ React.createElement(Plate, {
|
|
41
41
|
id: id
|
|
42
|
-
}, React.createElement(SdkProvider, {
|
|
42
|
+
}, /*#__PURE__*/ React.createElement(SdkProvider, {
|
|
43
43
|
sdk: sdk
|
|
44
|
-
}, React.createElement(ContentfulEditorIdProvider, {
|
|
44
|
+
}, /*#__PURE__*/ React.createElement(ContentfulEditorIdProvider, {
|
|
45
45
|
value: id
|
|
46
|
-
}, React.createElement(Toolbar, {
|
|
46
|
+
}, /*#__PURE__*/ React.createElement(Toolbar, {
|
|
47
47
|
isDisabled: true
|
|
48
48
|
})))));
|
|
49
49
|
await waitFor(()=>{
|
|
@@ -71,13 +71,13 @@ describe('Toolbar', ()=>{
|
|
|
71
71
|
MARKS.SUPERSCRIPT
|
|
72
72
|
]);
|
|
73
73
|
const id = getContentfulEditorId(sdk);
|
|
74
|
-
const { queryByTestId
|
|
74
|
+
const { queryByTestId } = render(/*#__PURE__*/ React.createElement(Plate, {
|
|
75
75
|
id: id
|
|
76
|
-
}, React.createElement(SdkProvider, {
|
|
76
|
+
}, /*#__PURE__*/ React.createElement(SdkProvider, {
|
|
77
77
|
sdk: sdk
|
|
78
|
-
}, React.createElement(ContentfulEditorIdProvider, {
|
|
78
|
+
}, /*#__PURE__*/ React.createElement(ContentfulEditorIdProvider, {
|
|
79
79
|
value: id
|
|
80
|
-
}, React.createElement(Toolbar, {
|
|
80
|
+
}, /*#__PURE__*/ React.createElement(Toolbar, {
|
|
81
81
|
isDisabled: true
|
|
82
82
|
})))));
|
|
83
83
|
expect(queryByTestId('dropdown-toolbar-button')).toBeVisible();
|
|
@@ -89,13 +89,13 @@ describe('Toolbar', ()=>{
|
|
|
89
89
|
MARKS.CODE
|
|
90
90
|
]);
|
|
91
91
|
const id = getContentfulEditorId(sdk);
|
|
92
|
-
const { queryByTestId
|
|
92
|
+
const { queryByTestId } = render(/*#__PURE__*/ React.createElement(Plate, {
|
|
93
93
|
id: id
|
|
94
|
-
}, React.createElement(SdkProvider, {
|
|
94
|
+
}, /*#__PURE__*/ React.createElement(SdkProvider, {
|
|
95
95
|
sdk: sdk
|
|
96
|
-
}, React.createElement(ContentfulEditorIdProvider, {
|
|
96
|
+
}, /*#__PURE__*/ React.createElement(ContentfulEditorIdProvider, {
|
|
97
97
|
value: id
|
|
98
|
-
}, React.createElement(Toolbar, {
|
|
98
|
+
}, /*#__PURE__*/ React.createElement(Toolbar, {
|
|
99
99
|
isDisabled: true
|
|
100
100
|
})))));
|
|
101
101
|
expect(queryByTestId('dropdown-toolbar-button')).not.toBeInTheDocument();
|
|
@@ -7,7 +7,7 @@ import { EmbeddedBlockToolbarIcon } from '../../plugins/shared/EmbeddedBlockTool
|
|
|
7
7
|
import { EmbeddedInlineToolbarIcon } from '../../plugins/shared/EmbeddedInlineToolbarIcon';
|
|
8
8
|
import { useSdkContext } from '../../SdkProvider';
|
|
9
9
|
import { EmbeddedEntityDropdownButton } from './EmbeddedEntityDropdownButton';
|
|
10
|
-
export const EmbedEntityWidget = ({ isDisabled
|
|
10
|
+
export const EmbedEntityWidget = ({ isDisabled, canInsertBlocks })=>{
|
|
11
11
|
const sdk = useSdkContext();
|
|
12
12
|
const editor = useContentfulEditor();
|
|
13
13
|
const [isEmbedDropdownOpen, setEmbedDropdownOpen] = useState(false);
|
|
@@ -17,30 +17,32 @@ export const EmbedEntityWidget = ({ isDisabled , canInsertBlocks })=>{
|
|
|
17
17
|
const inlineResourceEmbedEnabled = isNodeTypeEnabled(sdk.field, INLINES.EMBEDDED_RESOURCE);
|
|
18
18
|
const blockEntryEmbedEnabled = isNodeTypeEnabled(sdk.field, BLOCKS.EMBEDDED_ENTRY) && canInsertBlocks;
|
|
19
19
|
const blockResourceEmbedEnabled = isNodeTypeEnabled(sdk.field, BLOCKS.EMBEDDED_RESOURCE) && canInsertBlocks;
|
|
20
|
+
// Removed access check following https://contentful.atlassian.net/browse/DANTE-486
|
|
21
|
+
// TODO: refine permissions check in order to account for tags in rules and then readd access.can('read', 'Asset')
|
|
20
22
|
const blockAssetEmbedEnabled = isNodeTypeEnabled(sdk.field, BLOCKS.EMBEDDED_ASSET) && canInsertBlocks;
|
|
21
|
-
const actions = React.createElement(React.Fragment, null, blockEntryEmbedEnabled && React.createElement(EmbeddedBlockToolbarIcon, {
|
|
23
|
+
const actions = /*#__PURE__*/ React.createElement(React.Fragment, null, blockEntryEmbedEnabled && /*#__PURE__*/ React.createElement(EmbeddedBlockToolbarIcon, {
|
|
22
24
|
isDisabled: !!isDisabled,
|
|
23
25
|
nodeType: BLOCKS.EMBEDDED_ENTRY,
|
|
24
26
|
onClose: onCloseEntityDropdown
|
|
25
|
-
}), blockResourceEmbedEnabled && React.createElement(EmbeddedBlockToolbarIcon, {
|
|
27
|
+
}), blockResourceEmbedEnabled && /*#__PURE__*/ React.createElement(EmbeddedBlockToolbarIcon, {
|
|
26
28
|
isDisabled: !!isDisabled,
|
|
27
29
|
nodeType: BLOCKS.EMBEDDED_RESOURCE,
|
|
28
30
|
onClose: onCloseEntityDropdown
|
|
29
|
-
}), inlineEntryEmbedEnabled && React.createElement(EmbeddedInlineToolbarIcon, {
|
|
31
|
+
}), inlineEntryEmbedEnabled && /*#__PURE__*/ React.createElement(EmbeddedInlineToolbarIcon, {
|
|
30
32
|
nodeType: INLINES.EMBEDDED_ENTRY,
|
|
31
33
|
isDisabled: !!isDisabled || isLinkActive(editor),
|
|
32
34
|
onClose: onCloseEntityDropdown
|
|
33
|
-
}), inlineResourceEmbedEnabled && React.createElement(EmbeddedInlineToolbarIcon, {
|
|
35
|
+
}), inlineResourceEmbedEnabled && /*#__PURE__*/ React.createElement(EmbeddedInlineToolbarIcon, {
|
|
34
36
|
nodeType: INLINES.EMBEDDED_RESOURCE,
|
|
35
37
|
isDisabled: !!isDisabled || isLinkActive(editor),
|
|
36
38
|
onClose: onCloseEntityDropdown
|
|
37
|
-
}), blockAssetEmbedEnabled && React.createElement(EmbeddedBlockToolbarIcon, {
|
|
39
|
+
}), blockAssetEmbedEnabled && /*#__PURE__*/ React.createElement(EmbeddedBlockToolbarIcon, {
|
|
38
40
|
isDisabled: !!isDisabled,
|
|
39
41
|
nodeType: BLOCKS.EMBEDDED_ASSET,
|
|
40
42
|
onClose: onCloseEntityDropdown
|
|
41
43
|
}));
|
|
42
|
-
const showEmbedButton = blockEntryEmbedEnabled || blockResourceEmbedEnabled || inlineEntryEmbedEnabled || blockAssetEmbedEnabled;
|
|
43
|
-
return showEmbedButton ? React.createElement(EmbeddedEntityDropdownButton, {
|
|
44
|
+
const showEmbedButton = blockEntryEmbedEnabled || blockResourceEmbedEnabled || inlineEntryEmbedEnabled || inlineResourceEmbedEnabled || blockAssetEmbedEnabled;
|
|
45
|
+
return showEmbedButton ? /*#__PURE__*/ React.createElement(EmbeddedEntityDropdownButton, {
|
|
44
46
|
isDisabled: isDisabled,
|
|
45
47
|
onClose: onCloseEntityDropdown,
|
|
46
48
|
onToggle: onToggleEntityDropdown,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Button, Menu } from '@contentful/f36-components';
|
|
3
3
|
import { PlusIcon, ChevronDownIcon } from '@contentful/f36-icons';
|
|
4
|
-
export function EmbeddedEntityDropdownButton({ children
|
|
5
|
-
return React.createElement(Menu, {
|
|
4
|
+
export function EmbeddedEntityDropdownButton({ children, isDisabled, isOpen, onClose, onToggle }) {
|
|
5
|
+
return /*#__PURE__*/ React.createElement(Menu, {
|
|
6
6
|
placement: "bottom-end",
|
|
7
7
|
isOpen: isOpen,
|
|
8
8
|
onClose: onClose,
|
|
9
9
|
onOpen: onToggle
|
|
10
|
-
}, React.createElement(Menu.Trigger, null, React.createElement(Button, {
|
|
11
|
-
endIcon: React.createElement(ChevronDownIcon, null),
|
|
10
|
+
}, /*#__PURE__*/ React.createElement(Menu.Trigger, null, /*#__PURE__*/ React.createElement(Button, {
|
|
11
|
+
endIcon: /*#__PURE__*/ React.createElement(ChevronDownIcon, null),
|
|
12
12
|
testId: "toolbar-entity-dropdown-toggle",
|
|
13
13
|
variant: "secondary",
|
|
14
14
|
size: "small",
|
|
15
|
-
startIcon: React.createElement(PlusIcon, null),
|
|
15
|
+
startIcon: /*#__PURE__*/ React.createElement(PlusIcon, null),
|
|
16
16
|
isDisabled: isDisabled
|
|
17
|
-
}, "Embed")), React.createElement(Menu.List, {
|
|
17
|
+
}, "Embed")), /*#__PURE__*/ React.createElement(Menu.List, {
|
|
18
18
|
className: "toolbar-entity-dropdown-list"
|
|
19
19
|
}, children));
|
|
20
20
|
}
|
|
@@ -8,7 +8,7 @@ const styles = {
|
|
|
8
8
|
z-index: 2;
|
|
9
9
|
`
|
|
10
10
|
};
|
|
11
|
-
const StickyToolbarWrapper = ({ isDisabled
|
|
11
|
+
const StickyToolbarWrapper = ({ isDisabled, children })=>/*#__PURE__*/ React.createElement("div", {
|
|
12
12
|
className: isDisabled ? '' : styles.nativeSticky
|
|
13
13
|
}, children);
|
|
14
14
|
export default StickyToolbarWrapper;
|
|
@@ -67,26 +67,26 @@ const styles = {
|
|
|
67
67
|
marginRight: '20px'
|
|
68
68
|
})
|
|
69
69
|
};
|
|
70
|
-
const Dropdown = ({ sdk
|
|
70
|
+
const Dropdown = ({ sdk, isDisabled })=>{
|
|
71
71
|
const editor = useContentfulEditor();
|
|
72
72
|
const isActive = editor && (isMarkActive(editor, MARKS.SUPERSCRIPT) || isMarkActive(editor, MARKS.SUBSCRIPT) || isMarkActive(editor, MARKS.CODE));
|
|
73
|
-
return React.createElement(Menu, null, React.createElement(Menu.Trigger, null, React.createElement("span", null, React.createElement(IconButton, {
|
|
73
|
+
return /*#__PURE__*/ React.createElement(Menu, null, /*#__PURE__*/ React.createElement(Menu.Trigger, null, /*#__PURE__*/ React.createElement("span", null, /*#__PURE__*/ React.createElement(IconButton, {
|
|
74
74
|
size: "small",
|
|
75
75
|
className: styles.toolbarBtn,
|
|
76
76
|
variant: isActive ? 'secondary' : 'transparent',
|
|
77
|
-
icon: React.createElement(MoreHorizontalIcon, null),
|
|
77
|
+
icon: /*#__PURE__*/ React.createElement(MoreHorizontalIcon, null),
|
|
78
78
|
"aria-label": "toggle menu",
|
|
79
79
|
isDisabled: isDisabled,
|
|
80
80
|
testId: "dropdown-toolbar-button"
|
|
81
|
-
}))), React.createElement(Menu.List, null, isMarkEnabled(sdk.field, MARKS.SUPERSCRIPT) && React.createElement(ToolbarDropdownSuperscriptButton, {
|
|
81
|
+
}))), /*#__PURE__*/ React.createElement(Menu.List, null, isMarkEnabled(sdk.field, MARKS.SUPERSCRIPT) && /*#__PURE__*/ React.createElement(ToolbarDropdownSuperscriptButton, {
|
|
82
82
|
isDisabled: isDisabled
|
|
83
|
-
}), isMarkEnabled(sdk.field, MARKS.SUBSCRIPT) && React.createElement(ToolbarDropdownSubscriptButton, {
|
|
83
|
+
}), isMarkEnabled(sdk.field, MARKS.SUBSCRIPT) && /*#__PURE__*/ React.createElement(ToolbarDropdownSubscriptButton, {
|
|
84
84
|
isDisabled: isDisabled
|
|
85
|
-
}), isMarkEnabled(sdk.field, MARKS.CODE) && React.createElement(ToolbarDropdownCodeButton, {
|
|
85
|
+
}), isMarkEnabled(sdk.field, MARKS.CODE) && /*#__PURE__*/ React.createElement(ToolbarDropdownCodeButton, {
|
|
86
86
|
isDisabled: isDisabled
|
|
87
87
|
})));
|
|
88
88
|
};
|
|
89
|
-
const Toolbar = ({ isDisabled
|
|
89
|
+
const Toolbar = ({ isDisabled })=>{
|
|
90
90
|
const sdk = useSdkContext();
|
|
91
91
|
const editor = useContentfulEditor();
|
|
92
92
|
const canInsertBlocks = !isNodeTypeSelected(editor, BLOCKS.TABLE);
|
|
@@ -96,51 +96,52 @@ const Toolbar = ({ isDisabled })=>{
|
|
|
96
96
|
const isListSelected = isNodeTypeSelected(editor, BLOCKS.UL_LIST) || isNodeTypeSelected(editor, BLOCKS.OL_LIST);
|
|
97
97
|
const isBlockquoteSelected = isNodeTypeSelected(editor, BLOCKS.QUOTE);
|
|
98
98
|
const shouldDisableTables = isDisabled || !canInsertBlocks || isListSelected || isBlockquoteSelected;
|
|
99
|
+
// We only show the dropdown when: whenever at least bold , italic and underline are available; If nothing that would go inside the dropdown is available, we hide it
|
|
99
100
|
const boldItalicUnderlineAvailable = isMarkEnabled(sdk.field, MARKS.BOLD) || isMarkEnabled(sdk.field, MARKS.ITALIC) || isMarkEnabled(sdk.field, MARKS.UNDERLINE);
|
|
100
101
|
const dropdownItemsAvailable = isMarkEnabled(sdk.field, MARKS.SUPERSCRIPT) || isMarkEnabled(sdk.field, MARKS.SUBSCRIPT) || isMarkEnabled(sdk.field, MARKS.CODE);
|
|
101
102
|
const shouldShowDropdown = boldItalicUnderlineAvailable && dropdownItemsAvailable;
|
|
102
|
-
return React.createElement(Flex, {
|
|
103
|
+
return /*#__PURE__*/ React.createElement(Flex, {
|
|
103
104
|
testId: "toolbar",
|
|
104
105
|
className: styles.toolbar,
|
|
105
106
|
alignItems: "center"
|
|
106
|
-
}, React.createElement("div", {
|
|
107
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
107
108
|
className: styles.formattingOptionsWrapper
|
|
108
|
-
}, React.createElement(ToolbarHeadingButton, {
|
|
109
|
+
}, /*#__PURE__*/ React.createElement(ToolbarHeadingButton, {
|
|
109
110
|
isDisabled: isDisabled || !canInsertBlocks
|
|
110
|
-
}), validationInfo.isAnyMarkEnabled && React.createElement("span", {
|
|
111
|
+
}), validationInfo.isAnyMarkEnabled && /*#__PURE__*/ React.createElement("span", {
|
|
111
112
|
className: styles.divider
|
|
112
|
-
}), isMarkEnabled(sdk.field, MARKS.BOLD) && React.createElement(ToolbarBoldButton, {
|
|
113
|
+
}), isMarkEnabled(sdk.field, MARKS.BOLD) && /*#__PURE__*/ React.createElement(ToolbarBoldButton, {
|
|
113
114
|
isDisabled: isDisabled
|
|
114
|
-
}), isMarkEnabled(sdk.field, MARKS.ITALIC) && React.createElement(ToolbarItalicButton, {
|
|
115
|
+
}), isMarkEnabled(sdk.field, MARKS.ITALIC) && /*#__PURE__*/ React.createElement(ToolbarItalicButton, {
|
|
115
116
|
isDisabled: isDisabled
|
|
116
|
-
}), isMarkEnabled(sdk.field, MARKS.UNDERLINE) && React.createElement(ToolbarUnderlineButton, {
|
|
117
|
+
}), isMarkEnabled(sdk.field, MARKS.UNDERLINE) && /*#__PURE__*/ React.createElement(ToolbarUnderlineButton, {
|
|
117
118
|
isDisabled: isDisabled
|
|
118
|
-
}), !boldItalicUnderlineAvailable && isMarkEnabled(sdk.field, MARKS.SUPERSCRIPT) && React.createElement(ToolbarSuperscriptButton, {
|
|
119
|
+
}), !boldItalicUnderlineAvailable && isMarkEnabled(sdk.field, MARKS.SUPERSCRIPT) && /*#__PURE__*/ React.createElement(ToolbarSuperscriptButton, {
|
|
119
120
|
isDisabled: isDisabled
|
|
120
|
-
}), !boldItalicUnderlineAvailable && isMarkEnabled(sdk.field, MARKS.SUBSCRIPT) && React.createElement(ToolbarSubscriptButton, {
|
|
121
|
+
}), !boldItalicUnderlineAvailable && isMarkEnabled(sdk.field, MARKS.SUBSCRIPT) && /*#__PURE__*/ React.createElement(ToolbarSubscriptButton, {
|
|
121
122
|
isDisabled: isDisabled
|
|
122
|
-
}), !boldItalicUnderlineAvailable && isMarkEnabled(sdk.field, MARKS.CODE) && React.createElement(ToolbarCodeButton, {
|
|
123
|
+
}), !boldItalicUnderlineAvailable && isMarkEnabled(sdk.field, MARKS.CODE) && /*#__PURE__*/ React.createElement(ToolbarCodeButton, {
|
|
123
124
|
isDisabled: isDisabled
|
|
124
|
-
}), shouldShowDropdown && React.createElement(Dropdown, {
|
|
125
|
+
}), shouldShowDropdown && /*#__PURE__*/ React.createElement(Dropdown, {
|
|
125
126
|
sdk: sdk,
|
|
126
127
|
isDisabled: isDisabled
|
|
127
|
-
}), validationInfo.isAnyHyperlinkEnabled && React.createElement(React.Fragment, null, React.createElement("span", {
|
|
128
|
+
}), validationInfo.isAnyHyperlinkEnabled && /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("span", {
|
|
128
129
|
className: styles.divider
|
|
129
|
-
}), React.createElement(ToolbarHyperlinkButton, {
|
|
130
|
+
}), /*#__PURE__*/ React.createElement(ToolbarHyperlinkButton, {
|
|
130
131
|
isDisabled: isDisabled
|
|
131
|
-
})), validationInfo.isAnyBlockFormattingEnabled && React.createElement("span", {
|
|
132
|
+
})), validationInfo.isAnyBlockFormattingEnabled && /*#__PURE__*/ React.createElement("span", {
|
|
132
133
|
className: styles.divider
|
|
133
|
-
}), React.createElement(ToolbarListButton, {
|
|
134
|
+
}), /*#__PURE__*/ React.createElement(ToolbarListButton, {
|
|
134
135
|
isDisabled: isDisabled || !canInsertBlocks
|
|
135
|
-
}), isNodeTypeEnabled(sdk.field, BLOCKS.QUOTE) && React.createElement(ToolbarQuoteButton, {
|
|
136
|
+
}), isNodeTypeEnabled(sdk.field, BLOCKS.QUOTE) && /*#__PURE__*/ React.createElement(ToolbarQuoteButton, {
|
|
136
137
|
isDisabled: isDisabled || !canInsertBlocks
|
|
137
|
-
}), isNodeTypeEnabled(sdk.field, BLOCKS.HR) && React.createElement(ToolbarHrButton, {
|
|
138
|
+
}), isNodeTypeEnabled(sdk.field, BLOCKS.HR) && /*#__PURE__*/ React.createElement(ToolbarHrButton, {
|
|
138
139
|
isDisabled: isDisabled || !canInsertBlocks
|
|
139
|
-
}), isNodeTypeEnabled(sdk.field, BLOCKS.TABLE) && React.createElement(ToolbarTableButton, {
|
|
140
|
+
}), isNodeTypeEnabled(sdk.field, BLOCKS.TABLE) && /*#__PURE__*/ React.createElement(ToolbarTableButton, {
|
|
140
141
|
isDisabled: shouldDisableTables
|
|
141
|
-
})), React.createElement("div", {
|
|
142
|
+
})), /*#__PURE__*/ React.createElement("div", {
|
|
142
143
|
className: styles.embedActionsWrapper
|
|
143
|
-
}, React.createElement(EmbedEntityWidget, {
|
|
144
|
+
}, /*#__PURE__*/ React.createElement(EmbedEntityWidget, {
|
|
144
145
|
isDisabled: isDisabled,
|
|
145
146
|
canInsertBlocks: canInsertBlocks
|
|
146
147
|
})));
|
|
@@ -49,7 +49,7 @@ export function newReferenceEditorFakeSdk(props) {
|
|
|
49
49
|
locales,
|
|
50
50
|
cmaAdapter: createFakeCMAAdapter({
|
|
51
51
|
Entry: {
|
|
52
|
-
get: async ({ entryId
|
|
52
|
+
get: async ({ entryId })=>{
|
|
53
53
|
if (props?.fetchDelay) {
|
|
54
54
|
await delay(props.fetchDelay);
|
|
55
55
|
}
|
|
@@ -66,7 +66,7 @@ export function newReferenceEditorFakeSdk(props) {
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
Asset: {
|
|
69
|
-
get: async ({ assetId
|
|
69
|
+
get: async ({ assetId })=>{
|
|
70
70
|
if (props?.fetchDelay) {
|
|
71
71
|
await delay(props.fetchDelay);
|
|
72
72
|
}
|
|
@@ -91,7 +91,7 @@ export function newReferenceEditorFakeSdk(props) {
|
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
93
|
ContentType: {
|
|
94
|
-
get: async ({ contentTypeId
|
|
94
|
+
get: async ({ contentTypeId })=>{
|
|
95
95
|
if (contentTypeId === contentTypes.published.sys.id) {
|
|
96
96
|
return contentTypes.published;
|
|
97
97
|
}
|
|
@@ -28,7 +28,7 @@ function isFeaturingEntitySelector(entitySelectorConfigs = {}) {
|
|
|
28
28
|
return !!entitySelectorConfigs.Entry || !!entitySelectorConfigs.Asset;
|
|
29
29
|
}
|
|
30
30
|
function entityToLink(entity) {
|
|
31
|
-
const { id
|
|
31
|
+
const { id, type } = entity.sys;
|
|
32
32
|
return {
|
|
33
33
|
sys: {
|
|
34
34
|
id,
|
|
@@ -48,7 +48,7 @@ export class HyperlinkDialog extends (_React_Component = React.Component) {
|
|
|
48
48
|
}));
|
|
49
49
|
}
|
|
50
50
|
getValue() {
|
|
51
|
-
const { text
|
|
51
|
+
const { text, type, uri } = this.state;
|
|
52
52
|
const value = {
|
|
53
53
|
type
|
|
54
54
|
};
|
|
@@ -63,7 +63,7 @@ export class HyperlinkDialog extends (_React_Component = React.Component) {
|
|
|
63
63
|
return value;
|
|
64
64
|
}
|
|
65
65
|
isLinkComplete() {
|
|
66
|
-
const { text
|
|
66
|
+
const { text, type, uri, target } = this.getValue();
|
|
67
67
|
const requiresText = !this.props.hideText;
|
|
68
68
|
if (requiresText && !text) {
|
|
69
69
|
return false;
|
|
@@ -71,16 +71,16 @@ export class HyperlinkDialog extends (_React_Component = React.Component) {
|
|
|
71
71
|
return type === LINK_TYPES.URI && uri || target;
|
|
72
72
|
}
|
|
73
73
|
render() {
|
|
74
|
-
const { labels
|
|
75
|
-
return React.createElement(EntityProvider, {
|
|
74
|
+
const { labels } = this.props;
|
|
75
|
+
return /*#__PURE__*/ React.createElement(EntityProvider, {
|
|
76
76
|
sdk: this.props.sdk
|
|
77
|
-
}, React.createElement(React.Fragment, null, React.createElement(ModalContent, null, this.renderFields()), React.createElement(ModalControls, null, React.createElement(Button, {
|
|
77
|
+
}, /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(ModalContent, null, this.renderFields()), /*#__PURE__*/ React.createElement(ModalControls, null, /*#__PURE__*/ React.createElement(Button, {
|
|
78
78
|
type: "button",
|
|
79
79
|
onClick: ()=>this.props.onClose(null),
|
|
80
80
|
variant: "secondary",
|
|
81
81
|
testId: "cancel-cta",
|
|
82
82
|
size: "small"
|
|
83
|
-
}, "Cancel"), React.createElement(Button, {
|
|
83
|
+
}, "Cancel"), /*#__PURE__*/ React.createElement(Button, {
|
|
84
84
|
type: "submit",
|
|
85
85
|
variant: "positive",
|
|
86
86
|
onClick: this.handleSubmit,
|
|
@@ -90,39 +90,40 @@ export class HyperlinkDialog extends (_React_Component = React.Component) {
|
|
|
90
90
|
}, labels.confirm))));
|
|
91
91
|
}
|
|
92
92
|
renderFields() {
|
|
93
|
-
const { hideText
|
|
94
|
-
const { uri
|
|
93
|
+
const { hideText, allowedHyperlinkTypes, entitySelectorConfigs } = this.props;
|
|
94
|
+
const { uri, text, type } = this.state;
|
|
95
95
|
const isUriInputAutoFocused = type === LINK_TYPES.URI && (hideText || !!text);
|
|
96
|
-
return React.createElement(Form, null, hideText ? null : React.createElement(FormControl, {
|
|
96
|
+
return /*#__PURE__*/ React.createElement(Form, null, hideText ? null : /*#__PURE__*/ React.createElement(FormControl, {
|
|
97
97
|
id: "link-text",
|
|
98
98
|
isRequired: true
|
|
99
|
-
}, React.createElement(FormControl.Label, null, "Link text"), React.createElement(TextInput, {
|
|
99
|
+
}, /*#__PURE__*/ React.createElement(FormControl.Label, null, "Link text"), /*#__PURE__*/ React.createElement(TextInput, {
|
|
100
100
|
testId: "link-text-input",
|
|
101
101
|
name: "link-text",
|
|
102
102
|
value: text || '',
|
|
103
103
|
onChange: (e)=>this.setState({
|
|
104
104
|
text: e.target.value
|
|
105
105
|
}),
|
|
106
|
+
// eslint-disable-next-line -- TODO: describe this disable jsx-a11y/no-autofocus
|
|
106
107
|
autoFocus: !isUriInputAutoFocused
|
|
107
|
-
})), isFeaturingEntitySelector(entitySelectorConfigs) && React.createElement(FormControl, {
|
|
108
|
+
})), isFeaturingEntitySelector(entitySelectorConfigs) && /*#__PURE__*/ React.createElement(FormControl, {
|
|
108
109
|
id: "link-type",
|
|
109
110
|
name: "link-type"
|
|
110
|
-
}, React.createElement(FormControl.Label, null, "Link type"), React.createElement(Select, {
|
|
111
|
+
}, /*#__PURE__*/ React.createElement(FormControl.Label, null, "Link type"), /*#__PURE__*/ React.createElement(Select, {
|
|
111
112
|
value: type,
|
|
112
113
|
onChange: (e)=>this.setState({
|
|
113
114
|
type: e.target.value
|
|
114
115
|
}),
|
|
115
116
|
testId: "link-type-select"
|
|
116
|
-
}, allowedHyperlinkTypes.includes(LINK_TYPES.URI) || type === LINK_TYPES.URI ? React.createElement(Select.Option, {
|
|
117
|
+
}, allowedHyperlinkTypes.includes(LINK_TYPES.URI) || type === LINK_TYPES.URI ? /*#__PURE__*/ React.createElement(Select.Option, {
|
|
117
118
|
value: LINK_TYPES.URI
|
|
118
|
-
}, "URL") : null, allowedHyperlinkTypes.includes(LINK_TYPES.ENTRY) || type === LINK_TYPES.ENTRY ? React.createElement(Select.Option, {
|
|
119
|
+
}, "URL") : null, allowedHyperlinkTypes.includes(LINK_TYPES.ENTRY) || type === LINK_TYPES.ENTRY ? /*#__PURE__*/ React.createElement(Select.Option, {
|
|
119
120
|
value: LINK_TYPES.ENTRY
|
|
120
|
-
}, "Entry") : null, allowedHyperlinkTypes.includes(LINK_TYPES.ASSET) || type === LINK_TYPES.ASSET ? React.createElement(Select.Option, {
|
|
121
|
+
}, "Entry") : null, allowedHyperlinkTypes.includes(LINK_TYPES.ASSET) || type === LINK_TYPES.ASSET ? /*#__PURE__*/ React.createElement(Select.Option, {
|
|
121
122
|
value: LINK_TYPES.ASSET
|
|
122
|
-
}, "Asset") : null)), type === LINK_TYPES.URI ? React.createElement(FormControl, {
|
|
123
|
+
}, "Asset") : null)), type === LINK_TYPES.URI ? /*#__PURE__*/ React.createElement(FormControl, {
|
|
123
124
|
id: "link-uri",
|
|
124
125
|
isRequired: true
|
|
125
|
-
}, React.createElement(FormControl.Label, null, "Link target"), React.createElement(TextInput, {
|
|
126
|
+
}, /*#__PURE__*/ React.createElement(FormControl.Label, null, "Link target"), /*#__PURE__*/ React.createElement(TextInput, {
|
|
126
127
|
testId: "link-target-input",
|
|
127
128
|
name: "link-uri",
|
|
128
129
|
value: uri || '',
|
|
@@ -130,30 +131,31 @@ export class HyperlinkDialog extends (_React_Component = React.Component) {
|
|
|
130
131
|
onChange: (e)=>this.setState({
|
|
131
132
|
uri: e.target.value
|
|
132
133
|
}),
|
|
134
|
+
// eslint-disable-next-line -- TODO: describe this disable jsx-a11y/no-autofocus
|
|
133
135
|
autoFocus: isUriInputAutoFocused
|
|
134
|
-
}), React.createElement(FormControl.HelpText, null, "A protocol may be required, e.g. https://")) : this.renderEntityField());
|
|
136
|
+
}), /*#__PURE__*/ React.createElement(FormControl.HelpText, null, "A protocol may be required, e.g. https://")) : this.renderEntityField());
|
|
135
137
|
}
|
|
136
138
|
renderEntityField() {
|
|
137
|
-
const { type
|
|
139
|
+
const { type, entityLinks } = this.state;
|
|
138
140
|
const resetEntity = ()=>this.setTargetEntity(type, null);
|
|
139
141
|
const entityLink = entityLinks[type];
|
|
140
142
|
const isEntitySelectorVisible = !entityLink;
|
|
141
|
-
return React.createElement("div", null, React.createElement(FormLabel, {
|
|
143
|
+
return /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement(FormLabel, {
|
|
142
144
|
required: true,
|
|
143
145
|
htmlFor: ""
|
|
144
|
-
}, "Link target"), !isEntitySelectorVisible && React.createElement(TextLink, {
|
|
146
|
+
}, "Link target"), !isEntitySelectorVisible && /*#__PURE__*/ React.createElement(TextLink, {
|
|
145
147
|
as: "button",
|
|
146
148
|
className: css({
|
|
147
149
|
marginLeft: tokens.spacingS
|
|
148
150
|
}),
|
|
149
151
|
onClick: resetEntity
|
|
150
|
-
}, "Remove selection"), entityLink && React.createElement("div", null, type === LINK_TYPES.ENTRY && React.createElement(FetchingWrappedEntryCard, {
|
|
152
|
+
}, "Remove selection"), entityLink && /*#__PURE__*/ React.createElement("div", null, type === LINK_TYPES.ENTRY && /*#__PURE__*/ React.createElement(FetchingWrappedEntryCard, {
|
|
151
153
|
sdk: this.props.sdk,
|
|
152
154
|
locale: this.props.entitySelectorConfigs.Entry.locale,
|
|
153
155
|
entryId: entityLink.sys.id,
|
|
154
156
|
isDisabled: true,
|
|
155
157
|
isSelected: false
|
|
156
|
-
}), type == LINK_TYPES.ASSET && React.createElement(FetchingWrappedAssetCard, {
|
|
158
|
+
}), type == LINK_TYPES.ASSET && /*#__PURE__*/ React.createElement(FetchingWrappedAssetCard, {
|
|
157
159
|
sdk: this.props.sdk,
|
|
158
160
|
locale: this.props.entitySelectorConfigs.Asset.locale,
|
|
159
161
|
assetId: entityLink.sys.id,
|
|
@@ -162,14 +164,14 @@ export class HyperlinkDialog extends (_React_Component = React.Component) {
|
|
|
162
164
|
})), isEntitySelectorVisible && this.renderEntitySelector(type, isEntitySelectorVisible));
|
|
163
165
|
}
|
|
164
166
|
renderEntitySelector(type) {
|
|
165
|
-
return React.createElement("div", {
|
|
167
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
166
168
|
className: css({
|
|
167
169
|
marginTop: tokens.spacingS
|
|
168
170
|
})
|
|
169
|
-
}, type === LINK_TYPES.ENTRY && React.createElement(TextLink, {
|
|
171
|
+
}, type === LINK_TYPES.ENTRY && /*#__PURE__*/ React.createElement(TextLink, {
|
|
170
172
|
as: "button",
|
|
171
173
|
onClick: this.selectEntry
|
|
172
|
-
}, "Select entry"), type === LINK_TYPES.ASSET && React.createElement(TextLink, {
|
|
174
|
+
}, "Select entry"), type === LINK_TYPES.ASSET && /*#__PURE__*/ React.createElement(TextLink, {
|
|
173
175
|
as: "button",
|
|
174
176
|
onClick: this.selectAsset
|
|
175
177
|
}, "Select asset"));
|
|
@@ -181,7 +183,7 @@ export class HyperlinkDialog extends (_React_Component = React.Component) {
|
|
|
181
183
|
this.props.onClose(this.getValue());
|
|
182
184
|
});
|
|
183
185
|
_define_property(this, "selectEntry", async ()=>{
|
|
184
|
-
const { locale
|
|
186
|
+
const { locale, contentTypes } = this.props.entitySelectorConfigs.Entry;
|
|
185
187
|
const entry = await this.props.sdk.dialogs.selectSingleEntry({
|
|
186
188
|
locale,
|
|
187
189
|
contentTypes
|
|
@@ -189,13 +191,13 @@ export class HyperlinkDialog extends (_React_Component = React.Component) {
|
|
|
189
191
|
this.setTargetEntity(LINK_TYPES.ENTRY, entry);
|
|
190
192
|
});
|
|
191
193
|
_define_property(this, "selectAsset", async ()=>{
|
|
192
|
-
const { locale
|
|
194
|
+
const { locale } = this.props.entitySelectorConfigs.Asset;
|
|
193
195
|
const asset = await this.props.sdk.dialogs.selectSingleAsset({
|
|
194
196
|
locale
|
|
195
197
|
});
|
|
196
198
|
this.setTargetEntity(LINK_TYPES.ASSET, asset);
|
|
197
199
|
});
|
|
198
|
-
const { text
|
|
200
|
+
const { text, type, uri, target } = props.value;
|
|
199
201
|
const isEntityLink = Boolean(target);
|
|
200
202
|
const entityLinks = {
|
|
201
203
|
[LINK_TYPES.ENTRY]: null,
|
|
@@ -228,6 +230,7 @@ _define_property(HyperlinkDialog, "propTypes", {
|
|
|
228
230
|
text: PropTypes.string,
|
|
229
231
|
uri: PropTypes.string,
|
|
230
232
|
target: PropTypes.object,
|
|
233
|
+
// Will be overwritten accordingly if `uri` or `target.sys.linkType` are set.
|
|
231
234
|
type: PropTypes.oneOf([
|
|
232
235
|
'uri',
|
|
233
236
|
'Entry',
|
|
@@ -257,7 +260,7 @@ _define_property(HyperlinkDialog, "defaultProps", {
|
|
|
257
260
|
LINK_TYPES.URI
|
|
258
261
|
]
|
|
259
262
|
});
|
|
260
|
-
export const openHyperlinkDialog = (dialogs, { value
|
|
263
|
+
export const openHyperlinkDialog = (dialogs, { value, showTextInput, allowedHyperlinkTypes, entitySelectorConfigs })=>{
|
|
261
264
|
const isNew = !(value.uri || value.target);
|
|
262
265
|
const props = {
|
|
263
266
|
labels: {
|
|
@@ -3,8 +3,8 @@ import { ModalDialogLauncher } from '@contentful/field-editor-shared';
|
|
|
3
3
|
import { HyperlinkDialog } from './HypelinkDialog/HyperlinkDialog';
|
|
4
4
|
export const openRichTextDialog = (sdk)=>(options)=>{
|
|
5
5
|
if (options.parameters?.type === 'rich-text-hyperlink-dialog') {
|
|
6
|
-
return ModalDialogLauncher.openDialog(options, ({ onClose
|
|
7
|
-
return React.createElement(HyperlinkDialog, {
|
|
6
|
+
return ModalDialogLauncher.openDialog(options, ({ onClose })=>{
|
|
7
|
+
return /*#__PURE__*/ React.createElement(HyperlinkDialog, {
|
|
8
8
|
...options.parameters,
|
|
9
9
|
onClose: onClose,
|
|
10
10
|
sdk: sdk
|
|
@@ -4,11 +4,11 @@ export const renderRichTextDialog = (sdk)=>{
|
|
|
4
4
|
const parameters = sdk.parameters.invocation;
|
|
5
5
|
if (parameters?.type === 'rich-text-hyperlink-dialog') {
|
|
6
6
|
sdk.window.startAutoResizer();
|
|
7
|
-
return React.createElement(HyperlinkDialog, {
|
|
7
|
+
return /*#__PURE__*/ React.createElement(HyperlinkDialog, {
|
|
8
8
|
...parameters,
|
|
9
9
|
onClose: sdk.close,
|
|
10
10
|
sdk: sdk
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
return React.createElement("div", null);
|
|
13
|
+
return /*#__PURE__*/ React.createElement("div", null);
|
|
14
14
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toContentfulDocument } from '@contentful/contentful-slatejs-adapter';
|
|
1
|
+
/* eslint-disable react/no-unknown-property */ /** @jsx jsx */ import { toContentfulDocument } from '@contentful/contentful-slatejs-adapter';
|
|
2
2
|
import { COMMAND_PROMPT } from '../../plugins/CommandPalette/constants';
|
|
3
3
|
import { jsx } from '../../test-utils';
|
|
4
4
|
import { removeInternalMarks } from '../removeInternalMarks';
|
|
@@ -8,54 +8,54 @@ describe('internal mark', ()=>{
|
|
|
8
8
|
{
|
|
9
9
|
title: 'Paragraph mark is removed',
|
|
10
10
|
input: toContentfulDocument({
|
|
11
|
-
document: jsx("editor", null, jsx("hp", null, jsx("htext", {
|
|
11
|
+
document: /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", {
|
|
12
12
|
[COMMAND_PROMPT]: true
|
|
13
13
|
}))).children
|
|
14
14
|
}),
|
|
15
15
|
expected: toContentfulDocument({
|
|
16
|
-
document: jsx("editor", null, jsx("hp", null, jsx("htext", null))).children
|
|
16
|
+
document: /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null))).children
|
|
17
17
|
})
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
title: 'Heading mark is removed',
|
|
21
21
|
input: toContentfulDocument({
|
|
22
|
-
document: jsx("editor", null, jsx("hh1", null, jsx("htext", {
|
|
22
|
+
document: /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", null, /*#__PURE__*/ jsx("htext", {
|
|
23
23
|
[COMMAND_PROMPT]: true
|
|
24
24
|
}))).children
|
|
25
25
|
}),
|
|
26
26
|
expected: toContentfulDocument({
|
|
27
|
-
document: jsx("editor", null, jsx("hh1", null, jsx("htext", null))).children
|
|
27
|
+
document: /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hh1", null, /*#__PURE__*/ jsx("htext", null))).children
|
|
28
28
|
})
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
title: 'Block quote mark is removed',
|
|
32
32
|
input: toContentfulDocument({
|
|
33
|
-
document: jsx("editor", null, jsx("hquote", null, jsx("hp", null, jsx("htext", {
|
|
33
|
+
document: /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", {
|
|
34
34
|
[COMMAND_PROMPT]: true
|
|
35
35
|
})))).children
|
|
36
36
|
}),
|
|
37
37
|
expected: toContentfulDocument({
|
|
38
|
-
document: jsx("editor", null, jsx("hquote", null, jsx("hp", null, jsx("htext", null)))).children
|
|
38
|
+
document: /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", null)))).children
|
|
39
39
|
})
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
title: 'Other marks are not removed',
|
|
43
43
|
input: toContentfulDocument({
|
|
44
|
-
document: jsx("editor", null, jsx("hquote", null, jsx("hp", null, jsx("htext", {
|
|
44
|
+
document: /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", {
|
|
45
45
|
bold: true,
|
|
46
46
|
underline: true,
|
|
47
47
|
[COMMAND_PROMPT]: true
|
|
48
48
|
})))).children
|
|
49
49
|
}),
|
|
50
50
|
expected: toContentfulDocument({
|
|
51
|
-
document: jsx("editor", null, jsx("hquote", null, jsx("hp", null, jsx("htext", {
|
|
51
|
+
document: /*#__PURE__*/ jsx("editor", null, /*#__PURE__*/ jsx("hquote", null, /*#__PURE__*/ jsx("hp", null, /*#__PURE__*/ jsx("htext", {
|
|
52
52
|
bold: true,
|
|
53
53
|
underline: true
|
|
54
54
|
})))).children
|
|
55
55
|
})
|
|
56
56
|
}
|
|
57
57
|
];
|
|
58
|
-
for (const { input
|
|
58
|
+
for (const { input, expected, title } of data){
|
|
59
59
|
it(`${title}`, ()=>{
|
|
60
60
|
expect(removeInternalMarks(input)).toEqual(expected);
|
|
61
61
|
});
|