@eeacms/volto-group-block 5.0.1 → 6.0.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.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [6.0.0](https://github.com/eea/volto-group-block/compare/5.0.1...6.0.0) - 24 March 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- (feat): Possibility to copy/cut/paste blocks within section group block - refs #157469 [dobri1408 - [`e9fc098`](https://github.com/eea/volto-group-block/commit/e9fc09825ba2ae258feb77864491d97d94c585b4)]
|
|
12
|
+
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`2f42e7c`](https://github.com/eea/volto-group-block/commit/2f42e7c19a1da5a9c6a883cb4f101e8fa224ff94)]
|
|
7
13
|
### [5.0.1](https://github.com/eea/volto-group-block/compare/5.0.0...5.0.1) - 16 November 2022
|
|
8
14
|
|
|
9
15
|
#### :nail_care: Enhancements
|
|
@@ -20,8 +26,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
20
26
|
|
|
21
27
|
- Prepare 5.0.0 release [Miu Razvan - [`88c0ddd`](https://github.com/eea/volto-group-block/commit/88c0ddd569aeda7ee34d1eadea6a087f4e7dc257)]
|
|
22
28
|
- Update dependencies [Alin Voinea - [`c8405af`](https://github.com/eea/volto-group-block/commit/c8405afb830cdf62e7877bf30b619933519e1d71)]
|
|
23
|
-
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`18e26c6`](https://github.com/eea/volto-group-block/commit/18e26c6939706d572ab8574e9b1826b9abc76314)]
|
|
24
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`8ed6d21`](https://github.com/eea/volto-group-block/commit/8ed6d21d8489911cc4cb471e3f8823c35f4adc50)]
|
|
25
29
|
### [4.3.8](https://github.com/eea/volto-group-block/compare/4.3.7...4.3.8) - 26 August 2022
|
|
26
30
|
|
|
27
31
|
### [4.3.7](https://github.com/eea/volto-group-block/compare/4.3.6...4.3.7) - 22 August 2022
|
|
@@ -34,9 +38,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
34
38
|
|
|
35
39
|
#### :hammer_and_wrench: Others
|
|
36
40
|
|
|
37
|
-
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`4e73f8b`](https://github.com/eea/volto-group-block/commit/4e73f8be3c73559557efadc410cb56abc055d82d)]
|
|
38
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`3040335`](https://github.com/eea/volto-group-block/commit/3040335002c63b50208c95918413bc958150e7a9)]
|
|
39
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`386f730`](https://github.com/eea/volto-group-block/commit/386f730ed65f73fe1468b9b77351c97fb70edcc5)]
|
|
40
41
|
### [4.3.5](https://github.com/eea/volto-group-block/compare/4.3.4...4.3.5) - 4 January 2022
|
|
41
42
|
|
|
42
43
|
### [4.3.4](https://github.com/eea/volto-group-block/compare/4.3.3...4.3.4) - 3 January 2022
|
|
@@ -45,23 +46,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
45
46
|
|
|
46
47
|
#### :hammer_and_wrench: Others
|
|
47
48
|
|
|
48
|
-
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`3e62d79`](https://github.com/eea/volto-group-block/commit/3e62d79a7ed37d10d623bc845d43e1144f8080f7)]
|
|
49
49
|
### [4.3.2](https://github.com/eea/volto-group-block/compare/4.3.1...4.3.2) - 10 December 2021
|
|
50
50
|
|
|
51
51
|
#### :hammer_and_wrench: Others
|
|
52
52
|
|
|
53
53
|
- Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`bc36cf5`](https://github.com/eea/volto-group-block/commit/bc36cf58c39e2b43c2fbf5189df6ddefc1260857)]
|
|
54
|
-
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`8038e78`](https://github.com/eea/volto-group-block/commit/8038e783c1e8ddd71e21f72070fdfa8e7e098993)]
|
|
55
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`daccdbc`](https://github.com/eea/volto-group-block/commit/daccdbc733e47be7d6536eb67f8f2eea038dc94b)]
|
|
56
54
|
### [4.3.1](https://github.com/eea/volto-group-block/compare/4.3.0...4.3.1) - 11 October 2021
|
|
57
55
|
|
|
58
56
|
#### :hammer_and_wrench: Others
|
|
59
57
|
|
|
60
|
-
- Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`b0092e4`](https://github.com/eea/volto-group-block/commit/b0092e4f78a1a0184e22e32bb9806cd57417dfb2)]
|
|
61
|
-
- Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`ff8889c`](https://github.com/eea/volto-group-block/commit/ff8889cb7b0761b1df43b201984ce40b14e1561b)]
|
|
62
|
-
- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`0375c28`](https://github.com/eea/volto-group-block/commit/0375c28ed1ffe9186a4790b454795c0ca8039f72)]
|
|
63
|
-
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`c392190`](https://github.com/eea/volto-group-block/commit/c392190f044f5d9397bd2fb8c3d6a357f84960d0)]
|
|
64
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`9694501`](https://github.com/eea/volto-group-block/commit/9694501141e6780eba89464d36406e3c93629fd8)]
|
|
65
58
|
### [4.3.0](https://github.com/eea/volto-group-block/compare/4.2.3...4.3.0) - 24 June 2021
|
|
66
59
|
|
|
67
60
|
#### :hammer_and_wrench: Others
|
|
@@ -177,7 +170,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
177
170
|
- Release 1.0.0 [Alin Voinea - [`b6ef873`](https://github.com/eea/volto-group-block/commit/b6ef873cb6f61e17db66fdd4de1d9d4902a66fc6)]
|
|
178
171
|
- Update package meta info [Alin Voinea - [`143b7d4`](https://github.com/eea/volto-group-block/commit/143b7d44438d7afa5e346a9d21a85352df4e925f)]
|
|
179
172
|
- Add Jenkinkins pipeline [Alin Voinea - [`866a4e1`](https://github.com/eea/volto-group-block/commit/866a4e14ea1eb8f5adb01222e576e5ab6dc73a70)]
|
|
180
|
-
- yarn prettier [Alin Voinea - [`e3fe0a3`](https://github.com/eea/volto-group-block/commit/e3fe0a36b89878769341b45198d6c9e2f2584d15)]
|
|
181
173
|
### [0.1.3](https://github.com/eea/volto-group-block/compare/0.1.2...0.1.3) - 9 November 2020
|
|
182
174
|
|
|
183
175
|
#### :hammer_and_wrench: Others
|
|
@@ -217,5 +209,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
217
209
|
- Render meta block [Alin Voinea - [`0d44560`](https://github.com/eea/volto-group-block/commit/0d4456011ca56454068a54c610250b02df4ccb3b)]
|
|
218
210
|
- Implement meta block allowedBlocks settings [Alin Voinea - [`f24feb1`](https://github.com/eea/volto-group-block/commit/f24feb1a1751f04841c21c7cd52a517fb02074ba)]
|
|
219
211
|
- Edit meta block [Alin Voinea - [`236d291`](https://github.com/eea/volto-group-block/commit/236d29156fa835a7aa54eecdb4f120de0d64b271)]
|
|
220
|
-
- yarn bootstrap [Alin Voinea - [`e009dfb`](https://github.com/eea/volto-group-block/commit/e009dfb6b9b74d101a6722f0982a5359fc522b6b)]
|
|
221
212
|
- Initial commit [Alin Voinea - [`6a7b0de`](https://github.com/eea/volto-group-block/commit/6a7b0deb8f873d1462fd6a9c61edfc1562b3aace)]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-group-block",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "volto-group-block: Volto block to be used to group other blocks",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -18,10 +18,9 @@
|
|
|
18
18
|
"type": "git",
|
|
19
19
|
"url": "git@github.com:eea/volto-group-block.git"
|
|
20
20
|
},
|
|
21
|
-
"dependencies": {},
|
|
22
21
|
"devDependencies": {
|
|
23
|
-
"@plone/scripts": "*",
|
|
24
22
|
"@cypress/code-coverage": "^3.10.0",
|
|
23
|
+
"@plone/scripts": "*",
|
|
25
24
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
26
25
|
"md5": "^2.3.0"
|
|
27
26
|
},
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { isEmpty } from 'lodash';
|
|
2
|
+
import { isEmpty, without } from 'lodash';
|
|
3
3
|
import {
|
|
4
4
|
BlocksForm,
|
|
5
5
|
SidebarPortal,
|
|
6
6
|
Icon,
|
|
7
7
|
BlockDataForm,
|
|
8
|
+
BlocksToolbar,
|
|
8
9
|
} from '@plone/volto/components';
|
|
9
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
emptyBlocksForm,
|
|
12
|
+
getBlocksLayoutFieldname,
|
|
13
|
+
} from '@plone/volto/helpers';
|
|
10
14
|
import delightedSVG from '@plone/volto/icons/delighted.svg';
|
|
11
15
|
import dissatisfiedSVG from '@plone/volto/icons/dissatisfied.svg';
|
|
12
16
|
import PropTypes from 'prop-types';
|
|
@@ -28,15 +32,72 @@ const Edit = (props) => {
|
|
|
28
32
|
manage,
|
|
29
33
|
formDescription,
|
|
30
34
|
} = props;
|
|
35
|
+
const onSelectBlock = (id, isMultipleSelection, event, activeBlock) => {
|
|
36
|
+
let newMultiSelected = [];
|
|
37
|
+
let selected = id;
|
|
38
|
+
|
|
39
|
+
if (isMultipleSelection) {
|
|
40
|
+
selected = null;
|
|
41
|
+
const blocksLayoutFieldname = getBlocksLayoutFieldname(data?.data);
|
|
42
|
+
const blocks_layout = data?.data[blocksLayoutFieldname].items;
|
|
43
|
+
if (event.shiftKey) {
|
|
44
|
+
const anchor =
|
|
45
|
+
multiSelected.length > 0
|
|
46
|
+
? blocks_layout.indexOf(multiSelected[0])
|
|
47
|
+
: blocks_layout.indexOf(activeBlock);
|
|
48
|
+
const focus = blocks_layout.indexOf(id);
|
|
49
|
+
if (anchor === focus) {
|
|
50
|
+
newMultiSelected = [id];
|
|
51
|
+
} else if (focus > anchor) {
|
|
52
|
+
newMultiSelected = [...blocks_layout.slice(anchor, focus + 1)];
|
|
53
|
+
} else {
|
|
54
|
+
newMultiSelected = [...blocks_layout.slice(focus, anchor + 1)];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if ((event.ctrlKey || event.metaKey) && !event.shiftKey) {
|
|
58
|
+
if (multiSelected.includes(id)) {
|
|
59
|
+
selected = null;
|
|
60
|
+
newMultiSelected = without(multiSelected, id);
|
|
61
|
+
} else {
|
|
62
|
+
newMultiSelected = [...(multiSelected || []), id];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
31
66
|
|
|
67
|
+
setSelectedBlock(selected);
|
|
68
|
+
setMultiSelected(newMultiSelected);
|
|
69
|
+
};
|
|
32
70
|
const metadata = props.metadata || props.properties;
|
|
71
|
+
const [multiSelected, setMultiSelected] = useState([]);
|
|
33
72
|
const data_blocks = data?.data?.blocks;
|
|
34
73
|
const properties = isEmpty(data_blocks) ? emptyBlocksForm() : data.data;
|
|
35
74
|
|
|
36
75
|
const [selectedBlock, setSelectedBlock] = useState(
|
|
37
76
|
properties.blocks_layout.items[0],
|
|
38
77
|
);
|
|
39
|
-
|
|
78
|
+
const changeBlockData = (newBlockData) => {
|
|
79
|
+
let pastedBlocks = newBlockData.blocks_layout.items.filter((blockID) => {
|
|
80
|
+
if (data?.data?.blocks_layout.items.find((x) => x === blockID))
|
|
81
|
+
return false;
|
|
82
|
+
return true;
|
|
83
|
+
});
|
|
84
|
+
const selectedIndex =
|
|
85
|
+
data.data.blocks_layout.items.indexOf(selectedBlock) + 1;
|
|
86
|
+
onChangeBlock(block, {
|
|
87
|
+
...data,
|
|
88
|
+
data: {
|
|
89
|
+
...data?.data,
|
|
90
|
+
...newBlockData,
|
|
91
|
+
blocks_layout: {
|
|
92
|
+
items: [
|
|
93
|
+
...data.data.blocks_layout.items.slice(0, selectedIndex),
|
|
94
|
+
...pastedBlocks,
|
|
95
|
+
...data.data.blocks_layout.items.slice(selectedIndex),
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
};
|
|
40
101
|
React.useEffect(() => {
|
|
41
102
|
if (
|
|
42
103
|
isEmpty(data_blocks) &&
|
|
@@ -165,6 +226,28 @@ const Edit = (props) => {
|
|
|
165
226
|
>
|
|
166
227
|
{data.title || 'Section'}
|
|
167
228
|
</legend>
|
|
229
|
+
{selected ? (
|
|
230
|
+
<BlocksToolbar
|
|
231
|
+
selectedBlock={Object.keys(selectedBlock || {})[0]}
|
|
232
|
+
selectedBlocks={multiSelected}
|
|
233
|
+
onSetSelectedBlocks={(blockIds) => {
|
|
234
|
+
setMultiSelected(blockIds);
|
|
235
|
+
}}
|
|
236
|
+
formData={data.data}
|
|
237
|
+
onSelectBlock={(id, l, e) => {
|
|
238
|
+
const isMultipleSelection = e
|
|
239
|
+
? e.shiftKey || e.ctrlKey || e.metaKey
|
|
240
|
+
: false;
|
|
241
|
+
|
|
242
|
+
onSelectBlock(id, isMultipleSelection, e, selectedBlock);
|
|
243
|
+
}}
|
|
244
|
+
onChangeBlocks={(newBlockData) => {
|
|
245
|
+
changeBlockData(newBlockData);
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
248
|
+
) : (
|
|
249
|
+
''
|
|
250
|
+
)}
|
|
168
251
|
<BlocksForm
|
|
169
252
|
metadata={metadata}
|
|
170
253
|
properties={properties}
|
|
@@ -173,8 +256,11 @@ const Edit = (props) => {
|
|
|
173
256
|
allowedBlocks={data.allowedBlocks}
|
|
174
257
|
title={data.placeholder}
|
|
175
258
|
description={instructions}
|
|
176
|
-
onSelectBlock={(id) => {
|
|
177
|
-
|
|
259
|
+
onSelectBlock={(id, l, e) => {
|
|
260
|
+
const isMultipleSelection = e
|
|
261
|
+
? e.shiftKey || e.ctrlKey || e.metaKey
|
|
262
|
+
: false;
|
|
263
|
+
onSelectBlock(id, isMultipleSelection, e, selectedBlock);
|
|
178
264
|
}}
|
|
179
265
|
onChangeFormData={(newFormData) => {
|
|
180
266
|
onChangeBlock(block, {
|
|
@@ -223,6 +309,7 @@ const Edit = (props) => {
|
|
|
223
309
|
)}
|
|
224
310
|
</>
|
|
225
311
|
}
|
|
312
|
+
multiSelected={multiSelected.includes(blockProps.block)}
|
|
226
313
|
>
|
|
227
314
|
{editBlock}
|
|
228
315
|
</EditBlockWrapper>
|