@eeacms/volto-cca-policy 0.2.78 → 0.2.79
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,11 +4,16 @@ 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
|
-
### [0.2.
|
|
7
|
+
### [0.2.79](https://github.com/eea/volto-cca-policy/compare/0.2.78...0.2.79) - 14 November 2024
|
|
8
8
|
|
|
9
9
|
#### :hammer_and_wrench: Others
|
|
10
10
|
|
|
11
|
-
- Fix
|
|
11
|
+
- Fix match of url [Tiberiu Ichim - [`9afd6d0`](https://github.com/eea/volto-cca-policy/commit/9afd6d0fae594c70b8e22c77e5017b8a5c3211fb)]
|
|
12
|
+
- Fix match of url [Tiberiu Ichim - [`199befd`](https://github.com/eea/volto-cca-policy/commit/199befd31202a2f2c97b904eb9471027b47e4e18)]
|
|
13
|
+
- Fix getURL [Tiberiu Ichim - [`a9488e2`](https://github.com/eea/volto-cca-policy/commit/a9488e2f289c9898e9182190ba597af00949bef6)]
|
|
14
|
+
- Allow iframes in database items views [Tiberiu Ichim - [`1995e04`](https://github.com/eea/volto-cca-policy/commit/1995e04d86d5594035cd37e8d5f161b33c04280e)]
|
|
15
|
+
### [0.2.78](https://github.com/eea/volto-cca-policy/compare/0.2.77...0.2.78) - 12 November 2024
|
|
16
|
+
|
|
12
17
|
### [0.2.77](https://github.com/eea/volto-cca-policy/compare/0.2.76...0.2.77) - 7 November 2024
|
|
13
18
|
|
|
14
19
|
#### :house: Internal changes
|
package/package.json
CHANGED
|
@@ -53,6 +53,83 @@ const dataprotection = {
|
|
|
53
53
|
],
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
const MaybeFlourishVisualization = ({ content }) => {
|
|
57
|
+
const { map_graphs } = content;
|
|
58
|
+
|
|
59
|
+
// https://helpcenter.flourish.studio/hc/en-us/articles/8761537208463-How-to-embed-Flourish-charts-in-your-CMS
|
|
60
|
+
const data_src = (map_graphs) => {
|
|
61
|
+
if (typeof map_graphs === 'string') {
|
|
62
|
+
const regex = /data-src="([^"]*)"/;
|
|
63
|
+
const match = regex.exec(map_graphs);
|
|
64
|
+
|
|
65
|
+
if (match && match.length > 1) {
|
|
66
|
+
const dataSrcValue = match[1];
|
|
67
|
+
return dataSrcValue;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
};
|
|
72
|
+
const flourishPath = data_src(map_graphs);
|
|
73
|
+
const flourishUrl = map_graphs
|
|
74
|
+
? `https://flo.uri.sh/${flourishPath}/embed`
|
|
75
|
+
: null;
|
|
76
|
+
|
|
77
|
+
return !!flourishPath ? (
|
|
78
|
+
<PrivacyProtection
|
|
79
|
+
data={{
|
|
80
|
+
url: flourishUrl,
|
|
81
|
+
dataprotection: dataprotection,
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<iframe
|
|
85
|
+
height="980"
|
|
86
|
+
width="100%"
|
|
87
|
+
src={flourishUrl}
|
|
88
|
+
title="Interactive or visual content"
|
|
89
|
+
className="flourish-embed-iframe"
|
|
90
|
+
sandbox="allow-same-origin allow-forms allow-scripts allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"
|
|
91
|
+
></iframe>
|
|
92
|
+
</PrivacyProtection>
|
|
93
|
+
) : null;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
function getFirstIframeSrc(htmlString) {
|
|
97
|
+
const regex = /<iframe[^>]+src=["']([^"']+)["']/;
|
|
98
|
+
const match = htmlString.match(regex);
|
|
99
|
+
return match ? match[1] : null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const MaybeIframeVisualization = ({ content }) => {
|
|
103
|
+
const { map_graphs } = content;
|
|
104
|
+
|
|
105
|
+
const url = getFirstIframeSrc(map_graphs || '');
|
|
106
|
+
|
|
107
|
+
const [isClient, setIsClient] = React.useState();
|
|
108
|
+
|
|
109
|
+
React.useEffect(() => setIsClient(true), []);
|
|
110
|
+
|
|
111
|
+
if (!(isClient && url)) return null;
|
|
112
|
+
|
|
113
|
+
// <div dangerouslySetInnerHTML={{ __html: map_graphs }} />
|
|
114
|
+
return (
|
|
115
|
+
<PrivacyProtection
|
|
116
|
+
data={{
|
|
117
|
+
url: url,
|
|
118
|
+
dataprotection: dataprotection,
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
<iframe
|
|
122
|
+
height="980"
|
|
123
|
+
width="100%"
|
|
124
|
+
src={url}
|
|
125
|
+
title="Interactive or visual content"
|
|
126
|
+
className="flourish-embed-iframe"
|
|
127
|
+
sandbox="allow-same-origin allow-forms allow-scripts allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"
|
|
128
|
+
></iframe>
|
|
129
|
+
</PrivacyProtection>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
56
133
|
const DatabaseItemView = (props) => {
|
|
57
134
|
const { content } = props;
|
|
58
135
|
const type = content['@type'];
|
|
@@ -62,7 +139,6 @@ const DatabaseItemView = (props) => {
|
|
|
62
139
|
title,
|
|
63
140
|
acronym,
|
|
64
141
|
embed_url,
|
|
65
|
-
map_graphs,
|
|
66
142
|
long_description,
|
|
67
143
|
organisational_websites,
|
|
68
144
|
organisational_key_activities,
|
|
@@ -98,24 +174,6 @@ const DatabaseItemView = (props) => {
|
|
|
98
174
|
subtitle = '';
|
|
99
175
|
}
|
|
100
176
|
|
|
101
|
-
// https://helpcenter.flourish.studio/hc/en-us/articles/8761537208463-How-to-embed-Flourish-charts-in-your-CMS
|
|
102
|
-
const data_src = (map_graphs) => {
|
|
103
|
-
if (typeof map_graphs === 'string') {
|
|
104
|
-
const regex = /data-src="([^"]*)"/;
|
|
105
|
-
const match = regex.exec(map_graphs);
|
|
106
|
-
|
|
107
|
-
if (match && match.length > 1) {
|
|
108
|
-
const dataSrcValue = match[1];
|
|
109
|
-
return dataSrcValue;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return null;
|
|
113
|
-
};
|
|
114
|
-
const flourishPath = data_src(map_graphs);
|
|
115
|
-
const flourishUrl = map_graphs
|
|
116
|
-
? `https://flo.uri.sh/${flourishPath}/embed`
|
|
117
|
-
: null;
|
|
118
|
-
|
|
119
177
|
const is_cmshare_video = share_eea.some((domain) =>
|
|
120
178
|
content?.embed_url?.includes(domain),
|
|
121
179
|
);
|
|
@@ -217,23 +275,8 @@ const DatabaseItemView = (props) => {
|
|
|
217
275
|
</>
|
|
218
276
|
)}
|
|
219
277
|
|
|
220
|
-
{
|
|
221
|
-
|
|
222
|
-
data={{
|
|
223
|
-
url: flourishUrl,
|
|
224
|
-
dataprotection: dataprotection,
|
|
225
|
-
}}
|
|
226
|
-
>
|
|
227
|
-
<iframe
|
|
228
|
-
height="980"
|
|
229
|
-
width="100%"
|
|
230
|
-
src={flourishUrl}
|
|
231
|
-
title="Interactive or visual content"
|
|
232
|
-
className="flourish-embed-iframe"
|
|
233
|
-
sandbox="allow-same-origin allow-forms allow-scripts allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"
|
|
234
|
-
></iframe>
|
|
235
|
-
</PrivacyProtection>
|
|
236
|
-
)}
|
|
278
|
+
<MaybeFlourishVisualization {...props} />
|
|
279
|
+
<MaybeIframeVisualization {...props} />
|
|
237
280
|
|
|
238
281
|
<Divider />
|
|
239
282
|
|