@plone/volto 16.5.0 → 16.6.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,15 +1,18 @@
1
- ## 16.5.0 (2022-12-16)
1
+ ## 16.6.0 (2022-12-23)
2
2
 
3
3
  ### Feature
4
4
 
5
- - Update pt_BR translation @rafahela [#4121](https://github.com/plone/volto/issues/4121)
5
+ - Allow passing the `step` prop to NumberWidget @tiberiuichim [#4152](https://github.com/plone/volto/issues/4152)
6
6
 
7
7
  ### Bugfix
8
8
 
9
- - Update SlashMenu to include block title in shortcut search; and prevent default on keydown for Arrows and Enter @danalvrz [#4116](https://github.com/plone/volto/issues/4116)
10
- - Fix removing of toast notification of logout when user login once again. @iFlameing [#4125](https://github.com/plone/volto/issues/4125)
9
+ - Fix categorization list is not readable when there are longer values or filtering @iFlameing [#4113](https://github.com/plone/volto/issues/4113)
10
+ - Add scroll into view settings @robgietema [#4140](https://github.com/plone/volto/issues/4140)
11
+ - Remove searching capabilities of SortOn component of Search Block @iFlameing [#4162](https://github.com/plone/volto/issues/4162)
12
+ - Fixed externalRoutes short version @pnicolli [#4182](https://github.com/plone/volto/issues/4182)
11
13
 
12
- ### Internal
14
+ ### Documentation
13
15
 
14
- - Upgrade testbed and convenience api folder to Plone 6 final @sneridagh [#4105](https://github.com/plone/volto/issues/4105)
16
+ - Fix URLs to Plone 6 docs. @stevepiercy [#4143](https://github.com/plone/volto/issues/4143)
17
+ - Fix Sphinx warning Document headings start at H2, not H1 [myst.header]. @stevepiercy [#4145](https://github.com/plone/volto/issues/4145)
15
18
 
package/CHANGELOG.md CHANGED
@@ -8,6 +8,25 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 16.6.0 (2022-12-23)
12
+
13
+ ### Feature
14
+
15
+ - Allow passing the `step` prop to NumberWidget @tiberiuichim [#4152](https://github.com/plone/volto/issues/4152)
16
+
17
+ ### Bugfix
18
+
19
+ - Fix categorization list is not readable when there are longer values or filtering @iFlameing [#4113](https://github.com/plone/volto/issues/4113)
20
+ - Add scroll into view settings @robgietema [#4140](https://github.com/plone/volto/issues/4140)
21
+ - Remove searching capabilities of SortOn component of Search Block @iFlameing [#4162](https://github.com/plone/volto/issues/4162)
22
+ - Fixed externalRoutes short version @pnicolli [#4182](https://github.com/plone/volto/issues/4182)
23
+
24
+ ### Documentation
25
+
26
+ - Fix URLs to Plone 6 docs. @stevepiercy [#4143](https://github.com/plone/volto/issues/4143)
27
+ - Fix Sphinx warning Document headings start at H2, not H1 [myst.header]. @stevepiercy [#4145](https://github.com/plone/volto/issues/4145)
28
+
29
+
11
30
  ## 16.5.0 (2022-12-16)
12
31
 
13
32
  ### Feature
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "16.5.0",
12
+ "version": "16.6.0",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "16.5.0",
3
+ "version": "16.6.0",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -34,6 +34,8 @@ export default (config) => {
34
34
  'styleMenu',
35
35
  ];
36
36
 
37
+ config.settings.slate.scrollIntoView = false;
38
+
37
39
  config.addonReducers = {
38
40
  ...config.addonReducers,
39
41
  ...slateReducers,
@@ -80,6 +80,7 @@ const SortOn = (props) => {
80
80
  label: sortable_indexes[k]?.title || k,
81
81
  })),
82
82
  ]}
83
+ isSearchable={false}
83
84
  value={value}
84
85
  onChange={(data) => {
85
86
  !isEditMode && setSortOn(data.value);
@@ -32,6 +32,7 @@ const NumberWidget = (props) => {
32
32
  maximum,
33
33
  minimum,
34
34
  placeholder,
35
+ step,
35
36
  } = props;
36
37
 
37
38
  return (
@@ -43,6 +44,7 @@ const NumberWidget = (props) => {
43
44
  disabled={isDisabled}
44
45
  min={minimum || null}
45
46
  max={maximum || null}
47
+ step={step}
46
48
  value={value ?? ''}
47
49
  placeholder={placeholder}
48
50
  onChange={({ target }) =>
@@ -65,7 +67,7 @@ const NumberWidget = (props) => {
65
67
  NumberWidget.propTypes = {
66
68
  id: PropTypes.string.isRequired,
67
69
  title: PropTypes.string.isRequired,
68
- description: PropTypes.string,
70
+ description: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
69
71
  required: PropTypes.bool,
70
72
  error: PropTypes.arrayOf(PropTypes.string),
71
73
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
@@ -73,6 +75,7 @@ NumberWidget.propTypes = {
73
75
  wrapped: PropTypes.bool,
74
76
  maximum: PropTypes.number,
75
77
  minimum: PropTypes.number,
78
+ step: PropTypes.number,
76
79
  placeholder: PropTypes.string,
77
80
  };
78
81
 
package/src/routes.js CHANGED
@@ -2,6 +2,8 @@
2
2
  * Routes.
3
3
  * @module routes
4
4
  */
5
+ import debug from 'debug';
6
+ import { compact } from 'lodash';
5
7
  import {
6
8
  Add,
7
9
  AddonsControlpanel,
@@ -93,12 +95,36 @@ export const multilingualRoutes = [
93
95
  },
94
96
  ];
95
97
 
98
+ export function getExternalRoutes() {
99
+ return compact(
100
+ (config.settings?.externalRoutes || []).map((route) => {
101
+ const newRoute = {
102
+ component: NotFound,
103
+ };
104
+ if (typeof route.match === 'string') {
105
+ newRoute.path = route.match;
106
+ return newRoute;
107
+ } else if (
108
+ typeof route.match === 'object' &&
109
+ !Array.isArray(route.match)
110
+ ) {
111
+ return {
112
+ ...newRoute,
113
+ ...route.match,
114
+ };
115
+ } else {
116
+ debug('routes')(
117
+ 'Got invalid externalRoute, please check the configuration.',
118
+ );
119
+ return null;
120
+ }
121
+ }),
122
+ );
123
+ }
124
+
96
125
  export const defaultRoutes = [
97
126
  // redirect to external links if path is in blacklist
98
- ...(config.settings?.externalRoutes || []).map((route) => ({
99
- ...route.match,
100
- component: NotFound,
101
- })),
127
+ ...getExternalRoutes(),
102
128
  ...((config.settings?.isMultilingual && multilingualRoutes) || []),
103
129
  {
104
130
  path: '/',
@@ -0,0 +1,34 @@
1
+ import config from './registry';
2
+ import { getExternalRoutes } from './routes';
3
+
4
+ describe('externalRoutes', () => {
5
+ it('computes regular externalRoutes correctly', () => {
6
+ config.settings.externalRoutes = [
7
+ {
8
+ match: {
9
+ path: '/test',
10
+ },
11
+ },
12
+ ];
13
+ const testRoute = getExternalRoutes().find((r) => r.path === '/test');
14
+ expect(testRoute).not.toBeUndefined();
15
+ });
16
+ it('computes shorthand externalRoutes correctly', () => {
17
+ config.settings.externalRoutes = [{ match: '/test' }];
18
+ const testRoute = getExternalRoutes().find((r) => r.path === '/test');
19
+ expect(testRoute).not.toBeUndefined();
20
+ });
21
+ it('ignores invalid routes', () => {
22
+ config.settings.externalRoutes = [
23
+ '/test',
24
+ { '/test': true },
25
+ ['/test'],
26
+ { match: ['/test'] },
27
+ { match: 123 },
28
+ ];
29
+ const externalRoutes = getExternalRoutes();
30
+ const testRoute = externalRoutes.find((r) => r.path === '/test');
31
+ expect(testRoute).toBeUndefined();
32
+ expect(externalRoutes.length).toEqual(0);
33
+ });
34
+ });
package/news/4113.bug DELETED
@@ -1 +0,0 @@
1
- Fix categorization list is not readable when there are longer values or filtering @iFlameing