@eeacms/volto-flourish 0.1.3 → 0.1.4

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,7 +4,12 @@ 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.1.3](https://github.com/eea/volto-flourish/compare/0.1.2...0.1.3) - 13 February 2025
7
+ ### [0.1.4](https://github.com/eea/volto-flourish/compare/0.1.3...0.1.4) - 18 February 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Fix re-display of flourish [Tiberiu Ichim - [`9c6a2c0`](https://github.com/eea/volto-flourish/commit/9c6a2c06c746bf4fb00aa1ed06ed4122152462ae)]
12
+ ### [0.1.3](https://github.com/eea/volto-flourish/compare/0.1.2...0.1.3) - 17 February 2025
8
13
 
9
14
  #### :bug: Bug Fixes
10
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-flourish",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "@eeacms/volto-flourish: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,30 +1,30 @@
1
- import { useEffect, useRef } from 'react';
1
+ import { useEffect } from 'react';
2
2
 
3
3
  export default function Flourish({ baseUrl }) {
4
- const containerRef = useRef(null);
5
4
  const flourishUrl = `${baseUrl}/@@flourish/index.html`;
6
5
  const scriptUrl = `${baseUrl}/@@flourish/flourish.embed.js`;
7
6
 
8
7
  useEffect(() => {
9
- if (!baseUrl || !containerRef.current) return;
8
+ if (!baseUrl) return;
10
9
 
11
- const script = document.createElement('script');
12
- script.src = scriptUrl;
13
- script.async = true;
14
- script.onload = () => {};
10
+ if (!window.FlourishLoaded) {
11
+ window.Flourish = { disable_autoload: true };
15
12
 
16
- document.body.appendChild(script);
13
+ const script = document.createElement('script');
14
+ script.src = scriptUrl;
15
+ script.async = true;
16
+ script.onload = () => {};
17
17
 
18
- return () => {
19
- document.body.removeChild(script);
20
- };
18
+ document.body.appendChild(script);
19
+ } else {
20
+ setTimeout(() => {
21
+ const domNodes = document.querySelectorAll('.flourish-embed');
22
+ domNodes.forEach((domNode) => window.Flourish.loadEmbed(domNode));
23
+ }, 10);
24
+ }
25
+
26
+ return () => {};
21
27
  }, [baseUrl, scriptUrl]);
22
28
 
23
- return (
24
- <div
25
- ref={containerRef}
26
- className="flourish-embed"
27
- data-src={flourishUrl}
28
- ></div>
29
- );
29
+ return <div className="flourish-embed" data-src={flourishUrl}></div>;
30
30
  }