@plone/volto 17.18.0 → 17.18.2

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
@@ -17,6 +17,18 @@ myst:
17
17
 
18
18
  <!-- towncrier release notes start -->
19
19
 
20
+ ## 17.18.2 (2024-07-10)
21
+
22
+ ### Bugfix
23
+
24
+ - Return a redirect response from Volto server-side rendering if the API request was redirected. @JeffersonBledsoe @mamico [#4854](https://github.com/plone/volto/issues/4854)
25
+
26
+ ## 17.18.1 (2024-06-29)
27
+
28
+ ### Bugfix
29
+
30
+ - In the Slate text block, the markup shortcuts for heading and blockquote work again. @kHAPPY2004 [#5452](https://github.com/plone/volto/issues/5452)
31
+
20
32
  ## 17.18.0 (2024-06-28)
21
33
 
22
34
  ### Feature
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "17.18.0",
12
+ "version": "17.18.2",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -187,7 +187,8 @@
187
187
  "hooks": {
188
188
  "before:bump": [
189
189
  "yarn i18n",
190
- "yarn build:types"
190
+ "yarn build:types",
191
+ "git add types"
191
192
  ],
192
193
  "after:bump": [
193
194
  "pipx run towncrier build --draft --yes --version ${version} > .changelog.draft && pipx run towncrier build --yes --version ${version}",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "17.18.0",
3
+ "version": "17.18.2",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -22,6 +22,9 @@ export const P = 'p';
22
22
  export const LI = 'li';
23
23
  export const UL = 'ul';
24
24
  export const OL = 'ol';
25
+ export const H2 = 'h2';
26
+ export const H3 = 'h3';
27
+ export const BLOCKQUOTE = 'blockquote';
25
28
 
26
29
  // dom parsing node information
27
30
  export const TEXT_NODE = 3;
@@ -1,6 +1,6 @@
1
1
  import { toggleList, unwrapList } from './utils';
2
2
  import { isBlockActive } from '@plone/volto-slate/utils';
3
- import { UL, OL, LI } from '@plone/volto-slate/constants';
3
+ import { UL, OL, LI, H2, H3, BLOCKQUOTE } from '@plone/volto-slate/constants';
4
4
 
5
5
  /**
6
6
  * Uses the old toggleList function to toggle lists on or off or from a type to another.
@@ -22,11 +22,11 @@ export const localToggleList = (editor, format) => {
22
22
  */
23
23
  export const autoformatRules = [
24
24
  {
25
- type: 'h2',
25
+ type: H2,
26
26
  markup: '#',
27
27
  },
28
28
  {
29
- type: 'h3',
29
+ type: H3,
30
30
  markup: '##',
31
31
  },
32
32
  {
@@ -44,7 +44,7 @@ export const autoformatRules = [
44
44
  },
45
45
  },
46
46
  {
47
- type: 'blockquote',
47
+ type: BLOCKQUOTE,
48
48
  markup: ['>'],
49
49
  // preFormat,
50
50
  },
@@ -200,6 +200,7 @@ export const autoformatBlock = (editor, type, at, { preFormat, format }) => {
200
200
  Transforms.setNodes(
201
201
  editor,
202
202
  { type },
203
+ { at },
203
204
  { match: (n) => Editor.isBlock(editor, n) },
204
205
  );
205
206
  } else {
@@ -205,8 +205,10 @@ class View extends Component {
205
205
  */
206
206
  render() {
207
207
  const { views } = config;
208
- if (this.props.error && this.props.error.code === 301) {
209
- const redirect = flattenToAppURL(this.props.error.url).split('?')[0];
208
+ if ([301, 302].includes(this.props.error?.code)) {
209
+ const redirect = flattenToAppURL(this.props.error.url)
210
+ .split('?')[0]
211
+ .replace('/++api++', '');
210
212
  return <Redirect to={`${redirect}${this.props.location.search}`} />;
211
213
  } else if (this.props.error && !this.props.connectionRefused) {
212
214
  let FoundView;
@@ -22,6 +22,7 @@ beforeAll(() => {
22
22
  });
23
23
  config.settings.publicURL = 'https://plone.org';
24
24
  });
25
+ global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
25
26
 
26
27
  const mockStore = configureStore();
27
28
 
@@ -80,6 +80,10 @@ class Api {
80
80
 
81
81
  Object.keys(headers).forEach((key) => request.set(key, headers[key]));
82
82
 
83
+ if (__SERVER__ && checkUrl && ['get', 'head'].includes(method)) {
84
+ request.redirects(0);
85
+ }
86
+
83
87
  if (data) {
84
88
  request.send(data);
85
89
  }
@@ -104,6 +108,14 @@ class Api {
104
108
  url: request.xhr.responseURL,
105
109
  });
106
110
  }
111
+
112
+ if ([301, 302].includes(err?.status)) {
113
+ return reject({
114
+ code: err.status,
115
+ url: err.response.headers.location,
116
+ });
117
+ }
118
+
107
119
  return err ? reject(err) : resolve(response.body || response.text);
108
120
  });
109
121
  });
@@ -18,6 +18,7 @@ beforeAll(() => {
18
18
 
19
19
  const api = new Api();
20
20
  const { settings } = config;
21
+ global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
21
22
 
22
23
  test('get request', () => {});
23
24
 
@@ -24,6 +24,7 @@ beforeAll(() => {
24
24
 
25
25
  const api = new Api();
26
26
  const { settings } = config;
27
+ global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
27
28
 
28
29
  test('get request', () => {});
29
30