@plone/volto 16.9.0 → 16.10.0

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.draft CHANGED
@@ -1,21 +1,18 @@
1
- ## 16.9.0 (2023-01-27)
1
+ ## 16.10.0 (2023-02-06)
2
2
 
3
3
  ### Feature
4
4
 
5
- - Enable scrolling to ids via hashes in internal links @jackahl [#4165](https://github.com/plone/volto/issues/4165)
6
- - Read listing block schema from configuration registry @pnicolli [#4231](https://github.com/plone/volto/issues/4231)
7
- - Add displayName when registering a component @sneridagh [#4282](https://github.com/plone/volto/issues/4282)
8
- - Support for all default expanders (breadcrumbs, navigation, actions, types) in actions/reducers. Conditional loading of actions if the expanders are present. @sneridagh [#4285](https://github.com/plone/volto/issues/4285)
9
- - Add `addNewBlock` Cypress support command @sneridagh [#4313](https://github.com/plone/volto/issues/4313)
5
+ - Option for opening /edit with the same vertical offset like the page in view mode before. @ksuess [#3662](https://github.com/plone/volto/issues/3662)
6
+ - Add option to add an action button to the top of the toolbar and to add a menu button to the bottom of the toolbar. @ksuess [#4333](https://github.com/plone/volto/issues/4333)
7
+ - Update to latest versions in the backend for testing and the convenience api folder @sneridagh [#4361](https://github.com/plone/volto/issues/4361)
8
+ - Content Rules: Support server-provided schema for condition and action @ericof [#4368](https://github.com/plone/volto/issues/4368)
10
9
 
11
10
  ### Bugfix
12
11
 
13
- - Fixed maxLength validation for string type fields @pnicolli [#4189](https://github.com/plone/volto/issues/4189)
14
- - bugfix : add pathname as required proptype in Blocks/Edit @akshatgarg12 [#4194](https://github.com/plone/volto/issues/4194)
15
- - (Fix) Select Widgets scrolls the page when the options are not visible @dobri1408 [#4223](https://github.com/plone/volto/issues/4223)
16
- - Updated volto-slate to check for slateSettings before falling back to config @danalvrz [#4311](https://github.com/plone/volto/issues/4311)
12
+ - Fix react-error-overlay resolution @sneridagh [#4360](https://github.com/plone/volto/issues/4360)
17
13
 
18
- ### Internal
14
+ ### Documentation
19
15
 
20
- - Updated 4 Dependencies @SaiRev0 [#4104](https://github.com/plone/volto/issues/4104)
16
+ - Add documentation for copy, cut, and paste blocks in Volto. @MAX-786 [#3827](https://github.com/plone/volto/issues/3827)
17
+ - Fixed Grammar error @SaiRev0 [#4272](https://github.com/plone/volto/issues/4272)
21
18
 
Binary file
package/CHANGELOG.md CHANGED
@@ -8,6 +8,25 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 16.10.0 (2023-02-06)
12
+
13
+ ### Feature
14
+
15
+ - Option for opening /edit with the same vertical offset like the page in view mode before. @ksuess [#3662](https://github.com/plone/volto/issues/3662)
16
+ - Add option to add an action button to the top of the toolbar and to add a menu button to the bottom of the toolbar. @ksuess [#4333](https://github.com/plone/volto/issues/4333)
17
+ - Update to latest versions in the backend for testing and the convenience api folder @sneridagh [#4361](https://github.com/plone/volto/issues/4361)
18
+ - Content Rules: Support server-provided schema for condition and action @ericof [#4368](https://github.com/plone/volto/issues/4368)
19
+
20
+ ### Bugfix
21
+
22
+ - Fix react-error-overlay resolution @sneridagh [#4360](https://github.com/plone/volto/issues/4360)
23
+
24
+ ### Documentation
25
+
26
+ - Add documentation for copy, cut, and paste blocks in Volto. @MAX-786 [#3827](https://github.com/plone/volto/issues/3827)
27
+ - Fixed Grammar error @SaiRev0 [#4272](https://github.com/plone/volto/issues/4272)
28
+
29
+
11
30
  ## 16.9.0 (2023-01-27)
12
31
 
13
32
  ### Feature
@@ -24,6 +43,7 @@
24
43
  - bugfix : add pathname as required proptype in Blocks/Edit @akshatgarg12 [#4194](https://github.com/plone/volto/issues/4194)
25
44
  - (Fix) Select Widgets scrolls the page when the options are not visible @dobri1408 [#4223](https://github.com/plone/volto/issues/4223)
26
45
  - Updated volto-slate to check for slateSettings before falling back to config @danalvrz [#4311](https://github.com/plone/volto/issues/4311)
46
+ - Fix bug where label of search facet wasn't translated when the content object is being translated @robgietema [#4306](https://github.com/plone/volto/issues/4306)
27
47
 
28
48
  ### Internal
29
49
 
@@ -35,7 +55,6 @@
35
55
  ### Bugfix
36
56
 
37
57
  - Fix StyleWrapper extenders, the classNames were not being re-fed into the pipe @sneridagh [#4275](https://github.com/plone/volto/issues/4275)
38
- - Fix bug where label of search facet wasn't translated when the content object is being translated @robgietema
39
58
 
40
59
 
41
60
  ## 16.8.0 (2023-01-18)
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "16.9.0",
12
+ "version": "16.10.0",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -422,6 +422,7 @@
422
422
  "resolutions": {
423
423
  "clean-css": "5.3.1",
424
424
  "http-proxy": "^1.18.1",
425
+ "react-error-overlay": "6.0.9",
425
426
  "ua-parser-js": "0.7.28"
426
427
  },
427
428
  "volta": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "16.9.0",
3
+ "version": "16.10.0",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -339,6 +339,23 @@ const detectVocabulary = (type) => {
339
339
  }
340
340
  };
341
341
 
342
+ const processSchema = (schema) => {
343
+ const properties = { ...schema.properties };
344
+ Object.keys(properties).forEach((key) => {
345
+ const value = properties[key];
346
+ const vocabId = value?.vocabulary?.['@id'];
347
+ if (vocabId?.includes('@sources')) {
348
+ value['widget'] = 'internal_url';
349
+ delete value['vocabulary'];
350
+ }
351
+ });
352
+ const newSchema = {
353
+ ...schema,
354
+ properties,
355
+ };
356
+ return newSchema;
357
+ };
358
+
342
359
  const VariableModal = ({
343
360
  open,
344
361
  type,
@@ -371,17 +388,27 @@ const VariableModal = ({
371
388
  React.useEffect(() => {
372
389
  //reset input schema to rehydrate options
373
390
  setInputSchema('');
374
- const vocabularyOptions =
375
- vocabularyName &&
376
- vocabularies &&
377
- vocabularies[vocabularyName] &&
378
- vocabularies[vocabularyName].items
379
- ? vocabularies[vocabularyName].items.map((item, i) => {
380
- return [item.value, item.label];
381
- })
382
- : [];
383
- //set schema with the new options from vocabulary
384
- setInputSchema(setSchema(value.title, vocabularyOptions));
391
+ // On creation, @schema is provided by value
392
+ // On update, @schema comes from formData
393
+ const rawSchema = value['@schema'] || formData['@schema'];
394
+ let schema;
395
+ if (rawSchema) {
396
+ schema = processSchema(rawSchema);
397
+ } else {
398
+ const vocabularyOptions =
399
+ vocabularyName &&
400
+ vocabularies &&
401
+ vocabularies[vocabularyName] &&
402
+ vocabularies[vocabularyName].items
403
+ ? vocabularies[vocabularyName].items.map((item, i) => {
404
+ return [item.value, item.label];
405
+ })
406
+ : [];
407
+ //set schema with the new options from vocabulary
408
+ schema = setSchema(value.title, vocabularyOptions);
409
+ }
410
+ setInputSchema(schema);
411
+
385
412
  // eslint-disable-next-line react-hooks/exhaustive-deps
386
413
  }, [vocabularies, open, formData, value]);
387
414
 
@@ -180,10 +180,11 @@ class Form extends Component {
180
180
  formData.hasOwnProperty(blocksLayoutFieldname) &&
181
181
  formData[blocksLayoutFieldname].items.length > 0
182
182
  ) {
183
- selectedBlock = formData[blocksLayoutFieldname].items[0];
184
-
185
- if (config.blocks?.initialBlocksFocus?.[this.props.type]) {
186
- //Default selected is not the first block, but the one from config.
183
+ if (config.blocks?.initialBlocksFocus === null) {
184
+ selectedBlock = null;
185
+ } else if (this.props.type in config.blocks?.initialBlocksFocus) {
186
+ // Default selected is not the first block, but the one from config.
187
+ // TODO Select first block and not an arbitrary one.
187
188
  Object.keys(formData[blocksFieldname]).forEach((b_key) => {
188
189
  if (
189
190
  formData[blocksFieldname][b_key]['@type'] ===
@@ -192,8 +193,11 @@ class Form extends Component {
192
193
  selectedBlock = b_key;
193
194
  }
194
195
  });
196
+ } else {
197
+ selectedBlock = formData[blocksLayoutFieldname].items[0];
195
198
  }
196
199
  }
200
+
197
201
  this.state = {
198
202
  formData,
199
203
  initialFormData: cloneDeep(formData),
@@ -109,7 +109,7 @@ const messages = defineMessages({
109
109
  },
110
110
  });
111
111
 
112
- const toolbarComponents = {
112
+ let toolbarComponents = {
113
113
  personalTools: { component: PersonalTools, wrapper: null },
114
114
  more: { component: More, wrapper: null },
115
115
  types: { component: Types, wrapper: null, contentAsProps: true },
@@ -210,6 +210,12 @@ class Toolbar extends Component {
210
210
  if (!hasApiExpander('types', getBaseUrl(this.props.pathname))) {
211
211
  this.props.getTypes(getBaseUrl(this.props.pathname));
212
212
  }
213
+ toolbarComponents = {
214
+ ...(config.settings
215
+ ? config.settings.additionalToolbarComponents || {}
216
+ : {}),
217
+ ...toolbarComponents,
218
+ };
213
219
  this.props.setExpandedToolbar(this.state.expanded);
214
220
  document.addEventListener('mousedown', this.handleClickOutside, false);
215
221
  }
@@ -551,9 +557,13 @@ class Toolbar extends Component {
551
557
  </button>
552
558
  </>
553
559
  )}
560
+ <Pluggable name="main.toolbar.top" />
554
561
  </div>
555
562
  <div className="toolbar-bottom">
556
- <Pluggable name="main.toolbar.bottom" />
563
+ <Pluggable
564
+ name="main.toolbar.bottom"
565
+ params={{ onClickHandler: this.toggleMenu }}
566
+ />
557
567
  {!this.props.hideDefaultViewButtons && (
558
568
  <button
559
569
  className="user"
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { connect } from 'react-redux';
4
+ import config from '@plone/volto/registry';
4
5
 
5
6
  /**
6
7
  *
@@ -27,8 +28,14 @@ class ScrollToTop extends React.Component {
27
28
  * @memberof ScrollToTop
28
29
  */
29
30
  componentDidUpdate(prevProps) {
31
+ const noInitialBlocksFocus = // Do not scroll on /edit
32
+ config.blocks?.initialBlocksFocus === null
33
+ ? this.props.location?.pathname.slice(-5) !== '/edit'
34
+ : true;
30
35
  if (
36
+ !this.props.location?.hash &&
31
37
  !this.props.location?.pathname.hash &&
38
+ noInitialBlocksFocus &&
32
39
  this.props.location?.pathname !== prevProps.location?.pathname
33
40
  ) {
34
41
  window.scrollTo(0, 0);
@@ -1 +0,0 @@
1
- Updated 4 Dependencies @SaiRev0
package/news/4165.feature DELETED
@@ -1 +0,0 @@
1
- Enable scrolling to ids via hashes in internal links @jackahl
package/news/4189.bugfix DELETED
@@ -1 +0,0 @@
1
- Fixed maxLength validation for string type fields @pnicolli
package/news/4194.bugfix DELETED
@@ -1 +0,0 @@
1
- bugfix : add pathname as required proptype in Blocks/Edit @akshatgarg12
package/news/4223.bugfix DELETED
@@ -1 +0,0 @@
1
- (Fix) Select Widgets scrolls the page when the options are not visible @dobri1408
package/news/4231.feature DELETED
@@ -1 +0,0 @@
1
- Read listing block schema from configuration registry @pnicolli
package/news/4282.feature DELETED
@@ -1 +0,0 @@
1
- Add displayName when registering a component @sneridagh
package/news/4285.feature DELETED
@@ -1 +0,0 @@
1
- Support for all default expanders (breadcrumbs, navigation, actions, types) in actions/reducers. Conditional loading of actions if the expanders are present. @sneridagh
package/news/4311.bugfix DELETED
@@ -1 +0,0 @@
1
- Updated volto-slate to check for slateSettings before falling back to config @danalvrz
package/news/4313.feature DELETED
@@ -1 +0,0 @@
1
- Add `addNewBlock` Cypress support command @sneridagh