@eeacms/volto-marine-policy 2.0.23 → 2.0.25

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,31 @@ 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
+ ### [2.0.25](https://github.com/eea/volto-marine-policy/compare/2.0.24...2.0.25) - 27 August 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - pin volto-openlayers-map to 1.0.0 [Nilesh - [`49c4af6`](https://github.com/eea/volto-marine-policy/commit/49c4af6c0edd7473d753a193f8c98c1789818e0f)]
12
+ - fix volto-openlayers-map module resolving [nileshgulia1 - [`c27cfa7`](https://github.com/eea/volto-marine-policy/commit/c27cfa7a067b7c42fdc85a3b847001cd8e3db088)]
13
+ - eslint [nileshgulia1 - [`2c5300e`](https://github.com/eea/volto-marine-policy/commit/2c5300eba990cc4a3d4c3e87d69faa00d93e756c)]
14
+ - eslint . [nileshgulia1 - [`87664a3`](https://github.com/eea/volto-marine-policy/commit/87664a3f5252c4f41ca1a1b069fc3073627e2dcc)]
15
+ - fix imports [nileshgulia1 - [`9baee98`](https://github.com/eea/volto-marine-policy/commit/9baee9884012a41db83c178f3e3e1058ff6ae4ee)]
16
+ - update [nileshgulia1 - [`0d4694c`](https://github.com/eea/volto-marine-policy/commit/0d4694cc75d8c37e1d49fe4808b21e5de9dae9d3)]
17
+ - update open layers map config in simple data block refs#288034 [nileshgulia1 - [`cc14bb7`](https://github.com/eea/volto-marine-policy/commit/cc14bb7e178d111dc0e560d97c83b1f503b607bf)]
18
+ ### [2.0.24](https://github.com/eea/volto-marine-policy/compare/2.0.23...2.0.24) - 27 August 2025
19
+
20
+ #### :rocket: New Features
21
+
22
+ - feat: select font size for title [Teodor - [`74a1526`](https://github.com/eea/volto-marine-policy/commit/74a1526e7267d72cab7cd1fac838f26f08d51d47)]
23
+
24
+ #### :house: Internal changes
25
+
26
+ - style: Automated code fix [eea-jenkins - [`c30a127`](https://github.com/eea/volto-marine-policy/commit/c30a12768f15e1f325d7cabc42660657002ec2b5)]
27
+
28
+ #### :hammer_and_wrench: Others
29
+
30
+ - fix EEA colors for background [Teodor - [`73fed1a`](https://github.com/eea/volto-marine-policy/commit/73fed1a8129ed4730bf4e695c8c1feabd2d4391e)]
31
+ - toc styles [narcis2005 - [`687008b`](https://github.com/eea/volto-marine-policy/commit/687008be99f618cb0f2ca98304c9fe04d0aaefc8)]
7
32
  ### [2.0.23](https://github.com/eea/volto-marine-policy/compare/2.0.22...2.0.23) - 26 August 2025
8
33
 
9
34
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-marine-policy",
3
- "version": "2.0.23",
3
+ "version": "2.0.25",
4
4
  "description": "@eeacms/volto-marine-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { centerAndResetMapZoom, isValidURL } from './utils';
3
+ import { withOpenLayers } from '@eeacms/volto-openlayers-map';
3
4
 
4
5
  const showPageNr = (pageNr, currentPage, numberOfPages) => {
5
6
  // show first 5 pages
@@ -24,8 +25,8 @@ const showPageNr = (pageNr, currentPage, numberOfPages) => {
24
25
  return false;
25
26
  };
26
27
 
27
- export default function DemoSitesList(props) {
28
- const { selectedCase, onSelectedCase, pointsSource, map } = props;
28
+ function DemoSitesList(props) {
29
+ const { selectedCase, onSelectedCase, pointsSource, map, ol } = props;
29
30
  // const reSearch = new RegExp(`\\b(${searchInput})\\b`, 'gi');
30
31
  const [currentPage, setCurrentPage] = React.useState(1);
31
32
 
@@ -155,7 +156,7 @@ export default function DemoSitesList(props) {
155
156
  // scrollToElement('search-input');
156
157
  // reset map zoom
157
158
  onSelectedCase(null);
158
- centerAndResetMapZoom(map);
159
+ centerAndResetMapZoom({ map, ol });
159
160
  map.getInteractions().array_[9].getFeatures().clear();
160
161
  }}
161
162
  >
@@ -376,3 +377,5 @@ export default function DemoSitesList(props) {
376
377
  </>
377
378
  );
378
379
  }
380
+
381
+ export default withOpenLayers(DemoSitesList);
@@ -2,12 +2,17 @@ import React from 'react';
2
2
 
3
3
  import cx from 'classnames';
4
4
 
5
- import { Map, Layer, Layers, Controls } from '@eeacms/volto-openlayers-map/api';
6
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
5
+ import {
6
+ Map,
7
+ Layer,
8
+ Layers,
9
+ Controls,
10
+ useMapContext,
11
+ } from '@eeacms/volto-openlayers-map/api';
12
+ import { withOpenLayers } from '@eeacms/volto-openlayers-map';
7
13
 
8
14
  import InfoOverlay from './InfoOverlay';
9
15
  import FeatureInteraction from './FeatureInteraction';
10
- import { useMapContext } from '@eeacms/volto-openlayers-map/api';
11
16
 
12
17
  import {
13
18
  centerAndResetMapZoom,
@@ -25,7 +30,7 @@ const MapContextGateway = ({ setMap }) => {
25
30
  return null;
26
31
  };
27
32
 
28
- export default function DemoSitesMap(props) {
33
+ function DemoSitesMap(props) {
29
34
  const {
30
35
  items,
31
36
  activeItems,
@@ -37,8 +42,9 @@ export default function DemoSitesMap(props) {
37
42
  setMap,
38
43
  highlightedIndex,
39
44
  setHighlightedIndex,
45
+ ol,
40
46
  } = props;
41
- const features = getFeatures(items);
47
+ const features = getFeatures({ cases: items, ol });
42
48
  const [resetMapButtonClass, setResetMapButtonClass] =
43
49
  React.useState('inactive');
44
50
 
@@ -72,11 +78,11 @@ export default function DemoSitesMap(props) {
72
78
 
73
79
  if (activeItems) {
74
80
  pointsSource.clear();
75
- pointsSource.addFeatures(getFeatures(activeItems));
81
+ pointsSource.addFeatures(getFeatures({ cases: activeItems, ol }));
76
82
  // hideFilters && zoomMapToFeatures(map, getFeatures(activeItems));
77
83
  // zoomMapToFeatures(map, getFeatures(activeItems));
78
84
  }
79
- }, [map, activeItems, pointsSource, hideFilters]);
85
+ }, [map, activeItems, pointsSource, hideFilters, ol]);
80
86
 
81
87
  React.useEffect(() => {
82
88
  if (!map) return null;
@@ -119,11 +125,11 @@ export default function DemoSitesMap(props) {
119
125
  return () => {
120
126
  map.un('moveend', moveendListener);
121
127
  };
122
- }, [map, selectedCase, resetMapButtonClass, setResetMapButtonClass]);
128
+ }, [map, selectedCase, resetMapButtonClass, setResetMapButtonClass, ol]);
123
129
 
124
130
  const clusterStyle = React.useMemo(
125
- () => selectedClusterStyle(selectedCase),
126
- [selectedCase],
131
+ () => selectedClusterStyle({ selectedCase, ol }),
132
+ [selectedCase, ol],
127
133
  );
128
134
 
129
135
  const MapWithSelection = React.useMemo(() => Map, []);
@@ -159,9 +165,9 @@ export default function DemoSitesMap(props) {
159
165
  setHighlightedIndex(5);
160
166
  if (hideFilters) {
161
167
  // zoomMapToFeatures(map, getFeatures(activeItems));
162
- centerAndResetMapZoom(map);
168
+ centerAndResetMapZoom({ map, ol });
163
169
  } else {
164
- centerAndResetMapZoom(map);
170
+ centerAndResetMapZoom({ map, ol });
165
171
  // zoomMapToFeatures(map, getFeatures(activeItems));
166
172
  }
167
173
  map.getInteractions().array_[9].getFeatures().clear();
@@ -194,7 +200,7 @@ export default function DemoSitesMap(props) {
194
200
  ) : null;
195
201
  }
196
202
 
197
- const selectedClusterStyle = (selectedFeature) => {
203
+ const selectedClusterStyle = ({ selectedFeature, ol }) => {
198
204
  function _clusterStyle(feature, selectedFeature) {
199
205
  const size = feature.get('features').length;
200
206
  let clusterStyle = styleCache[size];
@@ -247,3 +253,5 @@ const selectedClusterStyle = (selectedFeature) => {
247
253
  }
248
254
  return _clusterStyle;
249
255
  };
256
+
257
+ export default withOpenLayers(DemoSitesMap);
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
2
+ import { withOpenLayers } from '@eeacms/volto-openlayers-map';
3
3
  import { useMapContext } from '@eeacms/volto-openlayers-map/api';
4
4
  // import { zoomMapToFeatures } from './utils';
5
5
 
6
- export const useStyles = () => {
6
+ export const useStyles = ({ ol }) => {
7
7
  const selected = React.useMemo(
8
8
  () =>
9
9
  new ol.style.Style({
@@ -18,7 +18,7 @@ export const useStyles = () => {
18
18
  }),
19
19
  }),
20
20
  }),
21
- [],
21
+ [ol],
22
22
  );
23
23
 
24
24
  const selectStyle = React.useCallback(
@@ -35,10 +35,10 @@ export const useStyles = () => {
35
35
  return { selected, selectStyle };
36
36
  };
37
37
 
38
- export default function FeatureInteraction({ onFeatureSelect }) {
38
+ function FeatureInteraction({ onFeatureSelect, ol }) {
39
39
  // console.log('featureinteraction', selectedCase);
40
40
  const { map } = useMapContext();
41
- const { selectStyle } = useStyles();
41
+ const { selectStyle } = useStyles({ ol });
42
42
 
43
43
  const select = new ol.interaction.Select({
44
44
  condition: ol.condition.click,
@@ -88,3 +88,5 @@ export default function FeatureInteraction({ onFeatureSelect }) {
88
88
 
89
89
  return null;
90
90
  }
91
+
92
+ export default withOpenLayers(FeatureInteraction);
@@ -1,14 +1,15 @@
1
1
  import React from 'react';
2
2
  import { useMapContext } from '@eeacms/volto-openlayers-map/api';
3
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
3
+ import { withOpenLayers } from '@eeacms/volto-openlayers-map';
4
4
  import FeatureDisplay from './FeatureDisplay';
5
5
  import { usePrevious } from '@plone/volto/helpers/Utils/usePrevious';
6
6
 
7
- export default function InfoOverlay({
7
+ function InfoOverlay({
8
8
  selectedFeature,
9
9
  onFeatureSelect,
10
10
  layerId,
11
11
  // hideFilters,
12
+ ol,
12
13
  }) {
13
14
  const { map } = useMapContext();
14
15
  const [tooltip, setTooltipRef] = React.useState();
@@ -63,7 +64,7 @@ export default function InfoOverlay({
63
64
  map.un('click', handler);
64
65
  map.removeOverlay(overlay);
65
66
  };
66
- }, [map, tooltip, onFeatureSelect]); //
67
+ }, [map, tooltip, onFeatureSelect, ol]); //
67
68
 
68
69
  const [isClient, setIsClient] = React.useState(false);
69
70
  React.useEffect(() => setIsClient(true), []);
@@ -82,3 +83,5 @@ export default function InfoOverlay({
82
83
  </div>
83
84
  ) : null;
84
85
  }
86
+
87
+ export default withOpenLayers(InfoOverlay);
@@ -1,5 +1,3 @@
1
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
2
-
3
1
  export const objectivesCustomOrder = [
4
2
  'Objective 1: Protect and restore marine and freshwater ecosystems and biodiversity',
5
3
  'Objective 2: Prevent and eliminate pollution of our oceans, seas and waters',
@@ -41,7 +39,7 @@ export function isValidURL(string) {
41
39
  }
42
40
  }
43
41
 
44
- export function centerAndResetMapZoom(map) {
42
+ export function centerAndResetMapZoom({ map, ol }) {
45
43
  map.getView().animate({
46
44
  zoom: 3.4,
47
45
  duration: 1000,
@@ -56,14 +54,14 @@ export function scrollToElement(elementId) {
56
54
  });
57
55
  }
58
56
 
59
- export function getExtentOfFeatures(features) {
57
+ export function getExtentOfFeatures({ features, ol }) {
60
58
  const points = features.map((f) => f.getGeometry().flatCoordinates);
61
59
  const point = new ol.geom.MultiPoint(points);
62
60
  return point.getExtent();
63
61
  }
64
62
 
65
- export function zoomMapToFeatures(map, features, threshold = 500) {
66
- const extent = getExtentOfFeatures(features);
63
+ export function zoomMapToFeatures({ map, features, ol, threshold = 500 }) {
64
+ const extent = getExtentOfFeatures({ map, features, ol });
67
65
 
68
66
  // let extentBuffer = (extent[3] - extent[1] + extent[2] - extent[0]) / 4;
69
67
  // extentBuffer = extentBuffer < threshold ? threshold : extentBuffer;
@@ -89,8 +87,8 @@ export function zoomMapToFeatures(map, features, threshold = 500) {
89
87
  }
90
88
  }
91
89
 
92
- export function getFeatures(cases) {
93
- const Feature = ol.ol.Feature;
90
+ export function getFeatures({ cases, ol }) {
91
+ const Feature = ol.Feature;
94
92
  const colors = {
95
93
  'Objective 1: Protect and restore marine and freshwater ecosystems and biodiversity':
96
94
  '#007b6c',
@@ -0,0 +1,73 @@
1
+ const TableOfContentsSchema = ({ data }) => {
2
+ const { variation = 'default' } = data;
3
+
4
+ return {
5
+ title: 'Table of Contents',
6
+ fieldsets: [
7
+ {
8
+ id: 'default',
9
+ title: 'Default',
10
+ fields: [
11
+ 'title',
12
+ 'hide_title',
13
+ 'title_font_size',
14
+ ...(variation === 'default' ? ['ordered'] : []),
15
+ ...(variation === 'horizontalMenu' ? ['sticky'] : []),
16
+ ...(variation === 'accordionMenu' ? ['sticky', 'side_menu'] : []),
17
+ ...(variation === 'accordionMenu' ? ['bulleted_list'] : []),
18
+ 'levels',
19
+ ],
20
+ },
21
+ ],
22
+ properties: {
23
+ title: {
24
+ title: 'Block title',
25
+ },
26
+ hide_title: {
27
+ title: 'Hide title',
28
+ type: 'boolean',
29
+ },
30
+ title_font_size: {
31
+ title: 'Title font size',
32
+ choices: [
33
+ ['small', 'Small'],
34
+ ['medium', 'Medium'],
35
+ ['large', 'Large'],
36
+ ],
37
+ default: 'medium',
38
+ },
39
+ sticky: {
40
+ title: 'Sticky on top',
41
+ type: 'boolean',
42
+ },
43
+ side_menu: {
44
+ title: 'Use as side menu',
45
+ type: 'boolean',
46
+ },
47
+ levels: {
48
+ title: 'Entries',
49
+ isMulti: true,
50
+ choices: [
51
+ ['h1', 'h1'],
52
+ ['h2', 'h2'],
53
+ ['h3', 'h3'],
54
+ ['h4', 'h4'],
55
+ ['h5', 'h5'],
56
+ ['h6', 'h6'],
57
+ ],
58
+ },
59
+ ordered: {
60
+ title: 'Ordered',
61
+ type: 'boolean',
62
+ },
63
+ bulleted_list: {
64
+ title: 'Use bullet list',
65
+ type: 'boolean',
66
+ description: 'Bullet point for child items',
67
+ },
68
+ },
69
+ required: [],
70
+ };
71
+ };
72
+
73
+ export default TableOfContentsSchema;
@@ -0,0 +1,85 @@
1
+ /**
2
+ * View toc block.
3
+ * @module components/manage/Blocks/ToC/View
4
+ */
5
+
6
+ import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import { map } from 'lodash';
9
+ import { List } from 'semantic-ui-react';
10
+ import { FormattedMessage, injectIntl } from 'react-intl';
11
+ import AnchorLink from 'react-anchor-link-smooth-scroll';
12
+ import Slugger from 'github-slugger';
13
+ import { normalizeString } from './helpers';
14
+ import cx from 'classnames';
15
+
16
+ const RenderListItems = ({ items, data }) => {
17
+ return map(items, (item) => {
18
+ const { id, level, title, override_toc, plaintext } = item;
19
+ const slug = override_toc
20
+ ? Slugger.slug(normalizeString(plaintext))
21
+ : Slugger.slug(normalizeString(title)) || id;
22
+ return (
23
+ item && (
24
+ <List.Item key={id} className={`item headline-${level}`} as="li">
25
+ <AnchorLink href={`#${slug}`}>{title}</AnchorLink>
26
+ {item.items?.length > 0 && (
27
+ <List
28
+ ordered={data.ordered}
29
+ bulleted={!data.ordered}
30
+ as={data.ordered ? 'ol' : 'ul'}
31
+ >
32
+ <RenderListItems items={item.items} data={data} />
33
+ </List>
34
+ )}
35
+ </List.Item>
36
+ )
37
+ );
38
+ });
39
+ };
40
+
41
+ /**
42
+ * View toc block class.
43
+ * @class View
44
+ * @extends Component
45
+ */
46
+ const View = ({ data, tocEntries }) => {
47
+ const titleFontSizeClass = data.title_font_size
48
+ ? `toc-title-${data.title_font_size}`
49
+ : 'toc-title-medium';
50
+
51
+ return (
52
+ <>
53
+ {data.title && !data.hide_title ? (
54
+ <h2 className={cx(titleFontSizeClass)}>
55
+ {data.title || (
56
+ <FormattedMessage
57
+ id="Table of Contents"
58
+ defaultMessage="Table of Contents"
59
+ />
60
+ )}
61
+ </h2>
62
+ ) : (
63
+ ''
64
+ )}
65
+ <List
66
+ ordered={data.ordered}
67
+ bulleted={!data.ordered}
68
+ as={data.ordered ? 'ol' : 'ul'}
69
+ >
70
+ <RenderListItems items={tocEntries} data={data} />
71
+ </List>
72
+ </>
73
+ );
74
+ };
75
+
76
+ /**
77
+ * Property types.
78
+ * @property {Object} propTypes Property types.
79
+ * @static
80
+ */
81
+ View.propTypes = {
82
+ properties: PropTypes.objectOf(PropTypes.any).isRequired,
83
+ };
84
+
85
+ export default injectIntl(View);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This function should be removed when upgrading to Volto 17.
3
+ * Replace with Volto's normalizeString from @plone/volto/helpers.
4
+ */
5
+
6
+ export function normalizeString(str) {
7
+ return str.normalize('NFD').replace(/\p{Diacritic}/gu, '');
8
+ }
package/src/index.js CHANGED
@@ -16,6 +16,7 @@ import { breadcrumb, localnavigation, workflowProgressPath } from './reducers';
16
16
  import customBlockTemplates from '@eeacms/volto-marine-policy/components/Blocks/CustomBlockTemplates/customBlockTemplates';
17
17
  import TextAlignWidget from './components/Widgets/TextAlign';
18
18
  import './slate-styles.less';
19
+ import './less/toc-title-sizes.less';
19
20
 
20
21
  import installSearchEngine from './search';
21
22
 
@@ -36,23 +37,6 @@ import eeaWhiteLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/as
36
37
  import europeanComissionLogo from '@eeacms/volto-marine-policy/static/ec_logo_white.svg';
37
38
  import MeasureView from '@eeacms/volto-marine-policy/components/Widgets/MeasureViewWidget';
38
39
 
39
- const available_colors = [
40
- '#ffffff',
41
- '#f7f3ef',
42
- '#e3edf7',
43
- '#002d54',
44
- '#59d3ff',
45
- '#2dd2b7',
46
- '#1271e1',
47
- '#826A6A',
48
- '#FAD0C3',
49
- '#F3E2AB',
50
- '#C1E1C5',
51
- '#BEDADC',
52
- '#BED3F3',
53
- '#000000',
54
- ];
55
-
56
40
  const restrictedBlocks = ['imagecards'];
57
41
 
58
42
  const messages = defineMessages({
@@ -204,8 +188,6 @@ const applyConfig = (config) => {
204
188
 
205
189
  config.settings.navDepth = 3;
206
190
 
207
- config.settings.available_colors = available_colors;
208
-
209
191
  // config.settings.externalRoutes = [
210
192
  // ...(config.settings.externalRoutes || []),
211
193
  // ...(config.settings.prefixPath
@@ -0,0 +1,17 @@
1
+ /* TOC Title Font Size Customizations */
2
+ .table-of-contents {
3
+ .toc-title-small {
4
+ font-size: 1.2rem !important;
5
+ line-height: 1.3;
6
+ }
7
+
8
+ .toc-title-medium {
9
+ font-size: 1.5rem !important;
10
+ line-height: 1.3;
11
+ }
12
+
13
+ .toc-title-large {
14
+ font-size: 2rem !important;
15
+ line-height: 1.2;
16
+ }
17
+ }
@@ -0,0 +1,25 @@
1
+ .table-of-contents.accordionMenu {
2
+ .ui.accordion {
3
+ .accordion {
4
+ margin: 1em 0em 0em !important;
5
+ padding: 0em;
6
+ }
7
+ .title {
8
+ padding: 0.75em 2em;
9
+ }
10
+ .content {
11
+ --bg-color: initial !important;
12
+ ul {
13
+ padding: 0.5rem 10px 1.3rem 50px;
14
+ }
15
+ .accordion-list-bulleted li::marker {
16
+ content: '\25CB';
17
+ color: @secondaryColor;
18
+ font-size: 1.2em;
19
+ }
20
+ .title {
21
+ font-size: 1em;
22
+ }
23
+ }
24
+ }
25
+ }
@@ -3,6 +3,7 @@
3
3
  *******************************/
4
4
 
5
5
  @import '../extras/print';
6
+ @import '../extras/tocnav';
6
7
 
7
8
  .documentFirstHeading {
8
9
  border-bottom: none !important;