@plone/volto 16.20.1 → 16.20.3

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,9 +1,6 @@
1
- ## 16.20.1 (2023-04-14)
1
+ ## 16.20.3 (2023-04-18)
2
2
 
3
3
  ### Bugfix
4
4
 
5
- - Generate a split sitemap @reebalazs [#4638](https://github.com/plone/volto/issues/4638)
6
- - Fix Move to top of folder ordering in folder content view @iFlameing [#4690](https://github.com/plone/volto/issues/4690)
7
- - Revert "Add current page parameter to the route in the listing and search block pagination (#4159)" @sneridagh [#4695](https://github.com/plone/volto/issues/4695)
8
- - Fix search block in edit mode re-queries multiple blocks with an empty search text @reebalazs [#4697](https://github.com/plone/volto/issues/4697)
5
+ - Revert inadvertently included files from another PR in #4710 @sneridagh [#4713](https://github.com/plone/volto/issues/4713)
9
6
 
Binary file
package/CHANGELOG.md CHANGED
@@ -8,6 +8,22 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 16.20.3 (2023-04-18)
12
+
13
+ ### Bugfix
14
+
15
+ - Revert inadvertently included files from another PR in #4710 @sneridagh [#4713](https://github.com/plone/volto/issues/4713)
16
+
17
+
18
+ ## 16.20.2 (2023-04-18)
19
+
20
+ ### Bugfix
21
+
22
+ - Fix robot.txt - the sitemap link should respect x-forwarded headers @reebalazs [#4638](https://github.com/plone/volto/issues/4638)
23
+ - Fix Move to top of folder ordering in folder content view by searching also @iFlameing [#4690](https://github.com/plone/volto/issues/4690)
24
+ - Fix faulty D&D elements in ObjectBrowserList widget @sneridagh [#4703](https://github.com/plone/volto/issues/4703)
25
+
26
+
11
27
  ## 16.20.1 (2023-04-14)
12
28
 
13
29
  ### Bugfix
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "16.20.1",
12
+ "version": "16.20.3",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -44,13 +44,13 @@
44
44
  "test:husky": "CI=true yarn test --bail --findRelatedTests",
45
45
  "test:debug": "node --inspect node_modules/.bin/jest --runInBand",
46
46
  "start:prod": "NODE_ENV=production node build/server.js",
47
- "prettier": "./node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,ts,tsx,json}'",
48
- "prettier:fix": "./node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,ts,tsx,json}'",
47
+ "prettier": "./node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json}'",
48
+ "prettier:fix": "./node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json}'",
49
49
  "stylelint": "./node_modules/.bin/stylelint 'theme/**/*.{css,less}' 'src/**/*.{css,less}'",
50
50
  "stylelint:overrides": "./node_modules/.bin/stylelint 'theme/**/*.overrides' 'src/**/*.overrides'",
51
51
  "stylelint:fix": "yarn stylelint --fix && yarn stylelint:overrides --fix",
52
- "lint": "./node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx,json}'",
53
- "lint:fix": "./node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx,json}'",
52
+ "lint": "./node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx,ts,tsx,json}'",
53
+ "lint:fix": "./node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx,ts,tsx,json}'",
54
54
  "i18n": "rm -rf build/messages && NODE_ENV=production i18n",
55
55
  "i18n:ci": "yarn i18n && git diff -G'^[^\"POT]' --exit-code",
56
56
  "dry-release": "release-it --dry-run",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "16.20.1",
3
+ "version": "16.20.3",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -796,12 +796,11 @@ class Contents extends Component {
796
796
  */
797
797
  onMoveToTop(event, { value }) {
798
798
  const id = this.state.items[value]['@id'];
799
- value = this.state.currentPage * this.state.pageSize + value;
800
799
  this.props
801
800
  .orderContent(
802
801
  getBaseUrl(this.props.pathname),
803
802
  id.replace(/^.*\//, ''),
804
- -value,
803
+ 'top',
805
804
  )
806
805
  .then(() => {
807
806
  this.setState(
@@ -821,18 +820,21 @@ class Contents extends Component {
821
820
  * @returns {undefined}
822
821
  */
823
822
  onMoveToBottom(event, { value }) {
824
- this.onOrderItem(
825
- this.state.items[value]['@id'],
826
- value,
827
- this.state.items.length - 1 - value,
828
- false,
829
- );
830
- this.onOrderItem(
831
- this.state.items[value]['@id'],
832
- value,
833
- this.state.items.length - 1 - value,
834
- true,
835
- );
823
+ const id = this.state.items[value]['@id'];
824
+ this.props
825
+ .orderContent(
826
+ getBaseUrl(this.props.pathname),
827
+ id.replace(/^.*\//, ''),
828
+ 'bottom',
829
+ )
830
+ .then(() => {
831
+ this.setState(
832
+ {
833
+ currentPage: 0,
834
+ },
835
+ () => this.fetchContents(),
836
+ );
837
+ });
836
838
  }
837
839
 
838
840
  /**
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { defineMessages, useIntl } from 'react-intl';
3
3
  import { Accordion, Button, Segment } from 'semantic-ui-react';
4
4
  import { DragDropList, FormFieldWrapper, Icon } from '@plone/volto/components';
5
- import { applySchemaDefaults } from '@plone/volto/helpers';
5
+ import { applySchemaDefaults, reorderArray } from '@plone/volto/helpers';
6
6
  import ObjectWidget from '@plone/volto/components/manage/Widgets/ObjectWidget';
7
7
 
8
8
  import upSVG from '@plone/volto/icons/up-key.svg';
@@ -164,13 +164,8 @@ const ObjectListWidget = (props) => {
164
164
  if (!destination) {
165
165
  return;
166
166
  }
167
-
168
- const first = value[source.index];
169
- const second = value[destination.index];
170
- value[destination.index] = first;
171
- value[source.index] = second;
172
-
173
- onChange(id, value);
167
+ const newValue = reorderArray(value, source.index, destination.index);
168
+ onChange(id, newValue);
174
169
  return true;
175
170
  }}
176
171
  >
@@ -28,9 +28,24 @@ export const generateRobots = (req) =>
28
28
  if (error) {
29
29
  resolve(text || error);
30
30
  } else {
31
+ // It appears that express does not take the x-forwarded headers into
32
+ // consideration, so we do it ourselves.
33
+ const {
34
+ 'x-forwarded-proto': forwardedProto,
35
+ 'x-forwarded-host': forwardedHost,
36
+ 'x-forwarded-port': forwardedPort,
37
+ } = req.headers;
38
+ const proto = forwardedProto ?? req.protocol;
39
+ const host = forwardedHost ?? req.get('Host');
40
+ const portNum = forwardedPort ?? req.get('Port');
41
+ const port =
42
+ (proto === 'https' && '' + portNum === '443') ||
43
+ (proto === 'http' && '' + portNum === '80')
44
+ ? ''
45
+ : `:${portNum}`;
31
46
  // Plone has probably returned the sitemap link with the internal url.
32
47
  // If so, let's replace it with the current one.
33
- const url = `${req.protocol}://${req.get('Host')}`;
48
+ const url = `${proto}://${host}${port}`;
34
49
  text = text.replace(internalUrl, url);
35
50
  // Replace the sitemap with the sitemap index.
36
51
  text = text.replace('sitemap.xml.gz', 'sitemap-index.xml');
@@ -258,11 +258,11 @@ export const removeFromArray = (array, index) => {
258
258
  };
259
259
 
260
260
  /**
261
- * Reorder array
261
+ * Moves an item from origin to target inside an array in an immutable way
262
262
  * @param {Array} array Array with data
263
- * @param {number} origin Index of item to be reordered
264
- * @param {number} target Index of item to be reordered to
265
- * @returns {Array} Array with reordered elements
263
+ * @param {number} origin Index of item to be moved from
264
+ * @param {number} target Index of item to be moved to
265
+ * @returns {Array} Resultant array
266
266
  */
267
267
  export const reorderArray = (array, origin, target) => {
268
268
  const result = Array.from(array);
@@ -86,6 +86,7 @@ export {
86
86
  hasApiExpander,
87
87
  replaceItemOfArray,
88
88
  cloneDeepSchema,
89
+ reorderArray,
89
90
  } from '@plone/volto/helpers/Utils/Utils';
90
91
  export { messages } from './MessageLabels/MessageLabels';
91
92
  export {