@contentful/field-editor-rich-text 3.15.0 → 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 +13 -11
- 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 +6 -4
- 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 +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 +4 -1
- 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 +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 +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 +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 +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 +4 -1
- 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/package.json +2 -2
|
@@ -9,21 +9,21 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
ContentfulEditorIdProvider: function() {
|
|
13
|
+
return ContentfulEditorIdProvider;
|
|
14
14
|
},
|
|
15
15
|
editorContext: function() {
|
|
16
16
|
return editorContext;
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
useContentfulEditorId: function() {
|
|
22
|
-
return useContentfulEditorId;
|
|
18
|
+
getContentfulEditorId: function() {
|
|
19
|
+
return getContentfulEditorId;
|
|
23
20
|
},
|
|
24
21
|
useContentfulEditor: function() {
|
|
25
22
|
return useContentfulEditor;
|
|
26
23
|
},
|
|
24
|
+
useContentfulEditorId: function() {
|
|
25
|
+
return useContentfulEditorId;
|
|
26
|
+
},
|
|
27
27
|
useContentfulEditorRef: function() {
|
|
28
28
|
return useContentfulEditorRef;
|
|
29
29
|
}
|
|
@@ -31,7 +31,7 @@ _export(exports, {
|
|
|
31
31
|
const _react = require("react");
|
|
32
32
|
const _hooks = require("./internal/hooks");
|
|
33
33
|
function getContentfulEditorId(sdk) {
|
|
34
|
-
const { entry
|
|
34
|
+
const { entry, field } = sdk;
|
|
35
35
|
const sys = entry.getSys();
|
|
36
36
|
return `rich-text-editor-${sys.id}-${field.id}-${field.locale}`;
|
|
37
37
|
}
|
|
@@ -16,14 +16,14 @@ _export(exports, {
|
|
|
16
16
|
return _default;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
19
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
20
20
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
21
21
|
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
22
|
-
const _richtexttypes = _interop_require_wildcard(require("@contentful/rich-text-types"));
|
|
22
|
+
const _richtexttypes = /*#__PURE__*/ _interop_require_wildcard(require("@contentful/rich-text-types"));
|
|
23
23
|
const _platecommon = require("@udecode/plate-common");
|
|
24
24
|
const _emotion = require("emotion");
|
|
25
|
-
const _fastdeepequal = _interop_require_default(require("fast-deep-equal"));
|
|
26
|
-
const _noop = _interop_require_default(require("lodash/noop"));
|
|
25
|
+
const _fastdeepequal = /*#__PURE__*/ _interop_require_default(require("fast-deep-equal"));
|
|
26
|
+
const _noop = /*#__PURE__*/ _interop_require_default(require("lodash/noop"));
|
|
27
27
|
const _ContentfulEditorProvider = require("./ContentfulEditorProvider");
|
|
28
28
|
const _toSlateValue = require("./helpers/toSlateValue");
|
|
29
29
|
const _misc = require("./internal/misc");
|
|
@@ -31,8 +31,8 @@ const _plugins = require("./plugins");
|
|
|
31
31
|
const _RichTextEditorstyles = require("./RichTextEditor.styles");
|
|
32
32
|
const _SdkProvider = require("./SdkProvider");
|
|
33
33
|
const _SyncEditorChanges = require("./SyncEditorChanges");
|
|
34
|
-
const _Toolbar = _interop_require_default(require("./Toolbar"));
|
|
35
|
-
const _StickyToolbarWrapper = _interop_require_default(require("./Toolbar/components/StickyToolbarWrapper"));
|
|
34
|
+
const _Toolbar = /*#__PURE__*/ _interop_require_default(require("./Toolbar"));
|
|
35
|
+
const _StickyToolbarWrapper = /*#__PURE__*/ _interop_require_default(require("./Toolbar/components/StickyToolbarWrapper"));
|
|
36
36
|
function _interop_require_default(obj) {
|
|
37
37
|
return obj && obj.__esModule ? obj : {
|
|
38
38
|
default: obj
|
|
@@ -59,7 +59,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
59
|
if (cache && cache.has(obj)) {
|
|
60
60
|
return cache.get(obj);
|
|
61
61
|
}
|
|
62
|
-
var newObj = {
|
|
62
|
+
var newObj = {
|
|
63
|
+
__proto__: null
|
|
64
|
+
};
|
|
63
65
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
64
66
|
for(var key in obj){
|
|
65
67
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -78,7 +80,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
78
80
|
return newObj;
|
|
79
81
|
}
|
|
80
82
|
const ConnectedRichTextEditor = (props)=>{
|
|
81
|
-
const { sdk
|
|
83
|
+
const { sdk, onAction, restrictedMarks } = props;
|
|
82
84
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
83
85
|
const plugins = _react.useMemo(()=>(0, _plugins.getPlugins)(sdk, onAction ?? _noop.default, restrictedMarks), [
|
|
84
86
|
sdk,
|
|
@@ -99,26 +101,26 @@ const ConnectedRichTextEditor = (props)=>{
|
|
|
99
101
|
}) : undefined, props.maxHeight !== undefined ? (0, _emotion.css)({
|
|
100
102
|
maxHeight: props.maxHeight
|
|
101
103
|
}) : undefined, props.isDisabled ? _RichTextEditorstyles.styles.disabled : _RichTextEditorstyles.styles.enabled, props.isToolbarHidden && _RichTextEditorstyles.styles.hiddenToolbar);
|
|
102
|
-
return _react.createElement(_SdkProvider.SdkProvider, {
|
|
104
|
+
return /*#__PURE__*/ _react.createElement(_SdkProvider.SdkProvider, {
|
|
103
105
|
sdk: sdk
|
|
104
|
-
}, _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
106
|
+
}, /*#__PURE__*/ _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
105
107
|
value: id
|
|
106
|
-
}, _react.createElement("div", {
|
|
108
|
+
}, /*#__PURE__*/ _react.createElement("div", {
|
|
107
109
|
className: _RichTextEditorstyles.styles.root,
|
|
108
110
|
"data-test-id": "rich-text-editor"
|
|
109
|
-
}, _react.createElement(_platecommon.PlateProvider, {
|
|
111
|
+
}, /*#__PURE__*/ _react.createElement(_platecommon.PlateProvider, {
|
|
110
112
|
id: id,
|
|
111
113
|
initialValue: initialValue,
|
|
112
114
|
plugins: plugins,
|
|
113
115
|
disableCorePlugins: _plugins.disableCorePlugins
|
|
114
|
-
}, !props.isToolbarHidden && _react.createElement(_StickyToolbarWrapper.default, {
|
|
116
|
+
}, !props.isToolbarHidden && /*#__PURE__*/ _react.createElement(_StickyToolbarWrapper.default, {
|
|
115
117
|
isDisabled: props.isDisabled
|
|
116
|
-
}, _react.createElement(_Toolbar.default, {
|
|
118
|
+
}, /*#__PURE__*/ _react.createElement(_Toolbar.default, {
|
|
117
119
|
isDisabled: props.isDisabled
|
|
118
|
-
})), _react.createElement(_SyncEditorChanges.SyncEditorChanges, {
|
|
120
|
+
})), /*#__PURE__*/ _react.createElement(_SyncEditorChanges.SyncEditorChanges, {
|
|
119
121
|
incomingValue: initialValue,
|
|
120
122
|
onChange: props.onChange
|
|
121
|
-
}), _react.createElement(_platecommon.Plate, {
|
|
123
|
+
}), /*#__PURE__*/ _react.createElement(_platecommon.Plate, {
|
|
122
124
|
id: id,
|
|
123
125
|
editableProps: {
|
|
124
126
|
className: classNames,
|
|
@@ -127,18 +129,18 @@ const ConnectedRichTextEditor = (props)=>{
|
|
|
127
129
|
})))));
|
|
128
130
|
};
|
|
129
131
|
const RichTextEditor = (props)=>{
|
|
130
|
-
const { sdk
|
|
132
|
+
const { sdk, isInitiallyDisabled, onAction, restrictedMarks, ...otherProps } = props;
|
|
131
133
|
const isEmptyValue = _react.useCallback((value)=>!value || (0, _fastdeepequal.default)(value, _richtexttypes.EMPTY_DOCUMENT), []);
|
|
132
134
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(props.sdk);
|
|
133
|
-
return _react.createElement(_fieldeditorreference.EntityProvider, {
|
|
135
|
+
return /*#__PURE__*/ _react.createElement(_fieldeditorreference.EntityProvider, {
|
|
134
136
|
sdk: sdk
|
|
135
|
-
}, _react.createElement(_fieldeditorshared.FieldConnector, {
|
|
137
|
+
}, /*#__PURE__*/ _react.createElement(_fieldeditorshared.FieldConnector, {
|
|
136
138
|
debounce: 0,
|
|
137
139
|
field: sdk.field,
|
|
138
140
|
isInitiallyDisabled: isInitiallyDisabled,
|
|
139
141
|
isEmptyValue: isEmptyValue,
|
|
140
142
|
isEqualValues: _fastdeepequal.default
|
|
141
|
-
}, ({ lastRemoteValue
|
|
143
|
+
}, ({ lastRemoteValue, disabled, setValue })=>/*#__PURE__*/ _react.createElement(ConnectedRichTextEditor, {
|
|
142
144
|
...otherProps,
|
|
143
145
|
key: `rich-text-editor-${id}`,
|
|
144
146
|
value: lastRemoteValue,
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "styles", {
|
|
|
8
8
|
return styles;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
11
|
+
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
12
12
|
const _emotion = require("emotion");
|
|
13
13
|
function _interop_require_default(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : {
|
|
@@ -42,6 +42,7 @@ const styles = {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
+
// We need to reset LIC style due to conflicts between PARAGRAPH styles
|
|
45
46
|
'ul > li > div': {
|
|
46
47
|
margin: 0
|
|
47
48
|
}
|
package/dist/cjs/SdkProvider.js
CHANGED
|
@@ -16,8 +16,8 @@ _export(exports, {
|
|
|
16
16
|
return useSdkContext;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
20
|
-
const _constate = _interop_require_default(require("constate"));
|
|
19
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
20
|
+
const _constate = /*#__PURE__*/ _interop_require_default(require("constate"));
|
|
21
21
|
function _interop_require_default(obj) {
|
|
22
22
|
return obj && obj.__esModule ? obj : {
|
|
23
23
|
default: obj
|
|
@@ -44,7 +44,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
44
44
|
if (cache && cache.has(obj)) {
|
|
45
45
|
return cache.get(obj);
|
|
46
46
|
}
|
|
47
|
-
var newObj = {
|
|
47
|
+
var newObj = {
|
|
48
|
+
__proto__: null
|
|
49
|
+
};
|
|
48
50
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
49
51
|
for(var key in obj){
|
|
50
52
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -62,8 +64,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
62
64
|
}
|
|
63
65
|
return newObj;
|
|
64
66
|
}
|
|
65
|
-
function useSdk({ sdk
|
|
66
|
-
const sdkMemo = _react.useMemo(()=>sdk, []);
|
|
67
|
+
function useSdk({ sdk }) {
|
|
68
|
+
const sdkMemo = _react.useMemo(()=>sdk, []); // eslint-disable-line -- TODO: explain this disable
|
|
67
69
|
return sdkMemo;
|
|
68
70
|
}
|
|
69
71
|
const [SdkProvider, useSdkContext] = (0, _constate.default)(useSdk);
|
|
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "SyncEditorChanges", {
|
|
|
8
8
|
return SyncEditorChanges;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _platecommon = require("@udecode/plate-common");
|
|
13
|
-
const _fastdeepequal = _interop_require_default(require("fast-deep-equal"));
|
|
13
|
+
const _fastdeepequal = /*#__PURE__*/ _interop_require_default(require("fast-deep-equal"));
|
|
14
14
|
const _callbacks = require("./helpers/callbacks");
|
|
15
15
|
const _hooks = require("./internal/hooks");
|
|
16
16
|
const _transforms = require("./internal/transforms");
|
|
@@ -40,7 +40,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
40
40
|
if (cache && cache.has(obj)) {
|
|
41
41
|
return cache.get(obj);
|
|
42
42
|
}
|
|
43
|
-
var newObj = {
|
|
43
|
+
var newObj = {
|
|
44
|
+
__proto__: null
|
|
45
|
+
};
|
|
44
46
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
45
47
|
for(var key in obj){
|
|
46
48
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -58,8 +60,12 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
58
60
|
}
|
|
59
61
|
return newObj;
|
|
60
62
|
}
|
|
61
|
-
|
|
63
|
+
/**
|
|
64
|
+
* A hook responsible for keeping the editor state in sync with incoming
|
|
65
|
+
* changes (aka. external updates
|
|
66
|
+
*/ const useAcceptIncomingChanges = (incomingValue)=>{
|
|
62
67
|
const editor = (0, _hooks.usePlateSelectors)().editor();
|
|
68
|
+
// Cache latest editor value to avoid unnecessary updates
|
|
63
69
|
const lastIncomingValue = _react.useRef(incomingValue);
|
|
64
70
|
_react.useEffect(()=>{
|
|
65
71
|
if ((0, _fastdeepequal.default)(lastIncomingValue.current, incomingValue)) {
|
|
@@ -72,13 +78,16 @@ const useAcceptIncomingChanges = (incomingValue)=>{
|
|
|
72
78
|
incomingValue
|
|
73
79
|
]);
|
|
74
80
|
};
|
|
75
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Attaches a custom onChange callback that
|
|
83
|
+
*/ const useOnValueChanged = (onChange)=>{
|
|
76
84
|
const editor = (0, _hooks.usePlateSelectors)().editor();
|
|
77
85
|
const setEditorOnChange = (0, _platecommon.usePlateActions)().onChange();
|
|
78
86
|
_react.useEffect(()=>{
|
|
79
87
|
const cb = (0, _callbacks.createOnChangeCallback)(onChange);
|
|
80
88
|
setEditorOnChange({
|
|
81
89
|
fn: (document)=>{
|
|
90
|
+
// Skip irrelevant events e.g. mouse selection
|
|
82
91
|
const operations = editor?.operations.filter((op)=>{
|
|
83
92
|
return op.type !== 'set_selection';
|
|
84
93
|
});
|
|
@@ -94,7 +103,7 @@ const useOnValueChanged = (onChange)=>{
|
|
|
94
103
|
setEditorOnChange
|
|
95
104
|
]);
|
|
96
105
|
};
|
|
97
|
-
const SyncEditorChanges = ({ incomingValue
|
|
106
|
+
const SyncEditorChanges = ({ incomingValue, onChange })=>{
|
|
98
107
|
useAcceptIncomingChanges(incomingValue);
|
|
99
108
|
useOnValueChanged(onChange);
|
|
100
109
|
return null;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
5
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
6
6
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
7
7
|
const _react1 = require("@testing-library/react");
|
|
8
8
|
const _platecommon = require("@udecode/plate-common");
|
|
9
9
|
require("@testing-library/jest-dom/extend-expect");
|
|
10
10
|
const _ContentfulEditorProvider = require("../../ContentfulEditorProvider");
|
|
11
11
|
const _SdkProvider = require("../../SdkProvider");
|
|
12
|
-
const _index = _interop_require_default(require("../index"));
|
|
12
|
+
const _index = /*#__PURE__*/ _interop_require_default(require("../index"));
|
|
13
13
|
function _interop_require_default(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : {
|
|
15
15
|
default: obj
|
|
@@ -36,7 +36,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
36
36
|
if (cache && cache.has(obj)) {
|
|
37
37
|
return cache.get(obj);
|
|
38
38
|
}
|
|
39
|
-
var newObj = {
|
|
39
|
+
var newObj = {
|
|
40
|
+
__proto__: null
|
|
41
|
+
};
|
|
40
42
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
43
|
for(var key in obj){
|
|
42
44
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -85,13 +87,13 @@ describe('Toolbar', ()=>{
|
|
|
85
87
|
test('everything on the toolbar should be disabled', async ()=>{
|
|
86
88
|
const sdk = mockSdk();
|
|
87
89
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
88
|
-
const { getByTestId
|
|
90
|
+
const { getByTestId } = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_platecommon.Plate, {
|
|
89
91
|
id: id
|
|
90
|
-
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
92
|
+
}, /*#__PURE__*/ _react.createElement(_SdkProvider.SdkProvider, {
|
|
91
93
|
sdk: sdk
|
|
92
|
-
}, _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
94
|
+
}, /*#__PURE__*/ _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
93
95
|
value: id
|
|
94
|
-
}, _react.createElement(_index.default, {
|
|
96
|
+
}, /*#__PURE__*/ _react.createElement(_index.default, {
|
|
95
97
|
isDisabled: true
|
|
96
98
|
})))));
|
|
97
99
|
await (0, _react1.waitFor)(()=>{
|
|
@@ -119,13 +121,13 @@ describe('Toolbar', ()=>{
|
|
|
119
121
|
_richtexttypes.MARKS.SUPERSCRIPT
|
|
120
122
|
]);
|
|
121
123
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
122
|
-
const { queryByTestId
|
|
124
|
+
const { queryByTestId } = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_platecommon.Plate, {
|
|
123
125
|
id: id
|
|
124
|
-
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
126
|
+
}, /*#__PURE__*/ _react.createElement(_SdkProvider.SdkProvider, {
|
|
125
127
|
sdk: sdk
|
|
126
|
-
}, _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
128
|
+
}, /*#__PURE__*/ _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
127
129
|
value: id
|
|
128
|
-
}, _react.createElement(_index.default, {
|
|
130
|
+
}, /*#__PURE__*/ _react.createElement(_index.default, {
|
|
129
131
|
isDisabled: true
|
|
130
132
|
})))));
|
|
131
133
|
expect(queryByTestId('dropdown-toolbar-button')).toBeVisible();
|
|
@@ -137,13 +139,13 @@ describe('Toolbar', ()=>{
|
|
|
137
139
|
_richtexttypes.MARKS.CODE
|
|
138
140
|
]);
|
|
139
141
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
140
|
-
const { queryByTestId
|
|
142
|
+
const { queryByTestId } = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_platecommon.Plate, {
|
|
141
143
|
id: id
|
|
142
|
-
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
144
|
+
}, /*#__PURE__*/ _react.createElement(_SdkProvider.SdkProvider, {
|
|
143
145
|
sdk: sdk
|
|
144
|
-
}, _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
146
|
+
}, /*#__PURE__*/ _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
145
147
|
value: id
|
|
146
|
-
}, _react.createElement(_index.default, {
|
|
148
|
+
}, /*#__PURE__*/ _react.createElement(_index.default, {
|
|
147
149
|
isDisabled: true
|
|
148
150
|
})))));
|
|
149
151
|
expect(queryByTestId('dropdown-toolbar-button')).not.toBeInTheDocument();
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "EmbedEntityWidget", {
|
|
|
8
8
|
return EmbedEntityWidget;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
13
13
|
const _ContentfulEditorProvider = require("../../ContentfulEditorProvider");
|
|
14
14
|
const _editor = require("../../helpers/editor");
|
|
@@ -38,7 +38,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
38
38
|
if (cache && cache.has(obj)) {
|
|
39
39
|
return cache.get(obj);
|
|
40
40
|
}
|
|
41
|
-
var newObj = {
|
|
41
|
+
var newObj = {
|
|
42
|
+
__proto__: null
|
|
43
|
+
};
|
|
42
44
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
43
45
|
for(var key in obj){
|
|
44
46
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -56,7 +58,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
56
58
|
}
|
|
57
59
|
return newObj;
|
|
58
60
|
}
|
|
59
|
-
const EmbedEntityWidget = ({ isDisabled
|
|
61
|
+
const EmbedEntityWidget = ({ isDisabled, canInsertBlocks })=>{
|
|
60
62
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
61
63
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
62
64
|
const [isEmbedDropdownOpen, setEmbedDropdownOpen] = (0, _react.useState)(false);
|
|
@@ -66,30 +68,32 @@ const EmbedEntityWidget = ({ isDisabled , canInsertBlocks })=>{
|
|
|
66
68
|
const inlineResourceEmbedEnabled = (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.INLINES.EMBEDDED_RESOURCE);
|
|
67
69
|
const blockEntryEmbedEnabled = (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.EMBEDDED_ENTRY) && canInsertBlocks;
|
|
68
70
|
const blockResourceEmbedEnabled = (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.EMBEDDED_RESOURCE) && canInsertBlocks;
|
|
71
|
+
// Removed access check following https://contentful.atlassian.net/browse/DANTE-486
|
|
72
|
+
// TODO: refine permissions check in order to account for tags in rules and then readd access.can('read', 'Asset')
|
|
69
73
|
const blockAssetEmbedEnabled = (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.EMBEDDED_ASSET) && canInsertBlocks;
|
|
70
|
-
const actions = _react.default.createElement(_react.default.Fragment, null, blockEntryEmbedEnabled && _react.default.createElement(_EmbeddedBlockToolbarIcon.EmbeddedBlockToolbarIcon, {
|
|
74
|
+
const actions = /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, blockEntryEmbedEnabled && /*#__PURE__*/ _react.default.createElement(_EmbeddedBlockToolbarIcon.EmbeddedBlockToolbarIcon, {
|
|
71
75
|
isDisabled: !!isDisabled,
|
|
72
76
|
nodeType: _richtexttypes.BLOCKS.EMBEDDED_ENTRY,
|
|
73
77
|
onClose: onCloseEntityDropdown
|
|
74
|
-
}), blockResourceEmbedEnabled && _react.default.createElement(_EmbeddedBlockToolbarIcon.EmbeddedBlockToolbarIcon, {
|
|
78
|
+
}), blockResourceEmbedEnabled && /*#__PURE__*/ _react.default.createElement(_EmbeddedBlockToolbarIcon.EmbeddedBlockToolbarIcon, {
|
|
75
79
|
isDisabled: !!isDisabled,
|
|
76
80
|
nodeType: _richtexttypes.BLOCKS.EMBEDDED_RESOURCE,
|
|
77
81
|
onClose: onCloseEntityDropdown
|
|
78
|
-
}), inlineEntryEmbedEnabled && _react.default.createElement(_EmbeddedInlineToolbarIcon.EmbeddedInlineToolbarIcon, {
|
|
82
|
+
}), inlineEntryEmbedEnabled && /*#__PURE__*/ _react.default.createElement(_EmbeddedInlineToolbarIcon.EmbeddedInlineToolbarIcon, {
|
|
79
83
|
nodeType: _richtexttypes.INLINES.EMBEDDED_ENTRY,
|
|
80
84
|
isDisabled: !!isDisabled || (0, _editor.isLinkActive)(editor),
|
|
81
85
|
onClose: onCloseEntityDropdown
|
|
82
|
-
}), inlineResourceEmbedEnabled && _react.default.createElement(_EmbeddedInlineToolbarIcon.EmbeddedInlineToolbarIcon, {
|
|
86
|
+
}), inlineResourceEmbedEnabled && /*#__PURE__*/ _react.default.createElement(_EmbeddedInlineToolbarIcon.EmbeddedInlineToolbarIcon, {
|
|
83
87
|
nodeType: _richtexttypes.INLINES.EMBEDDED_RESOURCE,
|
|
84
88
|
isDisabled: !!isDisabled || (0, _editor.isLinkActive)(editor),
|
|
85
89
|
onClose: onCloseEntityDropdown
|
|
86
|
-
}), blockAssetEmbedEnabled && _react.default.createElement(_EmbeddedBlockToolbarIcon.EmbeddedBlockToolbarIcon, {
|
|
90
|
+
}), blockAssetEmbedEnabled && /*#__PURE__*/ _react.default.createElement(_EmbeddedBlockToolbarIcon.EmbeddedBlockToolbarIcon, {
|
|
87
91
|
isDisabled: !!isDisabled,
|
|
88
92
|
nodeType: _richtexttypes.BLOCKS.EMBEDDED_ASSET,
|
|
89
93
|
onClose: onCloseEntityDropdown
|
|
90
94
|
}));
|
|
91
|
-
const showEmbedButton = blockEntryEmbedEnabled || blockResourceEmbedEnabled || inlineEntryEmbedEnabled || blockAssetEmbedEnabled;
|
|
92
|
-
return showEmbedButton ? _react.default.createElement(_EmbeddedEntityDropdownButton.EmbeddedEntityDropdownButton, {
|
|
95
|
+
const showEmbedButton = blockEntryEmbedEnabled || blockResourceEmbedEnabled || inlineEntryEmbedEnabled || inlineResourceEmbedEnabled || blockAssetEmbedEnabled;
|
|
96
|
+
return showEmbedButton ? /*#__PURE__*/ _react.default.createElement(_EmbeddedEntityDropdownButton.EmbeddedEntityDropdownButton, {
|
|
93
97
|
isDisabled: isDisabled,
|
|
94
98
|
onClose: onCloseEntityDropdown,
|
|
95
99
|
onToggle: onToggleEntityDropdown,
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "EmbeddedEntityDropdownButton", {
|
|
|
8
8
|
return EmbeddedEntityDropdownButton;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _f36icons = require("@contentful/f36-icons");
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
@@ -32,7 +32,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
32
32
|
if (cache && cache.has(obj)) {
|
|
33
33
|
return cache.get(obj);
|
|
34
34
|
}
|
|
35
|
-
var newObj = {
|
|
35
|
+
var newObj = {
|
|
36
|
+
__proto__: null
|
|
37
|
+
};
|
|
36
38
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
37
39
|
for(var key in obj){
|
|
38
40
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -50,20 +52,20 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
50
52
|
}
|
|
51
53
|
return newObj;
|
|
52
54
|
}
|
|
53
|
-
function EmbeddedEntityDropdownButton({ children
|
|
54
|
-
return _react.createElement(_f36components.Menu, {
|
|
55
|
+
function EmbeddedEntityDropdownButton({ children, isDisabled, isOpen, onClose, onToggle }) {
|
|
56
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Menu, {
|
|
55
57
|
placement: "bottom-end",
|
|
56
58
|
isOpen: isOpen,
|
|
57
59
|
onClose: onClose,
|
|
58
60
|
onOpen: onToggle
|
|
59
|
-
}, _react.createElement(_f36components.Menu.Trigger, null, _react.createElement(_f36components.Button, {
|
|
60
|
-
endIcon: _react.createElement(_f36icons.ChevronDownIcon, null),
|
|
61
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.Menu.Trigger, null, /*#__PURE__*/ _react.createElement(_f36components.Button, {
|
|
62
|
+
endIcon: /*#__PURE__*/ _react.createElement(_f36icons.ChevronDownIcon, null),
|
|
61
63
|
testId: "toolbar-entity-dropdown-toggle",
|
|
62
64
|
variant: "secondary",
|
|
63
65
|
size: "small",
|
|
64
|
-
startIcon: _react.createElement(_f36icons.PlusIcon, null),
|
|
66
|
+
startIcon: /*#__PURE__*/ _react.createElement(_f36icons.PlusIcon, null),
|
|
65
67
|
isDisabled: isDisabled
|
|
66
|
-
}, "Embed")), _react.createElement(_f36components.Menu.List, {
|
|
68
|
+
}, "Embed")), /*#__PURE__*/ _react.createElement(_f36components.Menu.List, {
|
|
67
69
|
className: "toolbar-entity-dropdown-list"
|
|
68
70
|
}, children));
|
|
69
71
|
}
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_default(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
12
12
|
const _emotion = require("emotion");
|
|
13
13
|
function _interop_require_default(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : {
|
|
@@ -23,7 +23,7 @@ const styles = {
|
|
|
23
23
|
z-index: 2;
|
|
24
24
|
`
|
|
25
25
|
};
|
|
26
|
-
const StickyToolbarWrapper = ({ isDisabled
|
|
26
|
+
const StickyToolbarWrapper = ({ isDisabled, children })=>/*#__PURE__*/ _react.default.createElement("div", {
|
|
27
27
|
className: isDisabled ? '' : styles.nativeSticky
|
|
28
28
|
}, children);
|
|
29
29
|
const _default = StickyToolbarWrapper;
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _f36icons = require("@contentful/f36-icons");
|
|
14
|
-
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
14
|
+
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
15
15
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
16
16
|
const _emotion = require("emotion");
|
|
17
17
|
const _ContentfulEditorProvider = require("../ContentfulEditorProvider");
|
|
@@ -58,7 +58,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
58
58
|
if (cache && cache.has(obj)) {
|
|
59
59
|
return cache.get(obj);
|
|
60
60
|
}
|
|
61
|
-
var newObj = {
|
|
61
|
+
var newObj = {
|
|
62
|
+
__proto__: null
|
|
63
|
+
};
|
|
62
64
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
63
65
|
for(var key in obj){
|
|
64
66
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -121,26 +123,26 @@ const styles = {
|
|
|
121
123
|
marginRight: '20px'
|
|
122
124
|
})
|
|
123
125
|
};
|
|
124
|
-
const Dropdown = ({ sdk
|
|
126
|
+
const Dropdown = ({ sdk, isDisabled })=>{
|
|
125
127
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
126
128
|
const isActive = editor && ((0, _queries.isMarkActive)(editor, _richtexttypes.MARKS.SUPERSCRIPT) || (0, _queries.isMarkActive)(editor, _richtexttypes.MARKS.SUBSCRIPT) || (0, _queries.isMarkActive)(editor, _richtexttypes.MARKS.CODE));
|
|
127
|
-
return _react.createElement(_f36components.Menu, null, _react.createElement(_f36components.Menu.Trigger, null, _react.createElement("span", null, _react.createElement(_f36components.IconButton, {
|
|
129
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Menu, null, /*#__PURE__*/ _react.createElement(_f36components.Menu.Trigger, null, /*#__PURE__*/ _react.createElement("span", null, /*#__PURE__*/ _react.createElement(_f36components.IconButton, {
|
|
128
130
|
size: "small",
|
|
129
131
|
className: styles.toolbarBtn,
|
|
130
132
|
variant: isActive ? 'secondary' : 'transparent',
|
|
131
|
-
icon: _react.createElement(_f36icons.MoreHorizontalIcon, null),
|
|
133
|
+
icon: /*#__PURE__*/ _react.createElement(_f36icons.MoreHorizontalIcon, null),
|
|
132
134
|
"aria-label": "toggle menu",
|
|
133
135
|
isDisabled: isDisabled,
|
|
134
136
|
testId: "dropdown-toolbar-button"
|
|
135
|
-
}))), _react.createElement(_f36components.Menu.List, null, (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUPERSCRIPT) && _react.createElement(_Superscript.ToolbarDropdownSuperscriptButton, {
|
|
137
|
+
}))), /*#__PURE__*/ _react.createElement(_f36components.Menu.List, null, (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUPERSCRIPT) && /*#__PURE__*/ _react.createElement(_Superscript.ToolbarDropdownSuperscriptButton, {
|
|
136
138
|
isDisabled: isDisabled
|
|
137
|
-
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUBSCRIPT) && _react.createElement(_Subscript.ToolbarDropdownSubscriptButton, {
|
|
139
|
+
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUBSCRIPT) && /*#__PURE__*/ _react.createElement(_Subscript.ToolbarDropdownSubscriptButton, {
|
|
138
140
|
isDisabled: isDisabled
|
|
139
|
-
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.CODE) && _react.createElement(_Code.ToolbarDropdownCodeButton, {
|
|
141
|
+
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.CODE) && /*#__PURE__*/ _react.createElement(_Code.ToolbarDropdownCodeButton, {
|
|
140
142
|
isDisabled: isDisabled
|
|
141
143
|
})));
|
|
142
144
|
};
|
|
143
|
-
const Toolbar = ({ isDisabled
|
|
145
|
+
const Toolbar = ({ isDisabled })=>{
|
|
144
146
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
145
147
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
146
148
|
const canInsertBlocks = !(0, _editor.isNodeTypeSelected)(editor, _richtexttypes.BLOCKS.TABLE);
|
|
@@ -150,51 +152,52 @@ const Toolbar = ({ isDisabled })=>{
|
|
|
150
152
|
const isListSelected = (0, _editor.isNodeTypeSelected)(editor, _richtexttypes.BLOCKS.UL_LIST) || (0, _editor.isNodeTypeSelected)(editor, _richtexttypes.BLOCKS.OL_LIST);
|
|
151
153
|
const isBlockquoteSelected = (0, _editor.isNodeTypeSelected)(editor, _richtexttypes.BLOCKS.QUOTE);
|
|
152
154
|
const shouldDisableTables = isDisabled || !canInsertBlocks || isListSelected || isBlockquoteSelected;
|
|
155
|
+
// 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
|
|
153
156
|
const boldItalicUnderlineAvailable = (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.BOLD) || (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.ITALIC) || (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.UNDERLINE);
|
|
154
157
|
const dropdownItemsAvailable = (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUPERSCRIPT) || (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUBSCRIPT) || (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.CODE);
|
|
155
158
|
const shouldShowDropdown = boldItalicUnderlineAvailable && dropdownItemsAvailable;
|
|
156
|
-
return _react.createElement(_f36components.Flex, {
|
|
159
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Flex, {
|
|
157
160
|
testId: "toolbar",
|
|
158
161
|
className: styles.toolbar,
|
|
159
162
|
alignItems: "center"
|
|
160
|
-
}, _react.createElement("div", {
|
|
163
|
+
}, /*#__PURE__*/ _react.createElement("div", {
|
|
161
164
|
className: styles.formattingOptionsWrapper
|
|
162
|
-
}, _react.createElement(_Heading.ToolbarHeadingButton, {
|
|
165
|
+
}, /*#__PURE__*/ _react.createElement(_Heading.ToolbarHeadingButton, {
|
|
163
166
|
isDisabled: isDisabled || !canInsertBlocks
|
|
164
|
-
}), validationInfo.isAnyMarkEnabled && _react.createElement("span", {
|
|
167
|
+
}), validationInfo.isAnyMarkEnabled && /*#__PURE__*/ _react.createElement("span", {
|
|
165
168
|
className: styles.divider
|
|
166
|
-
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.BOLD) && _react.createElement(_Bold.ToolbarBoldButton, {
|
|
169
|
+
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.BOLD) && /*#__PURE__*/ _react.createElement(_Bold.ToolbarBoldButton, {
|
|
167
170
|
isDisabled: isDisabled
|
|
168
|
-
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.ITALIC) && _react.createElement(_Italic.ToolbarItalicButton, {
|
|
171
|
+
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.ITALIC) && /*#__PURE__*/ _react.createElement(_Italic.ToolbarItalicButton, {
|
|
169
172
|
isDisabled: isDisabled
|
|
170
|
-
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.UNDERLINE) && _react.createElement(_Underline.ToolbarUnderlineButton, {
|
|
173
|
+
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.UNDERLINE) && /*#__PURE__*/ _react.createElement(_Underline.ToolbarUnderlineButton, {
|
|
171
174
|
isDisabled: isDisabled
|
|
172
|
-
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUPERSCRIPT) && _react.createElement(_Superscript.ToolbarSuperscriptButton, {
|
|
175
|
+
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUPERSCRIPT) && /*#__PURE__*/ _react.createElement(_Superscript.ToolbarSuperscriptButton, {
|
|
173
176
|
isDisabled: isDisabled
|
|
174
|
-
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUBSCRIPT) && _react.createElement(_Subscript.ToolbarSubscriptButton, {
|
|
177
|
+
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUBSCRIPT) && /*#__PURE__*/ _react.createElement(_Subscript.ToolbarSubscriptButton, {
|
|
175
178
|
isDisabled: isDisabled
|
|
176
|
-
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.CODE) && _react.createElement(_Code.ToolbarCodeButton, {
|
|
179
|
+
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.CODE) && /*#__PURE__*/ _react.createElement(_Code.ToolbarCodeButton, {
|
|
177
180
|
isDisabled: isDisabled
|
|
178
|
-
}), shouldShowDropdown && _react.createElement(Dropdown, {
|
|
181
|
+
}), shouldShowDropdown && /*#__PURE__*/ _react.createElement(Dropdown, {
|
|
179
182
|
sdk: sdk,
|
|
180
183
|
isDisabled: isDisabled
|
|
181
|
-
}), validationInfo.isAnyHyperlinkEnabled && _react.createElement(_react.Fragment, null, _react.createElement("span", {
|
|
184
|
+
}), validationInfo.isAnyHyperlinkEnabled && /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("span", {
|
|
182
185
|
className: styles.divider
|
|
183
|
-
}), _react.createElement(_Hyperlink.ToolbarHyperlinkButton, {
|
|
186
|
+
}), /*#__PURE__*/ _react.createElement(_Hyperlink.ToolbarHyperlinkButton, {
|
|
184
187
|
isDisabled: isDisabled
|
|
185
|
-
})), validationInfo.isAnyBlockFormattingEnabled && _react.createElement("span", {
|
|
188
|
+
})), validationInfo.isAnyBlockFormattingEnabled && /*#__PURE__*/ _react.createElement("span", {
|
|
186
189
|
className: styles.divider
|
|
187
|
-
}), _react.createElement(_List.ToolbarListButton, {
|
|
190
|
+
}), /*#__PURE__*/ _react.createElement(_List.ToolbarListButton, {
|
|
188
191
|
isDisabled: isDisabled || !canInsertBlocks
|
|
189
|
-
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.QUOTE) && _react.createElement(_Quote.ToolbarQuoteButton, {
|
|
192
|
+
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.QUOTE) && /*#__PURE__*/ _react.createElement(_Quote.ToolbarQuoteButton, {
|
|
190
193
|
isDisabled: isDisabled || !canInsertBlocks
|
|
191
|
-
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.HR) && _react.createElement(_Hr.ToolbarHrButton, {
|
|
194
|
+
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.HR) && /*#__PURE__*/ _react.createElement(_Hr.ToolbarHrButton, {
|
|
192
195
|
isDisabled: isDisabled || !canInsertBlocks
|
|
193
|
-
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.TABLE) && _react.createElement(_Table.ToolbarTableButton, {
|
|
196
|
+
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.TABLE) && /*#__PURE__*/ _react.createElement(_Table.ToolbarTableButton, {
|
|
194
197
|
isDisabled: shouldDisableTables
|
|
195
|
-
})), _react.createElement("div", {
|
|
198
|
+
})), /*#__PURE__*/ _react.createElement("div", {
|
|
196
199
|
className: styles.embedActionsWrapper
|
|
197
|
-
}, _react.createElement(_EmbedEntityWidget.EmbedEntityWidget, {
|
|
200
|
+
}, /*#__PURE__*/ _react.createElement(_EmbedEntityWidget.EmbedEntityWidget, {
|
|
198
201
|
isDisabled: isDisabled,
|
|
199
202
|
canInsertBlocks: canInsertBlocks
|
|
200
203
|
})));
|
|
@@ -59,7 +59,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
59
59
|
locales,
|
|
60
60
|
cmaAdapter: (0, _fieldeditortestutils.createFakeCMAAdapter)({
|
|
61
61
|
Entry: {
|
|
62
|
-
get: async ({ entryId
|
|
62
|
+
get: async ({ entryId })=>{
|
|
63
63
|
if (props?.fetchDelay) {
|
|
64
64
|
await delay(props.fetchDelay);
|
|
65
65
|
}
|
|
@@ -76,7 +76,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
Asset: {
|
|
79
|
-
get: async ({ assetId
|
|
79
|
+
get: async ({ assetId })=>{
|
|
80
80
|
if (props?.fetchDelay) {
|
|
81
81
|
await delay(props.fetchDelay);
|
|
82
82
|
}
|
|
@@ -101,7 +101,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
ContentType: {
|
|
104
|
-
get: async ({ contentTypeId
|
|
104
|
+
get: async ({ contentTypeId })=>{
|
|
105
105
|
if (contentTypeId === _fixtures.contentTypes.published.sys.id) {
|
|
106
106
|
return _fixtures.contentTypes.published;
|
|
107
107
|
}
|