@plone/volto 16.0.0-alpha.35 → 16.0.0-alpha.36

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Change Log
2
2
 
3
+ ## 16.0.0-alpha.36 (2022-09-26)
4
+
5
+ ### Bugfix
6
+
7
+ - Fix number widget when the value is 0 @iRohitSingh
8
+ - Fix the typo in change workflow status dialog in "de" @iRohitSingh
9
+ - Show unauthorized message when accessing the diff view without permission @robgietema
10
+ - Fix i18n in title of Aliases control panel @sneridagh
11
+ - The styling schema is now applied before the block variations schema enhancers, to allow those enhancers a chance to tweak the styling schema @tiberiuichim
12
+
13
+ ### Documentation
14
+
15
+ - Added controls for the `actions` property of the `AlignWidget` storybook @JeffersonBledsoe #3671
16
+ - Generic Setup -> `GenericSetup`. @stevepiercy
17
+
3
18
  ## 16.0.0-alpha.35 (2022-09-21)
4
19
 
5
20
  ### Breaking
@@ -13,6 +28,7 @@
13
28
  - Fix selection error when pressing backspace @robgietema
14
29
  - Fix sidebarTab in Toc Block @iRohitSingh
15
30
  - Fix virtualization (windowing) when displaying options with long titles for select widgets. (The virtualization happen when the number of options is greater than 25). Add dynamic height aware options using `react-virtualized`. @sneridagh
31
+ - Fix email validation to ensure all addresses are correctly validated @instification
16
32
 
17
33
  ### Documentation
18
34
 
@@ -30,6 +46,7 @@
30
46
 
31
47
  ### Bugfix
32
48
 
49
+ - Fix Press Enter in some blocks does not focus on the text block below #3647 @dobri1408
33
50
  - Add `matchAllRoutes` to AsyncConnect so that it matches all configured `asyncPropsExtenders` @tiberiuichim
34
51
  - Fix acceptence test groups controlpanel @ksuess
35
52
 
@@ -3092,6 +3092,7 @@ msgstr "UID"
3092
3092
 
3093
3093
  #: components/manage/Aliases/Aliases
3094
3094
  #: components/manage/Controlpanels/Aliases
3095
+ #: components/manage/Controlpanels/Controlpanels
3095
3096
  #: components/manage/Toolbar/More
3096
3097
  # defaultMessage: URL Management
3097
3098
  msgid "URL Management"
@@ -3089,6 +3089,7 @@ msgstr "UID"
3089
3089
 
3090
3090
  #: components/manage/Aliases/Aliases
3091
3091
  #: components/manage/Controlpanels/Aliases
3092
+ #: components/manage/Controlpanels/Controlpanels
3092
3093
  #: components/manage/Toolbar/More
3093
3094
  # defaultMessage: URL Management
3094
3095
  msgid "URL Management"
@@ -3083,6 +3083,7 @@ msgstr ""
3083
3083
 
3084
3084
  #: components/manage/Aliases/Aliases
3085
3085
  #: components/manage/Controlpanels/Aliases
3086
+ #: components/manage/Controlpanels/Controlpanels
3086
3087
  #: components/manage/Toolbar/More
3087
3088
  # defaultMessage: URL Management
3088
3089
  msgid "URL Management"
@@ -3093,6 +3093,7 @@ msgstr "UID"
3093
3093
 
3094
3094
  #: components/manage/Aliases/Aliases
3095
3095
  #: components/manage/Controlpanels/Aliases
3096
+ #: components/manage/Controlpanels/Controlpanels
3096
3097
  #: components/manage/Toolbar/More
3097
3098
  # defaultMessage: URL Management
3098
3099
  msgid "URL Management"
@@ -3090,6 +3090,7 @@ msgstr "UID"
3090
3090
 
3091
3091
  #: components/manage/Aliases/Aliases
3092
3092
  #: components/manage/Controlpanels/Aliases
3093
+ #: components/manage/Controlpanels/Controlpanels
3093
3094
  #: components/manage/Toolbar/More
3094
3095
  # defaultMessage: URL Management
3095
3096
  msgid "URL Management"
@@ -3100,6 +3100,7 @@ msgstr "UID"
3100
3100
 
3101
3101
  #: components/manage/Aliases/Aliases
3102
3102
  #: components/manage/Controlpanels/Aliases
3103
+ #: components/manage/Controlpanels/Controlpanels
3103
3104
  #: components/manage/Toolbar/More
3104
3105
  # defaultMessage: URL Management
3105
3106
  msgid "URL Management"
@@ -3083,6 +3083,7 @@ msgstr "UID"
3083
3083
 
3084
3084
  #: components/manage/Aliases/Aliases
3085
3085
  #: components/manage/Controlpanels/Aliases
3086
+ #: components/manage/Controlpanels/Controlpanels
3086
3087
  #: components/manage/Toolbar/More
3087
3088
  # defaultMessage: URL Management
3088
3089
  msgid "URL Management"
@@ -3091,6 +3091,7 @@ msgstr "UID"
3091
3091
 
3092
3092
  #: components/manage/Aliases/Aliases
3093
3093
  #: components/manage/Controlpanels/Aliases
3094
+ #: components/manage/Controlpanels/Controlpanels
3094
3095
  #: components/manage/Toolbar/More
3095
3096
  # defaultMessage: URL Management
3096
3097
  msgid "URL Management"
@@ -3102,6 +3102,7 @@ msgstr ""
3102
3102
 
3103
3103
  #: components/manage/Aliases/Aliases
3104
3104
  #: components/manage/Controlpanels/Aliases
3105
+ #: components/manage/Controlpanels/Controlpanels
3105
3106
  #: components/manage/Toolbar/More
3106
3107
  # defaultMessage: URL Management
3107
3108
  msgid "URL Management"
@@ -3091,6 +3091,7 @@ msgstr ""
3091
3091
 
3092
3092
  #: components/manage/Aliases/Aliases
3093
3093
  #: components/manage/Controlpanels/Aliases
3094
+ #: components/manage/Controlpanels/Controlpanels
3094
3095
  #: components/manage/Toolbar/More
3095
3096
  # defaultMessage: URL Management
3096
3097
  msgid "URL Management"
@@ -3093,6 +3093,7 @@ msgstr "UID"
3093
3093
 
3094
3094
  #: components/manage/Aliases/Aliases
3095
3095
  #: components/manage/Controlpanels/Aliases
3096
+ #: components/manage/Controlpanels/Controlpanels
3096
3097
  #: components/manage/Toolbar/More
3097
3098
  # defaultMessage: URL Management
3098
3099
  msgid "URL Management"
@@ -3083,6 +3083,7 @@ msgstr "UID"
3083
3083
 
3084
3084
  #: components/manage/Aliases/Aliases
3085
3085
  #: components/manage/Controlpanels/Aliases
3086
+ #: components/manage/Controlpanels/Controlpanels
3086
3087
  #: components/manage/Toolbar/More
3087
3088
  # defaultMessage: URL Management
3088
3089
  msgid "URL Management"
package/locales/volto.pot CHANGED
@@ -1,7 +1,7 @@
1
1
  msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Plone\n"
4
- "POT-Creation-Date: 2022-09-16T10:33:59.942Z\n"
4
+ "POT-Creation-Date: 2022-09-23T09:41:15.663Z\n"
5
5
  "Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
6
6
  "Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
7
7
  "MIME-Version: 1.0\n"
@@ -3085,6 +3085,7 @@ msgstr ""
3085
3085
 
3086
3086
  #: components/manage/Aliases/Aliases
3087
3087
  #: components/manage/Controlpanels/Aliases
3088
+ #: components/manage/Controlpanels/Controlpanels
3088
3089
  #: components/manage/Toolbar/More
3089
3090
  # defaultMessage: URL Management
3090
3091
  msgid "URL Management"
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "16.0.0-alpha.35",
12
+ "version": "16.0.0-alpha.36",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -77,7 +77,7 @@ const BlocksForm = (props) => {
77
77
  e.preventDefault();
78
78
  }
79
79
  if (e.key === 'Enter' && !disableEnter) {
80
- onAddBlock(config.settings.defaultBlockType, index + 1);
80
+ onSelectBlock(onAddBlock(config.settings.defaultBlockType, index + 1));
81
81
  e.preventDefault();
82
82
  }
83
83
  };
@@ -78,6 +78,10 @@ const messages = defineMessages({
78
78
  id: 'User Group Membership',
79
79
  defaultMessage: 'User Group Membership',
80
80
  },
81
+ urlmanagement: {
82
+ id: 'URL Management',
83
+ defaultMessage: 'URL Management',
84
+ },
81
85
  });
82
86
 
83
87
  /**
@@ -175,8 +179,8 @@ class Controlpanels extends Component {
175
179
  },
176
180
  {
177
181
  '@id': '/aliases',
178
- group: 'General',
179
- title: 'URL Management',
182
+ group: this.props.intl.formatMessage(messages.general),
183
+ title: this.props.intl.formatMessage(messages.urlmanagement),
180
184
  },
181
185
  {
182
186
  '@id': '/moderate-comments',
@@ -27,6 +27,7 @@ import {
27
27
  FormattedDate,
28
28
  Icon,
29
29
  Toolbar,
30
+ Unauthorized,
30
31
  } from '@plone/volto/components';
31
32
 
32
33
  import backSVG from '@plone/volto/icons/back.svg';
@@ -66,6 +67,7 @@ class Diff extends Component {
66
67
  getSchema: PropTypes.func.isRequired,
67
68
  getHistory: PropTypes.func.isRequired,
68
69
  schema: PropTypes.objectOf(PropTypes.any),
70
+ error: PropTypes.objectOf(PropTypes.any),
69
71
  pathname: PropTypes.string.isRequired,
70
72
  one: PropTypes.string.isRequired,
71
73
  two: PropTypes.string.isRequired,
@@ -205,7 +207,9 @@ class Diff extends Component {
205
207
  }),
206
208
  );
207
209
 
208
- return (
210
+ return this.props.error?.status === 401 ? (
211
+ <Unauthorized />
212
+ ) : (
209
213
  <Container id="page-diff">
210
214
  <Helmet title={this.props.intl.formatMessage(messages.diff)} />
211
215
  <h1>
@@ -363,12 +367,13 @@ export default compose(
363
367
  data: state.diff.data,
364
368
  historyEntries: state.history.entries,
365
369
  schema: state.schema.schema,
370
+ error: state.diff.error,
366
371
  pathname: props.location.pathname,
367
372
  one: qs.parse(props.location.search).one,
368
373
  two: qs.parse(props.location.search).two,
369
374
  view: qs.parse(props.location.search).view || 'split',
370
- title: state.content.data.title,
371
- type: state.content.data['@type'],
375
+ title: state.content.data?.title,
376
+ type: state.content.data?.['@type'],
372
377
  }),
373
378
  { getDiff, getSchema, getHistory },
374
379
  ),
@@ -6,8 +6,8 @@ import {
6
6
  } from '@plone/volto/helpers';
7
7
 
8
8
  const BlockDataForm = compose(
9
- withVariationSchemaEnhancer,
10
9
  withStylingSchemaEnhancer,
10
+ withVariationSchemaEnhancer,
11
11
  )(InlineForm);
12
12
 
13
13
  export default BlockDataForm;
@@ -28,6 +28,7 @@ beforeAll(() => {
28
28
  },
29
29
  testBlock: {
30
30
  id: 'testBlock',
31
+ // enableStyling: true,
31
32
  variations: [
32
33
  {
33
34
  id: 'default',
@@ -143,4 +144,77 @@ describe('BlockDataForm', () => {
143
144
  // schema is cloned, not mutated in place
144
145
  expect(testSchema.fieldsets[0].fields).toStrictEqual([]);
145
146
  });
147
+
148
+ it('should add styling field to schema', () => {
149
+ config.blocks.blocksConfig.testBlock.enableStyling = true;
150
+ const store = mockStore({
151
+ intl: {
152
+ locale: 'en',
153
+ messages: {},
154
+ },
155
+ });
156
+ const testSchema = {
157
+ fieldsets: [{ title: 'Default', id: 'default', fields: [] }],
158
+ properties: {},
159
+ required: [],
160
+ };
161
+ const formData = {
162
+ '@type': 'testBlock',
163
+ };
164
+ const { container } = render(
165
+ <Provider store={store}>
166
+ <BlockDataForm
167
+ formData={formData}
168
+ schema={testSchema}
169
+ onChangeField={(id, value) => {}}
170
+ />
171
+ </Provider>,
172
+ );
173
+ expect(container).toMatchSnapshot();
174
+ });
175
+
176
+ it('should allow variations to enhance styling schema', () => {
177
+ config.blocks.blocksConfig.testBlock.enableStyling = true;
178
+ let finalSchema; // the schema is cloned during enhancing; we need it for tests because the ObjectWidget is not rendered properly in the test
179
+ config.blocks.blocksConfig.testBlock.variations[0].schemaEnhancer = ({
180
+ schema,
181
+ }) => {
182
+ const stylesSchema = schema.properties.styles.schema;
183
+ stylesSchema.properties.extraField = { title: 'Extra field' };
184
+ stylesSchema.fieldsets[0].fields.push('extraField');
185
+ finalSchema = schema;
186
+ return schema;
187
+ };
188
+
189
+ const store = mockStore({
190
+ intl: {
191
+ locale: 'en',
192
+ messages: {},
193
+ },
194
+ });
195
+ const testSchema = {
196
+ fieldsets: [{ title: 'Default', id: 'default', fields: [] }],
197
+ properties: {},
198
+ required: [],
199
+ };
200
+ const formData = {
201
+ '@type': 'testBlock',
202
+ };
203
+ const { container } = render(
204
+ <Provider store={store}>
205
+ <BlockDataForm
206
+ formData={formData}
207
+ schema={testSchema}
208
+ onChangeField={(id, value) => {}}
209
+ />
210
+ </Provider>,
211
+ );
212
+ expect(container).toMatchSnapshot();
213
+ expect(
214
+ finalSchema.properties.styles.schema.properties.extraField,
215
+ ).toStrictEqual({ title: 'Extra field' });
216
+ expect(
217
+ finalSchema.properties.styles.schema.fieldsets[0].fields,
218
+ ).toStrictEqual(['align', 'extraField']);
219
+ });
146
220
  });
@@ -18,5 +18,10 @@ export default {
18
18
  </div>
19
19
  ),
20
20
  ],
21
- argTypes: {},
21
+ argTypes: {
22
+ actions: {
23
+ control: 'check',
24
+ options: ['left', 'right', 'center', 'wide', 'full'],
25
+ },
26
+ },
22
27
  };
@@ -44,7 +44,7 @@ const NumberWidget = (props) => {
44
44
  disabled={isDisabled}
45
45
  min={minimum || null}
46
46
  max={maximum || null}
47
- value={value || defaultValue}
47
+ value={value ?? defaultValue}
48
48
  placeholder={placeholder}
49
49
  onChange={({ target }) =>
50
50
  onChange(id, target.value === '' ? undefined : target.value)
@@ -40,7 +40,9 @@ const isMinPropertyValid = (value, valueToCompare, maxCriterion, intlFunc) => {
40
40
  const widgetValidation = {
41
41
  email: {
42
42
  isValidEmail: (emailValue, emailObj, intlFunc) => {
43
- const emailRegex = /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/;
43
+ // Email Regex taken from from WHATWG living standard:
44
+ // https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type=email)
45
+ const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
44
46
  const isValid = emailRegex.test(emailValue);
45
47
  return !isValid ? intlFunc(messages.isValidEmail) : null;
46
48
  },
@@ -76,5 +76,16 @@ describe('FormValidation', () => {
76
76
  email: [messages.isValidEmail.defaultMessage],
77
77
  });
78
78
  });
79
+
80
+ it('validates correct email', () => {
81
+ formData.email = 'test@domain.name';
82
+ expect(
83
+ FormValidation.validateFieldsPerFieldset({
84
+ schema,
85
+ formData,
86
+ formatMessage,
87
+ }),
88
+ ).toEqual({});
89
+ });
79
90
  });
80
91
  });