@eeacms/volto-flourish 0.1.3 → 0.1.5

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,14 @@ 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.5](https://github.com/eea/volto-flourish/compare/0.1.4...0.1.5) - 20 February 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Longer timeout, log nodes [Tiberiu Ichim - [`bbaf943`](https://github.com/eea/volto-flourish/commit/bbaf943454a8da6498004c0be781d64f1819cabb)]
12
+ ### [0.1.4](https://github.com/eea/volto-flourish/compare/0.1.3...0.1.4) - 18 February 2025
13
+
14
+ ### [0.1.3](https://github.com/eea/volto-flourish/compare/0.1.2...0.1.3) - 17 February 2025
8
15
 
9
16
  #### :bug: Bug Fixes
10
17
 
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.5",
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,34 @@
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) => {
23
+ window.Flourish.loadEmbed(domNode);
24
+ // eslint-disable-next-line no-console
25
+ console.log('Loaded Flourish for', domNode);
26
+ });
27
+ }, 500);
28
+ }
29
+
30
+ return () => {};
21
31
  }, [baseUrl, scriptUrl]);
22
32
 
23
- return (
24
- <div
25
- ref={containerRef}
26
- className="flourish-embed"
27
- data-src={flourishUrl}
28
- ></div>
29
- );
33
+ return <div className="flourish-embed" data-src={flourishUrl}></div>;
30
34
  }