@eeacms/volto-embed 9.0.6 → 9.1.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,27 @@ 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
+ ### [9.1.0](https://github.com/eea/volto-embed/compare/9.0.7...9.1.0) - 17 January 2024
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: show embed error + always show sources [Razvan - [`105d620`](https://github.com/eea/volto-embed/commit/105d6207b244df85eea6d6b9b3bd8e03da0a439b)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - Release 9.1.0 [Alin Voinea - [`b9921a5`](https://github.com/eea/volto-embed/commit/b9921a52564c7a1ca5664ca26d10f429c32f0e71)]
16
+ - fix tests [Razvan - [`5c75f20`](https://github.com/eea/volto-embed/commit/5c75f20483de681ff5c8dd39e7f0016771dc4472)]
17
+ ### [9.0.7](https://github.com/eea/volto-embed/compare/9.0.6...9.0.7) - 16 January 2024
18
+
19
+ #### :hammer_and_wrench: Others
20
+
21
+ - include useeffect dep [andreiggr - [`1c967fa`](https://github.com/eea/volto-embed/commit/1c967faea495f1fea9427a2ce92b6755574dd7fa)]
22
+ - screenshot internal/external url [andreiggr - [`62f2e04`](https://github.com/eea/volto-embed/commit/62f2e04023de461bb83cf5d5f5868146a329e022)]
23
+ - add snapshot [andreiggr - [`dbf1ebc`](https://github.com/eea/volto-embed/commit/dbf1ebc629448f75f2e48cc190742b4b6a00bcd7)]
24
+ - tests update2 [andreiggr - [`1c3c656`](https://github.com/eea/volto-embed/commit/1c3c656ae0868bccf9dac6984d550cd9ab7835b2)]
25
+ - tests update [andreiggr - [`c2483e1`](https://github.com/eea/volto-embed/commit/c2483e1fd2e788f5d990c5a0791beb43dd8ef4cf)]
26
+ - clean console [andreiggr - [`a2da2be`](https://github.com/eea/volto-embed/commit/a2da2beb10ebb00ab257f5992a75c2fedce0f094)]
27
+ - set publicUrl in tests [andreiggr - [`fb9e209`](https://github.com/eea/volto-embed/commit/fb9e209c67745c7053f8f08efe5d4f77d66721a8)]
7
28
  ### [9.0.6](https://github.com/eea/volto-embed/compare/9.0.5...9.0.6) - 10 January 2024
8
29
 
9
30
  #### :rocket: New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-embed",
3
- "version": "9.0.6",
3
+ "version": "9.1.0",
4
4
  "description": "Embed external content",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -65,7 +65,6 @@ function View(props) {
65
65
  parameters,
66
66
  useVisibilitySensor = true,
67
67
  with_notes = true,
68
- with_sources = true,
69
68
  with_more_info = true,
70
69
  with_share = true,
71
70
  with_enlarge = true,
@@ -92,7 +91,7 @@ function View(props) {
92
91
 
93
92
  useEffect(() => {
94
93
  const mapsId = maps['@id'] ? flattenToAppURL(maps['@id']) : undefined;
95
- if (url && url !== mapsId) {
94
+ if (mode === 'edit' && !maps.error && url && url !== mapsId) {
96
95
  getContent(url, null, id);
97
96
  }
98
97
  }, [id, getContent, mode, url, maps]);
@@ -101,6 +100,10 @@ function View(props) {
101
100
  return <Message>Please select a map from block editor.</Message>;
102
101
  }
103
102
 
103
+ if (maps?.error) {
104
+ return <p dangerouslySetInnerHTML={{ __html: maps.error }} />;
105
+ }
106
+
104
107
  if (!maps) {
105
108
  return null;
106
109
  }
@@ -114,7 +117,7 @@ function View(props) {
114
117
  parameters: queryParams,
115
118
  height: height || maps.height,
116
119
  with_notes,
117
- with_sources,
120
+ with_sources: true,
118
121
  with_more_info,
119
122
  with_share,
120
123
  with_enlarge,
@@ -39,13 +39,7 @@ export default (props) => {
39
39
  {
40
40
  id: 'toolbar',
41
41
  title: 'Toolbar',
42
- fields: [
43
- 'with_notes',
44
- 'with_sources',
45
- 'with_more_info',
46
- 'with_share',
47
- 'with_enlarge',
48
- ],
42
+ fields: ['with_notes', 'with_more_info', 'with_share', 'with_enlarge'],
49
43
  },
50
44
  {
51
45
  id: 'parameters',
@@ -9,6 +9,11 @@ import installEmbedMaps from '.';
9
9
 
10
10
  installEmbedMaps(config);
11
11
 
12
+ config.settings = {
13
+ ...config.settings,
14
+ publicURL: 'https://www.eea.europa.eu/',
15
+ };
16
+
12
17
  config.blocks.blocksConfig = {
13
18
  ...config.blocks.blocksConfig,
14
19
  maps: {
@@ -15,7 +15,7 @@ import { serializeNodes } from '@plone/volto-slate/editor/render';
15
15
  import { defineMessages, injectIntl } from 'react-intl';
16
16
  import { toast } from 'react-toastify';
17
17
  import config from '@plone/volto/registry';
18
- import { getBaseUrl } from '@plone/volto/helpers';
18
+ import { getBaseUrl, toPublicURL, isInternalURL } from '@plone/volto/helpers';
19
19
  import { Toast } from '@plone/volto/components';
20
20
  import {
21
21
  getConnectedDataParametersForContext,
@@ -136,6 +136,8 @@ const PrivacyProtection = (props) => {
136
136
  [checkExistance],
137
137
  );
138
138
 
139
+ const urlToScreenshot = isInternalURL(url) ? toPublicURL(url) : url;
140
+
139
141
  //screenshot api
140
142
  React.useEffect(() => {
141
143
  if (enabled && !bgImg && !show && url) {
@@ -143,8 +145,8 @@ const PrivacyProtection = (props) => {
143
145
  `${getBaseUrl(
144
146
  '',
145
147
  )}/cors-proxy/https://screenshot.eea.europa.eu/api/v1/retrieve_image_for_url?url=${encodeURIComponent(
146
- url,
147
- )}&w=1920&waitfor=4000`,
148
+ urlToScreenshot,
149
+ )}&w=1920&h=1000&waitfor=4000`,
148
150
  )
149
151
  .then((e) => e.blob())
150
152
  .then((blob) => {
@@ -166,7 +168,17 @@ const PrivacyProtection = (props) => {
166
168
  }
167
169
  });
168
170
  }
169
- }, [enabled, url, path, dispatch, bgImg, show, intl, editable]);
171
+ }, [
172
+ enabled,
173
+ url,
174
+ path,
175
+ dispatch,
176
+ bgImg,
177
+ show,
178
+ intl,
179
+ editable,
180
+ urlToScreenshot,
181
+ ]);
170
182
 
171
183
  return (
172
184
  <VisibilitySensor
@@ -5,6 +5,11 @@ import config from '@plone/volto/registry';
5
5
 
6
6
  import MapView from './MapView';
7
7
 
8
+ config.settings = {
9
+ ...config.settings,
10
+ publicURL: 'https://www.eea.europa.eu/',
11
+ };
12
+
8
13
  config.blocks.blocksConfig = {
9
14
  ...config.blocks.blocksConfig,
10
15
  maps: {