@plone/volto 16.9.0 → 16.11.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,12 @@
1
- ## 16.9.0 (2023-01-27)
1
+ ## 16.11.0 (2023-02-13)
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
+ - Add open external link in a new tab config option. @robgietema [#4379](https://github.com/plone/volto/issues/4379)
6
+ - Add scss support in core @sneridagh [#4383](https://github.com/plone/volto/issues/4383)
7
+ - Use open in new tab setting for link types. @robgietema [#4384](https://github.com/plone/volto/issues/4384)
10
8
 
11
9
  ### Bugfix
12
10
 
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)
17
-
18
- ### Internal
19
-
20
- - Updated 4 Dependencies @SaiRev0 [#4104](https://github.com/plone/volto/issues/4104)
11
+ - Fix Cannot read properties of undefined (reading 'translations') @avoinea [#4377](https://github.com/plone/volto/issues/4377)
21
12
 
Binary file
package/CHANGELOG.md CHANGED
@@ -8,6 +8,38 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 16.11.0 (2023-02-13)
12
+
13
+ ### Feature
14
+
15
+ - Add open external link in a new tab config option. @robgietema [#4379](https://github.com/plone/volto/issues/4379)
16
+ - Add scss support in core @sneridagh [#4383](https://github.com/plone/volto/issues/4383)
17
+ - Use open in new tab setting for link types. @robgietema [#4384](https://github.com/plone/volto/issues/4384)
18
+
19
+ ### Bugfix
20
+
21
+ - Fix Cannot read properties of undefined (reading 'translations') @avoinea [#4377](https://github.com/plone/volto/issues/4377)
22
+
23
+
24
+ ## 16.10.0 (2023-02-06)
25
+
26
+ ### Feature
27
+
28
+ - 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)
29
+ - 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)
30
+ - Update to latest versions in the backend for testing and the convenience api folder @sneridagh [#4361](https://github.com/plone/volto/issues/4361)
31
+ - Content Rules: Support server-provided schema for condition and action @ericof [#4368](https://github.com/plone/volto/issues/4368)
32
+
33
+ ### Bugfix
34
+
35
+ - Fix react-error-overlay resolution @sneridagh [#4360](https://github.com/plone/volto/issues/4360)
36
+
37
+ ### Documentation
38
+
39
+ - Add documentation for copy, cut, and paste blocks in Volto. @MAX-786 [#3827](https://github.com/plone/volto/issues/3827)
40
+ - Fixed Grammar error @SaiRev0 [#4272](https://github.com/plone/volto/issues/4272)
41
+
42
+
11
43
  ## 16.9.0 (2023-01-27)
12
44
 
13
45
  ### Feature
@@ -24,6 +56,7 @@
24
56
  - bugfix : add pathname as required proptype in Blocks/Edit @akshatgarg12 [#4194](https://github.com/plone/volto/issues/4194)
25
57
  - (Fix) Select Widgets scrolls the page when the options are not visible @dobri1408 [#4223](https://github.com/plone/volto/issues/4223)
26
58
  - Updated volto-slate to check for slateSettings before falling back to config @danalvrz [#4311](https://github.com/plone/volto/issues/4311)
59
+ - 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
60
 
28
61
  ### Internal
29
62
 
@@ -35,7 +68,6 @@
35
68
  ### Bugfix
36
69
 
37
70
  - 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
71
 
40
72
 
41
73
  ## 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.11.0",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -137,6 +137,12 @@
137
137
  "stylelint-prettier"
138
138
  ],
139
139
  "overrides": [
140
+ {
141
+ "files": [
142
+ "**/*.scss"
143
+ ],
144
+ "customSyntax": "postcss-scss"
145
+ },
140
146
  {
141
147
  "files": [
142
148
  "**/*.less"
@@ -316,6 +322,7 @@
316
322
  "postcss-load-config": "3.1.4",
317
323
  "postcss-loader": "4.3.0",
318
324
  "postcss-overrides": "3.1.4",
325
+ "postcss-scss": "4.0.6",
319
326
  "prepend-http": "2",
320
327
  "prettier": "2.0.5",
321
328
  "pretty-bytes": "5.3.0",
@@ -326,6 +333,7 @@
326
333
  "razzle": "4.2.17",
327
334
  "razzle-dev-utils": "4.2.17",
328
335
  "razzle-plugin-bundle-analyzer": "4.2.17",
336
+ "razzle-plugin-scss": "4.2.18",
329
337
  "rc-time-picker": "3.7.3",
330
338
  "react": "17.0.2",
331
339
  "react-anchor-link-smooth-scroll": "1.0.12",
@@ -422,6 +430,7 @@
422
430
  "resolutions": {
423
431
  "clean-css": "5.3.1",
424
432
  "http-proxy": "^1.18.1",
433
+ "react-error-overlay": "6.0.9",
425
434
  "ua-parser-js": "0.7.28"
426
435
  },
427
436
  "volta": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "16.9.0",
3
+ "version": "16.11.0",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,11 +1,16 @@
1
1
  import React from 'react';
2
2
  import { UniversalLink } from '@plone/volto/components';
3
+ import config from '@plone/volto/registry';
4
+ import { isInternalURL } from '@plone/volto/helpers';
3
5
 
4
6
  const ViewLink = ({ url, target, download, children }) => {
7
+ const { openExternalLinkInNewTab } = config.settings;
5
8
  return (
6
9
  <UniversalLink
7
10
  href={url}
8
- openLinkInNewTab={target === '_blank'}
11
+ openLinkInNewTab={
12
+ (openExternalLinkInNewTab && !isInternalURL(url)) || target === '_blank'
13
+ }
9
14
  download={download}
10
15
  >
11
16
  {children}
package/razzle.config.js CHANGED
@@ -330,6 +330,7 @@ const defaultPlugins = [
330
330
  { object: require('./webpack-plugins/webpack-svg-plugin') },
331
331
  { object: require('./webpack-plugins/webpack-bundle-analyze-plugin') },
332
332
  { object: require('./jest-extender-plugin') },
333
+ 'scss',
333
334
  ];
334
335
 
335
336
  const plugins = addonExtenders.reduce(
@@ -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
  }
@@ -504,7 +510,7 @@ class Toolbar extends Component {
504
510
  ((this.props.content.is_folderish &&
505
511
  this.props.types.length > 0) ||
506
512
  (config.settings.isMultilingual &&
507
- this.props.content['@components'].translations)) && (
513
+ this.props.content['@components']?.translations)) && (
508
514
  <button
509
515
  className="add"
510
516
  aria-label={this.props.intl.formatMessage(
@@ -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"
@@ -28,6 +28,7 @@ const NavItem = ({ item, lang }) => {
28
28
  key={item.url}
29
29
  className="item"
30
30
  rel="noopener noreferrer"
31
+ target={settings.openExternalLinkInNewTab ? '_blank' : '_self'}
31
32
  >
32
33
  {item.title}
33
34
  </a>
@@ -9,6 +9,7 @@ import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
9
9
  import { Container } from 'semantic-ui-react';
10
10
  import { UniversalLink } from '@plone/volto/components';
11
11
  import { FormattedMessage } from 'react-intl';
12
+ import config from '@plone/volto/registry';
12
13
 
13
14
  /**
14
15
  * View container class.
@@ -58,6 +59,7 @@ class LinkView extends Component {
58
59
  */
59
60
  render() {
60
61
  const { remoteUrl } = this.props.content;
62
+ const { openExternalLinkInNewTab } = config.settings;
61
63
  return (
62
64
  <Container id="page-document">
63
65
  <h1 className="documentFirstHeading">{this.props.content.title}</h1>
@@ -72,7 +74,12 @@ class LinkView extends Component {
72
74
  id="The link address is:"
73
75
  defaultMessage="The link address is:"
74
76
  />{' '}
75
- <UniversalLink href={remoteUrl}>
77
+ <UniversalLink
78
+ href={remoteUrl}
79
+ openLinkInNewTab={
80
+ openExternalLinkInNewTab && !isInternalURL(remoteUrl)
81
+ }
82
+ >
76
83
  {flattenToAppURL(remoteUrl)}
77
84
  </UniversalLink>
78
85
  </p>
@@ -111,6 +111,7 @@ let config = {
111
111
  downloadableObjects: ['File'], //list of content-types for which the direct download of the file will be carried out if the user is not authenticated
112
112
  viewableInBrowserObjects: [], //ex: ['File']. List of content-types for which the file will be displayed in browser if the user is not authenticated
113
113
  listingPreviewImageField: 'image', // deprecated from Volto 14 onwards
114
+ openExternalLinkInNewTab: false,
114
115
  notSupportedBrowsers: ['ie'],
115
116
  defaultPageSize: 25,
116
117
  isMultilingual: false,
@@ -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