@plone/volto 19.0.0-alpha.0 → 19.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.eslintrc +37 -0
- package/CHANGELOG.md +274 -2
- package/README.md +3 -6
- package/cypress/docker/prefixed-rules.yml +26 -0
- package/cypress/docker/prefixed.yml +24 -0
- package/cypress/support/commands.js +12 -6
- package/cypress/support/guillotina.js +1 -0
- package/cypress.config.js +1 -0
- package/locales/af.json +1 -0
- package/locales/ar.json +1 -0
- package/locales/bg.json +1 -0
- package/locales/bn.json +1 -0
- package/locales/ca/LC_MESSAGES/volto.po +96 -17
- package/locales/ca.json +1 -1
- package/locales/cs.json +1 -0
- package/locales/cy.json +1 -0
- package/locales/da.json +1 -0
- package/locales/de/LC_MESSAGES/volto.po +104 -25
- package/locales/de.json +1 -1
- package/locales/el.json +1 -0
- package/locales/en/LC_MESSAGES/volto.po +97 -18
- package/locales/en.json +1 -1
- package/locales/en_AU.json +1 -0
- package/locales/en_GB.json +1 -0
- package/locales/eo.json +1 -0
- package/locales/es/LC_MESSAGES/volto.po +97 -18
- package/locales/es.json +1 -1
- package/locales/et.json +1 -0
- package/locales/eu/LC_MESSAGES/volto.po +96 -17
- package/locales/eu.json +1 -1
- package/locales/fa.json +1 -0
- package/locales/fi/LC_MESSAGES/volto.po +96 -17
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +97 -18
- package/locales/fr.json +1 -1
- package/locales/fu.json +1 -0
- package/locales/gl.json +1 -0
- package/locales/he.json +1 -0
- package/locales/hi/LC_MESSAGES/volto.po +100 -21
- package/locales/hi.json +1 -1
- package/locales/hr.json +1 -0
- package/locales/hu.json +1 -0
- package/locales/hy.json +1 -0
- package/locales/id.json +1 -0
- package/locales/it/LC_MESSAGES/volto.po +101 -22
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +96 -17
- package/locales/ja.json +1 -1
- package/locales/ka.json +1 -0
- package/locales/kn.json +1 -0
- package/locales/ko.json +1 -0
- package/locales/lt.json +1 -0
- package/locales/lv.json +1 -0
- package/locales/mi.json +1 -0
- package/locales/mk.json +1 -0
- package/locales/my.json +1 -0
- package/locales/nb_NO.json +1 -0
- package/locales/nl/LC_MESSAGES/volto.po +100 -21
- package/locales/nl.json +1 -1
- package/locales/nn.json +1 -0
- package/locales/pl.json +1 -0
- package/locales/pt/LC_MESSAGES/volto.po +96 -17
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +116 -37
- package/locales/pt_BR.json +1 -1
- package/locales/rm.json +1 -0
- package/locales/ro/LC_MESSAGES/volto.po +100 -21
- package/locales/ro.json +1 -1
- package/locales/ru/LC_MESSAGES/volto.po +100 -21
- package/locales/ru.json +1 -1
- package/locales/sk.json +1 -0
- package/locales/sl.json +1 -0
- package/locales/sm.json +1 -0
- package/locales/sq.json +1 -0
- package/locales/sr.json +1 -0
- package/locales/sr@cyrl.json +1 -0
- package/locales/sr@latn.json +1 -0
- package/locales/sv.json +1 -1
- package/locales/ta.json +1 -0
- package/locales/te.json +1 -0
- package/locales/th.json +1 -0
- package/locales/to.json +1 -0
- package/locales/tr.json +1 -0
- package/locales/uk.json +1 -0
- package/locales/vi.json +1 -0
- package/locales/volto.pot +97 -18
- package/locales/zh_CN/LC_MESSAGES/volto.po +96 -17
- package/locales/zh_CN.json +1 -1
- package/locales/zh_Hant.json +1 -0
- package/locales/zh_Hant_HK.json +1 -0
- package/package.json +36 -27
- package/razzle.config.js +16 -0
- package/src/actions/actions/actions.test.js +3 -3
- package/src/actions/addons/addons.test.js +15 -12
- package/src/actions/aliases/aliases.test.js +1 -1
- package/src/actions/content/content.js +0 -1
- package/src/actions/controlpanels/controlpanels.js +13 -7
- package/src/actions/controlpanels/controlpanels.test.js +11 -5
- package/src/actions/querystring/querystring.test.js +2 -2
- package/src/actions/types/types.test.js +1 -1
- package/src/actions/users/users.js +2 -2
- package/src/components/manage/Actions/Actions.test.jsx +5 -1
- package/src/components/manage/Add/Add.jsx +27 -26
- package/src/components/manage/Add/Add.test.jsx +6 -3
- package/src/components/manage/Aliases/Aliases.test.jsx +7 -7
- package/src/components/manage/Blocks/Block/BlocksForm.jsx +1 -0
- package/src/components/manage/Blocks/Block/BlocksForm.test.jsx +48 -16
- package/src/components/manage/Blocks/Block/Edit.jsx +3 -1
- package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +9 -4
- package/src/components/manage/Blocks/Block/Settings.test.jsx +5 -1
- package/src/components/manage/Blocks/Block/StyleWrapper.jsx +11 -3
- package/src/components/manage/Blocks/Description/View.test.jsx +1 -1
- package/src/components/manage/Blocks/HTML/Edit.test.jsx +12 -5
- package/src/components/manage/Blocks/HTML/View.test.jsx +1 -1
- package/src/components/manage/Blocks/Image/Edit.jsx +5 -1
- package/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +6 -2
- package/src/components/manage/Blocks/LeadImage/Edit.jsx +2 -2
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx +1 -1
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +8 -1
- package/src/components/manage/Blocks/Listing/ImageGallery.jsx +6 -4
- package/src/components/manage/Blocks/Listing/View.test.jsx +3 -1
- package/src/components/manage/Blocks/Maps/Edit.jsx +2 -1
- package/src/components/manage/Blocks/Maps/MapsSidebar.test.jsx +5 -1
- package/src/components/manage/Blocks/Search/SearchBlockView.jsx +21 -4
- package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +13 -7
- package/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx +12 -6
- package/src/components/manage/Blocks/Teaser/Data.jsx +21 -7
- package/src/components/manage/Blocks/Teaser/DefaultBody.jsx +1 -1
- package/src/components/manage/Blocks/Teaser/schema.js +8 -3
- package/src/components/manage/Blocks/Title/Edit.jsx +8 -2
- package/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.test.jsx +11 -1
- package/src/components/manage/Blocks/Video/Edit.jsx +2 -1
- package/src/components/manage/Blocks/Video/VideoSidebar.test.jsx +5 -1
- package/src/components/manage/ConditionalLink/ConditionalLink.test.tsx +109 -0
- package/src/components/manage/ConditionalLink/ConditionalLink.tsx +36 -0
- package/src/components/manage/Contents/Contents.jsx +23 -2
- package/src/components/manage/Contents/Contents.test.jsx +36 -13
- package/src/components/manage/Contents/ContentsBreadcrumbs.Multilingual.test.jsx +18 -5
- package/src/components/manage/Contents/ContentsBreadcrumbs.jsx +20 -26
- package/src/components/manage/Contents/ContentsBreadcrumbs.test.jsx +14 -0
- package/src/components/manage/Contents/ContentsDeleteModal.jsx +258 -206
- package/src/components/manage/Contents/ContentsDeleteModal.stories.jsx +26 -8
- package/src/components/manage/Contents/ContentsItem.jsx +10 -2
- package/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +5 -1
- package/src/components/manage/Contents/ContentsRenameModal.test.jsx +5 -1
- package/src/components/manage/Contents/ContentsTagsModal.test.jsx +5 -1
- package/src/components/manage/Contents/ContentsUploadModal.test.jsx +13 -22
- package/src/components/manage/Contents/ContentsWorkflowModal.test.jsx +5 -1
- package/src/components/manage/Contents/__mocks__/index.tsx +16 -0
- package/src/components/manage/Contents/__mocks__/index.vitest.tsx +5 -0
- package/src/components/manage/Controlpanels/AddonsControlpanel.test.jsx +28 -3
- package/src/components/manage/Controlpanels/Aliases.test.jsx +35 -3
- package/src/components/manage/Controlpanels/ContentType.jsx +1 -1
- package/src/components/manage/Controlpanels/ContentType.test.jsx +29 -3
- package/src/components/manage/Controlpanels/ContentTypeLayout.test.jsx +4 -2
- package/src/components/manage/Controlpanels/ContentTypes.test.jsx +25 -2
- package/src/components/manage/Controlpanels/Controlpanel.test.jsx +37 -6
- package/src/components/manage/Controlpanels/Controlpanels.test.jsx +47 -3
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +3 -2
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx +15 -9
- package/src/components/manage/Controlpanels/ModerateComments.test.jsx +31 -5
- package/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +13 -4
- package/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx +9 -5
- package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +12 -4
- package/src/components/manage/Controlpanels/Rules/Rules.test.jsx +7 -3
- package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +33 -4
- package/src/components/manage/Controlpanels/Users/RenderUsers.jsx +156 -175
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx +3 -1
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +575 -630
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +16 -9
- package/src/components/manage/Delete/Delete.test.jsx +45 -4
- package/src/components/manage/Diff/Diff.test.jsx +15 -6
- package/src/components/manage/Diff/DiffField.test.jsx +12 -6
- package/src/components/manage/Display/Display.test.jsx +17 -6
- package/src/components/manage/Edit/Edit.jsx +2 -3
- package/src/components/manage/Edit/Edit.test.jsx +11 -3
- package/src/components/manage/Form/BlockDataForm.test.jsx +5 -1
- package/src/components/manage/Form/Form.jsx +32 -0
- package/src/components/manage/Form/Form.test.jsx +27 -19
- package/src/components/manage/Form/InlineForm.jsx +2 -2
- package/src/components/manage/Form/InlineForm.test.jsx +5 -1
- package/src/components/manage/Form/ModalForm.test.jsx +5 -1
- package/src/components/manage/Form/__mocks__/index.tsx +17 -0
- package/src/components/manage/Form/__mocks__/index.vitest.tsx +73 -0
- package/src/components/manage/History/History.test.jsx +3 -1
- package/src/components/manage/LinksToItem/LinksToItem.test.jsx +6 -4
- package/src/components/manage/MaybeWrap/MaybeWrap.tsx +15 -0
- package/src/components/manage/Multilingual/CompareLanguages.jsx +2 -5
- package/src/components/manage/Multilingual/CreateTranslation.jsx +8 -8
- package/src/components/manage/Multilingual/ManageTranslations.jsx +4 -2
- package/src/components/manage/Multilingual/ManageTranslations.test.jsx +8 -3
- package/src/components/manage/Multilingual/TranslationObject.jsx +1 -1
- package/src/components/manage/Preferences/ChangePassword.test.jsx +9 -2
- package/src/components/manage/Preferences/PersonalInformation.test.jsx +3 -1
- package/src/components/manage/Preferences/PersonalPreferences.test.jsx +20 -7
- package/src/components/manage/Rules/Rules.test.jsx +6 -3
- package/src/components/manage/Sharing/Sharing.test.jsx +3 -1
- package/src/components/manage/Sidebar/ObjectBrowserNav.jsx +2 -1
- package/src/components/manage/Sidebar/ObjectBrowserNav.test.jsx +3 -3
- package/src/components/manage/Sidebar/SidebarPortal.test.tsx +42 -0
- package/src/components/manage/Sidebar/SidebarPortal.tsx +48 -0
- package/src/components/manage/TemplateChooser/TemplateChooser.jsx +2 -1
- package/src/components/manage/Toolbar/More.jsx +4 -1
- package/src/components/manage/Toolbar/More.test.jsx +9 -7
- package/src/components/manage/Toolbar/PersonalTools.jsx +2 -1
- package/src/components/manage/Toolbar/Toolbar.jsx +3 -4
- package/src/components/manage/Toolbar/Types.jsx +7 -7
- package/src/components/manage/UniversalLink/UniversalLink.test.jsx +196 -14
- package/src/components/manage/UniversalLink/UniversalLink.tsx +215 -0
- package/src/components/manage/Widgets/ArrayWidget.test.jsx +22 -5
- package/src/components/manage/Widgets/CheckboxGroupWidget.test.jsx +12 -5
- package/src/components/manage/Widgets/DatetimeWidget.jsx +5 -0
- package/src/components/manage/Widgets/DatetimeWidget.test.jsx +21 -6
- package/src/components/manage/Widgets/FileWidget.jsx +14 -8
- package/src/components/manage/Widgets/ImageWidget.jsx +176 -40
- package/src/components/manage/Widgets/InternalUrlWidget.jsx +2 -0
- package/src/components/manage/Widgets/NumberWidget.test.jsx +8 -7
- package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +3 -0
- package/src/components/manage/Widgets/ObjectListWidget.jsx +11 -1
- package/src/components/manage/Widgets/ObjectListWidget.test.jsx +18 -8
- package/src/components/manage/Widgets/ObjectWidget.test.jsx +5 -1
- package/src/components/manage/Widgets/RadioGroupWidget.test.jsx +12 -5
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.test.jsx +12 -6
- package/src/components/manage/Widgets/RegistryImageWidget.test.jsx +44 -41
- package/src/components/manage/Widgets/SchemaWidget.test.jsx +12 -5
- package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +12 -5
- package/src/components/manage/Widgets/SelectAutoComplete.jsx +29 -12
- package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +12 -6
- package/src/components/manage/Widgets/SelectWidget.jsx +3 -1
- package/src/components/manage/Widgets/SelectWidget.test.jsx +12 -6
- package/src/components/manage/Widgets/TimeWidget.test.jsx +13 -5
- package/src/components/manage/Widgets/TokenWidget.test.jsx +12 -6
- package/src/components/manage/Widgets/UrlWidget.jsx +2 -0
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +18 -9
- package/src/components/manage/Widgets/__mocks__/index.tsx +16 -0
- package/src/components/manage/Widgets/__mocks__/index.vitest.tsx +41 -0
- package/src/components/manage/Workflow/Workflow.test.jsx +17 -7
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.jsx +1 -3
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.test.jsx +0 -4
- package/src/components/theme/App/App.jsx +3 -1
- package/src/components/theme/App/App.test.jsx +22 -17
- package/src/components/theme/AppExtras/AppExtras.test.jsx +6 -6
- package/src/components/theme/Avatar/Avatar.jsx +2 -1
- package/src/components/theme/Comments/CommentEditModal.test.jsx +5 -1
- package/src/components/theme/Comments/Comments.test.jsx +29 -12
- package/src/components/theme/ContactForm/ContactForm.test.jsx +8 -4
- package/src/components/theme/FormattedDate/FormattedDate.stories.jsx +20 -2
- package/src/components/theme/Header/Header.test.jsx +19 -13
- package/src/components/theme/Image/Image.jsx +11 -8
- package/src/components/theme/LanguageSelector/{LanguageSelector.test.jsx → LanguageSelector.test.tsx} +6 -6
- package/src/components/theme/LanguageSelector/LanguageSelector.tsx +89 -0
- package/src/components/theme/Logo/Logo.Multilingual.test.jsx +0 -5
- package/src/components/theme/Logout/Logout.test.jsx +1 -1
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.jsx +8 -12
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.test.jsx +3 -5
- package/src/components/theme/Navigation/NavItem.jsx +1 -5
- package/src/components/theme/Navigation/Navigation.Multilingual.test.jsx +0 -5
- package/src/components/theme/NotFound/NotFound.jsx +5 -2
- package/src/components/theme/NotFound/NotFound.test.jsx +3 -0
- package/src/components/theme/PasswordReset/PasswordReset.test.jsx +10 -1
- package/src/components/theme/PasswordReset/RequestPasswordReset.test.jsx +5 -1
- package/src/components/theme/PreviewImage/PreviewImage.jsx +1 -1
- package/src/components/theme/Register/Register.test.jsx +5 -1
- package/src/components/theme/RequestTimeout/RequestTimeout.jsx +1 -1
- package/src/components/theme/Search/Search.test.jsx +6 -4
- package/src/components/theme/Sitemap/Sitemap.jsx +6 -5
- package/src/components/theme/Sitemap/Sitemap.test.jsx +0 -1
- package/src/components/theme/TsTest/TsTest.test.tsx +0 -1
- package/src/components/theme/View/EventDatesInfo.test.jsx +12 -5
- package/src/components/theme/View/EventView.test.jsx +12 -5
- package/src/components/theme/View/FileView.jsx +9 -1
- package/src/components/theme/View/ListingView.test.jsx +2 -0
- package/src/components/theme/View/SummaryView.test.jsx +10 -0
- package/src/components/theme/View/TabularView.test.jsx +1 -0
- package/src/components/theme/View/View.jsx +1 -1
- package/src/components/theme/View/View.test.jsx +42 -23
- package/src/components/theme/Widgets/ImageWidget.jsx +2 -1
- package/src/config/ControlPanels.js +1 -0
- package/src/config/index.js +18 -25
- package/src/config/server.js +0 -2
- package/src/express-middleware/devproxy.js +20 -5
- package/src/helpers/Api/APIResourceWithAuth.js +8 -3
- package/src/helpers/Api/Api.js +7 -4
- package/src/helpers/Api/Api.plone.rest.test.js +11 -9
- package/src/helpers/Api/Api.test.js +11 -14
- package/src/helpers/AsyncConnect/AsyncConnect.test.jsx +145 -189
- package/src/helpers/AsyncConnect/ssr.js +4 -1
- package/src/helpers/AuthToken/AuthToken.test.js +60 -22
- package/src/helpers/Blocks/Blocks.test.js +1 -1
- package/src/helpers/Content/Content.js +23 -0
- package/src/helpers/Content/Content.test.js +39 -0
- package/src/helpers/Content/withClientSideContent.jsx +35 -0
- package/src/helpers/Extensions/withBlockSchemaEnhancer.jsx +4 -1
- package/src/helpers/Html/Html.jsx +13 -7
- package/src/helpers/Html/Html.test.jsx +32 -28
- package/src/helpers/LanguageMap/LanguageMap.js +115 -8
- package/src/helpers/Loadable/__mocks__/Loadable.jsx +16 -1
- package/src/helpers/Loadable/__mocks__/Loadable.vitest.jsx +39 -0
- package/src/helpers/MessageLabels/MessageLabels.js +5 -0
- package/src/helpers/Sitemap/Sitemap.js +4 -4
- package/src/helpers/Url/Url.js +32 -2
- package/src/helpers/Url/Url.test.js +62 -0
- package/src/helpers/Utils/withSaveAsDraft.jsx +241 -0
- package/src/hooks/user/useUser.js +1 -1
- package/src/middleware/Api.test.js +51 -0
- package/src/middleware/api.js +78 -29
- package/src/middleware/storeProtectLoadUtils.test.js +93 -81
- package/src/reducers/content/content.js +3 -18
- package/src/reducers/diff/diff.js +5 -1
- package/src/reducers/diff/diff.test.js +60 -4
- package/src/routes.js +4 -2
- package/src/server.jsx +45 -14
- package/src/start-client.jsx +9 -6
- package/src/start-server.js +9 -3
- package/test-setup-config.jsx +0 -2
- package/test-setup-globals-vitest.js +46 -0
- package/theme/themes/pastanaga/collections/table.overrides +9 -0
- package/theme/themes/pastanaga/extras/blocks.less +26 -0
- package/theme/themes/pastanaga/extras/contents.less +17 -5
- package/theme/themes/pastanaga/extras/main.less +32 -2
- package/tsconfig.declarations.json +12 -1
- package/tsconfig.json +5 -5
- package/types/components/manage/Blocks/Teaser/schema.d.ts +1 -0
- package/types/components/manage/ConditionalLink/ConditionalLink.d.ts +11 -15
- package/types/components/manage/Contents/__mocks__/index.vitest.d.ts +2 -0
- package/types/components/manage/Controlpanels/Users/RenderUsers.d.ts +18 -2
- package/types/components/manage/Controlpanels/Users/UsersControlpanel.d.ts +6 -2
- package/types/components/manage/Controlpanels/index.d.ts +2 -2
- package/types/components/manage/Form/__mocks__/index.vitest.d.ts +8 -0
- package/types/components/manage/MaybeWrap/MaybeWrap.d.ts +7 -5
- package/types/components/manage/Sidebar/SidebarPortal.d.ts +7 -15
- package/types/components/manage/UniversalLink/UniversalLink.d.ts +54 -20
- package/types/components/manage/Widgets/ImageWidget.d.ts +41 -1
- package/types/components/manage/Widgets/RecurrenceWidget/Utils.d.ts +12 -18
- package/types/components/manage/Widgets/__mocks__/index.vitest.d.ts +33 -0
- package/types/components/theme/FormattedDate/FormattedDate.stories.d.ts +1 -1
- package/types/components/theme/LanguageSelector/LanguageSelector.d.ts +3 -10
- package/types/helpers/Content/Content.d.ts +7 -0
- package/types/helpers/Content/withClientSideContent.d.ts +1 -0
- package/types/helpers/Extensions/withBlockSchemaEnhancer.d.ts +4 -5
- package/types/helpers/Helmet/Helmet.d.ts +1 -1
- package/types/helpers/LanguageMap/LanguageMap.d.ts +428 -4
- package/types/helpers/Loadable/__mocks__/Loadable.vitest.d.ts +3 -0
- package/types/helpers/MessageLabels/MessageLabels.d.ts +68 -62
- package/types/helpers/Url/Url.d.ts +14 -0
- package/types/helpers/Url/bulkFlattenToAppURL.d.ts +5 -0
- package/types/helpers/Utils/withSaveAsDraft.d.ts +1 -0
- package/types/middleware/api.d.ts +6 -9
- package/types/react-router-hash-link.d.ts +12 -0
- package/types/reducers/index.d.ts +1 -0
- package/types/routes.d.ts +4 -0
- package/types/server.d.ts +1 -1
- package/types/start-client.d.ts +0 -1
- package/vite-plugins/svg.mjs +81 -0
- package/vitest.config.mjs +77 -0
- package/package-why.json +0 -34
- package/src/actions/content/content.multilingual.test.js +0 -17
- package/src/components/manage/ConditionalLink/ConditionalLink.jsx +0 -27
- package/src/components/manage/ConditionalLink/ConditionalLink.test.jsx +0 -30
- package/src/components/manage/MaybeWrap/MaybeWrap.jsx +0 -9
- package/src/components/manage/Sidebar/SidebarPortal.jsx +0 -47
- package/src/components/manage/Sidebar/SidebarPortal.test.jsx +0 -26
- package/src/components/manage/UniversalLink/UniversalLink.jsx +0 -154
- package/src/components/manage/Widgets/FileWidget.test.jsx +0 -91
- package/src/components/theme/LanguageSelector/LanguageSelector.jsx +0 -77
- package/theme/themes/pastanaga/extras/utils.less +0 -63
|
@@ -3,25 +3,50 @@ import { Provider } from 'react-intl-redux';
|
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import BlocksForm from './BlocksForm';
|
|
5
5
|
import { render } from '@testing-library/react';
|
|
6
|
-
|
|
7
6
|
import config from '@plone/volto/registry';
|
|
8
7
|
|
|
9
8
|
config.experimental = { addBlockButton: { enabled: false } };
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
);
|
|
10
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
11
|
+
return await import(
|
|
12
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
13
|
+
);
|
|
14
|
+
});
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
beforeAll(async () => {
|
|
17
|
+
const { __setLoadables } = await import(
|
|
18
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
19
|
+
);
|
|
20
|
+
await __setLoadables();
|
|
21
|
+
});
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
let mockSerial = 0;
|
|
24
|
+
vi.mock('uuid', () => {
|
|
20
25
|
return {
|
|
21
|
-
v4:
|
|
26
|
+
v4: vi.fn().mockImplementation(() => `id-${mockSerial++}`),
|
|
22
27
|
};
|
|
23
28
|
});
|
|
24
29
|
|
|
30
|
+
vi.mock('react-beautiful-dnd', () => ({
|
|
31
|
+
DragDropContext: ({ children }) => <div>{children}</div>,
|
|
32
|
+
Droppable: ({ children }) =>
|
|
33
|
+
children({
|
|
34
|
+
innerRef: () => {},
|
|
35
|
+
droppableProps: {},
|
|
36
|
+
placeholder: <div />,
|
|
37
|
+
}),
|
|
38
|
+
Draggable: ({ children }) =>
|
|
39
|
+
children({
|
|
40
|
+
innerRef: () => {},
|
|
41
|
+
draggableProps: {},
|
|
42
|
+
dragHandleProps: {},
|
|
43
|
+
}),
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
vi.mock('./Order/Order', () => ({
|
|
47
|
+
default: () => <div>Order Component</div>,
|
|
48
|
+
}));
|
|
49
|
+
|
|
25
50
|
const mockStore = configureStore();
|
|
26
51
|
|
|
27
52
|
test('Allow override of blocksConfig', () => {
|
|
@@ -70,10 +95,13 @@ test('Allow override of blocksConfig', () => {
|
|
|
70
95
|
|
|
71
96
|
const { container } = render(
|
|
72
97
|
<Provider store={store}>
|
|
73
|
-
<
|
|
74
|
-
|
|
98
|
+
<div>
|
|
99
|
+
<BlocksForm {...data} />
|
|
100
|
+
<div id="sidebar-order"></div>
|
|
101
|
+
</div>
|
|
75
102
|
</Provider>,
|
|
76
103
|
);
|
|
104
|
+
|
|
77
105
|
expect(container).toMatchSnapshot();
|
|
78
106
|
});
|
|
79
107
|
|
|
@@ -88,7 +116,7 @@ test('Removes invalid blocks on saving', () => {
|
|
|
88
116
|
},
|
|
89
117
|
});
|
|
90
118
|
|
|
91
|
-
const onChangeFormData =
|
|
119
|
+
const onChangeFormData = vi.fn(() => {});
|
|
92
120
|
|
|
93
121
|
const data = {
|
|
94
122
|
pathname: '/test',
|
|
@@ -126,18 +154,22 @@ test('Removes invalid blocks on saving', () => {
|
|
|
126
154
|
|
|
127
155
|
render(
|
|
128
156
|
<Provider store={store}>
|
|
129
|
-
<
|
|
130
|
-
|
|
157
|
+
<div>
|
|
158
|
+
<BlocksForm {...data} />
|
|
159
|
+
<div id="sidebar-order"></div>
|
|
160
|
+
</div>
|
|
131
161
|
</Provider>,
|
|
132
162
|
);
|
|
133
|
-
|
|
163
|
+
|
|
164
|
+
expect(onChangeFormData).toHaveBeenCalledWith({
|
|
134
165
|
blocks: {
|
|
135
166
|
a: { '@type': 'custom', text: 'a' },
|
|
136
167
|
b: { '@type': 'custom', text: 'b' },
|
|
137
168
|
},
|
|
138
169
|
blocks_layout: { items: ['a', 'b', 'MISSING-YOU-1'] },
|
|
139
170
|
});
|
|
140
|
-
|
|
171
|
+
|
|
172
|
+
expect(onChangeFormData).toHaveBeenCalledWith({
|
|
141
173
|
blocks: {
|
|
142
174
|
a: { '@type': 'custom', text: 'a' },
|
|
143
175
|
b: { '@type': 'custom', text: 'b' },
|
|
@@ -122,7 +122,7 @@ export class Edit extends Component {
|
|
|
122
122
|
*/
|
|
123
123
|
render() {
|
|
124
124
|
const { blocksConfig = config.blocks.blocksConfig } = this.props;
|
|
125
|
-
const { editable, type } = this.props;
|
|
125
|
+
const { editable, type, isContainer: parentIsContainer } = this.props;
|
|
126
126
|
|
|
127
127
|
const disableNewBlocks = this.props.data?.disableNewBlocks;
|
|
128
128
|
|
|
@@ -187,6 +187,7 @@ export class Edit extends Component {
|
|
|
187
187
|
selected: this.props.selected || this.props.multiSelected,
|
|
188
188
|
multiSelected: this.props.multiSelected,
|
|
189
189
|
hovered: this.props.hovered === this.props.id,
|
|
190
|
+
error: !!this.props.blocksErrors?.[this.props.id],
|
|
190
191
|
})}
|
|
191
192
|
style={{ outline: 'none' }}
|
|
192
193
|
ref={this.blockNode}
|
|
@@ -198,6 +199,7 @@ export class Edit extends Component {
|
|
|
198
199
|
{...this.props}
|
|
199
200
|
blockNode={this.blockNode}
|
|
200
201
|
data={this.props.data}
|
|
202
|
+
className={cx({ contained: parentIsContainer })}
|
|
201
203
|
/>
|
|
202
204
|
{this.props.manage && (
|
|
203
205
|
<SidebarPortal
|
|
@@ -21,9 +21,13 @@ import BlockChooserButton from '@plone/volto/components/manage/BlockChooser/Bloc
|
|
|
21
21
|
import trashSVG from '@plone/volto/icons/delete.svg';
|
|
22
22
|
|
|
23
23
|
const messages = defineMessages({
|
|
24
|
-
|
|
25
|
-
id: '
|
|
26
|
-
defaultMessage: 'delete',
|
|
24
|
+
delete_block: {
|
|
25
|
+
id: 'delete_block',
|
|
26
|
+
defaultMessage: 'delete {type} block',
|
|
27
|
+
},
|
|
28
|
+
drag_block: {
|
|
29
|
+
id: 'drag_block',
|
|
30
|
+
defaultMessage: 'drag {type} block',
|
|
27
31
|
},
|
|
28
32
|
});
|
|
29
33
|
|
|
@@ -99,6 +103,7 @@ const EditBlockWrapper = (props) => {
|
|
|
99
103
|
}}
|
|
100
104
|
{...draginfo.dragHandleProps}
|
|
101
105
|
className="drag handle wrapper"
|
|
106
|
+
aria-label={intl.formatMessage(messages.drag_block, { type })}
|
|
102
107
|
>
|
|
103
108
|
<Icon name={dragSVG} size="18px" />
|
|
104
109
|
</div>
|
|
@@ -111,7 +116,7 @@ const EditBlockWrapper = (props) => {
|
|
|
111
116
|
basic
|
|
112
117
|
onClick={() => onDeleteBlock(block, true)}
|
|
113
118
|
className="delete-button"
|
|
114
|
-
aria-label={intl.formatMessage(messages.
|
|
119
|
+
aria-label={intl.formatMessage(messages.delete_block, { type })}
|
|
115
120
|
>
|
|
116
121
|
<Icon name={trashSVG} size="18px" />
|
|
117
122
|
</Button>
|
|
@@ -5,7 +5,11 @@ import configureStore from 'redux-mock-store';
|
|
|
5
5
|
import config from '@plone/volto/registry';
|
|
6
6
|
import { Provider } from 'react-intl-redux';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
vi.mock('@plone/volto/components/manage/Form', async () => {
|
|
9
|
+
return await import(
|
|
10
|
+
'@plone/volto/components/manage/Form/__mocks__/index.vitest.tsx'
|
|
11
|
+
);
|
|
12
|
+
});
|
|
9
13
|
|
|
10
14
|
const mockStore = configureStore();
|
|
11
15
|
|
|
@@ -9,7 +9,13 @@ import {
|
|
|
9
9
|
const StyleWrapper = (props) => {
|
|
10
10
|
let classNames,
|
|
11
11
|
style = [];
|
|
12
|
-
const {
|
|
12
|
+
const {
|
|
13
|
+
block,
|
|
14
|
+
children,
|
|
15
|
+
content,
|
|
16
|
+
data = {},
|
|
17
|
+
isContainer: parentIsContainer,
|
|
18
|
+
} = props;
|
|
13
19
|
classNames = buildStyleClassNamesFromData(data.styles);
|
|
14
20
|
|
|
15
21
|
classNames = buildStyleClassNamesExtenders({
|
|
@@ -24,14 +30,16 @@ const StyleWrapper = (props) => {
|
|
|
24
30
|
'',
|
|
25
31
|
// If we are rendering blocks inside a container, then pass also the data from the container
|
|
26
32
|
// This is needed in order to calculate properly the styles for the blocks inside the container
|
|
27
|
-
|
|
33
|
+
parentIsContainer && content.blocks ? content : {},
|
|
28
34
|
);
|
|
29
35
|
|
|
30
36
|
const rewrittenChildren = React.Children.map(children, (child) => {
|
|
31
37
|
if (React.isValidElement(child)) {
|
|
32
38
|
const childProps = {
|
|
33
39
|
...props,
|
|
34
|
-
className: cx([child.props.className, ...classNames]
|
|
40
|
+
className: cx([child.props.className, ...classNames], {
|
|
41
|
+
contained: parentIsContainer,
|
|
42
|
+
}),
|
|
35
43
|
style: { ...child.props.style, ...style },
|
|
36
44
|
};
|
|
37
45
|
return React.cloneElement(child, childProps);
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
3
|
import View from './View';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
it('renders a view description component', () => {
|
|
6
6
|
const component = renderer.create(
|
|
7
7
|
<View properties={{ description: 'My Description' }} />,
|
|
8
8
|
);
|
|
@@ -7,11 +7,18 @@ import Edit from './Edit';
|
|
|
7
7
|
|
|
8
8
|
const mockStore = configureStore();
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
10
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
11
|
+
return await import(
|
|
12
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeAll(async () => {
|
|
17
|
+
const { __setLoadables } = await import(
|
|
18
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
19
|
+
);
|
|
20
|
+
await __setLoadables();
|
|
21
|
+
});
|
|
15
22
|
|
|
16
23
|
test('renders an edit html block component', async () => {
|
|
17
24
|
const store = mockStore({
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
3
|
import View from './View';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
it('renders a view html component', () => {
|
|
6
6
|
const component = renderer.create(<View data={{ html: '<h1></h1>' }} />);
|
|
7
7
|
const json = component.toJSON();
|
|
8
8
|
expect(json).toMatchSnapshot();
|
|
@@ -20,7 +20,11 @@ function Edit(props) {
|
|
|
20
20
|
|
|
21
21
|
const handleChange = React.useCallback(
|
|
22
22
|
async (id, image, { title, image_field, image_scales } = {}) => {
|
|
23
|
-
const url = image
|
|
23
|
+
const url = Array.isArray(image)
|
|
24
|
+
? image?.[0]?.['@id']
|
|
25
|
+
: image
|
|
26
|
+
? image['@id'] || image
|
|
27
|
+
: '';
|
|
24
28
|
|
|
25
29
|
props.onChangeBlock(props.block, {
|
|
26
30
|
...props.data,
|
|
@@ -5,11 +5,15 @@ import { Provider } from 'react-intl-redux';
|
|
|
5
5
|
|
|
6
6
|
import ImageSidebar from './ImageSidebar';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
vi.mock('@plone/volto/components/manage/Form', async () => {
|
|
9
|
+
return await import(
|
|
10
|
+
'@plone/volto/components/manage/Form/__mocks__/index.vitest.tsx'
|
|
11
|
+
);
|
|
12
|
+
});
|
|
9
13
|
|
|
10
14
|
const mockStore = configureStore();
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
it('renders an Image Block Sidebar component', () => {
|
|
13
17
|
const store = mockStore({
|
|
14
18
|
content: {
|
|
15
19
|
create: {},
|
|
@@ -43,13 +43,13 @@ const Edit = (props) => {
|
|
|
43
43
|
{!hasImage && (
|
|
44
44
|
<Message>
|
|
45
45
|
<center>
|
|
46
|
-
<
|
|
46
|
+
<Image src={imageBlockSVG} alt="" />
|
|
47
47
|
<div className="message-text">{placeholder}</div>
|
|
48
48
|
</center>
|
|
49
49
|
</Message>
|
|
50
50
|
)}
|
|
51
51
|
{hasImage && hasImageData && (
|
|
52
|
-
<
|
|
52
|
+
<Image
|
|
53
53
|
className={className}
|
|
54
54
|
src={`data:${properties.image['content-type']};base64,${properties.image.data}`}
|
|
55
55
|
width={properties.image.width}
|
|
@@ -96,7 +96,7 @@ const LeadImageSidebar = ({
|
|
|
96
96
|
<Segment className="sidebar-metadata-container" secondary>
|
|
97
97
|
{properties.image.filename}
|
|
98
98
|
{properties.image.data && (
|
|
99
|
-
<
|
|
99
|
+
<Image
|
|
100
100
|
// TODO understand when this actually happens
|
|
101
101
|
src={`data:${properties.image['content-type']};base64,${properties.image.data}`}
|
|
102
102
|
width={properties.image.width}
|
|
@@ -5,7 +5,12 @@ import { Provider } from 'react-intl-redux';
|
|
|
5
5
|
|
|
6
6
|
import LeadImageSidebar from './LeadImageSidebar';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
vi.mock('@plone/volto/components/manage/Widgets');
|
|
9
|
+
vi.mock('@plone/volto/components/manage/Widgets', async () => {
|
|
10
|
+
return await import(
|
|
11
|
+
'@plone/volto/components/manage/Widgets/__mocks__/index.vitest.tsx'
|
|
12
|
+
);
|
|
13
|
+
});
|
|
9
14
|
|
|
10
15
|
const mockStore = configureStore();
|
|
11
16
|
|
|
@@ -16,6 +21,7 @@ test('renders a Lead Image block Sidebar component', () => {
|
|
|
16
21
|
messages: {},
|
|
17
22
|
},
|
|
18
23
|
});
|
|
24
|
+
|
|
19
25
|
const component = renderer.create(
|
|
20
26
|
<Provider store={store}>
|
|
21
27
|
<LeadImageSidebar
|
|
@@ -45,6 +51,7 @@ test('renders a Lead Image block Sidebar component', () => {
|
|
|
45
51
|
/>
|
|
46
52
|
</Provider>,
|
|
47
53
|
);
|
|
54
|
+
|
|
48
55
|
const json = component.toJSON();
|
|
49
56
|
expect(json).toMatchSnapshot();
|
|
50
57
|
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
2
|
import loadable from '@loadable/component';
|
|
4
3
|
import 'react-image-gallery/styles/css/image-gallery.css';
|
|
5
4
|
import { Button } from 'semantic-ui-react';
|
|
6
5
|
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
addSubpathPrefix,
|
|
8
|
+
flattenToAppURL,
|
|
9
|
+
} from '@plone/volto/helpers/Url/Url';
|
|
8
10
|
import config from '@plone/volto/registry';
|
|
9
11
|
|
|
10
12
|
import galleryLeftSVG from '@plone/volto/icons/left-key.svg';
|
|
@@ -81,10 +83,10 @@ const ImageGalleryTemplate = ({ items }) => {
|
|
|
81
83
|
);
|
|
82
84
|
const imagesInfo = renderItems.map((item) => {
|
|
83
85
|
return {
|
|
84
|
-
original: `${flattenToAppURL(item['@id'])}/@@images/${
|
|
86
|
+
original: `${addSubpathPrefix(flattenToAppURL(item['@id']))}/@@images/${
|
|
85
87
|
item.image_field
|
|
86
88
|
}/large`,
|
|
87
|
-
thumbnail: `${flattenToAppURL(item['@id'])}/@@images/${
|
|
89
|
+
thumbnail: `${addSubpathPrefix(flattenToAppURL(item['@id']))}/@@images/${
|
|
88
90
|
item.image_field
|
|
89
91
|
}/thumb`,
|
|
90
92
|
};
|
|
@@ -2,7 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
3
|
import View from './View';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
vi.mock('./ListingBody', () => ({
|
|
6
|
+
default: () => <div className="theblock" />,
|
|
7
|
+
}));
|
|
6
8
|
|
|
7
9
|
test('renders a view image component for the listing block', () => {
|
|
8
10
|
const component = renderer.create(
|
|
@@ -11,6 +11,7 @@ import MapsSidebar from '@plone/volto/components/manage/Blocks/Maps/MapsSidebar'
|
|
|
11
11
|
import clearSVG from '@plone/volto/icons/clear.svg';
|
|
12
12
|
import aheadSVG from '@plone/volto/icons/ahead.svg';
|
|
13
13
|
import mapsBlockSVG from '@plone/volto/components/manage/Blocks/Maps/block-maps.svg';
|
|
14
|
+
import Image from '@plone/volto/components/theme/Image/Image';
|
|
14
15
|
|
|
15
16
|
const messages = defineMessages({
|
|
16
17
|
MapsBlockInputPlaceholder: {
|
|
@@ -121,7 +122,7 @@ const Edit = React.memo((props) => {
|
|
|
121
122
|
) : (
|
|
122
123
|
<Message>
|
|
123
124
|
<center>
|
|
124
|
-
<
|
|
125
|
+
<Image src={mapsBlockSVG} alt="" />
|
|
125
126
|
<div className="toolbar-inner">
|
|
126
127
|
<Input
|
|
127
128
|
onKeyDown={onKeyDownVariantMenuForm}
|
|
@@ -5,7 +5,11 @@ import { Provider } from 'react-intl-redux';
|
|
|
5
5
|
|
|
6
6
|
import MapsSidebar from './MapsSidebar';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
vi.mock('@plone/volto/components/manage/Form', async () => {
|
|
9
|
+
return await import(
|
|
10
|
+
'@plone/volto/components/manage/Form/__mocks__/index.vitest.tsx'
|
|
11
|
+
);
|
|
12
|
+
});
|
|
9
13
|
|
|
10
14
|
const mockStore = configureStore();
|
|
11
15
|
|
|
@@ -42,7 +42,7 @@ const blockPropsAreChanged = (prevProps, nextProps) => {
|
|
|
42
42
|
return isEqual(prev, next);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
const applyDefaults = (data, root) => {
|
|
45
|
+
const applyDefaults = (data, root, blockQuery) => {
|
|
46
46
|
const defaultQuery = [
|
|
47
47
|
{
|
|
48
48
|
i: 'path',
|
|
@@ -51,7 +51,8 @@ const applyDefaults = (data, root) => {
|
|
|
51
51
|
},
|
|
52
52
|
];
|
|
53
53
|
|
|
54
|
-
const
|
|
54
|
+
const dataQuery = data?.query?.length ? data.query : [];
|
|
55
|
+
const searchBySearchableText = dataQuery.filter(
|
|
55
56
|
(item) => item['i'] === 'SearchableText',
|
|
56
57
|
).length;
|
|
57
58
|
|
|
@@ -66,11 +67,27 @@ const applyDefaults = (data, root) => {
|
|
|
66
67
|
? { sort_order: 'descending' }
|
|
67
68
|
: {};
|
|
68
69
|
|
|
70
|
+
// We start with the base query from the block.
|
|
71
|
+
// We enhance it with the query from the facets (filters).
|
|
72
|
+
// We fall back to the default query.
|
|
73
|
+
let query = blockQuery?.length ? blockQuery : [];
|
|
74
|
+
if (!query.length) {
|
|
75
|
+
query = dataQuery.length ? dataQuery : defaultQuery;
|
|
76
|
+
} else if (dataQuery.length) {
|
|
77
|
+
// We have both a base query and a filter. Combine them.
|
|
78
|
+
// Items in the filter win over items in the base query.
|
|
79
|
+
const filterKeys = new Set(dataQuery.map((obj) => obj.i));
|
|
80
|
+
query = [
|
|
81
|
+
...dataQuery,
|
|
82
|
+
...blockQuery.filter((item) => !filterKeys.has(item.i)),
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
|
|
69
86
|
return {
|
|
70
87
|
...data,
|
|
71
88
|
...sort_on,
|
|
72
89
|
...sort_order,
|
|
73
|
-
query
|
|
90
|
+
query,
|
|
74
91
|
};
|
|
75
92
|
};
|
|
76
93
|
|
|
@@ -93,7 +110,7 @@ const SearchBlockView = (props) => {
|
|
|
93
110
|
}, [dataListingBodyVariation, mode]);
|
|
94
111
|
|
|
95
112
|
const root = useSelector((state) => state.breadcrumbs.root);
|
|
96
|
-
const listingBodyData = applyDefaults(searchData, root);
|
|
113
|
+
const listingBodyData = applyDefaults(searchData, root, data.query?.query);
|
|
97
114
|
|
|
98
115
|
const { variations } = config.blocks.blocksConfig.listing;
|
|
99
116
|
const listingBodyVariation = variations.find(({ id }) => id === selectedView);
|
|
@@ -2,18 +2,24 @@ import React from 'react';
|
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import { waitFor, render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
5
|
import DateRangeFacet from './DateRangeFacet';
|
|
7
6
|
|
|
8
7
|
const mockStore = configureStore();
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
9
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
10
|
+
return await import(
|
|
11
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
12
|
+
);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
beforeAll(async () => {
|
|
16
|
+
const { __setLoadables } = await import(
|
|
17
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
18
|
+
);
|
|
19
|
+
await __setLoadables();
|
|
20
|
+
});
|
|
15
21
|
|
|
16
|
-
describe('
|
|
22
|
+
describe('DateRangeFacet', () => {
|
|
17
23
|
it('renders a facet component with a date range widget', async () => {
|
|
18
24
|
const store = mockStore({
|
|
19
25
|
userSession: { token: null },
|
|
@@ -2,16 +2,22 @@ import React from 'react';
|
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import { waitFor, render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
5
|
import SelectFacet from './SelectFacet';
|
|
7
6
|
|
|
8
7
|
const mockStore = configureStore();
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
9
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable', async () => {
|
|
10
|
+
return await import(
|
|
11
|
+
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
12
|
+
);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
beforeAll(async () => {
|
|
16
|
+
const { __setLoadables } = await import(
|
|
17
|
+
'@plone/volto/helpers/Loadable/Loadable'
|
|
18
|
+
);
|
|
19
|
+
await __setLoadables();
|
|
20
|
+
});
|
|
15
21
|
|
|
16
22
|
describe('SelectFacet', () => {
|
|
17
23
|
it('renders a facet component with select dropdown', async () => {
|
|
@@ -21,7 +21,7 @@ const messages = defineMessages({
|
|
|
21
21
|
},
|
|
22
22
|
refreshTeaser: {
|
|
23
23
|
id: 'Refresh source content',
|
|
24
|
-
defaultMessage: '
|
|
24
|
+
defaultMessage: 'Reset to target',
|
|
25
25
|
},
|
|
26
26
|
invalidTeaser: {
|
|
27
27
|
id: 'Invalid teaser source',
|
|
@@ -29,6 +29,16 @@ const messages = defineMessages({
|
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
function getImageField(resp) {
|
|
33
|
+
if (!resp) return null;
|
|
34
|
+
|
|
35
|
+
if (resp.preview_image_link) return 'preview_image_link';
|
|
36
|
+
if (resp.preview_image) return 'preview_image';
|
|
37
|
+
if (resp.image) return 'image';
|
|
38
|
+
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
const TeaserData = (props) => {
|
|
33
43
|
const {
|
|
34
44
|
block,
|
|
@@ -58,16 +68,20 @@ const TeaserData = (props) => {
|
|
|
58
68
|
'@type': resp?.['@type'],
|
|
59
69
|
Description: resp?.description,
|
|
60
70
|
Title: resp.title,
|
|
61
|
-
hasPreviewImage: resp
|
|
71
|
+
hasPreviewImage: getImageField(resp) ? true : false,
|
|
62
72
|
head_title: resp.head_title ?? null,
|
|
63
|
-
image_field: resp
|
|
64
|
-
? 'preview_image'
|
|
65
|
-
: resp?.image
|
|
66
|
-
? 'image'
|
|
67
|
-
: null,
|
|
73
|
+
image_field: getImageField(resp),
|
|
68
74
|
image_scales: {
|
|
69
75
|
preview_image: [resp?.preview_image],
|
|
70
76
|
image: [resp?.image],
|
|
77
|
+
preview_image_link: resp?.preview_image_link
|
|
78
|
+
? [
|
|
79
|
+
{
|
|
80
|
+
...resp?.preview_image_link?.['image_scales']?.image?.[0],
|
|
81
|
+
base_path: resp?.preview_image_link?.['@id'],
|
|
82
|
+
},
|
|
83
|
+
]
|
|
84
|
+
: [],
|
|
71
85
|
},
|
|
72
86
|
title: resp.title,
|
|
73
87
|
};
|
|
@@ -33,7 +33,7 @@ const TeaserDefaultTemplate = (props) => {
|
|
|
33
33
|
{!href && isEditMode && (
|
|
34
34
|
<Message>
|
|
35
35
|
<div className="teaser-item placeholder">
|
|
36
|
-
<
|
|
36
|
+
<Image src={imageBlockSVG} alt="" />
|
|
37
37
|
<p>{intl.formatMessage(messages.PleaseChooseContent)}</p>
|
|
38
38
|
</div>
|
|
39
39
|
</Message>
|
|
@@ -22,9 +22,13 @@ const messages = defineMessages({
|
|
|
22
22
|
id: 'Description',
|
|
23
23
|
defaultMessage: 'Description',
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
kicker: {
|
|
26
26
|
id: 'head_title',
|
|
27
|
-
defaultMessage: '
|
|
27
|
+
defaultMessage: 'Kicker',
|
|
28
|
+
},
|
|
29
|
+
kicker_description: {
|
|
30
|
+
id: 'The kicker is a line of text shown above the title.',
|
|
31
|
+
defaultMessage: 'The kicker is a line of text shown above the title.',
|
|
28
32
|
},
|
|
29
33
|
teaser: {
|
|
30
34
|
id: 'Teaser',
|
|
@@ -88,7 +92,8 @@ export const TeaserSchema = ({ data, intl }) => {
|
|
|
88
92
|
title: intl.formatMessage(messages.title),
|
|
89
93
|
},
|
|
90
94
|
head_title: {
|
|
91
|
-
title: intl.formatMessage(messages.
|
|
95
|
+
title: intl.formatMessage(messages.kicker),
|
|
96
|
+
description: intl.formatMessage(messages.kicker_description),
|
|
92
97
|
},
|
|
93
98
|
description: {
|
|
94
99
|
title: intl.formatMessage(messages.description),
|
|
@@ -77,8 +77,14 @@ export const TitleBlockEdit = (props) => {
|
|
|
77
77
|
ReactEditor.focus(editor);
|
|
78
78
|
} else {
|
|
79
79
|
// nothing is selected, move focus to end
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
// make sure that the editor is focused
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
const focused = ReactEditor.focus(editor);
|
|
83
|
+
if (!focused) {
|
|
84
|
+
ReactEditor.focus(editor);
|
|
85
|
+
Transforms.select(editor, Editor.end(editor, []));
|
|
86
|
+
}
|
|
87
|
+
}, 0);
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
}, [prevSelected, selected, editor]);
|