@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useIntl, defineMessages } from 'react-intl';
|
|
2
3
|
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
3
4
|
import {
|
|
4
5
|
Option,
|
|
@@ -12,15 +13,35 @@ import {
|
|
|
12
13
|
selectFacetValueToQuery,
|
|
13
14
|
} from './base';
|
|
14
15
|
|
|
16
|
+
const messages = defineMessages({
|
|
17
|
+
selectOption: {
|
|
18
|
+
id: 'Select option',
|
|
19
|
+
defaultMessage: 'Select option',
|
|
20
|
+
},
|
|
21
|
+
select: {
|
|
22
|
+
id: 'Select…',
|
|
23
|
+
defaultMessage: 'Select…',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
15
27
|
const SelectFacet = (props) => {
|
|
16
28
|
const { facet, choices, reactSelect, isMulti, onChange, value, isEditMode } =
|
|
17
29
|
props;
|
|
30
|
+
const intl = useIntl();
|
|
18
31
|
const Select = reactSelect.default;
|
|
19
32
|
const v = Array.isArray(value) && value.length === 0 ? null : value;
|
|
20
33
|
|
|
21
34
|
return (
|
|
22
35
|
<Select
|
|
23
|
-
placeholder={
|
|
36
|
+
placeholder={
|
|
37
|
+
facet?.title ??
|
|
38
|
+
(facet?.field?.label || intl.formatMessage(messages.select))
|
|
39
|
+
}
|
|
40
|
+
aria-label={
|
|
41
|
+
facet?.title ??
|
|
42
|
+
facet?.field?.label ??
|
|
43
|
+
intl.formatMessage(messages.selectOption)
|
|
44
|
+
}
|
|
24
45
|
className="react-select-container"
|
|
25
46
|
classNamePrefix="react-select"
|
|
26
47
|
options={choices}
|
|
@@ -6,12 +6,7 @@ import SelectFacet from './SelectFacet';
|
|
|
6
6
|
|
|
7
7
|
const mockStore = configureStore();
|
|
8
8
|
|
|
9
|
-
vi.mock('@plone/volto/helpers/Loadable/Loadable'
|
|
10
|
-
return await import(
|
|
11
|
-
'@plone/volto/helpers/Loadable/__mocks__/Loadable.vitest.jsx'
|
|
12
|
-
);
|
|
13
|
-
});
|
|
14
|
-
|
|
9
|
+
vi.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
15
10
|
beforeAll(async () => {
|
|
16
11
|
const { __setLoadables } = await import(
|
|
17
12
|
'@plone/volto/helpers/Loadable/Loadable'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useId } from 'react';
|
|
1
2
|
import { Button } from 'semantic-ui-react';
|
|
2
3
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
3
4
|
import cx from 'classnames';
|
|
@@ -48,6 +49,10 @@ const SortOn = (props) => {
|
|
|
48
49
|
querystring = {},
|
|
49
50
|
intl,
|
|
50
51
|
} = props;
|
|
52
|
+
const uniqueId = useId();
|
|
53
|
+
const sortOnLabelId = `sort-on-label-${uniqueId}`;
|
|
54
|
+
const selectId = `select-search-sort-on-${uniqueId}`;
|
|
55
|
+
|
|
51
56
|
const { sortable_indexes } = querystring;
|
|
52
57
|
const Select = reactSelect.default;
|
|
53
58
|
|
|
@@ -75,11 +80,12 @@ const SortOn = (props) => {
|
|
|
75
80
|
<div className="search-sort-on">
|
|
76
81
|
{showSelectField ? (
|
|
77
82
|
<>
|
|
78
|
-
<span className="sort-label">
|
|
83
|
+
<span id={sortOnLabelId} className="sort-label">
|
|
79
84
|
{intl.formatMessage(messages.sortOn)}
|
|
80
85
|
</span>
|
|
81
86
|
<Select
|
|
82
|
-
|
|
87
|
+
aria-labelledby={sortOnLabelId}
|
|
88
|
+
id={selectId}
|
|
83
89
|
name="select-searchblock-sort-on"
|
|
84
90
|
className="search-react-select-container"
|
|
85
91
|
classNamePrefix="react-select"
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Radio, Header } from 'semantic-ui-react';
|
|
3
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
4
|
+
|
|
5
|
+
const messages = defineMessages({
|
|
6
|
+
toggleOption: {
|
|
7
|
+
id: 'Toggle option',
|
|
8
|
+
defaultMessage: 'Toggle option',
|
|
9
|
+
},
|
|
10
|
+
});
|
|
3
11
|
|
|
4
12
|
const ToggleFacet = (props) => {
|
|
13
|
+
const intl = useIntl();
|
|
5
14
|
const { facet, isEditMode, onChange, value } = props; // value, choices, isMulti, onChange,
|
|
15
|
+
const labelText =
|
|
16
|
+
facet?.title ??
|
|
17
|
+
facet?.field?.label ??
|
|
18
|
+
intl.formatMessage(messages.toggleOption);
|
|
6
19
|
|
|
7
20
|
return (
|
|
8
21
|
<div className="checkbox-facet">
|
|
@@ -10,6 +23,7 @@ const ToggleFacet = (props) => {
|
|
|
10
23
|
<div className="radio">
|
|
11
24
|
<Radio
|
|
12
25
|
toggle
|
|
26
|
+
aria-label={labelText}
|
|
13
27
|
checked={value || typeof value === 'string'}
|
|
14
28
|
disabled={isEditMode}
|
|
15
29
|
onChange={(e, { checked }) => {
|
|
@@ -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
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useContext } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Message } from 'semantic-ui-react';
|
|
4
4
|
import { defineMessages, useIntl } from 'react-intl';
|
|
@@ -8,6 +8,7 @@ import MaybeWrap from '@plone/volto/components/manage/MaybeWrap/MaybeWrap';
|
|
|
8
8
|
import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import config from '@plone/volto/registry';
|
|
11
|
+
import { GridContext } from '@plone/volto/components/manage/Blocks/Grid/context';
|
|
11
12
|
|
|
12
13
|
const messages = defineMessages({
|
|
13
14
|
PleaseChooseContent: {
|
|
@@ -18,7 +19,7 @@ const messages = defineMessages({
|
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
const TeaserDefaultTemplate = (props) => {
|
|
21
|
-
const { className, data, isEditMode, style } = props;
|
|
22
|
+
const { className, data, isContainer: inGrid, isEditMode, style } = props;
|
|
22
23
|
const intl = useIntl();
|
|
23
24
|
const href = data.href?.[0];
|
|
24
25
|
const image = data.preview_image?.[0];
|
|
@@ -26,6 +27,12 @@ const TeaserDefaultTemplate = (props) => {
|
|
|
26
27
|
|
|
27
28
|
const Image = config.getComponent('Image').component;
|
|
28
29
|
const { openExternalLinkInNewTab } = config.settings;
|
|
30
|
+
const columns = useContext(GridContext);
|
|
31
|
+
const sizes = config.blocks.blocksConfig.teaser.getSizes({
|
|
32
|
+
data,
|
|
33
|
+
inGrid,
|
|
34
|
+
columns,
|
|
35
|
+
});
|
|
29
36
|
|
|
30
37
|
return (
|
|
31
38
|
<div className={cx('block teaser', className)} style={style}>
|
|
@@ -33,7 +40,7 @@ const TeaserDefaultTemplate = (props) => {
|
|
|
33
40
|
{!href && isEditMode && (
|
|
34
41
|
<Message>
|
|
35
42
|
<div className="teaser-item placeholder">
|
|
36
|
-
<
|
|
43
|
+
<Image src={imageBlockSVG} alt="" />
|
|
37
44
|
<p>{intl.formatMessage(messages.PleaseChooseContent)}</p>
|
|
38
45
|
</div>
|
|
39
46
|
</Message>
|
|
@@ -64,6 +71,7 @@ const TeaserDefaultTemplate = (props) => {
|
|
|
64
71
|
alt=""
|
|
65
72
|
loading="lazy"
|
|
66
73
|
responsive={true}
|
|
74
|
+
sizes={sizes}
|
|
67
75
|
/>
|
|
68
76
|
</div>
|
|
69
77
|
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import config from '@plone/volto/registry';
|
|
2
|
+
|
|
3
|
+
export function getTeaserBlockSizes({
|
|
4
|
+
data = {},
|
|
5
|
+
inGrid = false,
|
|
6
|
+
columns = 1,
|
|
7
|
+
} = {}) {
|
|
8
|
+
const { tabletBreakpoint, defaultContainerWidth } = config.settings.layout;
|
|
9
|
+
const desktopImageWidth = Math.floor(
|
|
10
|
+
defaultContainerWidth / (inGrid ? columns : 2),
|
|
11
|
+
);
|
|
12
|
+
return `auto, (max-width: ${tabletBreakpoint}px) 100vw, ${desktopImageWidth}px`;
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getTeaserBlockSizes } from './utils';
|
|
2
|
+
import config from '@plone/volto/registry';
|
|
3
|
+
|
|
4
|
+
config.settings.layout = { tabletBreakpoint: 768, defaultContainerWidth: 940 };
|
|
5
|
+
|
|
6
|
+
describe('getTeaserBlockSizes', () => {
|
|
7
|
+
it('returns the teaser sizes string for a standalone teaser block', () => {
|
|
8
|
+
expect(getTeaserBlockSizes()).toBe('auto, (max-width: 768px) 100vw, 470px');
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('returns the teaser sizes for a 1-column grid', () => {
|
|
12
|
+
expect(getTeaserBlockSizes({ inGrid: true, columns: 1 })).toBe(
|
|
13
|
+
'auto, (max-width: 768px) 100vw, 940px',
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('returns the teaser sizes for 2 columns', () => {
|
|
18
|
+
expect(getTeaserBlockSizes({ inGrid: true, columns: 2 })).toBe(
|
|
19
|
+
'auto, (max-width: 768px) 100vw, 470px',
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('returns the teaser sizes for 3 columns', () => {
|
|
24
|
+
expect(getTeaserBlockSizes({ inGrid: true, columns: 3 })).toBe(
|
|
25
|
+
'auto, (max-width: 768px) 100vw, 313px',
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('returns the teaser sizes for 4 columns', () => {
|
|
30
|
+
expect(getTeaserBlockSizes({ inGrid: true, columns: 4 })).toBe(
|
|
31
|
+
'auto, (max-width: 768px) 100vw, 235px',
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -17,6 +17,10 @@ const messages = defineMessages({
|
|
|
17
17
|
id: 'Type the title…',
|
|
18
18
|
defaultMessage: 'Type the title…',
|
|
19
19
|
},
|
|
20
|
+
editable_title: {
|
|
21
|
+
id: 'Content title',
|
|
22
|
+
defaultMessage: 'Content title',
|
|
23
|
+
},
|
|
20
24
|
});
|
|
21
25
|
|
|
22
26
|
function usePrevious(value) {
|
|
@@ -159,6 +163,7 @@ export const TitleBlockEdit = (props) => {
|
|
|
159
163
|
renderElement={renderElement}
|
|
160
164
|
onFocus={handleFocus}
|
|
161
165
|
aria-multiline="false"
|
|
166
|
+
aria-label={intl.formatMessage(messages.editable_title)}
|
|
162
167
|
></Editable>
|
|
163
168
|
</Slate>
|
|
164
169
|
);
|
|
@@ -4,19 +4,29 @@ import { FormattedMessage } from 'react-intl';
|
|
|
4
4
|
import { Embed, Message } from 'semantic-ui-react';
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
7
|
+
import VideoEmbed from '@plone/volto/components/theme/VideoEmbed/VideoEmbed';
|
|
8
|
+
import config from '@plone/volto/registry';
|
|
7
9
|
|
|
8
10
|
//Extracting videoID, listID and thumbnailURL from the video URL
|
|
9
|
-
const getVideoIDAndPlaceholder = (url) => {
|
|
11
|
+
const getVideoIDAndPlaceholder = (url, peertubeInstances) => {
|
|
12
|
+
let hasMatch = false;
|
|
10
13
|
let videoID = null;
|
|
11
14
|
let listID = null;
|
|
12
15
|
let thumbnailURL = null;
|
|
16
|
+
let videoSource = null;
|
|
17
|
+
let videoUrl = null;
|
|
13
18
|
|
|
14
19
|
if (url) {
|
|
15
|
-
if (
|
|
20
|
+
if (
|
|
21
|
+
/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)(?:.*)$/i.test(url)
|
|
22
|
+
) {
|
|
23
|
+
hasMatch = true;
|
|
24
|
+
videoSource = 'youtube';
|
|
16
25
|
if (url.match('list')) {
|
|
17
26
|
const matches = url.match(/^.*\?list=(.*)|^.*&list=(.*)$/);
|
|
18
27
|
listID = matches[1] || matches[2];
|
|
19
|
-
|
|
28
|
+
videoUrl = `https://www.youtube.com/embed/videoseries?list=${listID}`;
|
|
29
|
+
videoSource = null;
|
|
20
30
|
let thumbnailID = null;
|
|
21
31
|
if (url.match(/\?v=(.*)&list/)) {
|
|
22
32
|
thumbnailID = url.match(/^.*\?v=(.*)&list(.*)/)[1];
|
|
@@ -32,6 +42,8 @@ const getVideoIDAndPlaceholder = (url) => {
|
|
|
32
42
|
videoID = url.match(/^.*\.be\/(.*)/)[1];
|
|
33
43
|
} else if (url.match(/\?v=/)) {
|
|
34
44
|
videoID = url.match(/^.*\?v=(.*)$/)[1];
|
|
45
|
+
} else if (url.match('shorts')) {
|
|
46
|
+
videoID = url.match(/^.*\/shorts\/(.*)/)[1];
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
if (videoID) {
|
|
@@ -44,6 +56,8 @@ const getVideoIDAndPlaceholder = (url) => {
|
|
|
44
56
|
'https://img.youtube.com/vi/' + thumbnailID + '/sddefault.jpg';
|
|
45
57
|
}
|
|
46
58
|
} else if (url.match('vimeo')) {
|
|
59
|
+
hasMatch = true;
|
|
60
|
+
videoSource = 'vimeo';
|
|
47
61
|
videoID = url.match(/^.*\.com\/(.*)/)[1];
|
|
48
62
|
if (videoID) {
|
|
49
63
|
let thumbnailID = videoID;
|
|
@@ -52,22 +66,37 @@ const getVideoIDAndPlaceholder = (url) => {
|
|
|
52
66
|
}
|
|
53
67
|
thumbnailURL = 'https://vumbnail.com/' + thumbnailID + '.jpg';
|
|
54
68
|
}
|
|
69
|
+
} else if (
|
|
70
|
+
url &&
|
|
71
|
+
Array.isArray(peertubeInstances) &&
|
|
72
|
+
url.match(new RegExp(peertubeInstances.join('|'), 'gi'))
|
|
73
|
+
) {
|
|
74
|
+
const peertubeRegex = /^(https?:\/\/[^/]+)\/w\/([A-Za-z0-9_-]+)/i;
|
|
75
|
+
const match = url.match(peertubeRegex);
|
|
76
|
+
if (match) {
|
|
77
|
+
hasMatch = true;
|
|
78
|
+
videoSource = 'peertube';
|
|
79
|
+
const instance = match[1];
|
|
80
|
+
videoID = match[2];
|
|
81
|
+
videoUrl = `${instance}/videos/embed/${videoID}`;
|
|
82
|
+
}
|
|
55
83
|
}
|
|
56
84
|
}
|
|
57
|
-
return { videoID,
|
|
85
|
+
return { videoID, videoUrl, thumbnailURL, videoSource, hasMatch };
|
|
58
86
|
};
|
|
59
|
-
|
|
60
87
|
const Body = ({ data, isEditMode }) => {
|
|
61
88
|
let placeholder = data.preview_image
|
|
62
89
|
? isInternalURL(data.preview_image)
|
|
63
90
|
? `${flattenToAppURL(data.preview_image)}/@@images/image`
|
|
64
91
|
: data.preview_image
|
|
65
92
|
: null;
|
|
93
|
+
const peertubeInstances =
|
|
94
|
+
config.blocks.blocksConfig.video.allowedPeertubeInstances;
|
|
66
95
|
|
|
67
|
-
const { videoID,
|
|
96
|
+
const { videoID, videoUrl, thumbnailURL, videoSource, hasMatch, listID } =
|
|
97
|
+
getVideoIDAndPlaceholder(data.url, peertubeInstances);
|
|
68
98
|
|
|
69
99
|
placeholder = !placeholder ? thumbnailURL : placeholder;
|
|
70
|
-
|
|
71
100
|
const ref = React.createRef();
|
|
72
101
|
const onKeyDown = (e) => {
|
|
73
102
|
if (e.nativeEvent.keyCode === 13) {
|
|
@@ -77,13 +106,16 @@ const Body = ({ data, isEditMode }) => {
|
|
|
77
106
|
|
|
78
107
|
const embedSettings = {
|
|
79
108
|
placeholder: placeholder,
|
|
80
|
-
icon: 'play',
|
|
81
109
|
defaultActive: false,
|
|
82
|
-
autoplay: false,
|
|
110
|
+
autoplay: data.autoplay || false,
|
|
83
111
|
aspectRatio: '16:9',
|
|
84
112
|
tabIndex: 0,
|
|
85
113
|
onKeyPress: onKeyDown,
|
|
86
114
|
ref: ref,
|
|
115
|
+
title: data.title,
|
|
116
|
+
id: videoID,
|
|
117
|
+
source: videoSource,
|
|
118
|
+
url: videoUrl,
|
|
87
119
|
};
|
|
88
120
|
|
|
89
121
|
return (
|
|
@@ -94,7 +126,7 @@ const Body = ({ data, isEditMode }) => {
|
|
|
94
126
|
'full-width': data.align === 'full',
|
|
95
127
|
})}
|
|
96
128
|
>
|
|
97
|
-
{
|
|
129
|
+
{hasMatch ? (
|
|
98
130
|
<>
|
|
99
131
|
{data.url.match('list') ? (
|
|
100
132
|
<Embed
|
|
@@ -102,44 +134,38 @@ const Body = ({ data, isEditMode }) => {
|
|
|
102
134
|
{...embedSettings}
|
|
103
135
|
/>
|
|
104
136
|
) : (
|
|
105
|
-
<
|
|
137
|
+
<VideoEmbed id={videoID} {...embedSettings} />
|
|
106
138
|
)}
|
|
107
139
|
</>
|
|
108
140
|
) : (
|
|
109
141
|
<>
|
|
110
|
-
{data.url.match('
|
|
111
|
-
|
|
142
|
+
{data.url.match('.mp4') ? (
|
|
143
|
+
// eslint-disable-next-line jsx-a11y/media-has-caption
|
|
144
|
+
<video
|
|
145
|
+
src={
|
|
146
|
+
isInternalURL(data.url)
|
|
147
|
+
? data.url.includes('@@download')
|
|
148
|
+
? data.url
|
|
149
|
+
: `${flattenToAppURL(data.url)}/@@download/file`
|
|
150
|
+
: data.url
|
|
151
|
+
}
|
|
152
|
+
controls
|
|
153
|
+
poster={placeholder}
|
|
154
|
+
type="video/mp4"
|
|
155
|
+
/>
|
|
156
|
+
) : isEditMode ? (
|
|
157
|
+
<div>
|
|
158
|
+
<Message>
|
|
159
|
+
<center>
|
|
160
|
+
<FormattedMessage
|
|
161
|
+
id="Please enter a valid URL by deleting the block and adding a new video block."
|
|
162
|
+
defaultMessage="Please enter a valid URL by deleting the block and adding a new video block."
|
|
163
|
+
/>
|
|
164
|
+
</center>
|
|
165
|
+
</Message>
|
|
166
|
+
</div>
|
|
112
167
|
) : (
|
|
113
|
-
|
|
114
|
-
{data.url.match('.mp4') ? (
|
|
115
|
-
// eslint-disable-next-line jsx-a11y/media-has-caption
|
|
116
|
-
<video
|
|
117
|
-
src={
|
|
118
|
-
isInternalURL(data.url)
|
|
119
|
-
? data.url.includes('@@download')
|
|
120
|
-
? data.url
|
|
121
|
-
: `${flattenToAppURL(data.url)}/@@download/file`
|
|
122
|
-
: data.url
|
|
123
|
-
}
|
|
124
|
-
controls
|
|
125
|
-
poster={placeholder}
|
|
126
|
-
type="video/mp4"
|
|
127
|
-
/>
|
|
128
|
-
) : isEditMode ? (
|
|
129
|
-
<div>
|
|
130
|
-
<Message>
|
|
131
|
-
<center>
|
|
132
|
-
<FormattedMessage
|
|
133
|
-
id="Please enter a valid URL by deleting the block and adding a new video block."
|
|
134
|
-
defaultMessage="Please enter a valid URL by deleting the block and adding a new video block."
|
|
135
|
-
/>
|
|
136
|
-
</center>
|
|
137
|
-
</Message>
|
|
138
|
-
</div>
|
|
139
|
-
) : (
|
|
140
|
-
<div className="invalidVideoFormat" />
|
|
141
|
-
)}
|
|
142
|
-
</>
|
|
168
|
+
<div className="invalidVideoFormat" />
|
|
143
169
|
)}
|
|
144
170
|
</>
|
|
145
171
|
)}
|
|
@@ -20,6 +20,12 @@ config.blocks.blocksConfig = {
|
|
|
20
20
|
addPermission: [],
|
|
21
21
|
view: [],
|
|
22
22
|
},
|
|
23
|
+
allowedPeertubeInstances: [
|
|
24
|
+
'freediverse.com', // About: https://freediverse.com/about/instance
|
|
25
|
+
'fair.tube', // About: https://fair.tube/about/instance
|
|
26
|
+
'tube.reseau-canope.fr', // About: https://tube.reseau-canope.fr/about/instance
|
|
27
|
+
'peertube.eus', // About: https://peertube.eus/about/instance
|
|
28
|
+
],
|
|
23
29
|
},
|
|
24
30
|
};
|
|
25
31
|
|
|
@@ -29,10 +35,13 @@ test('renders a youtube video component with "list" in its url', () => {
|
|
|
29
35
|
const url =
|
|
30
36
|
'https://www.youtube.com/watch?v=KwRSRRyuk-Q&list=PLGN9BI-OAQkQmEqf6O8jeyoFY1b2hD1uL&index=1';
|
|
31
37
|
const videoDetails = getVideoIDAndPlaceholder(url);
|
|
38
|
+
const listID = 'PLGN9BI-OAQkQmEqf6O8jeyoFY1b2hD1uL&index=1';
|
|
32
39
|
expect(videoDetails).toEqual({
|
|
40
|
+
hasMatch: true,
|
|
33
41
|
videoID: null,
|
|
34
|
-
|
|
42
|
+
videoUrl: `https://www.youtube.com/embed/videoseries?list=${listID}`,
|
|
35
43
|
thumbnailURL: 'https://img.youtube.com/vi/KwRSRRyuk-Q/sddefault.jpg',
|
|
44
|
+
videoSource: null,
|
|
36
45
|
});
|
|
37
46
|
});
|
|
38
47
|
|
|
@@ -40,9 +49,11 @@ test('extracts video details from a youtube video with "/live/" in its url', ()
|
|
|
40
49
|
const url = 'https://www.youtube.com/live/ISdHvS6Ck3k?si=COeVakmC1lI6jQy3';
|
|
41
50
|
const videoDetails = getVideoIDAndPlaceholder(url);
|
|
42
51
|
expect(videoDetails).toEqual({
|
|
52
|
+
hasMatch: true,
|
|
43
53
|
videoID: 'ISdHvS6Ck3k?si=COeVakmC1lI6jQy3',
|
|
44
|
-
|
|
54
|
+
videoUrl: null,
|
|
45
55
|
thumbnailURL: 'https://img.youtube.com/vi/ISdHvS6Ck3k/sddefault.jpg',
|
|
56
|
+
videoSource: 'youtube',
|
|
46
57
|
});
|
|
47
58
|
});
|
|
48
59
|
|
|
@@ -50,9 +61,11 @@ test('extracts video details from a youtube video with ".be/" in its url', () =>
|
|
|
50
61
|
const url = 'https://youtu.be/P9j-xYdWT28?si=zZ2putStJbPBLCdt';
|
|
51
62
|
const videoDetails = getVideoIDAndPlaceholder(url);
|
|
52
63
|
expect(videoDetails).toEqual({
|
|
64
|
+
hasMatch: true,
|
|
53
65
|
videoID: 'P9j-xYdWT28?si=zZ2putStJbPBLCdt',
|
|
54
|
-
|
|
66
|
+
videoUrl: null,
|
|
55
67
|
thumbnailURL: 'https://img.youtube.com/vi/P9j-xYdWT28/sddefault.jpg',
|
|
68
|
+
videoSource: 'youtube',
|
|
56
69
|
});
|
|
57
70
|
});
|
|
58
71
|
|
|
@@ -60,9 +73,23 @@ test('extracts video details from a youtube video with "?v=" in its url', () =>
|
|
|
60
73
|
const url = 'https://www.youtube.com/watch?v=KUd6e105u_I';
|
|
61
74
|
const videoDetails = getVideoIDAndPlaceholder(url);
|
|
62
75
|
expect(videoDetails).toEqual({
|
|
76
|
+
hasMatch: true,
|
|
63
77
|
videoID: 'KUd6e105u_I',
|
|
64
|
-
|
|
78
|
+
videoUrl: null,
|
|
65
79
|
thumbnailURL: 'https://img.youtube.com/vi/KUd6e105u_I/sddefault.jpg',
|
|
80
|
+
videoSource: 'youtube',
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('extracts video details from a youtube short', () => {
|
|
85
|
+
const url = 'https://www.youtube.com/shorts/_-DjLZCfGOg';
|
|
86
|
+
const videoDetails = getVideoIDAndPlaceholder(url);
|
|
87
|
+
expect(videoDetails).toEqual({
|
|
88
|
+
hasMatch: true,
|
|
89
|
+
videoID: '_-DjLZCfGOg',
|
|
90
|
+
videoUrl: null,
|
|
91
|
+
thumbnailURL: 'https://img.youtube.com/vi/_-DjLZCfGOg/sddefault.jpg',
|
|
92
|
+
videoSource: 'youtube',
|
|
66
93
|
});
|
|
67
94
|
});
|
|
68
95
|
|
|
@@ -70,9 +97,11 @@ test('extracts video details from a vimeo video url', () => {
|
|
|
70
97
|
const url = 'https://vimeo.com/639449679';
|
|
71
98
|
const videoDetails = getVideoIDAndPlaceholder(url);
|
|
72
99
|
expect(videoDetails).toEqual({
|
|
100
|
+
hasMatch: true,
|
|
73
101
|
videoID: '639449679',
|
|
74
|
-
|
|
102
|
+
videoUrl: null,
|
|
75
103
|
thumbnailURL: 'https://vumbnail.com/639449679.jpg',
|
|
104
|
+
videoSource: 'vimeo',
|
|
76
105
|
});
|
|
77
106
|
});
|
|
78
107
|
|
|
@@ -98,6 +127,94 @@ test('renders a youtube video body component', () => {
|
|
|
98
127
|
expect(json).toMatchSnapshot();
|
|
99
128
|
});
|
|
100
129
|
|
|
130
|
+
test('renders a youtu.be video body component', () => {
|
|
131
|
+
const store = mockStore({
|
|
132
|
+
intl: {
|
|
133
|
+
locale: 'en',
|
|
134
|
+
messages: {},
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const component = renderer.create(
|
|
139
|
+
<Provider store={store}>
|
|
140
|
+
<Body
|
|
141
|
+
data={{
|
|
142
|
+
'@type': 'video',
|
|
143
|
+
url: 'https://youtu.be/KwRSRRyuk-Q',
|
|
144
|
+
}}
|
|
145
|
+
/>
|
|
146
|
+
</Provider>,
|
|
147
|
+
);
|
|
148
|
+
const json = component.toJSON();
|
|
149
|
+
expect(json).toMatchSnapshot();
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test('renders a youtube short video body component', () => {
|
|
153
|
+
const store = mockStore({
|
|
154
|
+
intl: {
|
|
155
|
+
locale: 'en',
|
|
156
|
+
messages: {},
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
const component = renderer.create(
|
|
161
|
+
<Provider store={store}>
|
|
162
|
+
<Body
|
|
163
|
+
data={{
|
|
164
|
+
'@type': 'video',
|
|
165
|
+
url: 'https://www.youtube.com/shorts/ayyZ_S30Lhc',
|
|
166
|
+
}}
|
|
167
|
+
/>
|
|
168
|
+
</Provider>,
|
|
169
|
+
);
|
|
170
|
+
const json = component.toJSON();
|
|
171
|
+
expect(json).toMatchSnapshot();
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
test('renders a peertube video body component', () => {
|
|
175
|
+
const store = mockStore({
|
|
176
|
+
intl: {
|
|
177
|
+
locale: 'en',
|
|
178
|
+
messages: {},
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
const component = renderer.create(
|
|
183
|
+
<Provider store={store}>
|
|
184
|
+
<Body
|
|
185
|
+
data={{
|
|
186
|
+
'@type': 'video',
|
|
187
|
+
url: 'https://peertube.eus/w/qjubDnZ79UmmjhAUqvX2zu',
|
|
188
|
+
}}
|
|
189
|
+
/>
|
|
190
|
+
</Provider>,
|
|
191
|
+
);
|
|
192
|
+
const json = component.toJSON();
|
|
193
|
+
expect(json).toMatchSnapshot();
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
test('renders a incorrect peertube video body component', () => {
|
|
197
|
+
const store = mockStore({
|
|
198
|
+
intl: {
|
|
199
|
+
locale: 'en',
|
|
200
|
+
messages: {},
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
const component = renderer.create(
|
|
205
|
+
<Provider store={store}>
|
|
206
|
+
<Body
|
|
207
|
+
data={{
|
|
208
|
+
'@type': 'video',
|
|
209
|
+
url: 'https://other.peertubes.eus/w/qjubDnZ79UmmjhAUqvX2zu',
|
|
210
|
+
}}
|
|
211
|
+
/>
|
|
212
|
+
</Provider>,
|
|
213
|
+
);
|
|
214
|
+
const json = component.toJSON();
|
|
215
|
+
expect(json).toMatchSnapshot();
|
|
216
|
+
});
|
|
217
|
+
|
|
101
218
|
test('renders a youtube video body component in edit mode', () => {
|
|
102
219
|
const store = mockStore({
|
|
103
220
|
intl: {
|