@plone/volto 19.0.0-alpha.3 → 19.0.0-alpha.30
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 -6
- package/CHANGELOG.md +534 -2
- package/README.md +23 -21
- package/babel.js +1 -9
- 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/global-test-setup.js +1 -2
- package/locales/af/LC_MESSAGES/volto.po +5500 -0
- package/locales/af.json +1 -1
- package/locales/ar/LC_MESSAGES/volto.po +5500 -0
- package/locales/ar.json +1 -1
- package/locales/bg/LC_MESSAGES/volto.po +5500 -0
- package/locales/bg.json +1 -1
- package/locales/bn/LC_MESSAGES/volto.po +5500 -0
- package/locales/bn.json +1 -1
- package/locales/ca/LC_MESSAGES/volto.po +559 -349
- package/locales/ca.json +1 -1
- package/locales/cs/LC_MESSAGES/volto.po +5500 -0
- package/locales/cs.json +1 -1
- package/locales/cy/LC_MESSAGES/volto.po +5500 -0
- package/locales/cy.json +1 -1
- package/locales/da/LC_MESSAGES/volto.po +5500 -0
- package/locales/da.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +232 -21
- package/locales/de.json +1 -1
- package/locales/el/LC_MESSAGES/volto.po +5500 -0
- package/locales/el.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +226 -11
- package/locales/en.json +1 -1
- package/locales/en_AU/LC_MESSAGES/volto.po +5500 -0
- package/locales/en_AU.json +1 -1
- package/locales/en_GB/LC_MESSAGES/volto.po +5500 -0
- package/locales/en_GB.json +1 -1
- package/locales/eo/LC_MESSAGES/volto.po +5500 -0
- package/locales/eo.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +321 -111
- package/locales/es.json +1 -1
- package/locales/et/LC_MESSAGES/volto.po +5500 -0
- package/locales/et.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +404 -194
- package/locales/eu.json +1 -1
- package/locales/fa/LC_MESSAGES/volto.po +5500 -0
- package/locales/fa.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +221 -11
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +220 -10
- package/locales/fr.json +1 -1
- package/locales/fu/LC_MESSAGES/volto.po +5500 -0
- package/locales/fu.json +1 -1
- package/locales/gl/LC_MESSAGES/volto.po +5501 -0
- package/locales/gl.json +1 -1
- package/locales/he/LC_MESSAGES/volto.po +5500 -0
- package/locales/he.json +1 -1
- package/locales/hi/LC_MESSAGES/volto.po +225 -10
- package/locales/hi.json +1 -1
- package/locales/hr/LC_MESSAGES/volto.po +5500 -0
- package/locales/hr.json +1 -1
- package/locales/hu/LC_MESSAGES/volto.po +5500 -0
- package/locales/hu.json +1 -1
- package/locales/hy/LC_MESSAGES/volto.po +5500 -0
- package/locales/hy.json +1 -1
- package/locales/id/LC_MESSAGES/volto.po +5500 -0
- package/locales/id.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +239 -24
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +264 -53
- package/locales/ja.json +1 -1
- package/locales/ka/LC_MESSAGES/volto.po +5500 -0
- package/locales/ka.json +1 -1
- package/locales/kn/LC_MESSAGES/volto.po +5500 -0
- package/locales/kn.json +1 -1
- package/locales/ko/LC_MESSAGES/volto.po +5500 -0
- package/locales/ko.json +1 -1
- package/locales/lt/LC_MESSAGES/volto.po +5500 -0
- package/locales/lt.json +1 -1
- package/locales/lv/LC_MESSAGES/volto.po +5500 -0
- package/locales/lv.json +1 -1
- package/locales/mi/LC_MESSAGES/volto.po +5500 -0
- package/locales/mi.json +1 -1
- package/locales/mk/LC_MESSAGES/volto.po +5500 -0
- package/locales/mk.json +1 -1
- package/locales/my/LC_MESSAGES/volto.po +5500 -0
- package/locales/my.json +1 -1
- package/locales/nb_NO/LC_MESSAGES/volto.po +5500 -0
- package/locales/nb_NO.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +243 -32
- package/locales/nl.json +1 -1
- package/locales/nn/LC_MESSAGES/volto.po +5500 -0
- package/locales/nn.json +1 -1
- package/locales/pl/LC_MESSAGES/volto.po +5500 -0
- package/locales/pl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +869 -659
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +229 -19
- package/locales/pt_BR.json +1 -1
- package/locales/rm/LC_MESSAGES/volto.po +5500 -0
- package/locales/rm.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +252 -42
- package/locales/ro.json +1 -1
- package/locales/ru/LC_MESSAGES/volto.po +220 -10
- package/locales/ru.json +1 -1
- package/locales/sk/LC_MESSAGES/volto.po +5500 -0
- package/locales/sk.json +1 -1
- package/locales/sl/LC_MESSAGES/volto.po +5500 -0
- package/locales/sl.json +1 -1
- package/locales/sm/LC_MESSAGES/volto.po +5500 -0
- package/locales/sm.json +1 -1
- package/locales/sq/LC_MESSAGES/volto.po +5500 -0
- package/locales/sq.json +1 -1
- package/locales/sr/LC_MESSAGES/volto.po +5500 -0
- package/locales/sr.json +1 -1
- package/locales/sr@cyrl/LC_MESSAGES/volto.po +5500 -0
- package/locales/sr@cyrl.json +1 -1
- package/locales/sr@latn/LC_MESSAGES/volto.po +5500 -0
- package/locales/sr@latn.json +1 -1
- package/locales/sv/LC_MESSAGES/volto.po +5500 -0
- package/locales/sv.json +1 -1
- package/locales/ta/LC_MESSAGES/volto.po +5501 -0
- package/locales/ta.json +1 -1
- package/locales/te/LC_MESSAGES/volto.po +5500 -0
- package/locales/te.json +1 -1
- package/locales/th/LC_MESSAGES/volto.po +5500 -0
- package/locales/th.json +1 -1
- package/locales/to/LC_MESSAGES/volto.po +5500 -0
- package/locales/to.json +1 -1
- package/locales/tr/LC_MESSAGES/volto.po +5501 -0
- package/locales/tr.json +1 -1
- package/locales/uk/LC_MESSAGES/volto.po +5500 -0
- package/locales/uk.json +1 -1
- package/locales/vi/LC_MESSAGES/volto.po +5500 -0
- package/locales/vi.json +1 -1
- package/locales/volto.pot +220 -10
- package/locales/zh_CN/LC_MESSAGES/volto.po +221 -10
- package/locales/zh_CN.json +1 -1
- package/locales/zh_Hant/LC_MESSAGES/volto.po +5500 -0
- package/locales/zh_Hant.json +1 -1
- package/locales/zh_Hant_HK/LC_MESSAGES/volto.po +5500 -0
- package/locales/zh_Hant_HK.json +1 -1
- package/package.json +72 -146
- package/razzle.config.js +32 -25
- package/src/actions/blockTypes/blockTypes.ts +24 -0
- package/src/components/manage/Actions/Actions.test.jsx +1 -5
- package/src/components/manage/Add/Add.jsx +15 -10
- package/src/components/manage/BlockChooser/BlockChooser.jsx +1 -0
- package/src/components/manage/Blocks/Block/BlocksForm.jsx +10 -7
- package/src/components/manage/Blocks/Block/BlocksForm.test.jsx +3 -14
- package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +9 -4
- package/src/components/manage/Blocks/Block/Order/Item.jsx +27 -13
- package/src/components/manage/Blocks/Block/Order/Item.test.jsx +90 -0
- package/src/components/manage/Blocks/Block/Order/Order.jsx +116 -67
- package/src/components/manage/Blocks/Block/Order/utilities.js +28 -11
- package/src/components/manage/Blocks/Block/Settings.test.jsx +1 -5
- package/src/components/manage/Blocks/Grid/View.jsx +14 -11
- package/src/components/manage/Blocks/Grid/context.js +3 -0
- package/src/components/manage/Blocks/HTML/Edit.test.jsx +1 -5
- package/src/components/manage/Blocks/Image/Edit.jsx +5 -1
- package/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +2 -5
- 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 +2 -5
- package/src/components/manage/Blocks/Listing/Edit.jsx +1 -0
- package/src/components/manage/Blocks/Listing/ImageGallery.jsx +6 -4
- package/src/components/manage/Blocks/Listing/ListingBody.jsx +4 -0
- package/src/components/manage/Blocks/Maps/Edit.jsx +2 -1
- package/src/components/manage/Blocks/Maps/MapsSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/Search/SearchBlockView.jsx +21 -4
- package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +1 -6
- package/src/components/manage/Blocks/Search/components/SelectFacet.jsx +22 -1
- package/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx +1 -6
- package/src/components/manage/Blocks/Search/components/SortOn.jsx +8 -2
- package/src/components/manage/Blocks/Search/components/ToggleFacet.jsx +14 -0
- package/src/components/manage/Blocks/Teaser/Data.jsx +21 -7
- package/src/components/manage/Blocks/Teaser/DefaultBody.jsx +11 -3
- package/src/components/manage/Blocks/Teaser/View.jsx +0 -1
- package/src/components/manage/Blocks/Teaser/utils.js +13 -0
- package/src/components/manage/Blocks/Teaser/utils.test.js +34 -0
- package/src/components/manage/Blocks/Title/Edit.jsx +5 -0
- package/src/components/manage/Blocks/Video/Body.jsx +69 -43
- package/src/components/manage/Blocks/Video/Body.test.jsx +122 -5
- package/src/components/manage/Blocks/Video/Edit.jsx +22 -3
- package/src/components/manage/Blocks/Video/Edit.test.jsx +6 -0
- package/src/components/manage/Blocks/Video/VideoSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/Video/View.jsx +1 -0
- package/src/components/manage/Blocks/Video/View.test.jsx +29 -15
- package/src/components/manage/Blocks/Video/schema.js +14 -1
- package/src/components/manage/Contents/Contents.jsx +697 -659
- package/src/components/manage/Contents/Contents.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsBreadcrumbs.jsx +6 -5
- package/src/components/manage/Contents/ContentsItem.jsx +1 -1
- package/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsRenameModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsTagsModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsWorkflowModal.test.jsx +1 -5
- package/src/components/manage/Contents/DropZoneContent.jsx +338 -0
- package/src/components/manage/Contents/__mocks__/index.tsx +2 -18
- package/src/components/manage/Controlpanels/AddonsControlpanel.jsx +7 -0
- package/src/components/manage/Controlpanels/Aliases.test.jsx +1 -5
- package/src/components/manage/Controlpanels/BlockType.tsx +166 -0
- package/src/components/manage/Controlpanels/BlockTypes.tsx +145 -0
- package/src/components/manage/Controlpanels/ContentType.jsx +1 -1
- package/src/components/manage/Controlpanels/ContentType.test.jsx +1 -5
- package/src/components/manage/Controlpanels/ContentTypeSchema.jsx +1 -1
- package/src/components/manage/Controlpanels/Controlpanels.jsx +28 -5
- package/src/components/manage/Controlpanels/Controlpanels.test.jsx +10 -0
- package/src/components/manage/Controlpanels/DatabaseInformation.jsx +9 -0
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +3 -2
- package/src/components/manage/Controlpanels/ModerateComments.jsx +8 -0
- package/src/components/manage/Controlpanels/Relations/Relations.jsx +1 -1
- package/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +1 -5
- package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +1 -5
- package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +1 -5
- package/src/components/manage/Controlpanels/Users/RenderUsers.jsx +156 -175
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx +3 -0
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +575 -631
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +58 -11
- package/src/components/manage/Diff/Diff.jsx +201 -298
- package/src/components/manage/Diff/Diff.test.jsx +1 -6
- package/src/components/manage/Diff/DiffField.test.jsx +1 -6
- package/src/components/manage/Display/Display.test.jsx +2 -11
- package/src/components/manage/Edit/Edit.test.jsx +1 -5
- package/src/components/manage/Form/BlockDataForm.test.jsx +1 -5
- package/src/components/manage/Form/Form.jsx +3 -3
- package/src/components/manage/Form/Form.test.jsx +1 -5
- package/src/components/manage/Form/InlineForm.jsx +2 -2
- package/src/components/manage/Form/InlineForm.test.jsx +1 -5
- package/src/components/manage/Form/ModalForm.jsx +12 -10
- package/src/components/manage/Form/ModalForm.test.jsx +27 -5
- package/src/components/manage/Form/__mocks__/index.tsx +9 -27
- package/src/components/manage/Multilingual/CompareLanguages.jsx +6 -6
- package/src/components/manage/Multilingual/CreateTranslation.jsx +16 -13
- package/src/components/manage/Multilingual/ManageTranslations.jsx +5 -5
- package/src/components/manage/Multilingual/TranslationObject.jsx +11 -8
- package/src/components/manage/Preferences/ChangePassword.test.jsx +1 -5
- package/src/components/manage/Preferences/PersonalPreferences.jsx +8 -5
- package/src/components/manage/Preferences/PersonalPreferences.test.jsx +1 -17
- package/src/components/manage/Sharing/Sharing.jsx +21 -15
- package/src/components/manage/Sidebar/ObjectBrowser.jsx +3 -0
- package/src/components/manage/Sidebar/ObjectBrowserBody.jsx +18 -2
- package/src/components/manage/Sidebar/ObjectBrowserNav.jsx +2 -1
- 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/TemplateChooser/TemplateChooser.test.jsx +1 -0
- package/src/components/manage/Toast/Toast.jsx +32 -0
- package/src/components/manage/Toast/Toast.test.jsx +9 -5
- package/src/components/manage/Toolbar/PersonalTools.jsx +2 -1
- package/src/components/manage/Toolbar/PersonalTools.test.jsx +15 -0
- package/src/components/manage/Toolbar/Toolbar.jsx +14 -4
- package/src/components/manage/Toolbar/Types.crash.test.jsx +48 -0
- package/src/components/manage/Toolbar/Types.jsx +6 -4
- package/src/components/manage/UniversalLink/UniversalLink.test.jsx +16 -0
- package/src/components/manage/UniversalLink/UniversalLink.tsx +2 -0
- package/src/components/manage/Widgets/AlignWidget.stories.jsx +9 -0
- package/src/components/manage/Widgets/AlignWidget.test.tsx +95 -0
- package/src/components/manage/Widgets/{AlignWidget.jsx → AlignWidget.tsx} +23 -7
- package/src/components/manage/Widgets/ArrayWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/BlockAlignment.stories.tsx +104 -0
- package/src/components/manage/Widgets/BlockAlignment.test.tsx +104 -0
- package/src/components/manage/Widgets/BlockAlignment.tsx +88 -0
- package/src/components/manage/Widgets/BlockWidth.stories.tsx +69 -0
- package/src/components/manage/Widgets/BlockWidth.test.tsx +62 -0
- package/src/components/manage/Widgets/BlockWidth.tsx +101 -0
- package/src/components/manage/Widgets/ButtonsWidget.stories.jsx +61 -0
- package/src/components/manage/Widgets/ButtonsWidget.test.tsx +138 -0
- package/src/components/manage/Widgets/ButtonsWidget.tsx +195 -0
- package/src/components/manage/Widgets/CheckboxGroupWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/DatetimeWidget.jsx +102 -53
- package/src/components/manage/Widgets/DatetimeWidget.test.jsx +56 -6
- package/src/components/manage/Widgets/FileWidget.jsx +21 -8
- package/src/components/manage/Widgets/FormFieldWrapper.jsx +146 -168
- package/src/components/manage/Widgets/ImageWidget.jsx +177 -38
- package/src/components/manage/Widgets/InternalUrlWidget.jsx +2 -0
- package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +8 -0
- package/src/components/manage/Widgets/ObjectListWidget.test.jsx +2 -11
- package/src/components/manage/Widgets/ObjectWidget.test.jsx +1 -5
- package/src/components/manage/Widgets/QueryWidget.jsx +137 -9
- package/src/components/manage/Widgets/RadioGroupWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/RegistryImageWidget.jsx +1 -1
- package/src/components/manage/Widgets/RegistryImageWidget.test.jsx +4 -2
- package/src/components/manage/Widgets/SchemaWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +1 -6
- package/src/components/manage/Widgets/SelectAutoComplete.jsx +29 -12
- package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +1 -6
- package/src/components/manage/Widgets/SelectWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/Size.stories.tsx +69 -0
- package/src/components/manage/Widgets/Size.test.tsx +59 -0
- package/src/components/manage/Widgets/Size.tsx +78 -0
- package/src/components/manage/Widgets/TimeWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/TokenWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/UrlWidget.jsx +49 -18
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +2 -11
- package/src/components/manage/Widgets/__mocks__/index.tsx +33 -51
- package/src/components/manage/Widgets/index.tsx +21 -0
- package/src/components/manage/Workflow/Workflow.test.jsx +2 -11
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.jsx +1 -0
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.test.jsx +30 -0
- package/src/components/theme/App/App.jsx +5 -1
- package/src/components/theme/Avatar/Avatar.jsx +2 -1
- package/src/components/theme/Comments/CommentEditModal.test.jsx +1 -5
- package/src/components/theme/Comments/Comments.test.jsx +2 -11
- package/src/components/theme/ConnectionRefused/ConnectionRefused.jsx +3 -2
- package/src/components/theme/ContactForm/ContactForm.test.jsx +1 -5
- package/src/components/theme/Image/Image.jsx +25 -13
- package/src/components/theme/Image/Image.test.jsx +247 -146
- package/src/components/theme/InjectPloneComponentsCSS/InjectPloneComponentsCSS.tsx +7 -0
- package/src/components/theme/LanguageSelector/LanguageSelector.tsx +89 -0
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.jsx +42 -12
- package/src/components/theme/PasswordReset/PasswordReset.jsx +108 -191
- package/src/components/theme/PasswordReset/RequestPasswordReset.test.jsx +1 -5
- package/src/components/theme/PreviewImage/PreviewImage.jsx +1 -1
- package/src/components/theme/Register/Register.test.jsx +1 -5
- package/src/components/theme/RequestTimeout/RequestTimeout.jsx +1 -1
- package/src/components/theme/Sitemap/Sitemap.stories.jsx +82 -0
- package/src/components/theme/SlotRenderer/SlotRenderer.tsx +12 -6
- package/src/components/theme/Unauthorized/Unauthorized.jsx +35 -25
- package/src/components/theme/Unauthorized/Unauthorized.test.jsx +28 -1
- package/src/components/theme/VideoEmbed/VideoEmbed.jsx +100 -0
- package/src/components/theme/View/EventDatesInfo.test.jsx +1 -6
- package/src/components/theme/View/EventView.stories.jsx +89 -0
- package/src/components/theme/View/EventView.test.jsx +1 -6
- package/src/components/theme/View/FileView.stories.jsx +50 -0
- package/src/components/theme/View/ImageView.jsx +2 -1
- package/src/components/theme/View/ImageView.test.jsx +3 -0
- package/src/components/theme/View/LinkView.stories.jsx +57 -0
- package/src/components/theme/View/ListingView.stories.jsx +70 -0
- package/src/components/theme/View/NewsItemView.stories.jsx +58 -0
- package/src/components/theme/View/RenderBlocks.jsx +8 -10
- package/src/components/theme/View/RenderBlocks.stories.jsx +112 -0
- package/src/components/theme/View/RenderBlocks.test.jsx +14 -4
- package/src/components/theme/View/SummaryView.stories.jsx +71 -0
- package/src/components/theme/View/TabularView.stories.jsx +66 -0
- package/src/components/theme/View/View.jsx +8 -1
- package/src/components/theme/Widgets/ImageWidget.jsx +2 -1
- package/src/components/theme/Widgets/ImageWidget.test.jsx +31 -11
- package/src/config/Blocks.jsx +3 -0
- package/src/config/ControlPanels.js +3 -0
- package/src/config/Widgets.jsx +7 -0
- package/src/config/index.js +19 -12
- package/src/config/server.js +0 -2
- package/src/config/slots.js +19 -0
- package/src/config/validation.ts +8 -0
- package/src/constants/ActionTypes.js +1 -0
- package/src/express-middleware/devproxy.js +22 -5
- package/src/express-middleware/files.js +1 -0
- package/src/express-middleware/files.test.js +59 -0
- package/src/express-middleware/images.js +1 -0
- package/src/express-middleware/images.test.js +50 -0
- package/src/helpers/Api/APIResourceWithAuth.js +8 -3
- package/src/helpers/Api/Api.js +7 -4
- package/src/helpers/AsyncConnect/ssr.js +4 -1
- package/src/helpers/AuthToken/AuthToken.js +1 -6
- package/src/helpers/Blocks/Blocks.js +113 -28
- package/src/helpers/Blocks/Blocks.test.js +100 -0
- 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/FormValidation/FormValidation.test.js +31 -0
- package/src/helpers/FormValidation/validators.ts +52 -6
- package/src/helpers/Html/Html.jsx +13 -4
- package/src/helpers/Loadable/__mocks__/Loadable.jsx +7 -22
- package/src/helpers/MessageLabels/MessageLabels.js +10 -0
- package/src/helpers/Sitemap/Sitemap.js +4 -4
- package/src/helpers/Url/Url.js +33 -2
- package/src/helpers/Url/Url.test.js +62 -0
- package/src/helpers/Utils/Utils.jsx +17 -0
- package/src/helpers/Utils/Utils.test.jsx +39 -0
- package/src/hooks/user/useUser.js +1 -1
- package/src/internalChecks.test.ts +11 -0
- package/src/middleware/api.js +17 -8
- package/src/middleware/storeProtectLoadUtils.test.js +3 -3
- package/src/reducers/blockTypes/blockTypes.js +38 -0
- 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/reducers/index.js +2 -0
- package/src/reducers/querystring/querystring.js +8 -1
- package/src/reducers/users/users.js +1 -1
- package/src/routes.js +13 -1
- package/src/server.jsx +47 -13
- package/src/start-client.jsx +9 -2
- package/src/start-server.js +9 -3
- package/test-addons-loader.js +3 -0
- package/test-setup-globals.js +56 -2
- package/theme/themes/default/elements/segment.variables +9 -16
- package/theme/themes/pastanaga/collections/form.overrides +1 -1
- package/theme/themes/pastanaga/elements/segment.variables +1 -4
- package/theme/themes/pastanaga/extras/block-types.less +17 -0
- package/theme/themes/pastanaga/extras/blocks.less +19 -0
- package/theme/themes/pastanaga/extras/contents.less +75 -0
- package/theme/themes/pastanaga/extras/main.less +20 -4
- package/theme/themes/pastanaga/extras/toolbar.less +10 -5
- package/theme/themes/pastanaga/extras/videoembed.less +22 -0
- package/theme/themes/pastanaga/extras/widgets.less +79 -0
- package/tsconfig.declarations.json +1 -1
- package/tsconfig.json +4 -5
- package/types/actions/blockTypes/blockTypes.d.ts +7 -0
- package/types/components/index.d.ts +1 -1
- package/types/components/manage/Blocks/Block/Order/Item.test.d.ts +1 -0
- package/types/components/manage/Blocks/Block/Order/utilities.d.ts +2 -1
- package/types/components/manage/Blocks/Grid/context.d.ts +1 -0
- package/types/components/manage/Blocks/Teaser/utils.d.ts +5 -0
- package/types/components/manage/Blocks/Video/Body.d.ts +4 -2
- package/types/components/manage/Blocks/Video/schema.d.ts +4 -0
- package/types/components/manage/Contents/DropZoneContent.d.ts +2 -0
- package/types/components/manage/Contents/__mocks__/index.d.ts +2 -2
- package/types/components/manage/Controlpanels/BlockType.d.ts +7 -0
- package/types/components/manage/Controlpanels/BlockTypes.d.ts +7 -0
- package/types/components/manage/Controlpanels/Relations/RelationsMatrix.d.ts +1 -1
- 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/Diff/Diff.d.ts +7 -2
- package/types/components/manage/Form/__mocks__/index.d.ts +8 -8
- package/types/components/manage/Multilingual/ManageTranslations.d.ts +1 -1
- package/types/components/manage/Sidebar/ObjectBrowser.d.ts +1 -1
- package/types/components/manage/Sidebar/SidebarPortal.d.ts +7 -15
- package/types/components/manage/Toolbar/Types.crash.test.d.ts +1 -0
- package/types/components/manage/Widgets/AlignWidget.d.ts +8 -10
- package/types/components/manage/Widgets/AlignWidget.stories.d.ts +1 -0
- package/types/components/manage/Widgets/BlockAlignment.d.ts +7 -0
- package/types/components/manage/Widgets/BlockAlignment.stories.d.ts +8 -0
- package/types/components/manage/Widgets/BlockWidth.d.ts +7 -0
- package/types/components/manage/Widgets/BlockWidth.stories.d.ts +6 -0
- package/types/components/manage/Widgets/ButtonsWidget.d.ts +48 -1
- package/types/components/manage/Widgets/ButtonsWidget.stories.d.ts +3 -0
- package/types/components/manage/Widgets/FormFieldWrapper.d.ts +28 -5
- package/types/components/manage/Widgets/ImageWidget.d.ts +41 -1
- package/types/components/manage/Widgets/InternalUrlWidget.d.ts +1 -1
- package/types/components/manage/Widgets/ObjectBrowserWidget.d.ts +2 -0
- package/types/components/manage/Widgets/QueryWidget.d.ts +5 -2
- package/types/components/manage/Widgets/RecurrenceWidget/Utils.d.ts +12 -18
- package/types/components/manage/Widgets/Size.d.ts +7 -0
- package/types/components/manage/Widgets/Size.stories.d.ts +6 -0
- package/types/components/manage/Widgets/UrlWidget.d.ts +1 -1
- package/types/components/manage/Widgets/__mocks__/index.d.ts +33 -33
- package/types/components/manage/Widgets/index.d.ts +11 -6
- package/types/components/theme/ConnectionRefused/ConnectionRefused.d.ts +2 -2
- package/types/components/theme/InjectPloneComponentsCSS/InjectPloneComponentsCSS.d.ts +3 -0
- package/types/components/theme/LanguageSelector/LanguageSelector.d.ts +3 -10
- package/types/components/theme/PasswordReset/PasswordReset.d.ts +6 -2
- package/types/components/theme/Sitemap/Sitemap.stories.d.ts +13 -0
- package/types/components/theme/SlotRenderer/SlotRenderer.d.ts +4 -5
- package/types/components/theme/Unauthorized/Unauthorized.d.ts +2 -2
- package/types/components/theme/VideoEmbed/VideoEmbed.d.ts +2 -0
- package/types/components/theme/View/EventView.stories.d.ts +19 -0
- package/types/components/theme/View/FileView.stories.d.ts +18 -0
- package/types/components/theme/View/LinkView.stories.d.ts +18 -0
- package/types/components/theme/View/ListingView.stories.d.ts +24 -0
- package/types/components/theme/View/NewsItemView.stories.d.ts +23 -0
- package/types/components/theme/View/RenderBlocks.stories.d.ts +23 -0
- package/types/components/theme/View/SummaryView.stories.d.ts +23 -0
- package/types/components/theme/View/TabularView.stories.d.ts +23 -0
- package/types/config/ControlPanels.d.ts +1 -0
- package/types/config/Views.d.ts +1 -1
- package/types/config/Widgets.d.ts +6 -0
- package/types/config/slots.d.ts +7 -0
- package/types/constants/ActionTypes.d.ts +1 -0
- package/types/helpers/Blocks/Blocks.d.ts +4 -0
- 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/FormValidation/validators.d.ts +18 -1
- package/types/helpers/Helmet/Helmet.d.ts +1 -1
- package/types/helpers/Loadable/__mocks__/Loadable.d.ts +2 -2
- package/types/helpers/MessageLabels/MessageLabels.d.ts +105 -93
- package/types/helpers/Url/Url.d.ts +14 -0
- package/types/helpers/Url/bulkFlattenToAppURL.d.ts +5 -0
- package/types/helpers/Utils/Utils.d.ts +1 -0
- package/types/reducers/blockTypes/blockTypes.d.ts +16 -0
- package/types/reducers/index.d.ts +3 -0
- package/types/routes.d.ts +7 -5
- package/types/start-client.d.ts +0 -1
- package/vitest.config.mjs +84 -42
- package/webpack-plugins/webpack-less-plugin.js +1 -1
- package/webpack-plugins/webpack-scss-plugin.js +172 -0
- package/cypress/downloads/downloads.html +0 -0
- package/jest-addons-loader.js +0 -3
- package/jest-extender-plugin.js +0 -39
- package/jest-setup-afterenv.js +0 -2
- package/jest-svgsystem-transform.js +0 -10
- package/package-why.json +0 -34
- package/patches/patchit.sh +0 -2
- package/patches/razzle-jest.patch +0 -10
- package/src/components/manage/Contents/__mocks__/index.vitest.tsx +0 -5
- package/src/components/manage/Form/__mocks__/index.vitest.tsx +0 -73
- package/src/components/manage/Sidebar/SidebarPortal.jsx +0 -47
- package/src/components/manage/Sidebar/SidebarPortal.test.jsx +0 -26
- package/src/components/manage/Widgets/AlignWidget.test.jsx +0 -59
- package/src/components/manage/Widgets/ButtonsWidget.jsx +0 -41
- package/src/components/manage/Widgets/ButtonsWidget.test.jsx +0 -70
- package/src/components/manage/Widgets/__mocks__/index.vitest.tsx +0 -41
- package/src/components/theme/LanguageSelector/LanguageSelector.jsx +0 -79
- package/src/helpers/Loadable/__mocks__/Loadable.vitest.jsx +0 -39
- package/test-setup-globals-vitest.js +0 -46
- package/theme/themes/pastanaga/extras/utils.less +0 -63
- /package/src/components/theme/LanguageSelector/{LanguageSelector.test.jsx → LanguageSelector.test.tsx} +0 -0
|
@@ -3,6 +3,7 @@ import { Button, Segment, Popup } from 'semantic-ui-react';
|
|
|
3
3
|
import { useIntl, defineMessages } from 'react-intl';
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
6
|
+
import Image from '@plone/volto/components/theme/Image/Image';
|
|
6
7
|
import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
7
8
|
import { getContentIcon } from '@plone/volto/helpers/Content/Content';
|
|
8
9
|
import config from '@plone/volto/registry';
|
|
@@ -69,7 +70,7 @@ const ObjectBrowserNav = ({
|
|
|
69
70
|
}
|
|
70
71
|
>
|
|
71
72
|
{item['@type'] === 'Image' ? (
|
|
72
|
-
<
|
|
73
|
+
<Image
|
|
73
74
|
src={`${item['@id']}/@@images/image/preview`}
|
|
74
75
|
alt={item.title}
|
|
75
76
|
style={{
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { cleanup, render, screen } from '@testing-library/react';
|
|
3
|
+
|
|
4
|
+
import SidebarPortal from './SidebarPortal';
|
|
5
|
+
|
|
6
|
+
describe('SidebarPortal', () => {
|
|
7
|
+
let portalRoot: HTMLDivElement | null;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
portalRoot = document.createElement('div');
|
|
11
|
+
portalRoot.setAttribute('id', 'sidebar-properties');
|
|
12
|
+
document.body.appendChild(portalRoot);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
cleanup();
|
|
17
|
+
portalRoot?.remove();
|
|
18
|
+
portalRoot = null;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('renders the sidebar portal when the block is selected', async () => {
|
|
22
|
+
render(
|
|
23
|
+
<SidebarPortal selected={true}>
|
|
24
|
+
<p>Tested!</p>
|
|
25
|
+
</SidebarPortal>,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
expect(await screen.findByText('Tested!')).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('does not render the sidebar portal when the block is not selected', () => {
|
|
32
|
+
render(
|
|
33
|
+
<SidebarPortal selected={false}>
|
|
34
|
+
<p>Tested, but you should not see this!</p>
|
|
35
|
+
</SidebarPortal>,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
expect(
|
|
39
|
+
screen.queryByText('Tested, but you should not see this!'),
|
|
40
|
+
).not.toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
|
|
4
|
+
type SidebarPortalProps = {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
selected: boolean;
|
|
7
|
+
tab?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const SidebarPortal = ({
|
|
11
|
+
children,
|
|
12
|
+
selected,
|
|
13
|
+
tab = 'sidebar-properties',
|
|
14
|
+
}: SidebarPortalProps) => {
|
|
15
|
+
const [isClient, setIsClient] = React.useState(false);
|
|
16
|
+
|
|
17
|
+
React.useEffect(() => setIsClient(true), []);
|
|
18
|
+
|
|
19
|
+
if (!isClient || !selected) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const target = document.getElementById(tab);
|
|
24
|
+
|
|
25
|
+
if (!target) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return createPortal(
|
|
30
|
+
<div role="form" style={{ height: '100%' }}>
|
|
31
|
+
<div
|
|
32
|
+
style={{ height: '100%' }}
|
|
33
|
+
role="presentation"
|
|
34
|
+
onClick={(e) => {
|
|
35
|
+
e.stopPropagation();
|
|
36
|
+
}}
|
|
37
|
+
onKeyDown={(e) => {
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</div>
|
|
43
|
+
</div>,
|
|
44
|
+
target,
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default SidebarPortal;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { Button, Grid, Message } from 'semantic-ui-react';
|
|
4
|
+
import Image from '@plone/volto/components/theme/Image/Image';
|
|
4
5
|
|
|
5
6
|
const TemplateChooser = ({ templates, onSelectTemplate }) => {
|
|
6
7
|
const intl = useIntl();
|
|
@@ -15,7 +16,7 @@ const TemplateChooser = ({ templates, onSelectTemplate }) => {
|
|
|
15
16
|
className="template-chooser-item"
|
|
16
17
|
onClick={() => onSelectTemplate(index)}
|
|
17
18
|
>
|
|
18
|
-
<
|
|
19
|
+
<Image src={template.image} alt="" />
|
|
19
20
|
<div className="template-chooser-title">
|
|
20
21
|
{intl.formatMessage({
|
|
21
22
|
id: template.id,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
3
4
|
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
4
5
|
|
|
5
6
|
import successSVG from '@plone/volto/icons/ready.svg';
|
|
@@ -7,7 +8,28 @@ import infoSVG from '@plone/volto/icons/info.svg';
|
|
|
7
8
|
import errorSVG from '@plone/volto/icons/error.svg';
|
|
8
9
|
import warningSVG from '@plone/volto/icons/warning.svg';
|
|
9
10
|
|
|
11
|
+
const messages = defineMessages({
|
|
12
|
+
success: {
|
|
13
|
+
id: 'toast_type_success',
|
|
14
|
+
defaultMessage: 'Success',
|
|
15
|
+
},
|
|
16
|
+
error: {
|
|
17
|
+
id: 'toast_type_error',
|
|
18
|
+
defaultMessage: 'Error',
|
|
19
|
+
},
|
|
20
|
+
warning: {
|
|
21
|
+
id: 'toast_type_warning',
|
|
22
|
+
defaultMessage: 'Warning',
|
|
23
|
+
},
|
|
24
|
+
info: {
|
|
25
|
+
id: 'toast_type_info',
|
|
26
|
+
defaultMessage: 'Information',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
10
30
|
const Toast = (props) => {
|
|
31
|
+
const intl = useIntl();
|
|
32
|
+
|
|
11
33
|
function getIcon(props) {
|
|
12
34
|
if (props.info) {
|
|
13
35
|
return infoSVG;
|
|
@@ -22,12 +44,22 @@ const Toast = (props) => {
|
|
|
22
44
|
}
|
|
23
45
|
}
|
|
24
46
|
|
|
47
|
+
function getTypeLabel(props) {
|
|
48
|
+
if (props.error) return intl.formatMessage(messages.error);
|
|
49
|
+
if (props.warning) return intl.formatMessage(messages.warning);
|
|
50
|
+
if (props.info) return intl.formatMessage(messages.info);
|
|
51
|
+
if (props.success) return intl.formatMessage(messages.success);
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
25
55
|
const { title, content } = props;
|
|
56
|
+
const typeLabel = getTypeLabel(props);
|
|
26
57
|
|
|
27
58
|
return (
|
|
28
59
|
<>
|
|
29
60
|
<Icon name={getIcon(props)} size="18px" />
|
|
30
61
|
<div className="toast-inner-content">
|
|
62
|
+
{typeLabel && <span className="visually-hidden">{typeLabel}</span>}
|
|
31
63
|
{title && <h4>{title}</h4>}
|
|
32
64
|
<div>{content}</div>
|
|
33
65
|
</div>
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
|
+
import { IntlProvider } from 'react-intl';
|
|
3
4
|
import Toast from './Toast';
|
|
4
5
|
|
|
5
6
|
test('renders a Toast info component', () => {
|
|
6
7
|
const component = renderer.create(
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
<IntlProvider locale="en">
|
|
9
|
+
<Toast
|
|
10
|
+
info
|
|
11
|
+
title="I'm a title"
|
|
12
|
+
content="This is the content, lorem ipsum"
|
|
13
|
+
/>
|
|
14
|
+
,
|
|
15
|
+
</IntlProvider>,
|
|
12
16
|
);
|
|
13
17
|
const json = component.toJSON();
|
|
14
18
|
expect(json).toMatchSnapshot();
|
|
@@ -7,6 +7,7 @@ import cx from 'classnames';
|
|
|
7
7
|
import { FormattedMessage, useIntl, defineMessages } from 'react-intl';
|
|
8
8
|
|
|
9
9
|
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
10
|
+
import Image from '@plone/volto/components/theme/Image/Image';
|
|
10
11
|
import { getUser } from '@plone/volto/actions/users/users';
|
|
11
12
|
import { Pluggable } from '@plone/volto/components/manage/Pluggable';
|
|
12
13
|
import { expandToBackendURL, getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
@@ -96,7 +97,7 @@ const PersonalTools = (props) => {
|
|
|
96
97
|
</header>
|
|
97
98
|
<div className={cx('avatar', { default: !user.portrait })}>
|
|
98
99
|
{user.portrait ? (
|
|
99
|
-
<
|
|
100
|
+
<Image
|
|
100
101
|
src={expandToBackendURL(user.portrait)}
|
|
101
102
|
alt={intl.formatMessage(messages.userAvatar)}
|
|
102
103
|
/>
|
|
@@ -23,6 +23,11 @@ describe('Toolbar Personal Tools component', () => {
|
|
|
23
23
|
userSession: {
|
|
24
24
|
token: jwt.sign({ sub: 'admin' }, 'secret'),
|
|
25
25
|
},
|
|
26
|
+
site: {
|
|
27
|
+
data: {
|
|
28
|
+
'plone.image_scales': { preview: {}, listing: {} },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
26
31
|
content: {
|
|
27
32
|
data: {
|
|
28
33
|
'@type': 'Folder',
|
|
@@ -74,6 +79,11 @@ describe('Toolbar Personal Tools component', () => {
|
|
|
74
79
|
userSession: {
|
|
75
80
|
token: jwt.sign({ sub: 'admin' }, 'secret'),
|
|
76
81
|
},
|
|
82
|
+
site: {
|
|
83
|
+
data: {
|
|
84
|
+
'plone.image_scales': { preview: {}, listing: {} },
|
|
85
|
+
},
|
|
86
|
+
},
|
|
77
87
|
content: {
|
|
78
88
|
data: {
|
|
79
89
|
'@type': 'Folder',
|
|
@@ -126,6 +136,11 @@ describe('Toolbar Personal Tools component', () => {
|
|
|
126
136
|
userSession: {
|
|
127
137
|
token: jwt.sign({ sub: 'admin' }, 'secret'),
|
|
128
138
|
},
|
|
139
|
+
site: {
|
|
140
|
+
data: {
|
|
141
|
+
'plone.image_scales': { preview: {}, listing: {} },
|
|
142
|
+
},
|
|
143
|
+
},
|
|
129
144
|
content: {
|
|
130
145
|
data: {
|
|
131
146
|
'@type': 'Folder',
|
|
@@ -68,6 +68,10 @@ const messages = defineMessages({
|
|
|
68
68
|
id: 'Shrink toolbar',
|
|
69
69
|
defaultMessage: 'Shrink toolbar',
|
|
70
70
|
},
|
|
71
|
+
expandToolbar: {
|
|
72
|
+
id: 'Expand toolbar',
|
|
73
|
+
defaultMessage: 'Expand toolbar',
|
|
74
|
+
},
|
|
71
75
|
personalInformation: {
|
|
72
76
|
id: 'Personal Information',
|
|
73
77
|
defaultMessage: 'Personal Information',
|
|
@@ -455,6 +459,7 @@ class Toolbar extends Component {
|
|
|
455
459
|
</div>
|
|
456
460
|
</div>
|
|
457
461
|
<div
|
|
462
|
+
id="toolbar-body"
|
|
458
463
|
className={this.state.expanded ? 'toolbar expanded' : 'toolbar'}
|
|
459
464
|
ref={this.toolbarRef}
|
|
460
465
|
>
|
|
@@ -616,15 +621,20 @@ class Toolbar extends Component {
|
|
|
616
621
|
</div>
|
|
617
622
|
<div className="toolbar-handler">
|
|
618
623
|
<button
|
|
619
|
-
aria-label={this.props.intl.formatMessage(
|
|
620
|
-
messages.shrinkToolbar,
|
|
621
|
-
)}
|
|
622
624
|
className={cx('toolbar-handler-button', {
|
|
623
625
|
[this.props.content?.review_state]:
|
|
624
626
|
this.props.content?.review_state,
|
|
625
627
|
})}
|
|
626
628
|
onClick={this.handleShrink}
|
|
627
|
-
|
|
629
|
+
aria-expanded={expanded}
|
|
630
|
+
aria-controls="toolbar-body"
|
|
631
|
+
>
|
|
632
|
+
<span aria-live="assertive" className="visually-hidden">
|
|
633
|
+
{expanded
|
|
634
|
+
? this.props.intl.formatMessage(messages.shrinkToolbar)
|
|
635
|
+
: this.props.intl.formatMessage(messages.expandToolbar)}
|
|
636
|
+
</span>
|
|
637
|
+
</button>
|
|
628
638
|
</div>
|
|
629
639
|
</div>
|
|
630
640
|
<div className="pusher" />
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer from 'react-test-renderer';
|
|
3
|
+
import configureStore from 'redux-mock-store';
|
|
4
|
+
import { Provider } from 'react-intl-redux';
|
|
5
|
+
import thunk from 'redux-thunk';
|
|
6
|
+
|
|
7
|
+
import Types from './Types';
|
|
8
|
+
|
|
9
|
+
const mockStore = configureStore([thunk]);
|
|
10
|
+
|
|
11
|
+
describe('Types Defensive', () => {
|
|
12
|
+
it('does not crash when a language is missing from langmap', () => {
|
|
13
|
+
const store = mockStore({
|
|
14
|
+
site: {
|
|
15
|
+
data: {
|
|
16
|
+
'plone.available_languages': ['en', 'fr_HT'], // fr_HT is missing from langmap
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
types: { types: [{ title: 'Document' }] },
|
|
20
|
+
content: {
|
|
21
|
+
data: {
|
|
22
|
+
'@id': '/test',
|
|
23
|
+
'@type': 'Document',
|
|
24
|
+
language: { token: 'en' },
|
|
25
|
+
'@components': {
|
|
26
|
+
translations: { items: [] },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
intl: {
|
|
31
|
+
locale: 'en',
|
|
32
|
+
messages: {},
|
|
33
|
+
},
|
|
34
|
+
userSession: {
|
|
35
|
+
token: 'thetoken',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// This should not throw TypeError: Cannot read properties of undefined (reading 'nativeName')
|
|
40
|
+
const component = renderer.create(
|
|
41
|
+
<Provider store={store}>
|
|
42
|
+
<Types pathname="/test" active />
|
|
43
|
+
</Provider>,
|
|
44
|
+
);
|
|
45
|
+
const json = component.toJSON();
|
|
46
|
+
expect(json).toBeDefined();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -54,14 +54,14 @@ const Types = ({ types, pathname, content, currentLanguage }) => {
|
|
|
54
54
|
</div>
|
|
55
55
|
</>
|
|
56
56
|
)}
|
|
57
|
-
{content['@components']
|
|
57
|
+
{content?.['@components']?.translations &&
|
|
58
58
|
(() => {
|
|
59
59
|
const translationsLeft = filter(
|
|
60
60
|
availableLanguages,
|
|
61
61
|
(lang) =>
|
|
62
62
|
!Boolean(
|
|
63
|
-
content['@components']
|
|
64
|
-
find(content['@components']
|
|
63
|
+
content?.['@components']?.translations &&
|
|
64
|
+
find(content?.['@components']?.translations?.items, {
|
|
65
65
|
language: lang,
|
|
66
66
|
}),
|
|
67
67
|
) && toBackendLang(currentLanguage) !== lang,
|
|
@@ -95,7 +95,9 @@ const Types = ({ types, pathname, content, currentLanguage }) => {
|
|
|
95
95
|
id="Translate to {lang}"
|
|
96
96
|
defaultMessage="Translate to {lang}"
|
|
97
97
|
values={{
|
|
98
|
-
lang:
|
|
98
|
+
lang: (
|
|
99
|
+
langmap[lang]?.nativeName || lang
|
|
100
|
+
).toLowerCase(),
|
|
99
101
|
}}
|
|
100
102
|
/>
|
|
101
103
|
</Link>
|
|
@@ -89,6 +89,22 @@ describe('UniversalLink', () => {
|
|
|
89
89
|
);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
+
it('check UniversalLink append http when user has not entered the protocol', () => {
|
|
93
|
+
const { getByTitle } = render(
|
|
94
|
+
<Provider store={store}>
|
|
95
|
+
<MemoryRouter>
|
|
96
|
+
<UniversalLink href="www.github.com" title="Volto GitHub repository">
|
|
97
|
+
<h1>Title</h1>
|
|
98
|
+
</UniversalLink>
|
|
99
|
+
</MemoryRouter>
|
|
100
|
+
</Provider>,
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
expect(getByTitle('Volto GitHub repository').getAttribute('href')).toBe(
|
|
104
|
+
'http://www.github.com',
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
|
|
92
108
|
it('check UniversalLink set target attribute for ext links', () => {
|
|
93
109
|
const { getByTitle } = render(
|
|
94
110
|
<Provider store={store}>
|
|
@@ -122,6 +122,7 @@ const UniversalLink = React.memo(
|
|
|
122
122
|
onClick,
|
|
123
123
|
onKeyDown,
|
|
124
124
|
item,
|
|
125
|
+
href,
|
|
125
126
|
...rest
|
|
126
127
|
} = props;
|
|
127
128
|
__test.renderCounter();
|
|
@@ -148,6 +149,7 @@ const UniversalLink = React.memo(
|
|
|
148
149
|
target={openLinkInNewTab ?? false ? '_blank' : undefined}
|
|
149
150
|
title={title}
|
|
150
151
|
className={className}
|
|
152
|
+
onClick={onClick}
|
|
151
153
|
smooth={smooth ?? config.settings.hashLinkSmoothScroll}
|
|
152
154
|
// @ts-ignore
|
|
153
155
|
ref={ref}
|
|
@@ -7,6 +7,15 @@ export const Align = WidgetStory.bind({
|
|
|
7
7
|
widget: AlignWidget,
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
+
export const AlignDefaultLeft = WidgetStory.bind({
|
|
11
|
+
props: {
|
|
12
|
+
id: 'align-default-left',
|
|
13
|
+
title: 'Align (default left)',
|
|
14
|
+
default: 'left',
|
|
15
|
+
},
|
|
16
|
+
widget: AlignWidget,
|
|
17
|
+
});
|
|
18
|
+
|
|
10
19
|
export default {
|
|
11
20
|
title: 'Edit Widgets/Align',
|
|
12
21
|
component: AlignWidget,
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
import configureStore from 'redux-mock-store';
|
|
5
|
+
import { Provider } from 'react-intl-redux';
|
|
6
|
+
import imageFullSVG from '@plone/volto/icons/image-full.svg';
|
|
7
|
+
|
|
8
|
+
import AlignWidget from './AlignWidget';
|
|
9
|
+
import type { ButtonsWidgetProps } from './ButtonsWidget';
|
|
10
|
+
|
|
11
|
+
const mockStore = configureStore();
|
|
12
|
+
|
|
13
|
+
const renderAlignWidget = (
|
|
14
|
+
props: Partial<ButtonsWidgetProps> = {},
|
|
15
|
+
): {
|
|
16
|
+
onChange: ButtonsWidgetProps['onChange'];
|
|
17
|
+
asFragment: () => DocumentFragment;
|
|
18
|
+
getByRole: ReturnType<typeof render>['getByRole'];
|
|
19
|
+
} => {
|
|
20
|
+
const { onChange: providedOnChange, ...restProps } = props;
|
|
21
|
+
const onChange = providedOnChange ?? vi.fn();
|
|
22
|
+
const store = mockStore({
|
|
23
|
+
intl: {
|
|
24
|
+
locale: 'en',
|
|
25
|
+
messages: {},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const widgetProps: ButtonsWidgetProps = {
|
|
30
|
+
id: 'align',
|
|
31
|
+
title: 'Alignment',
|
|
32
|
+
fieldSet: 'default',
|
|
33
|
+
onChange,
|
|
34
|
+
value: undefined,
|
|
35
|
+
default: undefined,
|
|
36
|
+
disabled: false,
|
|
37
|
+
isDisabled: false,
|
|
38
|
+
...restProps,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const rendered = render(
|
|
42
|
+
<Provider store={store}>
|
|
43
|
+
<AlignWidget {...widgetProps} />
|
|
44
|
+
</Provider>,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
onChange,
|
|
49
|
+
asFragment: rendered.asFragment,
|
|
50
|
+
getByRole: rendered.getByRole,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
describe('AlignWidget', () => {
|
|
55
|
+
it('renders with default actions', () => {
|
|
56
|
+
const { asFragment } = renderAlignWidget();
|
|
57
|
+
expect(asFragment()).toMatchSnapshot();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('renders with custom actions', () => {
|
|
61
|
+
const { asFragment } = renderAlignWidget({
|
|
62
|
+
actions: ['additional'],
|
|
63
|
+
actionsInfoMap: {
|
|
64
|
+
additional: [imageFullSVG, 'Additional action title'],
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
expect(asFragment()).toMatchSnapshot();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('selects the defaultAction when value is missing', () => {
|
|
72
|
+
const { getByRole } = renderAlignWidget({
|
|
73
|
+
defaultAction: 'left',
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
expect(getByRole('radio', { name: 'Left' })).toBeChecked();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('selects the default when value is missing', () => {
|
|
80
|
+
const { getByRole } = renderAlignWidget({
|
|
81
|
+
default: 'left',
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(getByRole('radio', { name: 'Left' })).toBeChecked();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('does not override provided value with default', () => {
|
|
88
|
+
const { onChange } = renderAlignWidget({
|
|
89
|
+
default: 'left',
|
|
90
|
+
value: 'center',
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
expect(onChange).not.toHaveBeenCalledWith('align', 'left');
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { defineMessages, useIntl } from 'react-intl';
|
|
3
|
-
import ButtonsWidget
|
|
3
|
+
import ButtonsWidget, {
|
|
4
|
+
type ActionInfo,
|
|
5
|
+
type ButtonsWidgetProps,
|
|
6
|
+
} from './ButtonsWidget';
|
|
4
7
|
import imageLeftSVG from '@plone/volto/icons/image-left.svg';
|
|
5
8
|
import imageRightSVG from '@plone/volto/icons/image-right.svg';
|
|
6
9
|
import imageFitSVG from '@plone/volto/icons/image-fit.svg';
|
|
7
10
|
import imageNarrowSVG from '@plone/volto/icons/image-narrow.svg';
|
|
8
11
|
import imageWideSVG from '@plone/volto/icons/image-wide.svg';
|
|
9
12
|
import imageFullSVG from '@plone/volto/icons/image-full.svg';
|
|
13
|
+
import type { IntlShape } from 'react-intl';
|
|
10
14
|
|
|
11
15
|
const messages = defineMessages({
|
|
12
16
|
left: {
|
|
@@ -35,20 +39,32 @@ const messages = defineMessages({
|
|
|
35
39
|
},
|
|
36
40
|
});
|
|
37
41
|
|
|
38
|
-
export const defaultActionsInfo = ({
|
|
42
|
+
export const defaultActionsInfo = ({
|
|
43
|
+
intl,
|
|
44
|
+
}: {
|
|
45
|
+
intl: IntlShape;
|
|
46
|
+
}): Record<string, ActionInfo> => ({
|
|
39
47
|
left: [imageLeftSVG, intl.formatMessage(messages.left)],
|
|
40
|
-
right: [imageRightSVG, intl.formatMessage(messages.right)],
|
|
41
48
|
center: [imageFitSVG, intl.formatMessage(messages.center)],
|
|
49
|
+
right: [imageRightSVG, intl.formatMessage(messages.right)],
|
|
42
50
|
narrow: [imageNarrowSVG, intl.formatMessage(messages.narrow)],
|
|
43
51
|
wide: [imageWideSVG, intl.formatMessage(messages.wide)],
|
|
44
52
|
full: [imageFullSVG, intl.formatMessage(messages.full)],
|
|
45
53
|
});
|
|
46
54
|
|
|
47
|
-
|
|
55
|
+
type AlignWidgetProps = ButtonsWidgetProps & {
|
|
56
|
+
defaultAction?: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const AlignWidget = (props: AlignWidgetProps) => {
|
|
48
60
|
const intl = useIntl();
|
|
49
61
|
|
|
50
|
-
const {
|
|
51
|
-
|
|
62
|
+
const {
|
|
63
|
+
actions = ['left', 'center', 'right', 'full'],
|
|
64
|
+
actionsInfoMap,
|
|
65
|
+
default: defaultValue,
|
|
66
|
+
defaultAction,
|
|
67
|
+
} = props;
|
|
52
68
|
|
|
53
69
|
const actionsInfo = {
|
|
54
70
|
...defaultActionsInfo({ intl }),
|
|
@@ -60,7 +76,7 @@ const AlignWidget = (props) => {
|
|
|
60
76
|
{...props}
|
|
61
77
|
actions={actions}
|
|
62
78
|
actionsInfoMap={actionsInfo}
|
|
63
|
-
|
|
79
|
+
default={defaultValue ?? defaultAction ?? 'center'}
|
|
64
80
|
/>
|
|
65
81
|
);
|
|
66
82
|
};
|
|
@@ -8,12 +8,7 @@ import ArrayWidget from './ArrayWidget';
|
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
|
-
vi.mock('@plone/volto/helpers/Loadable/Loadable'
|
|
12
|
-
return await import(
|
|
13
|
-
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
14
|
-
);
|
|
15
|
-
});
|
|
16
|
-
|
|
11
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
17
12
|
// Mock react-sortable-hoc to prevent the container error
|
|
18
13
|
vi.mock('react-sortable-hoc', () => ({
|
|
19
14
|
...vi.importActual('react-sortable-hoc'),
|