@eeacms/volto-group-block 6.0.0 → 6.1.1
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,12 +4,33 @@ 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.
|
|
7
|
+
### [6.1.1](https://github.com/eea/volto-group-block/compare/6.1.0...6.1.1) - 22 May 2023
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: add support for toc [Miu Razvan - [`0c4568b`](https://github.com/eea/volto-group-block/commit/0c4568b816dcfa55820f45f796f115fcf2306dfa)]
|
|
12
|
+
|
|
13
|
+
### [6.1.0](https://github.com/eea/volto-group-block/compare/6.0.0...6.1.0) - 4 April 2023
|
|
14
|
+
|
|
15
|
+
#### :house: Internal changes
|
|
16
|
+
|
|
17
|
+
- chore(package.json): update package version to 6.1.0 [Miu Razvan - [`b4251fc`](https://github.com/eea/volto-group-block/commit/b4251fcfa4c713d1777e4c389b36d3501a8a8d92)]
|
|
18
|
+
|
|
19
|
+
#### :hammer_and_wrench: Others
|
|
20
|
+
|
|
21
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`37ffae5`](https://github.com/eea/volto-group-block/commit/37ffae512967b36af22cbed208a3ec9e1ddc392b)]
|
|
22
|
+
## [6.0.0](https://github.com/eea/volto-group-block/compare/5.0.1...6.0.0) - 24 March 2023
|
|
8
23
|
|
|
9
24
|
#### :hammer_and_wrench: Others
|
|
10
25
|
|
|
11
26
|
- (feat): Possibility to copy/cut/paste blocks within section group block - refs #157469 [dobri1408 - [`e9fc098`](https://github.com/eea/volto-group-block/commit/e9fc09825ba2ae258feb77864491d97d94c585b4)]
|
|
27
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`db4b09a`](https://github.com/eea/volto-group-block/commit/db4b09a6c14a8b271dec0c766886ffbcc3fe205e)]
|
|
28
|
+
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`b8c2bf4`](https://github.com/eea/volto-group-block/commit/b8c2bf471868bb0394b2dbbf75ccb7917a9ef0bf)]
|
|
29
|
+
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`b343119`](https://github.com/eea/volto-group-block/commit/b3431196931fd568476fa8bf6fbc508e086229ae)]
|
|
12
30
|
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`2f42e7c`](https://github.com/eea/volto-group-block/commit/2f42e7c19a1da5a9c6a883cb4f101e8fa224ff94)]
|
|
31
|
+
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`73afcc2`](https://github.com/eea/volto-group-block/commit/73afcc2f417797cedaa78cceefb007001d6c2406)]
|
|
32
|
+
- yarn 3 [Alin Voinea - [`3c00ccc`](https://github.com/eea/volto-group-block/commit/3c00ccc7110bbf12a4d268182313418fb46b1a5d)]
|
|
33
|
+
- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`9b9662b`](https://github.com/eea/volto-group-block/commit/9b9662bda1da70ba0c3a7b4b05cebf130ed89e9e)]
|
|
13
34
|
### [5.0.1](https://github.com/eea/volto-group-block/compare/5.0.0...5.0.1) - 16 November 2022
|
|
14
35
|
|
|
15
36
|
#### :nail_care: Enhancements
|
|
@@ -26,6 +47,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
26
47
|
|
|
27
48
|
- Prepare 5.0.0 release [Miu Razvan - [`88c0ddd`](https://github.com/eea/volto-group-block/commit/88c0ddd569aeda7ee34d1eadea6a087f4e7dc257)]
|
|
28
49
|
- Update dependencies [Alin Voinea - [`c8405af`](https://github.com/eea/volto-group-block/commit/c8405afb830cdf62e7877bf30b619933519e1d71)]
|
|
50
|
+
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`18e26c6`](https://github.com/eea/volto-group-block/commit/18e26c6939706d572ab8574e9b1826b9abc76314)]
|
|
51
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`8ed6d21`](https://github.com/eea/volto-group-block/commit/8ed6d21d8489911cc4cb471e3f8823c35f4adc50)]
|
|
29
52
|
### [4.3.8](https://github.com/eea/volto-group-block/compare/4.3.7...4.3.8) - 26 August 2022
|
|
30
53
|
|
|
31
54
|
### [4.3.7](https://github.com/eea/volto-group-block/compare/4.3.6...4.3.7) - 22 August 2022
|
|
@@ -38,6 +61,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
38
61
|
|
|
39
62
|
#### :hammer_and_wrench: Others
|
|
40
63
|
|
|
64
|
+
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`4e73f8b`](https://github.com/eea/volto-group-block/commit/4e73f8be3c73559557efadc410cb56abc055d82d)]
|
|
65
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`3040335`](https://github.com/eea/volto-group-block/commit/3040335002c63b50208c95918413bc958150e7a9)]
|
|
66
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`386f730`](https://github.com/eea/volto-group-block/commit/386f730ed65f73fe1468b9b77351c97fb70edcc5)]
|
|
41
67
|
### [4.3.5](https://github.com/eea/volto-group-block/compare/4.3.4...4.3.5) - 4 January 2022
|
|
42
68
|
|
|
43
69
|
### [4.3.4](https://github.com/eea/volto-group-block/compare/4.3.3...4.3.4) - 3 January 2022
|
|
@@ -46,15 +72,23 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
46
72
|
|
|
47
73
|
#### :hammer_and_wrench: Others
|
|
48
74
|
|
|
75
|
+
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`3e62d79`](https://github.com/eea/volto-group-block/commit/3e62d79a7ed37d10d623bc845d43e1144f8080f7)]
|
|
49
76
|
### [4.3.2](https://github.com/eea/volto-group-block/compare/4.3.1...4.3.2) - 10 December 2021
|
|
50
77
|
|
|
51
78
|
#### :hammer_and_wrench: Others
|
|
52
79
|
|
|
53
80
|
- Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`bc36cf5`](https://github.com/eea/volto-group-block/commit/bc36cf58c39e2b43c2fbf5189df6ddefc1260857)]
|
|
81
|
+
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`8038e78`](https://github.com/eea/volto-group-block/commit/8038e783c1e8ddd71e21f72070fdfa8e7e098993)]
|
|
82
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`daccdbc`](https://github.com/eea/volto-group-block/commit/daccdbc733e47be7d6536eb67f8f2eea038dc94b)]
|
|
54
83
|
### [4.3.1](https://github.com/eea/volto-group-block/compare/4.3.0...4.3.1) - 11 October 2021
|
|
55
84
|
|
|
56
85
|
#### :hammer_and_wrench: Others
|
|
57
86
|
|
|
87
|
+
- Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`b0092e4`](https://github.com/eea/volto-group-block/commit/b0092e4f78a1a0184e22e32bb9806cd57417dfb2)]
|
|
88
|
+
- Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`ff8889c`](https://github.com/eea/volto-group-block/commit/ff8889cb7b0761b1df43b201984ce40b14e1561b)]
|
|
89
|
+
- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`0375c28`](https://github.com/eea/volto-group-block/commit/0375c28ed1ffe9186a4790b454795c0ca8039f72)]
|
|
90
|
+
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`c392190`](https://github.com/eea/volto-group-block/commit/c392190f044f5d9397bd2fb8c3d6a357f84960d0)]
|
|
91
|
+
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`9694501`](https://github.com/eea/volto-group-block/commit/9694501141e6780eba89464d36406e3c93629fd8)]
|
|
58
92
|
### [4.3.0](https://github.com/eea/volto-group-block/compare/4.2.3...4.3.0) - 24 June 2021
|
|
59
93
|
|
|
60
94
|
#### :hammer_and_wrench: Others
|
|
@@ -170,6 +204,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
170
204
|
- Release 1.0.0 [Alin Voinea - [`b6ef873`](https://github.com/eea/volto-group-block/commit/b6ef873cb6f61e17db66fdd4de1d9d4902a66fc6)]
|
|
171
205
|
- Update package meta info [Alin Voinea - [`143b7d4`](https://github.com/eea/volto-group-block/commit/143b7d44438d7afa5e346a9d21a85352df4e925f)]
|
|
172
206
|
- Add Jenkinkins pipeline [Alin Voinea - [`866a4e1`](https://github.com/eea/volto-group-block/commit/866a4e14ea1eb8f5adb01222e576e5ab6dc73a70)]
|
|
207
|
+
- yarn prettier [Alin Voinea - [`e3fe0a3`](https://github.com/eea/volto-group-block/commit/e3fe0a36b89878769341b45198d6c9e2f2584d15)]
|
|
173
208
|
### [0.1.3](https://github.com/eea/volto-group-block/compare/0.1.2...0.1.3) - 9 November 2020
|
|
174
209
|
|
|
175
210
|
#### :hammer_and_wrench: Others
|
|
@@ -209,4 +244,5 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
209
244
|
- Render meta block [Alin Voinea - [`0d44560`](https://github.com/eea/volto-group-block/commit/0d4456011ca56454068a54c610250b02df4ccb3b)]
|
|
210
245
|
- Implement meta block allowedBlocks settings [Alin Voinea - [`f24feb1`](https://github.com/eea/volto-group-block/commit/f24feb1a1751f04841c21c7cd52a517fb02074ba)]
|
|
211
246
|
- Edit meta block [Alin Voinea - [`236d291`](https://github.com/eea/volto-group-block/commit/236d29156fa835a7aa54eecdb4f120de0d64b271)]
|
|
247
|
+
- yarn bootstrap [Alin Voinea - [`e009dfb`](https://github.com/eea/volto-group-block/commit/e009dfb6b9b74d101a6722f0982a5359fc522b6b)]
|
|
212
248
|
- Initial commit [Alin Voinea - [`6a7b0de`](https://github.com/eea/volto-group-block/commit/6a7b0deb8f873d1462fd6a9c61edfc1562b3aace)]
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { isEmpty, without } from 'lodash';
|
|
3
|
+
import config from '@plone/volto/registry';
|
|
3
4
|
import {
|
|
4
5
|
BlocksForm,
|
|
5
6
|
SidebarPortal,
|
|
@@ -32,6 +33,44 @@ const Edit = (props) => {
|
|
|
32
33
|
manage,
|
|
33
34
|
formDescription,
|
|
34
35
|
} = props;
|
|
36
|
+
const metadata = props.metadata || props.properties;
|
|
37
|
+
const [multiSelected, setMultiSelected] = useState([]);
|
|
38
|
+
const data_blocks = data?.data?.blocks;
|
|
39
|
+
const properties = isEmpty(data_blocks) ? emptyBlocksForm() : data.data;
|
|
40
|
+
|
|
41
|
+
const [selectedBlock, setSelectedBlock] = useState(
|
|
42
|
+
properties.blocks_layout.items[0],
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const blockState = {};
|
|
46
|
+
let charCount = 0;
|
|
47
|
+
|
|
48
|
+
const handleKeyDown = (
|
|
49
|
+
e,
|
|
50
|
+
index,
|
|
51
|
+
block,
|
|
52
|
+
node,
|
|
53
|
+
{
|
|
54
|
+
disableEnter = false,
|
|
55
|
+
disableArrowUp = false,
|
|
56
|
+
disableArrowDown = false,
|
|
57
|
+
} = {},
|
|
58
|
+
) => {
|
|
59
|
+
const hasblockActive = !!selectedBlock;
|
|
60
|
+
if (e.key === 'ArrowUp' && !disableArrowUp && !hasblockActive) {
|
|
61
|
+
props.onFocusPreviousBlock(block, node);
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
}
|
|
64
|
+
if (e.key === 'ArrowDown' && !disableArrowDown && !hasblockActive) {
|
|
65
|
+
props.onFocusNextBlock(block, node);
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
}
|
|
68
|
+
if (e.key === 'Enter' && !disableEnter && !hasblockActive) {
|
|
69
|
+
props.onAddBlock(config.settings.defaultBlockType, index + 1);
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
35
74
|
const onSelectBlock = (id, isMultipleSelection, event, activeBlock) => {
|
|
36
75
|
let newMultiSelected = [];
|
|
37
76
|
let selected = id;
|
|
@@ -67,14 +106,7 @@ const Edit = (props) => {
|
|
|
67
106
|
setSelectedBlock(selected);
|
|
68
107
|
setMultiSelected(newMultiSelected);
|
|
69
108
|
};
|
|
70
|
-
const metadata = props.metadata || props.properties;
|
|
71
|
-
const [multiSelected, setMultiSelected] = useState([]);
|
|
72
|
-
const data_blocks = data?.data?.blocks;
|
|
73
|
-
const properties = isEmpty(data_blocks) ? emptyBlocksForm() : data.data;
|
|
74
109
|
|
|
75
|
-
const [selectedBlock, setSelectedBlock] = useState(
|
|
76
|
-
properties.blocks_layout.items[0],
|
|
77
|
-
);
|
|
78
110
|
const changeBlockData = (newBlockData) => {
|
|
79
111
|
let pastedBlocks = newBlockData.blocks_layout.items.filter((blockID) => {
|
|
80
112
|
if (data?.data?.blocks_layout.items.find((x) => x === blockID))
|
|
@@ -98,6 +130,7 @@ const Edit = (props) => {
|
|
|
98
130
|
},
|
|
99
131
|
});
|
|
100
132
|
};
|
|
133
|
+
|
|
101
134
|
React.useEffect(() => {
|
|
102
135
|
if (
|
|
103
136
|
isEmpty(data_blocks) &&
|
|
@@ -111,9 +144,6 @@ const Edit = (props) => {
|
|
|
111
144
|
}
|
|
112
145
|
}, [onChangeBlock, properties, selectedBlock, block, data, data_blocks]);
|
|
113
146
|
|
|
114
|
-
const blockState = {};
|
|
115
|
-
let charCount = 0;
|
|
116
|
-
|
|
117
147
|
/**
|
|
118
148
|
* Count the number of characters that are anything except using Regex
|
|
119
149
|
* @param {string} paragraph
|
|
@@ -216,7 +246,16 @@ const Edit = (props) => {
|
|
|
216
246
|
}
|
|
217
247
|
|
|
218
248
|
return (
|
|
219
|
-
<fieldset
|
|
249
|
+
<fieldset
|
|
250
|
+
role="presentation"
|
|
251
|
+
className="section-block"
|
|
252
|
+
onKeyDown={(e) => {
|
|
253
|
+
handleKeyDown(e, props.index, props.block, props.blockNode.current);
|
|
254
|
+
}}
|
|
255
|
+
// The tabIndex is required for the keyboard navigation
|
|
256
|
+
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
|
|
257
|
+
tabIndex={-1}
|
|
258
|
+
>
|
|
220
259
|
<legend
|
|
221
260
|
onClick={() => {
|
|
222
261
|
setSelectedBlock();
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Icon, BlockChooser } from '@plone/volto/components';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
blockHasValue,
|
|
5
|
+
buildStyleClassNamesFromData,
|
|
6
|
+
} from '@plone/volto/helpers';
|
|
5
7
|
import { Button } from 'semantic-ui-react';
|
|
6
8
|
import includes from 'lodash/includes';
|
|
7
9
|
import isBoolean from 'lodash/isBoolean';
|
|
8
10
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
9
|
-
import { doesNodeContainClick } from 'semantic-ui-react/dist/commonjs/lib';
|
|
10
11
|
import cx from 'classnames';
|
|
12
|
+
import config from '@plone/volto/registry';
|
|
13
|
+
import { doesNodeContainClick } from 'semantic-ui-react/dist/commonjs/lib';
|
|
11
14
|
|
|
12
15
|
import dragSVG from '@plone/volto/icons/drag.svg';
|
|
13
16
|
import addSVG from '@plone/volto/icons/circle-plus.svg';
|
|
@@ -86,6 +89,8 @@ class EditBlockWrapper extends React.Component {
|
|
|
86
89
|
? data.required
|
|
87
90
|
: includes(config.blocks.requiredBlocks, type);
|
|
88
91
|
|
|
92
|
+
const styles = buildStyleClassNamesFromData(data.styles);
|
|
93
|
+
|
|
89
94
|
// Get editing instructions from block settings or props
|
|
90
95
|
let instructions = data?.instructions?.data || data?.instructions;
|
|
91
96
|
if (!instructions || instructions === '<p><br/></p>') {
|
|
@@ -97,7 +102,9 @@ class EditBlockWrapper extends React.Component {
|
|
|
97
102
|
<div
|
|
98
103
|
ref={draginfo?.innerRef}
|
|
99
104
|
{...(selected ? draginfo?.draggableProps : null)}
|
|
100
|
-
className={`block-editor-${data['@type']}
|
|
105
|
+
className={cx(`block-editor-${data['@type']}`, styles, {
|
|
106
|
+
[data.align]: data.align,
|
|
107
|
+
})}
|
|
101
108
|
>
|
|
102
109
|
{(!selected || !visible || disabled) && (
|
|
103
110
|
<div
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { getBlocks } from '@plone/volto/helpers';
|
|
2
2
|
import { GroupBlockEdit, GroupBlockView, GroupBlockLayout } from './components';
|
|
3
3
|
|
|
4
|
+
import codeSVG from '@plone/volto/icons/row.svg';
|
|
5
|
+
|
|
4
6
|
const applyConfig = (config) => {
|
|
5
7
|
const choices = Object.keys(config.blocks.blocksConfig)
|
|
6
8
|
.map((key) => {
|
|
@@ -38,11 +40,25 @@ const applyConfig = (config) => {
|
|
|
38
40
|
restricted: false,
|
|
39
41
|
mostUsed: false,
|
|
40
42
|
blockHasOwnFocusManagement: true,
|
|
41
|
-
sidebarTab:
|
|
43
|
+
sidebarTab: 1,
|
|
42
44
|
security: {
|
|
43
45
|
addPermission: [],
|
|
44
46
|
view: [],
|
|
45
47
|
},
|
|
48
|
+
tocEntries: (block = {}, tocData) => {
|
|
49
|
+
// integration with volto-block-toc
|
|
50
|
+
const headlines = tocData.levels || ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
51
|
+
let entries = [];
|
|
52
|
+
const blocks = getBlocks(block?.data || {});
|
|
53
|
+
blocks.forEach((block) => {
|
|
54
|
+
const { value, plaintext } = block[1];
|
|
55
|
+
const type = value?.[0]?.type;
|
|
56
|
+
if (headlines.includes(type)) {
|
|
57
|
+
entries.push([parseInt(type.slice(1)), plaintext, block[0]]);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return entries;
|
|
61
|
+
},
|
|
46
62
|
};
|
|
47
63
|
|
|
48
64
|
return config;
|