Skip to content

Commit

Permalink
Merge branch 'master' into rowblock
Browse files Browse the repository at this point in the history
* master:
  Release 17.0.0-alpha.13
  Enforce max upload size (#4868)
  Fix and improve the `addStyling` helper (#4880)
  Release 17.0.0-alpha.12
  Fix regression in horizontal scroll in contents view, add it back (#4872)
  Configurable Container component from registry for some key route views. (#4871)
  Allow to deselect color in ColorPickerWidget. (#4839)
  • Loading branch information
sneridagh committed Jun 17, 2023
2 parents d764b70 + 453d36f commit 567969f
Show file tree
Hide file tree
Showing 38 changed files with 384 additions and 46 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,29 @@

<!-- towncrier release notes start -->

## 17.0.0-alpha.13 (2023-06-15)

### Feature

- Add and enforce a new config setting, `maxFileUploadSize`. @davisagli [#4868](https://github.com/plone/volto/issues/4868)

### Bugfix

- Fix and improve the `addStyling` helper @sneridagh [#4880](https://github.com/plone/volto/issues/4880)


## 17.0.0-alpha.12 (2023-06-14)

### Feature

- Allow to deselect color in ColorPickerWidget. @ksuess [#4838](https://github.com/plone/volto/issues/4838)
- Configurable Container component from registry for some key route views. @sneridagh [#4871](https://github.com/plone/volto/issues/4871)

### Bugfix

- Fix regression in horizontal scroll in contents view, add it back @sneridagh [#4872](https://github.com/plone/volto/issues/4872)


## 17.0.0-alpha.11 (2023-06-09)

### Bugfix
Expand Down
4 changes: 4 additions & 0 deletions docs/source/configuration/settings-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ maxResponseSize
You can edit this limit in the `settings` object setting a new value in bytes
(for example, to set 500 mb you need to write 5000000000).
maxFileUploadSize
The maximum allowed size of file uploads (in bytes).
Default: `null` (no limit enforced by Volto).
initialReducersBlacklist
The initial state passed from server to browser needs to be minimal in order to optimize the resultant html generated. This state gets stored in `window.__data` and received in client.
Expand Down
5 changes: 5 additions & 0 deletions locales/ca/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4344,6 +4344,11 @@ msgstr "quan"
msgid "event_where"
msgstr "On?"

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
7 changes: 6 additions & 1 deletion locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4341,10 +4341,15 @@ msgstr "Datum"
msgid "event_where"
msgstr "Ort"

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr "Dateien, die größer sind als {limit}, dürfen nicht hochgeladen werden."

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
msgstr "TODO Translation. IntIds neu generieren und Relationen neu katalogisieren"
msgstr "IntIds neu generieren und Relationen neu katalogisieren"

#: components/manage/Blocks/Teaser/schema
# defaultMessage: Head title
Expand Down
5 changes: 5 additions & 0 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4335,6 +4335,11 @@ msgstr ""
msgid "event_where"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
5 changes: 5 additions & 0 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4346,6 +4346,11 @@ msgstr "Cuándo"
msgid "event_where"
msgstr "Dónde"

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
5 changes: 5 additions & 0 deletions locales/eu/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4342,6 +4342,11 @@ msgstr "Noiz"
msgid "event_where"
msgstr "Non"

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
5 changes: 5 additions & 0 deletions locales/fi/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4346,6 +4346,11 @@ msgstr "Milloin"
msgid "event_where"
msgstr "Missä"

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
5 changes: 5 additions & 0 deletions locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4352,6 +4352,11 @@ msgstr "Quand"
msgid "event_where"
msgstr "Où"

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
5 changes: 5 additions & 0 deletions locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4335,6 +4335,11 @@ msgstr "Quando"
msgid "event_where"
msgstr "Dove"

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
5 changes: 5 additions & 0 deletions locales/ja/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4343,6 +4343,11 @@ msgstr "日時"
msgid "event_where"
msgstr "場所"

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
5 changes: 5 additions & 0 deletions locales/nl/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4354,6 +4354,11 @@ msgstr ""
msgid "event_where"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
5 changes: 5 additions & 0 deletions locales/pt/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4343,6 +4343,11 @@ msgstr ""
msgid "event_where"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
5 changes: 5 additions & 0 deletions locales/pt_BR/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4345,6 +4345,11 @@ msgstr "Quando"
msgid "event_where"
msgstr "Onde"

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
5 changes: 5 additions & 0 deletions locales/ro/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4335,6 +4335,11 @@ msgstr "Data"
msgid "event_where"
msgstr "Locație"

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
11 changes: 8 additions & 3 deletions locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2023-06-09T09:09:49.024Z\n"
"POT-Creation-Date: 2023-06-13T20:41:58.672Z\n"
"Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -39,7 +39,7 @@ msgid "Action changed"
msgstr ""

#: components/manage/Controlpanels/Rules/ConfigureRule
# defaultMessage: Action:
# defaultMessage: Action:
msgid "Action: "
msgstr ""

Expand Down Expand Up @@ -686,7 +686,7 @@ msgid "Condition changed"
msgstr ""

#: components/manage/Controlpanels/Rules/ConfigureRule
# defaultMessage: Condition:
# defaultMessage: Condition:
msgid "Condition: "
msgstr ""

Expand Down Expand Up @@ -4337,6 +4337,11 @@ msgstr ""
msgid "event_where"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
5 changes: 5 additions & 0 deletions locales/zh_CN/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4341,6 +4341,11 @@ msgstr ""
msgid "event_where"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: This website does not accept files larger than {limit}
msgid "fileTooLarge"
msgstr ""

#: helpers/MessageLabels/MessageLabels
# defaultMessage: flush intIds and rebuild relations
msgid "flush intIds and rebuild relations"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"license": "MIT",
"version": "17.0.0-alpha.11",
"version": "17.0.0-alpha.13",
"repository": {
"type": "git",
"url": "git@github.com:plone/volto.git"
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": "17.0.0-alpha.11",
"version": "17.0.0-alpha.13",
"description": "Slate.js integration with Volto",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
11 changes: 8 additions & 3 deletions packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { defineMessages, useIntl } from 'react-intl';
import { useInView } from 'react-intersection-observer';
import { Dimmer, Loader, Message, Segment } from 'semantic-ui-react';

import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers';
import {
flattenToAppURL,
getBaseUrl,
validateFileUploadSize,
} from '@plone/volto/helpers';
import config from '@plone/volto/registry';
import {
BlockDataForm,
Expand Down Expand Up @@ -71,6 +75,7 @@ export const DefaultTextBlockEditor = (props) => {
const { slate } = config.settings;
const { textblockExtensions } = slate;
const { value } = data;
const intl = useIntl();

// const [addNewBlockOpened, setAddNewBlockOpened] = React.useState();
const [showDropzone, setShowDropzone] = React.useState(false);
Expand Down Expand Up @@ -106,6 +111,7 @@ export const DefaultTextBlockEditor = (props) => {
files.forEach((file) => {
const [mime] = file.type.split('/');
if (mime !== 'image') return;
if (!validateFileUploadSize(file, intl.formatMessage)) return;

readAsDataURL(file).then((data) => {
const fields = data.match(/^data:(.*);(.*),(.*)$/);
Expand All @@ -127,7 +133,7 @@ export const DefaultTextBlockEditor = (props) => {
});
setShowDropzone(false);
},
[pathname, uploadContent, block],
[pathname, uploadContent, block, intl.formatMessage],
);

const { loaded, loading } = uploadRequest;
Expand Down Expand Up @@ -178,7 +184,6 @@ export const DefaultTextBlockEditor = (props) => {
instructions = formDescription;
}

const intl = useIntl();
const placeholder =
data.placeholder || formTitle || intl.formatMessage(messages.text);
const schema = TextBlockSchema(data);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import isUrl from 'is-url';
import imageExtensions from 'image-extensions';
import { blockTagDeserializer } from '@plone/volto-slate/editor/deserialize';
import { getBaseUrl } from '@plone/volto/helpers';
import { getBaseUrl, validateFileUploadSize } from '@plone/volto/helpers';
import { v4 as uuid } from 'uuid';
import { Transforms } from 'slate';

Expand Down Expand Up @@ -66,7 +66,9 @@ export const withDeserializers = (editor) => {
...editor.dataTransferHandlers,
files: (files) => {
const unprocessed = [];
const { intl } = editor.getBlockProps();
for (const file of files) {
if (!validateFileUploadSize(file, intl.formatMessage)) return;
const reader = new FileReader();
const [mime] = file.type.split('/');
if (mime === 'image') {
Expand Down
7 changes: 6 additions & 1 deletion src/components/manage/Blocks/HeroImageLeft/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import { defineMessages, injectIntl } from 'react-intl';
import cx from 'classnames';

import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers';
import {
flattenToAppURL,
getBaseUrl,
validateFileUploadSize,
} from '@plone/volto/helpers';
import { createContent } from '@plone/volto/actions';
import { Icon, SidebarPortal, LinkMore } from '@plone/volto/components';

Expand Down Expand Up @@ -275,6 +279,7 @@ class EditComponent extends Component {
*/
onUploadImage({ target }) {
const file = target.files[0];
if (!validateFileUploadSize(file, this.props.intl.formatMessage)) return;
this.setState({
uploading: true,
});
Expand Down
Loading

0 comments on commit 567969f

Please sign in to comment.