diff --git a/PACKAGES.md b/PACKAGES.md index 5e12ae1955..5f72ef477c 100644 --- a/PACKAGES.md +++ b/PACKAGES.md @@ -2,17 +2,37 @@ This document describes the packages that come with Volto, the default frontend for Plone 6. +These packages are part of Plone's API-first story. +Most of them are experimental and are marked in their respective `README` files. +Plone 6.1.x (Volto 18) depends on: +- `@plone/registry` +- `@plone/scripts` +- `@plone/volto-slate` + +and as a development dependency: +- `@plone/types` + +Plone 6.0.x (Volto 17 and below) does not use any of them. + +These packages are expected to be used and become part of Plone 7. +Some of them might become part of Plone 6.1.x minor versions. + +The packages are divided into three categories or types: + +- core +- utilities +- add-ons + ## `@plone/types` Plone types is a special development package. It contains the Plone typings for TypeScript. -It's considered a core package, and it's the only package that the other core packages can rely on as -a `devDependency` in your project configuration. +It's considered a core package, and it's the only package that the other core packages can rely on as a `devDependency` in your project configuration. This package contains `.d.ts` typing definitions, curated by hand. -Due to the nature of this package, it does not need bundling. -It's published "as is", so you can import the type definitions from anywhere in your code. +Due to the nature of this package, it does not need to be built nor bundled. +It is published "as is", so you can import the type definitions from anywhere in your code. ## Core packages @@ -29,12 +49,10 @@ They must be published and bundled in a traditional (transpiled) way. The bundle of these packages must work on both CommonJS and ECMAScript Module (ESM) environments. -## Utility packages +## Utilities packages -- `@plone/drivers` -- `@plone/helpers` - `@plone/providers` -- `@plone/rsc` +- `@plone/helpers` ### Rules @@ -44,19 +62,22 @@ They must be published in the traditional way, as a bundle. This bundle must work on both CommonJS and ESM environments. -## Feature packages +## Add-on packages - `@plone/blocks` -- `@plone/contents` - `@plone/slots` +- `@plone/theming` +- `@plone/contents` ### Rules -Feature packages, or add-on packages, can depend on any other package. +Add-on or feature packages, can depend on any other package. You must distribute them as source code, and not transpile them. They must provide a default configuration registry loader as the default main entry point export. -They must be loadable as any other add-on. +Unlike Volto add-ons, do *NOT* place the code in the `src` folder. +If you do not transpile the package, the direct resolution must work out of the box, where both the bundler and TypeScript resolution are direct. +They must be loadable as any other add-on, and contain an add-on registry compatible `install`-able default export. ## Development utility packages diff --git a/docs/source/release-notes/index.md b/docs/source/release-notes/index.md index 7faa526e3e..e5524fc087 100644 --- a/docs/source/release-notes/index.md +++ b/docs/source/release-notes/index.md @@ -17,6 +17,29 @@ myst: +## 18.2.3 (2024-12-09) + +### Bugfix + +- Fixed circular import error in dev with HMR in core Views and Widgets shadow customizations. @sneridagh [#6526](https://github.com/plone/volto/issues/6526) + +## 18.2.2 (2024-12-09) + +### Bugfix + +- Fixed circular import error in dev with HMR in core Blocks shadow customizations. @sneridagh [#6525](https://github.com/plone/volto/issues/6525) + +## 18.2.1 (2024-12-09) + +### Bugfix + +- Fixes ICS download in non-public event content. @sneridagh [#6515](https://github.com/plone/volto/issues/6515) +- Fixed circular import error in dev with HMR in `App` component when imported in the main default config. @sneridagh [#6524](https://github.com/plone/volto/issues/6524) + +### Internal + +- Fix extension in files containing JSX. @sneridagh [#6520](https://github.com/plone/volto/issues/6520) + ## 18.2.0 (2024-12-08) ### Internal diff --git a/packages/volto-slate/CHANGELOG.md b/packages/volto-slate/CHANGELOG.md index 31bb6fbdee..1693cb8f47 100644 --- a/packages/volto-slate/CHANGELOG.md +++ b/packages/volto-slate/CHANGELOG.md @@ -8,6 +8,12 @@ +## 18.0.3 (2024-12-09) + +### Internal + +- Fix extension in files containing JSX. @sneridagh [#6520](https://github.com/plone/volto/issues/6520) + ## 18.0.2 (2024-12-08) ### Internal diff --git a/packages/volto-slate/package.json b/packages/volto-slate/package.json index 7e5e1103ca..c0e41e043d 100644 --- a/packages/volto-slate/package.json +++ b/packages/volto-slate/package.json @@ -1,6 +1,6 @@ { "name": "@plone/volto-slate", - "version": "18.0.2", + "version": "18.0.3", "description": "Slate.js integration with Volto", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", diff --git a/packages/volto-slate/src/blocks/Table/Cell.test.js b/packages/volto-slate/src/blocks/Table/Cell.test.jsx similarity index 100% rename from packages/volto-slate/src/blocks/Table/Cell.test.js rename to packages/volto-slate/src/blocks/Table/Cell.test.jsx diff --git a/packages/volto-slate/src/blocks/Table/TableBlockEdit.test.js b/packages/volto-slate/src/blocks/Table/TableBlockEdit.test.jsx similarity index 100% rename from packages/volto-slate/src/blocks/Table/TableBlockEdit.test.js rename to packages/volto-slate/src/blocks/Table/TableBlockEdit.test.jsx diff --git a/packages/volto-slate/src/blocks/Table/TableBlockView.test.js b/packages/volto-slate/src/blocks/Table/TableBlockView.test.jsx similarity index 100% rename from packages/volto-slate/src/blocks/Table/TableBlockView.test.js rename to packages/volto-slate/src/blocks/Table/TableBlockView.test.jsx diff --git a/packages/volto-slate/src/blocks/Text/TextBlockEdit.test.js b/packages/volto-slate/src/blocks/Text/TextBlockEdit.test.jsx similarity index 100% rename from packages/volto-slate/src/blocks/Text/TextBlockEdit.test.js rename to packages/volto-slate/src/blocks/Text/TextBlockEdit.test.jsx diff --git a/packages/volto-slate/src/editor/ui/ToolbarButton.test.js b/packages/volto-slate/src/editor/ui/ToolbarButton.test.jsx similarity index 100% rename from packages/volto-slate/src/editor/ui/ToolbarButton.test.js rename to packages/volto-slate/src/editor/ui/ToolbarButton.test.jsx diff --git a/packages/volto-slate/src/elementEditor/makeInlineElementPlugin.js b/packages/volto-slate/src/elementEditor/makeInlineElementPlugin.jsx similarity index 100% rename from packages/volto-slate/src/elementEditor/makeInlineElementPlugin.js rename to packages/volto-slate/src/elementEditor/makeInlineElementPlugin.jsx diff --git a/packages/volto/.eslintrc.core.js b/packages/volto/.eslintrc.core.js index 41cf953afe..a6b04e24c1 100644 --- a/packages/volto/.eslintrc.core.js +++ b/packages/volto/.eslintrc.core.js @@ -11,6 +11,7 @@ if (process.env.VOLTOCONFIG) { rules = null; } else { rules = { + 'react/jsx-filename-extension': ['warn', { extensions: ['.tsx', '.jsx'] }], 'no-restricted-imports': [ 'warn', { diff --git a/packages/volto/.release-it.json b/packages/volto/.release-it.json index 0395373591..ecce30528b 100644 --- a/packages/volto/.release-it.json +++ b/packages/volto/.release-it.json @@ -3,7 +3,7 @@ "../scripts/prepublish.js": {} }, "hooks": { - "before:bump": ["pnpm i18n", "pnpm build:types", "git add types"], + "before:bump": ["pnpm i18n"], "after:bump": [ "pipx run towncrier build --draft --yes --version ${version} > .changelog.draft", "pipx run towncrier build --yes --version ${version}", diff --git a/packages/volto/CHANGELOG.md b/packages/volto/CHANGELOG.md index 7faa526e3e..e5524fc087 100644 --- a/packages/volto/CHANGELOG.md +++ b/packages/volto/CHANGELOG.md @@ -17,6 +17,29 @@ myst: +## 18.2.3 (2024-12-09) + +### Bugfix + +- Fixed circular import error in dev with HMR in core Views and Widgets shadow customizations. @sneridagh [#6526](https://github.com/plone/volto/issues/6526) + +## 18.2.2 (2024-12-09) + +### Bugfix + +- Fixed circular import error in dev with HMR in core Blocks shadow customizations. @sneridagh [#6525](https://github.com/plone/volto/issues/6525) + +## 18.2.1 (2024-12-09) + +### Bugfix + +- Fixes ICS download in non-public event content. @sneridagh [#6515](https://github.com/plone/volto/issues/6515) +- Fixed circular import error in dev with HMR in `App` component when imported in the main default config. @sneridagh [#6524](https://github.com/plone/volto/issues/6524) + +### Internal + +- Fix extension in files containing JSX. @sneridagh [#6520](https://github.com/plone/volto/issues/6520) + ## 18.2.0 (2024-12-08) ### Internal diff --git a/packages/volto/news/6523.bugfix b/packages/volto/news/6523.bugfix new file mode 100644 index 0000000000..81d4a50ae7 --- /dev/null +++ b/packages/volto/news/6523.bugfix @@ -0,0 +1 @@ +Disable initial scroll to top after SSR completion. @Faakhir30 diff --git a/packages/volto/package.json b/packages/volto/package.json index bb57ff9920..afe541524b 100644 --- a/packages/volto/package.json +++ b/packages/volto/package.json @@ -9,7 +9,7 @@ } ], "license": "MIT", - "version": "18.2.0", + "version": "18.2.3", "repository": { "type": "git", "url": "git@github.com:plone/volto.git" diff --git a/packages/volto/src/components/manage/Pluggable/Pluggable.stories.js b/packages/volto/src/components/manage/Pluggable/Pluggable.stories.jsx similarity index 100% rename from packages/volto/src/components/manage/Pluggable/Pluggable.stories.js rename to packages/volto/src/components/manage/Pluggable/Pluggable.stories.jsx diff --git a/packages/volto/src/components/manage/Pluggable/Pluggable.test.js b/packages/volto/src/components/manage/Pluggable/Pluggable.test.jsx similarity index 100% rename from packages/volto/src/components/manage/Pluggable/Pluggable.test.js rename to packages/volto/src/components/manage/Pluggable/Pluggable.test.jsx diff --git a/packages/volto/src/components/manage/Pluggable/__snapshots__/Pluggable.test.js.snap b/packages/volto/src/components/manage/Pluggable/__snapshots__/Pluggable.test.jsx.snap similarity index 100% rename from packages/volto/src/components/manage/Pluggable/__snapshots__/Pluggable.test.js.snap rename to packages/volto/src/components/manage/Pluggable/__snapshots__/Pluggable.test.jsx.snap diff --git a/packages/volto/src/components/manage/UniversalLink/UniversalLink.stories.js b/packages/volto/src/components/manage/UniversalLink/UniversalLink.stories.jsx similarity index 100% rename from packages/volto/src/components/manage/UniversalLink/UniversalLink.stories.js rename to packages/volto/src/components/manage/UniversalLink/UniversalLink.stories.jsx diff --git a/packages/volto/src/components/manage/Widgets/ObjectBrowserWidget.stories.js b/packages/volto/src/components/manage/Widgets/ObjectBrowserWidget.stories.jsx similarity index 100% rename from packages/volto/src/components/manage/Widgets/ObjectBrowserWidget.stories.js rename to packages/volto/src/components/manage/Widgets/ObjectBrowserWidget.stories.jsx diff --git a/packages/volto/src/components/manage/Widgets/ObjectListWidget.stories.js b/packages/volto/src/components/manage/Widgets/ObjectListWidget.stories.jsx similarity index 100% rename from packages/volto/src/components/manage/Widgets/ObjectListWidget.stories.js rename to packages/volto/src/components/manage/Widgets/ObjectListWidget.stories.jsx diff --git a/packages/volto/src/components/manage/Widgets/ObjectListWidget.test.js b/packages/volto/src/components/manage/Widgets/ObjectListWidget.test.jsx similarity index 100% rename from packages/volto/src/components/manage/Widgets/ObjectListWidget.test.js rename to packages/volto/src/components/manage/Widgets/ObjectListWidget.test.jsx diff --git a/packages/volto/src/components/manage/Widgets/VocabularyTermsWidget.stories.js b/packages/volto/src/components/manage/Widgets/VocabularyTermsWidget.stories.jsx similarity index 100% rename from packages/volto/src/components/manage/Widgets/VocabularyTermsWidget.stories.js rename to packages/volto/src/components/manage/Widgets/VocabularyTermsWidget.stories.jsx diff --git a/packages/volto/src/components/manage/Widgets/__snapshots__/ObjectListWidget.test.js.snap b/packages/volto/src/components/manage/Widgets/__snapshots__/ObjectListWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/manage/Widgets/__snapshots__/ObjectListWidget.test.js.snap rename to packages/volto/src/components/manage/Widgets/__snapshots__/ObjectListWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Avatar/Avatar.stories.js b/packages/volto/src/components/theme/Avatar/Avatar.stories.jsx similarity index 100% rename from packages/volto/src/components/theme/Avatar/Avatar.stories.js rename to packages/volto/src/components/theme/Avatar/Avatar.stories.jsx diff --git a/packages/volto/src/components/theme/EventDetails/EventDetails.jsx b/packages/volto/src/components/theme/EventDetails/EventDetails.jsx index e1ba3dfb89..bbc7964c77 100644 --- a/packages/volto/src/components/theme/EventDetails/EventDetails.jsx +++ b/packages/volto/src/components/theme/EventDetails/EventDetails.jsx @@ -6,7 +6,7 @@ import { Recurrence, } from '@plone/volto/components/theme/View/EventDatesInfo'; import Icon from '@plone/volto/components/theme/Icon/Icon'; -import { expandToBackendURL } from '@plone/volto/helpers/Url/Url'; +import { flattenToAppURL } from '@plone/volto/helpers/Url/Url'; import calendarSVG from '@plone/volto/icons/calendar.svg'; @@ -147,7 +147,7 @@ const EventDetails = ({ content, display_as = 'aside' }) => { className="ics-download" target="_blank" rel="noreferrer" - href={`${expandToBackendURL(content['@id'])}/ics_view`} + href={`${flattenToAppURL(content['@id'])}/ics_view`} > {intl.formatMessage(messages.downloadEvent)} diff --git a/packages/volto/src/components/theme/EventDetails/__snapshots__/EventDetails.test.jsx.snap b/packages/volto/src/components/theme/EventDetails/__snapshots__/EventDetails.test.jsx.snap index 1d605e546b..a7fad6aa2f 100644 --- a/packages/volto/src/components/theme/EventDetails/__snapshots__/EventDetails.test.jsx.snap +++ b/packages/volto/src/components/theme/EventDetails/__snapshots__/EventDetails.test.jsx.snap @@ -127,7 +127,7 @@ exports[`renders event details component with all props 1`] = ` /> @@ -169,7 +169,7 @@ exports[`renders event details component with only required props 1`] = ` /> @@ -211,7 +211,7 @@ exports[`renders event details component without links to api in the text 1`] = /> diff --git a/packages/volto/src/components/theme/Navigation/ContextNavigation.stories.js b/packages/volto/src/components/theme/Navigation/ContextNavigation.stories.jsx similarity index 100% rename from packages/volto/src/components/theme/Navigation/ContextNavigation.stories.js rename to packages/volto/src/components/theme/Navigation/ContextNavigation.stories.jsx diff --git a/packages/volto/src/components/theme/Navigation/withContentNavigation.js b/packages/volto/src/components/theme/Navigation/withContentNavigation.jsx similarity index 100% rename from packages/volto/src/components/theme/Navigation/withContentNavigation.js rename to packages/volto/src/components/theme/Navigation/withContentNavigation.jsx diff --git a/packages/volto/src/components/theme/PreviewImage/PreviewImage.test.js b/packages/volto/src/components/theme/PreviewImage/PreviewImage.test.jsx similarity index 100% rename from packages/volto/src/components/theme/PreviewImage/PreviewImage.test.js rename to packages/volto/src/components/theme/PreviewImage/PreviewImage.test.jsx diff --git a/packages/volto/src/components/theme/PreviewImage/__snapshots__/PreviewImage.test.js.snap b/packages/volto/src/components/theme/PreviewImage/__snapshots__/PreviewImage.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/PreviewImage/__snapshots__/PreviewImage.test.js.snap rename to packages/volto/src/components/theme/PreviewImage/__snapshots__/PreviewImage.test.jsx.snap diff --git a/packages/volto/src/components/theme/Title/Title.stories.js b/packages/volto/src/components/theme/Title/Title.stories.jsx similarity index 100% rename from packages/volto/src/components/theme/Title/Title.stories.js rename to packages/volto/src/components/theme/Title/Title.stories.jsx diff --git a/packages/volto/src/components/theme/View/__snapshots__/EventView.test.jsx.snap b/packages/volto/src/components/theme/View/__snapshots__/EventView.test.jsx.snap index acf53acafc..269d255c4b 100644 --- a/packages/volto/src/components/theme/View/__snapshots__/EventView.test.jsx.snap +++ b/packages/volto/src/components/theme/View/__snapshots__/EventView.test.jsx.snap @@ -251,7 +251,7 @@ exports[`renders an event view component with all props 1`] = ` /> @@ -357,7 +357,7 @@ exports[`renders an event view component with only required props 1`] = ` /> @@ -458,7 +458,7 @@ exports[`renders an event view component without links to api in the text 1`] = /> diff --git a/packages/volto/src/components/theme/Widgets/ArrayWidget.test.js b/packages/volto/src/components/theme/Widgets/ArrayWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/ArrayWidget.test.js rename to packages/volto/src/components/theme/Widgets/ArrayWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/BooleanWidget.test.js b/packages/volto/src/components/theme/Widgets/BooleanWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/BooleanWidget.test.js rename to packages/volto/src/components/theme/Widgets/BooleanWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/DateWidget.test.js b/packages/volto/src/components/theme/Widgets/DateWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/DateWidget.test.js rename to packages/volto/src/components/theme/Widgets/DateWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/DatetimeWidget.test.js b/packages/volto/src/components/theme/Widgets/DatetimeWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/DatetimeWidget.test.js rename to packages/volto/src/components/theme/Widgets/DatetimeWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/DescriptionWidget.test.js b/packages/volto/src/components/theme/Widgets/DescriptionWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/DescriptionWidget.test.js rename to packages/volto/src/components/theme/Widgets/DescriptionWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/EmailWidget.test.js b/packages/volto/src/components/theme/Widgets/EmailWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/EmailWidget.test.js rename to packages/volto/src/components/theme/Widgets/EmailWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/FileWidget.test.js b/packages/volto/src/components/theme/Widgets/FileWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/FileWidget.test.js rename to packages/volto/src/components/theme/Widgets/FileWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/ImageWidget.test.js b/packages/volto/src/components/theme/Widgets/ImageWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/ImageWidget.test.js rename to packages/volto/src/components/theme/Widgets/ImageWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/PasswordWidget.test.js b/packages/volto/src/components/theme/Widgets/PasswordWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/PasswordWidget.test.js rename to packages/volto/src/components/theme/Widgets/PasswordWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/RelationWidget.test.js b/packages/volto/src/components/theme/Widgets/RelationWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/RelationWidget.test.js rename to packages/volto/src/components/theme/Widgets/RelationWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/RelationsWidget.test.js b/packages/volto/src/components/theme/Widgets/RelationsWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/RelationsWidget.test.js rename to packages/volto/src/components/theme/Widgets/RelationsWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/RichTextWidget.test.js b/packages/volto/src/components/theme/Widgets/RichTextWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/RichTextWidget.test.js rename to packages/volto/src/components/theme/Widgets/RichTextWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/SelectWidget.test.js b/packages/volto/src/components/theme/Widgets/SelectWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/SelectWidget.test.js rename to packages/volto/src/components/theme/Widgets/SelectWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/TextWidget.test.js b/packages/volto/src/components/theme/Widgets/TextWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/TextWidget.test.js rename to packages/volto/src/components/theme/Widgets/TextWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/TitleWidget.test.js b/packages/volto/src/components/theme/Widgets/TitleWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/TitleWidget.test.js rename to packages/volto/src/components/theme/Widgets/TitleWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/TokenWidget.test.js b/packages/volto/src/components/theme/Widgets/TokenWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/TokenWidget.test.js rename to packages/volto/src/components/theme/Widgets/TokenWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/UrlWidget.test.js b/packages/volto/src/components/theme/Widgets/UrlWidget.test.jsx similarity index 100% rename from packages/volto/src/components/theme/Widgets/UrlWidget.test.js rename to packages/volto/src/components/theme/Widgets/UrlWidget.test.jsx diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/ArrayWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/ArrayWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/ArrayWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/ArrayWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/BooleanWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/BooleanWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/BooleanWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/BooleanWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/DateWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/DateWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/DateWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/DateWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/DatetimeWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/DatetimeWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/DatetimeWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/DatetimeWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/DescriptionWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/DescriptionWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/DescriptionWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/DescriptionWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/EmailWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/EmailWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/EmailWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/EmailWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/FileWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/FileWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/FileWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/FileWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/ImageWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/ImageWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/ImageWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/ImageWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/PasswordWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/PasswordWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/PasswordWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/PasswordWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/RelationWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/RelationWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/RelationWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/RelationWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/RelationsWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/RelationsWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/RelationsWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/RelationsWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/RichTextWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/RichTextWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/RichTextWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/RichTextWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/SelectWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/SelectWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/SelectWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/SelectWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/TextWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/TextWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/TextWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/TextWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/TitleWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/TitleWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/TitleWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/TitleWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/TokenWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/TokenWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/TokenWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/TokenWidget.test.jsx.snap diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/UrlWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/UrlWidget.test.jsx.snap similarity index 100% rename from packages/volto/src/components/theme/Widgets/__snapshots__/UrlWidget.test.js.snap rename to packages/volto/src/components/theme/Widgets/__snapshots__/UrlWidget.test.jsx.snap diff --git a/packages/volto/src/config/Blocks.jsx b/packages/volto/src/config/Blocks.jsx index 573bdce903..0110a6616c 100644 --- a/packages/volto/src/config/Blocks.jsx +++ b/packages/volto/src/config/Blocks.jsx @@ -530,6 +530,15 @@ const requiredBlocks = ['title']; const initialBlocks = {}; const initialBlocksFocus = {}; //{Document:'title'} +export function installDefaultBlocks(config) { + config.blocks.requiredBlocks = requiredBlocks; + config.blocks.blocksConfig = blocksConfig; + config.blocks.groupBlocksOrder = groupBlocksOrder; + config.blocks.initialBlocks = initialBlocks; + config.blocks.initialBlocksFocus = initialBlocksFocus; + config.blocks.showEditBlocksInBabelView = false; +} + export { groupBlocksOrder, requiredBlocks, diff --git a/packages/volto/src/config/Components.jsx b/packages/volto/src/config/Components.jsx index bd6fea6f85..420a175b43 100644 --- a/packages/volto/src/config/Components.jsx +++ b/packages/volto/src/config/Components.jsx @@ -2,9 +2,12 @@ import App from '@plone/volto/components/theme/App/App'; import PreviewImage from '@plone/volto/components/theme/PreviewImage/PreviewImage'; import Image from '@plone/volto/components/theme/Image/Image'; -// Register components. -export const components = { - PreviewImage: { component: PreviewImage }, - App: { component: App }, - Image: { component: Image }, -}; +export function installDefaultComponents(config) { + config.components = { + PreviewImage: { component: PreviewImage }, + App: { component: App }, + Image: { component: Image }, + }; + + return config; +} diff --git a/packages/volto/src/config/Views.jsx b/packages/volto/src/config/Views.jsx index bb60818ece..e9aef779dc 100644 --- a/packages/volto/src/config/Views.jsx +++ b/packages/volto/src/config/Views.jsx @@ -138,3 +138,13 @@ export const layoutViewsNamesMapping = { view: 'Default view', default: 'Default view', }; + +export function installDefaultViews(config) { + config.views.layoutViews = layoutViews; + config.views.contentTypesViews = contentTypesViews; + config.views.defaultView = defaultView; + config.views.errorViews = errorViews; + config.views.layoutViewsNamesMapping = layoutViewsNamesMapping; + + return config; +} diff --git a/packages/volto/src/config/Widgets.jsx b/packages/volto/src/config/Widgets.jsx index 07f2a72c57..e4be7ea248 100644 --- a/packages/volto/src/config/Widgets.jsx +++ b/packages/volto/src/config/Widgets.jsx @@ -151,3 +151,8 @@ export const widgetMapping = { // Default Widget export const defaultWidget = TextWidget; + +export function installDefaultWidgets(config) { + config.widgets = widgetMapping; + config.widgets.default = defaultWidget; +} diff --git a/packages/volto/src/config/index.js b/packages/volto/src/config/index.js index 348b21319d..48ab6e0159 100644 --- a/packages/volto/src/config/index.js +++ b/packages/volto/src/config/index.js @@ -1,22 +1,7 @@ +import ConfigRegistry from '@plone/volto/registry'; import { parse as parseUrl } from 'url'; -import { defaultWidget, widgetMapping } from './Widgets'; -import { - layoutViews, - contentTypesViews, - defaultView, - errorViews, - layoutViewsNamesMapping, -} from './Views'; import { nonContentRoutes } from './NonContentRoutes'; import { nonContentRoutesPublic } from './NonContentRoutesPublic'; -import { - groupBlocksOrder, - requiredBlocks, - blocksConfig, - initialBlocks, - initialBlocksFocus, -} from './Blocks'; -import { components } from './Components'; import { loadables } from './Loadables'; import { workflowMapping } from './Workflows'; import slots from './slots'; @@ -32,7 +17,10 @@ import { import applyAddonConfiguration, { addonsInfo } from 'load-volto-addons'; -import ConfigRegistry from '@plone/volto/registry'; +import { installDefaultComponents } from './Components'; +import { installDefaultWidgets } from './Widgets'; +import { installDefaultViews } from './Views'; +import { installDefaultBlocks } from './Blocks'; import { getSiteAsyncPropExtender } from '@plone/volto/helpers/Site'; import { registerValidators } from './validation'; @@ -195,28 +183,12 @@ let config = { enabled: true, }, }, - widgets: { - ...widgetMapping, - default: defaultWidget, - }, - views: { - layoutViews, - contentTypesViews, - defaultView, - errorViews, - layoutViewsNamesMapping, - }, - blocks: { - requiredBlocks, - blocksConfig, - groupBlocksOrder, - initialBlocks, - initialBlocksFocus, - showEditBlocksInBabelView: false, - }, + widgets: {}, + views: {}, + blocks: {}, addonRoutes: [], addonReducers: {}, - components, + components: {}, slots: {}, utilities: {}, }; @@ -261,5 +233,9 @@ Object.entries(slots).forEach(([slotName, components]) => { }); registerValidators(ConfigRegistry); +installDefaultComponents(ConfigRegistry); +installDefaultWidgets(ConfigRegistry); +installDefaultViews(ConfigRegistry); +installDefaultBlocks(ConfigRegistry); applyAddonConfiguration(ConfigRegistry); diff --git a/packages/volto/src/express-middleware/files.js b/packages/volto/src/express-middleware/files.js index 40f3f5d71a..547165f201 100644 --- a/packages/volto/src/express-middleware/files.js +++ b/packages/volto/src/express-middleware/files.js @@ -30,7 +30,10 @@ function filesMiddlewareFn(req, res, next) { export default function filesMiddleware() { const middleware = express.Router(); - middleware.all(['**/@@download/*', '**/@@display-file/*'], filesMiddlewareFn); + middleware.all( + ['**/@@download/*', '**/@@display-file/*', '**/ics_view'], + filesMiddlewareFn, + ); middleware.id = 'filesResourcesProcessor'; return middleware; } diff --git a/packages/volto/src/helpers/AsyncConnect/AsyncConnect.test.js b/packages/volto/src/helpers/AsyncConnect/AsyncConnect.test.jsx similarity index 100% rename from packages/volto/src/helpers/AsyncConnect/AsyncConnect.test.js rename to packages/volto/src/helpers/AsyncConnect/AsyncConnect.test.jsx diff --git a/packages/volto/src/helpers/Extensions/__snapshots__/withBlockExtensions.test.js.snap b/packages/volto/src/helpers/Extensions/__snapshots__/withBlockExtensions.test.jsx.snap similarity index 100% rename from packages/volto/src/helpers/Extensions/__snapshots__/withBlockExtensions.test.js.snap rename to packages/volto/src/helpers/Extensions/__snapshots__/withBlockExtensions.test.jsx.snap diff --git a/packages/volto/src/helpers/Extensions/withBlockExtensions.test.js b/packages/volto/src/helpers/Extensions/withBlockExtensions.test.jsx similarity index 100% rename from packages/volto/src/helpers/Extensions/withBlockExtensions.test.js rename to packages/volto/src/helpers/Extensions/withBlockExtensions.test.jsx diff --git a/packages/volto/src/helpers/ScrollToTop/ScrollToTop.jsx b/packages/volto/src/helpers/ScrollToTop/ScrollToTop.jsx index 8122fbea63..1da8f505e1 100644 --- a/packages/volto/src/helpers/ScrollToTop/ScrollToTop.jsx +++ b/packages/volto/src/helpers/ScrollToTop/ScrollToTop.jsx @@ -37,6 +37,7 @@ class ScrollToTop extends React.Component { const isHash = location?.hash || location?.pathname.hash; if ( !isHash && + prevProps.location !== undefined && noInitialBlocksFocus && location?.pathname !== prevProps.location?.pathname ) { diff --git a/packages/volto/src/helpers/Utils/Utils.test.js b/packages/volto/src/helpers/Utils/Utils.test.jsx similarity index 100% rename from packages/volto/src/helpers/Utils/Utils.test.js rename to packages/volto/src/helpers/Utils/Utils.test.jsx diff --git a/packages/volto/types/config/Components.d.ts b/packages/volto/types/config/Components.d.ts index 8f3d09ffa1..7a158367a6 100644 --- a/packages/volto/types/config/Components.d.ts +++ b/packages/volto/types/config/Components.d.ts @@ -1,14 +1 @@ -export namespace components { - namespace PreviewImage { - export { PreviewImage as component }; - } - namespace App { - export { App as component }; - } - namespace Image { - export { Image as component }; - } -} -import PreviewImage_1 from '@plone/volto/components/theme/PreviewImage/PreviewImage'; -import App_1 from '@plone/volto/components/theme/App/App'; -import Image_1 from '@plone/volto/components/theme/Image/Image'; +export function installDefaultComponents(config: any): any;