Skip to content

Commit

Permalink
Merge branch 'main' into vitesupport
Browse files Browse the repository at this point in the history
* main:
  Automatically add the PLIP to the PLIP project board (#6134)
  Fix link to renamed `src/constants/Languages.cjs` (#6135)
  Release 18.0.0-alpha.39
  Release generate-volto 9.0.0-alpha.17
  rename test-setup-config.js to test-setup-config.jsx (#6133)
  Cleanup Image widget and pass down `onSelectItem` prop if any (#6132)
  Release 18.0.0-alpha.38
  Release @plone/slate 18.0.0-alpha.15
  Rename `constants/Language` module to the right suffix, and other actions to make ESM bundlers happy. (#6130)
  • Loading branch information
sneridagh committed Jun 29, 2024
2 parents e2588ae + 51bdfa0 commit 476af45
Show file tree
Hide file tree
Showing 25 changed files with 102 additions and 51 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/PLIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ about: Plone Improvement Proposal
title: ''
labels: '03 type: feature (plip)'
assignees: ''
projects: 'plone/47'

---

Expand Down
2 changes: 1 addition & 1 deletion apps/plone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"setupFiles": [
"@plone/volto/test-setup-globals.js",
"@plone/volto/test-setup-config.js"
"@plone/volto/test-setup-config.jsx"
],
"globals": {
"__DEV__": true
Expand Down
2 changes: 1 addition & 1 deletion docs/source/development/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The workflow for creating *new* translatable text strings is as follows:
1. Extract all i18n strings from your code with a script and create artifacts, like `.po` and `.pot` files.
1. Use your favorite editor to translate all i18n strings by editing the `.po` files.
1. Re-run the script, which then moves the translations from the `.po` files into `.json` files for Volto to use.
1. Edit [`packages/volto/src/constants/Languages.js`](https:/plone/volto/blob/main/packages/volto/src/constants/Languages.js), adding your new language's locale code, as defined in {ref}`i18n-l10n-locale-and-language-tag-conventions-label`.
1. Edit [`packages/volto/src/constants/Languages.cjs`](https:/plone/volto/blob/main/packages/volto/src/constants/Languages.cjs), adding your new language's locale code, as defined in {ref}`i18n-l10n-locale-and-language-tag-conventions-label`.
1. Run the unit tests as described in {ref}`run-jest-tests-on-volto-core-label`, following the prompt to update the snapshot when the test fails.

This way of organizing translations relies on [gettext](https://en.wikipedia.org/wiki/Gettext), a proven and established system with great tool support.
Expand Down
13 changes: 13 additions & 0 deletions docs/source/release-notes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ myst:

<!-- towncrier release notes start -->

## 18.0.0-alpha.39 (2024-06-28)

### Bugfix

- Cleanup Image widget and pass down onSelectItem prop if any @sneridagh [#6132](https:/plone/volto/issues/6132)
- Whitelist some dynamic imports to suppress vite warnings in storybook @tomschall [#6133](https:/plone/volto/issues/6133)

## 18.0.0-alpha.38 (2024-06-28)

### Internal

- Renamed `constants/Languages.js` to `constants/Languages.cjs` @sneridagh [#6130](https:/plone/volto/issues/6130)

## 18.0.0-alpha.37 (2024-06-27)

### Feature
Expand Down
17 changes: 17 additions & 0 deletions docs/source/upgrade-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,23 @@ The input field's placeholder text was moved above the buttons.
Together these changes improve usability both on small screens and in small containers, such as when the widget is in grid block elements.


### Renamed the `constants/Languages` module

`src/constants/Languages.js` has been renamed to `src/constants/Languages.cjs` since, in fact, it's a CommonJS module.
This change is needed for consistency with module suffixes in Volto core, in preparation for replacing Razzle with a modern builder.

The only Volto component that makes use of it is `PersonalPreferences`.
If you shadow it, then you should update this component.
For the rest, it is unlikely that your code refers to this module, since it's used internally by Volto itself.

### Renamed `test-setup-config` module

`test-setup-config.js` has been renamed to `test-setup-config.jsx` since, in fact, it contains JSX.
This change is needed for consistency with module suffixes in Volto core, in preparation for replacing Razzle with a modern builder.

It is unlikely that your code uses it, unless you heavily customized the Jest testing pipeline.


(volto-upgrade-guide-17.x.x)=

## Upgrading to Volto 17.x.x
Expand Down
6 changes: 6 additions & 0 deletions packages/generator-volto/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

<!-- towncrier release notes start -->

## 9.0.0-alpha.17 (2024-06-28)

### Bugfix

- Rename test-setup-config.js to test-setup-config.jsx, otherwise jest tests will eventually fail @tomschall [#6133](https:/plone/volto/issues/6133)

## 9.0.0-alpha.16 (2024-05-15)

### Bugfix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"setupFiles": [
"@plone/volto/test-setup-globals.js",
"@plone/volto/test-setup-config.js"
"@plone/volto/test-setup-config.jsx"
],
"globals": {
"__DEV__": true
Expand Down
2 changes: 1 addition & 1 deletion packages/generator-volto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"license": "MIT",
"version": "9.0.0-alpha.16",
"version": "9.0.0-alpha.17",
"repository": {
"type": "git",
"url": "git+https:/plone/generator-volto.git"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto-slate/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

<!-- towncrier release notes start -->

## 18.0.0-alpha.15 (2024-06-28)

### Internal

- Add proper dependencies to `volto-slate`. @sneridagh [#6130](https:/plone/volto/issues/6130)

## 18.0.0-alpha.14 (2024-06-26)

### Feature
Expand Down
2 changes: 1 addition & 1 deletion packages/volto-slate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@plone/volto-slate",
"version": "18.0.0-alpha.14",
"version": "18.0.0-alpha.15",
"description": "Slate.js integration with Volto",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
13 changes: 13 additions & 0 deletions packages/volto/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ myst:

<!-- towncrier release notes start -->

## 18.0.0-alpha.39 (2024-06-28)

### Bugfix

- Cleanup Image widget and pass down onSelectItem prop if any @sneridagh [#6132](https:/plone/volto/issues/6132)
- Whitelist some dynamic imports to suppress vite warnings in storybook @tomschall [#6133](https:/plone/volto/issues/6133)

## 18.0.0-alpha.38 (2024-06-28)

### Internal

- Renamed `constants/Languages.js` to `constants/Languages.cjs` @sneridagh [#6130](https:/plone/volto/issues/6130)

## 18.0.0-alpha.37 (2024-06-27)

### Feature
Expand Down
1 change: 1 addition & 0 deletions packages/volto/news/6134.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Automatically add a PLIP issue to the PLIP project board. @stevepiercy
1 change: 1 addition & 0 deletions packages/volto/news/6135.documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix link to renamed `src/constants/Languages.cjs`. @stevepiercy
4 changes: 2 additions & 2 deletions packages/volto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"license": "MIT",
"version": "18.0.0-alpha.37",
"version": "18.0.0-alpha.39",
"repository": {
"type": "git",
"url": "[email protected]:plone/volto.git"
Expand Down Expand Up @@ -109,7 +109,7 @@
},
"setupFiles": [
"./test-setup-globals.js",
"./test-setup-config.js"
"./test-setup-config.jsx"
],
"globalSetup": "./global-test-setup.js",
"setupFilesAfterEnv": [
Expand Down
2 changes: 1 addition & 1 deletion packages/volto/razzle.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const AfterBuildPlugin = require('@fiverr/afterbuild-webpack-plugin');
const fileLoaderFinder = makeLoaderFinder('file-loader');

const projectRootPath = path.resolve('.');
const languages = require('./src/constants/Languages');
const languages = require('./src/constants/Languages.cjs');

const packageJson = require(path.join(projectRootPath, 'package.json'));

Expand Down
29 changes: 1 addition & 28 deletions packages/volto/src/components/manage/Blocks/Image/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
*/

import React from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';

import { injectIntl } from 'react-intl';
import cx from 'classnames';
import { ImageSidebar, SidebarPortal } from '@plone/volto/components';
import { createContent } from '@plone/volto/actions';

import {
flattenToAppURL,
Expand All @@ -21,18 +16,6 @@ import config from '@plone/volto/registry';

import { ImageInput } from '@plone/volto/components/manage/Widgets/ImageWidget';

/**
* Edit image block function.
* @function Edit
*/

// const messages = defineMessages({
// notImage: {
// id: 'The provided link does not lead to an image.',
// defaultMessage: 'The provided link does not lead to an image.',
// },
// });

function Edit(props) {
const { data } = props;
const Image = config.getComponent({ name: 'Image' }).component;
Expand Down Expand Up @@ -120,14 +103,4 @@ function Edit(props) {
);
}

export default compose(
injectIntl,
withBlockExtensions,
connect(
(state, ownProps) => ({
request: state.content.subrequests[ownProps.block] || {},
content: state.content.subrequests[ownProps.block]?.data,
}),
{ createContent },
),
)(Edit);
export default withBlockExtensions(Edit);
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { toast } from 'react-toastify';

import { Toast } from '@plone/volto/components';
import { Form } from '@plone/volto/components/manage/Form';
import languages from '@plone/volto/constants/Languages';
import languages from '@plone/volto/constants/Languages.cjs';
import { changeLanguage } from '@plone/volto/actions';
import { toGettextLang } from '@plone/volto/helpers';
import config from '@plone/volto/registry';
Expand Down
20 changes: 10 additions & 10 deletions packages/volto/src/components/manage/Widgets/ImageWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const UnconnectedImageInput = (props) => {
objectBrowserPickerType = 'image',
description,
placeholderLinkInput = '',
onSelectItem,
} = props;

const intl = useIntl();
Expand Down Expand Up @@ -204,16 +205,15 @@ const UnconnectedImageInput = (props) => {
e.preventDefault();
openObjectBrowser({
mode: objectBrowserPickerType,
onSelectItem: (
url,
{ title, image_field, image_scales },
) => {
onChange(props.id, flattenToAppURL(url), {
title,
image_field,
image_scales,
});
},
onSelectItem: onSelectItem
? onSelectItem
: (url, { title, image_field, image_scales }) => {
onChange(props.id, flattenToAppURL(url), {
title,
image_field,
image_scales,
});
},
currentPath: contextUrl,
});
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export default {
pt_BR: 'Português (Brasil)',
zh_CN: '中文',
};

// export default languages;
2 changes: 1 addition & 1 deletion packages/volto/src/helpers/AuthToken/AuthToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function persistAuthToken(store, req) {
handleChange(true);
}

// if (module.hot) {
// if (module?.hot) {
// module.hot.dispose((data) => {
// data.reloaded = true;
// });
Expand Down
6 changes: 4 additions & 2 deletions packages/volto/src/server.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import userSession from '@plone/volto/reducers/userSession/userSession';

import ErrorPage from '@plone/volto/error';

import languages from '@plone/volto/constants/Languages';
import languages from '@plone/volto/constants/Languages.cjs';

import configureStore from '@plone/volto/store';
import { ReduxAsyncConnect, loadOnServer } from './helpers/AsyncConnect';
Expand All @@ -46,7 +46,9 @@ let locales = {};
if (config.settings) {
config.settings.supportedLanguages.forEach((lang) => {
const langFileName = toGettextLang(lang);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
locales = { ...locales, [toReactIntlLang(lang)]: locale.default };
});
});
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
declare const _default: any;
declare const _default: (props: any) => import("react/jsx-runtime").JSX.Element;
export default _default;
15 changes: 15 additions & 0 deletions packages/volto/types/constants/Languages.d.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export let ca: string;
export let de: string;
export let en: string;
export let es: string;
export let eu: string;
export let fi: string;
export let fr: string;
export let hi: string;
export let it: string;
export let nl: string;
export let ro: string;
export let ja: string;
export let pt: string;
export let pt_BR: string;
export let zh_CN: string;
1 change: 1 addition & 0 deletions styles/Vocab/Plone/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
`plone.volto`
[Aa]sync
[Bb]ackend
CommonJS
JavaScript
npm
nvm
Expand Down

0 comments on commit 476af45

Please sign in to comment.