@eeacms/volto-eea-website-theme 2.4.0 → 3.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,19 @@ 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
+ ### [3.0.0](https://github.com/eea/volto-eea-website-theme/compare/2.4.0...3.0.0) - 21 October 2024
8
+
9
+ #### :nail_care: Enhancements
10
+
11
+ - refactor: Require Volto 17.20.0+ - Move Volto Core customizations from our add-ons to Volto Core - refs #277684 [Teodor Voicu - [`cece189`](https://github.com/eea/volto-eea-website-theme/commit/cece189b8fedd7a5107ce22c9e2c8536a38e772c)]
12
+
13
+ #### :house: Internal changes
14
+
15
+ - chore: package.json [alin - [`7c6e23b`](https://github.com/eea/volto-eea-website-theme/commit/7c6e23bad1c69aa81185c2bceb2bf1797d202dc5)]
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - Breaking release 3.0.0 [alin - [`02e9f64`](https://github.com/eea/volto-eea-website-theme/commit/02e9f6452e147108bc7340d28f82c0a7b015b57d)]
7
20
  ### [2.4.0](https://github.com/eea/volto-eea-website-theme/compare/2.3.0...2.4.0) - 11 October 2024
8
21
 
9
22
  #### :bug: Bug Fixes
package/README.md CHANGED
@@ -16,6 +16,12 @@
16
16
 
17
17
  EEA Website [Volto](https://github.com/plone/volto) Theme
18
18
 
19
+ ## Upgrade
20
+
21
+ ### Upgrading to 3.x.x
22
+
23
+ * This version removes some Volto customizations and it requires **Volto 17.20.0+**. See [CHANGELOG.md](https://github.com/eea/volto-eea-website-theme/blob/master/CHANGELOG.md)
24
+
19
25
  ## Demo
20
26
 
21
27
  - https://www.eea.europa.eu
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "2.4.0",
3
+ "version": "3.0.0",
4
4
  "description": "@eeacms/volto-eea-website-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -24,8 +24,8 @@
24
24
  "url": "git@github.com:eea/volto-eea-website-theme.git"
25
25
  },
26
26
  "dependencies": {
27
- "@eeacms/volto-block-toc": "*",
28
27
  "@eeacms/volto-block-style": "*",
28
+ "@eeacms/volto-block-toc": "*",
29
29
  "@eeacms/volto-eea-design-system": "*",
30
30
  "@eeacms/volto-group-block": "*",
31
31
  "volto-subsites": "*"
@@ -1,12 +0,0 @@
1
- 3c3
2
- < import EditBlock from './Edit';
3
- ---
4
- > import EditBlock from '@plone/volto/components/manage/Blocks/Block/Edit.jsx';
5
- 20c20
6
- < import EditBlockWrapper from './EditBlockWrapper';
7
- ---
8
- > import EditBlockWrapper from '@plone/volto/components/manage/Blocks/Block/EditBlockWrapper.jsx';
9
- 41a42
10
- > errors,
11
- 261a263
12
- > errors,
@@ -1,289 +0,0 @@
1
- import React from 'react';
2
- import { useIntl } from 'react-intl';
3
- import EditBlock from '@plone/volto/components/manage/Blocks/Block/Edit.jsx';
4
- import { DragDropList } from '@plone/volto/components';
5
- import {
6
- getBlocks,
7
- getBlocksFieldname,
8
- applyBlockDefaults,
9
- } from '@plone/volto/helpers';
10
- import {
11
- addBlock,
12
- insertBlock,
13
- changeBlock,
14
- deleteBlock,
15
- moveBlock,
16
- mutateBlock,
17
- nextBlockId,
18
- previousBlockId,
19
- } from '@plone/volto/helpers';
20
- import EditBlockWrapper from '@plone/volto/components/manage/Blocks/Block/EditBlockWrapper.jsx';
21
- import { setSidebarTab } from '@plone/volto/actions';
22
- import { useDispatch } from 'react-redux';
23
- import { useDetectClickOutside, useEvent } from '@plone/volto/helpers';
24
- import config from '@plone/volto/registry';
25
-
26
- const BlocksForm = (props) => {
27
- const {
28
- pathname,
29
- onChangeField,
30
- properties,
31
- type,
32
- navRoot,
33
- onChangeFormData,
34
- selectedBlock,
35
- multiSelected,
36
- onSelectBlock,
37
- allowedBlocks,
38
- showRestricted,
39
- title,
40
- description,
41
- metadata,
42
- errors,
43
- manage,
44
- children,
45
- isMainForm = true,
46
- isContainer,
47
- stopPropagation,
48
- disableAddBlockOnEnterKey,
49
- blocksConfig = config.blocks.blocksConfig,
50
- editable = true,
51
- direction = 'vertical',
52
- } = props;
53
-
54
- const blockList = getBlocks(properties);
55
-
56
- const dispatch = useDispatch();
57
- const intl = useIntl();
58
-
59
- const ClickOutsideListener = () => {
60
- onSelectBlock(null);
61
- dispatch(setSidebarTab(0));
62
- };
63
-
64
- const ref = useDetectClickOutside({
65
- onTriggered: ClickOutsideListener,
66
- triggerKeys: ['Escape'],
67
- // Disabled feature for now https://github.com/plone/volto/pull/2389#issuecomment-830027413
68
- disableClick: true,
69
- disableKeys: !isMainForm,
70
- });
71
-
72
- const handleKeyDown = (
73
- e,
74
- index,
75
- block,
76
- node,
77
- {
78
- disableEnter = false,
79
- disableArrowUp = false,
80
- disableArrowDown = false,
81
- } = {},
82
- ) => {
83
- const isMultipleSelection = e.shiftKey;
84
- if (e.key === 'ArrowUp' && !disableArrowUp) {
85
- onFocusPreviousBlock(block, node, isMultipleSelection);
86
- e.preventDefault();
87
- }
88
- if (e.key === 'ArrowDown' && !disableArrowDown) {
89
- onFocusNextBlock(block, node, isMultipleSelection);
90
- e.preventDefault();
91
- }
92
- if (e.key === 'Enter' && !disableEnter) {
93
- if (!disableAddBlockOnEnterKey) {
94
- onSelectBlock(onAddBlock(config.settings.defaultBlockType, index + 1));
95
- }
96
- e.preventDefault();
97
- }
98
- };
99
-
100
- const onFocusPreviousBlock = (
101
- currentBlock,
102
- blockNode,
103
- isMultipleSelection,
104
- ) => {
105
- const prev = previousBlockId(properties, currentBlock);
106
- if (prev === null) return;
107
-
108
- blockNode.blur();
109
-
110
- onSelectBlock(prev, isMultipleSelection);
111
- };
112
-
113
- const onFocusNextBlock = (currentBlock, blockNode, isMultipleSelection) => {
114
- const next = nextBlockId(properties, currentBlock);
115
- if (next === null) return;
116
-
117
- blockNode.blur();
118
-
119
- onSelectBlock(next, isMultipleSelection);
120
- };
121
-
122
- const onMutateBlock = (id, value) => {
123
- const newFormData = mutateBlock(properties, id, value);
124
- onChangeFormData(newFormData);
125
- };
126
-
127
- const onInsertBlock = (id, value, current) => {
128
- const [newId, newFormData] = insertBlock(
129
- properties,
130
- id,
131
- value,
132
- current,
133
- config.experimental.addBlockButton.enabled ? 1 : 0,
134
- );
135
-
136
- const blocksFieldname = getBlocksFieldname(newFormData);
137
- const blockData = newFormData[blocksFieldname][newId];
138
- newFormData[blocksFieldname][newId] = applyBlockDefaults({
139
- data: blockData,
140
- intl,
141
- metadata,
142
- properties,
143
- });
144
-
145
- onChangeFormData(newFormData);
146
- return newId;
147
- };
148
-
149
- const onAddBlock = (type, index) => {
150
- if (editable) {
151
- const [id, newFormData] = addBlock(properties, type, index);
152
- const blocksFieldname = getBlocksFieldname(newFormData);
153
- const blockData = newFormData[blocksFieldname][id];
154
- newFormData[blocksFieldname][id] = applyBlockDefaults({
155
- data: blockData,
156
- intl,
157
- metadata,
158
- properties,
159
- });
160
- onChangeFormData(newFormData);
161
- return id;
162
- }
163
- };
164
-
165
- const onChangeBlock = (id, value) => {
166
- const newFormData = changeBlock(properties, id, value);
167
- onChangeFormData(newFormData);
168
- };
169
-
170
- const onDeleteBlock = (id, selectPrev) => {
171
- const previous = previousBlockId(properties, id);
172
-
173
- const newFormData = deleteBlock(properties, id);
174
- onChangeFormData(newFormData);
175
-
176
- onSelectBlock(selectPrev ? previous : null);
177
- };
178
-
179
- const onMoveBlock = (dragIndex, hoverIndex) => {
180
- const newFormData = moveBlock(properties, dragIndex, hoverIndex);
181
- onChangeFormData(newFormData);
182
- };
183
-
184
- const defaultBlockWrapper = ({ draginfo }, editBlock, blockProps) => (
185
- <EditBlockWrapper draginfo={draginfo} blockProps={blockProps}>
186
- {editBlock}
187
- </EditBlockWrapper>
188
- );
189
-
190
- const editBlockWrapper = children || defaultBlockWrapper;
191
-
192
- // Remove invalid blocks on saving
193
- // Note they are alreaady filtered by DragDropList, but we also want them
194
- // to be removed when the user saves the page next. Otherwise the invalid
195
- // blocks would linger for ever.
196
- for (const [n, v] of blockList) {
197
- if (!v) {
198
- const newFormData = deleteBlock(properties, n);
199
- onChangeFormData(newFormData);
200
- }
201
- }
202
-
203
- useEvent('voltoClickBelowContent', () => {
204
- if (!config.experimental.addBlockButton.enabled || !isMainForm) return;
205
- onSelectBlock(
206
- onAddBlock(config.settings.defaultBlockType, blockList.length),
207
- );
208
- });
209
-
210
- return (
211
- <div
212
- className="blocks-form"
213
- role="presentation"
214
- ref={ref}
215
- onKeyDown={(e) => {
216
- if (stopPropagation) {
217
- e.stopPropagation();
218
- }
219
- }}
220
- >
221
- <fieldset className="invisible" disabled={!editable}>
222
- <DragDropList
223
- childList={blockList}
224
- onMoveItem={(result) => {
225
- const { source, destination } = result;
226
- if (!destination) {
227
- return;
228
- }
229
- const newFormData = moveBlock(
230
- properties,
231
- source.index,
232
- destination.index,
233
- );
234
- onChangeFormData(newFormData);
235
- return true;
236
- }}
237
- direction={direction}
238
- >
239
- {(dragProps) => {
240
- const { child, childId, index } = dragProps;
241
- const blockProps = {
242
- allowedBlocks,
243
- showRestricted,
244
- block: childId,
245
- data: child,
246
- handleKeyDown,
247
- id: childId,
248
- formTitle: title,
249
- formDescription: description,
250
- index,
251
- manage,
252
- onAddBlock,
253
- onInsertBlock,
254
- onChangeBlock,
255
- onChangeField,
256
- onChangeFormData,
257
- onDeleteBlock,
258
- onFocusNextBlock,
259
- onFocusPreviousBlock,
260
- onMoveBlock,
261
- onMutateBlock,
262
- onSelectBlock,
263
- errors,
264
- pathname,
265
- metadata,
266
- properties,
267
- contentType: type,
268
- navRoot,
269
- blocksConfig,
270
- selected: selectedBlock === childId,
271
- multiSelected: multiSelected?.includes(childId),
272
- type: child['@type'],
273
- editable,
274
- showBlockChooser: selectedBlock === childId,
275
- detached: isContainer,
276
- };
277
- return editBlockWrapper(
278
- dragProps,
279
- <EditBlock key={childId} {...blockProps} />,
280
- blockProps,
281
- );
282
- }}
283
- </DragDropList>
284
- </fieldset>
285
- </div>
286
- );
287
- };
288
-
289
- export default BlocksForm;
@@ -1,2 +0,0 @@
1
- Customize from @plone/volto 17.18.2 - refs https://taskman.eionet.europa.eu/issues/269086
2
- Should be safe to remove with @plone/volto 18.x - https://github.com/plone/volto/pull/6181