Skip to content

Commit

Permalink
Merge branch 'main' into theming-a-base-theme
Browse files Browse the repository at this point in the history
  • Loading branch information
stevepiercy authored Oct 3, 2024
2 parents 783feef + 52a23bd commit 1a07450
Show file tree
Hide file tree
Showing 66 changed files with 342 additions and 131 deletions.
24 changes: 14 additions & 10 deletions docs/source/contributing/developing-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ Volto has the following folder structure.
```


## Development pre-requisites
## Development prerequisites

To set up a Volto core development environment, your system must satisfy the following pre-requisites.
To set up a Volto core development environment, your system must satisfy the following prerequisites.

```{include} ./install-operating-system.md
```
Expand Down Expand Up @@ -330,13 +330,6 @@ By default, the use of TypeScript is required in Plone frontend libraries, Volto

The monorepository consists of several core libraries.

### Volto project generator

`@plone/generator-volto` is a Yeoman generator that helps you set up Volto via command line.
It generates all the boilerplate needed to start developing a Plone Volto project.
It is used by [CookieCutter Plone Starter](https://github.com/collective/cookiecutter-plone-starter), the recommended way to set up Plone projects.
The generator features an `addon` template for scaffolding Volto add-ons in your projects.

### Registry

`@plone/registry` provides support for building an add-on registry and infrastructure for JavaScript and TypeScript-based apps.
Expand All @@ -354,6 +347,17 @@ Used by Volto, you can also use it in other JavaScript frameworks and environmen

`@plone/volto-slate` is the glue package that provides support for the Slate library in Volto.

### Volto project generator

`@plone/generator-volto` is a Yeoman generator that helps you set up Volto via command line.
It generates all the boilerplate needed to start developing a Plone Volto project.
It is used by [CookieCutter Plone Starter](https://github.com/collective/cookiecutter-plone-starter), the recommended way to set up Plone projects.
The generator features an `addon` template for scaffolding Volto add-ons in your projects.

```{deprecated} 18.0.0-alpha.43
For Volto 18, `@plone/generator-volto` is replaced by [Cookieplone](https://github.com/plone/cookieplone).
```


## Supported frontends

Expand All @@ -362,7 +366,7 @@ Volto is the default frontend, and is React-based.
Classic UI is the Python-based, server-side rendered frontend.

In Volto's `apps` folder, you'll find a Volto project scaffolding that uses Volto as a library.
This is the same as that which you'll have when you run the Volto generator or `cookiecutter-plone-starter`.
This is the same as that which you'll have when you follow the instructions in {doc}`plone:install/create-project`).


## Experimental frontends
Expand Down
4 changes: 2 additions & 2 deletions docs/source/upgrade-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ If you shadowed the module {file}`packages/volto/src/helpers/FormValidation/Form
This prop must be assigned with the new prop passed down from the blocks engine `blocksErrors`.
If not passed down, the block can't display any field validation error.

```tsx
```jsx
// More component code above here

const {
Expand Down Expand Up @@ -451,7 +451,7 @@ The `Tags` component has been moved to the `belowContent` slot.
It now receives the `content` property instead of the `tags` property.


{upgrade-18-cookieplone-label}=
(upgrade-18-cookieplone-label)=

### Cookieplone is now the recommended project and add-on generator for Volto 18

Expand Down
1 change: 1 addition & 0 deletions packages/client/news/6349.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed client copy mutation, cleanup up move mutation for consistency @pnicolli
4 changes: 2 additions & 2 deletions packages/client/src/restapi/copymove/copy.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('[POST] Copy', () => {
});

act(() => {
result.current.mutate({ data: copyData });
result.current.mutate({ path: '/', data: copyData });
});

await waitFor(() => expect(result.current.isSuccess).toBe(true));
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('[POST] Copy', () => {
});

act(() => {
result.current.mutate({ data: copyMultipleData });
result.current.mutate({ path: '/', data: copyMultipleData });
});

await waitFor(() => expect(result.current.isSuccess).toBe(true));
Expand Down
28 changes: 13 additions & 15 deletions packages/client/src/restapi/copymove/copy.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
import { z } from 'zod';
import { ApiRequestParams, apiRequest } from '../../API';
import {
PloneClientConfig,
PloneClientConfigSchema,
} from '../../validation/config';
import { PloneClientConfig } from '../../validation/config';
import { copyMoveDataSchema as copyDataSchema } from '../../validation/copymove';
import { CopyMoveResponse as CopyResponse } from '@plone/types';

export const copyArgsSchema = z.object({
data: copyDataSchema,
config: PloneClientConfigSchema,
});

export type CopyArgs = z.infer<typeof copyArgsSchema>;
export type CopyArgs = z.infer<typeof copyDataSchema> & {
config: PloneClientConfig;
};

export const copy = async ({
path,
data,
config,
}: CopyArgs): Promise<CopyResponse> => {
const validatedArgs = copyArgsSchema.parse({
const validatedArgs = copyDataSchema.parse({
path,
data,
config,
});

const options: ApiRequestParams = {
config,
data: validatedArgs.data,
config: validatedArgs.config,
};

return apiRequest('post', '/@copy', options);
const copyPath = `${validatedArgs.path}/@copy`;

return apiRequest('post', copyPath, options);
};

export const copyMutation = ({ config }: { config: PloneClientConfig }) => ({
mutationKey: ['post', 'copy'],
mutationFn: ({ data }: Omit<CopyArgs, 'config'>) => copy({ data, config }),
mutationFn: ({ path, data }: Omit<CopyArgs, 'config'>) =>
copy({ path, data, config }),
});
22 changes: 7 additions & 15 deletions packages/client/src/restapi/copymove/move.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
import { z } from 'zod';
import { ApiRequestParams, apiRequest } from '../../API';
import {
PloneClientConfig,
PloneClientConfigSchema,
} from '../../validation/config';
import { PloneClientConfig } from '../../validation/config';
import { copyMoveDataSchema as moveDataSchema } from '../../validation/copymove';
import { CopyMoveResponse as MoveResponse } from '@plone/types';

export const MoveArgsSchema = z.object({
path: z.string(),
data: moveDataSchema,
config: PloneClientConfigSchema,
});

export type MoveArgs = z.infer<typeof MoveArgsSchema>;
export type MoveArgs = z.infer<typeof moveDataSchema> & {
config: PloneClientConfig;
};

export const move = async ({
path,
data,
config,
}: MoveArgs): Promise<MoveResponse> => {
const validatedArgs = MoveArgsSchema.parse({
const validatedArgs = moveDataSchema.parse({
path,
data,
config,
});

const options: ApiRequestParams = {
config,
data: validatedArgs.data,
config: validatedArgs.config,
};

const movePath = `/${validatedArgs.path}/@move`;
const movePath = `${validatedArgs.path}/@move`;

return apiRequest('post', movePath, options);
};
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/validation/copymove.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { z } from 'zod';

export const copyMoveDataSchema = z.object({
source: z.union([z.string(), z.array(z.string())]),
path: z.string(),
data: z.object({
source: z.union([z.string(), z.array(z.string())]),
}),
});
1 change: 1 addition & 0 deletions packages/scripts/news/6354.documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added the configuration for VSCode not to reformat Markdown and MyST files. @aadityaforwork
16 changes: 12 additions & 4 deletions packages/scripts/vscodesettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ if (fs.existsSync('.vscode')) {

if (!vscodeSettingsJSON['eslint.workingDirectories']) {
vscodeSettingsJSON['eslint.workingDirectories'] = [{ mode: 'auto' }];
}

fs.writeFileSync(
'.vscode/settings.json',
`${stringify(vscodeSettingsJSON, null, 2)}`,
);
if (!vscodeSettingsJSON['[markdown]']) {
vscodeSettingsJSON['[markdown]'] = {
'editor.formatOnSave': false,
};
} else {
vscodeSettingsJSON['[markdown]']['editor.formatOnSave'] = false;
}

fs.writeFileSync(
'.vscode/settings.json',
`${stringify(vscodeSettingsJSON, null, 2)}`,
);
1 change: 1 addition & 0 deletions packages/volto-slate/news/6293.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fetch `user` before pass it to the `restricted` function of the block settings. @wesleybl
4 changes: 2 additions & 2 deletions packages/volto-slate/src/blocks/Text/SlashMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { filter, isEmpty } from 'lodash';
import { Menu } from 'semantic-ui-react';
import { useIntl, FormattedMessage } from 'react-intl';
import { Icon } from '@plone/volto/components';
import { useSelector } from 'react-redux';
import { useUser } from '@plone/volto/hooks';

const emptySlateBlock = () => ({
value: [
Expand Down Expand Up @@ -111,7 +111,7 @@ const PersistentSlashMenu = ({ editor }) => {
} = props;
const disableNewBlocks = data?.disableNewBlocks || detached;

const user = useSelector((state) => state.users?.user);
const user = useUser();

const [slashMenuSelected, setSlashMenuSelected] = React.useState(0);

Expand Down
4 changes: 4 additions & 0 deletions packages/volto/cypress/tests/core/basic/a11y.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ describe('Accessibility Tests', () => {

it('Contact form has not a11y violations', () => {
cy.navigate('/contact-form');
cy.get('#field-name').click().type('input');
cy.get('#field-from').click().type('[email protected]');
cy.get('#field-subject').click().type('input');
cy.get('#field-message').click().type('input');
cy.checkA11y();
});

Expand Down
2 changes: 1 addition & 1 deletion packages/volto/cypress/tests/core/blocks/blocks-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Table Block Tests', () => {
cy.get('.block-editor-slateTable [role=textbox]')
.first()
.click()
.should('have.css', 'outline', 'rgb(135, 143, 147) none 0px');
.should('have.css', 'outline', 'rgba(0, 0, 0, 0.87) none 0px');

cy.get(
'.celled.fixed.table thead tr th:first-child() [contenteditable="true"]',
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/ca/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,11 @@ msgstr "Llenguatge"
msgid "Language independent field."
msgstr ""

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,11 @@ msgstr "Sprache"
msgid "Language independent field."
msgstr "Sprachunabhängiges Feld."

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr "Dies ist ein sprachunabhängiges Feld. Jeder Wert, den Sie hier eingeben, überschreibt das entsprechende Feld aller Mitglieder der Übersetzungsgruppe, wenn Sie dieses Formular speichern."

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,11 @@ msgstr ""
msgid "Language independent field."
msgstr ""

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,11 @@ msgstr "Idioma"
msgid "Language independent field."
msgstr "Campo independiente de idioma."

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/eu/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,11 @@ msgstr "Hizkuntza"
msgid "Language independent field."
msgstr "Hizkuntzarekiko Independentea den eremua."

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/fi/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,11 @@ msgstr "Kieli"
msgid "Language independent field."
msgstr "Kieliriippumaton kenttä"

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,11 @@ msgstr "Langage"
msgid "Language independent field."
msgstr "Champ indépendant de la langue."

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/hi/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,11 @@ msgstr "भाषा"
msgid "Language independent field."
msgstr "भाषा स्वतंत्र क्षेत्र।"

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
Loading

0 comments on commit 1a07450

Please sign in to comment.