diff --git a/src/Blocks/EmbedEEATableauBlock/View.jsx b/src/Blocks/EmbedEEATableauBlock/View.jsx index 1c2b692..2a4b829 100644 --- a/src/Blocks/EmbedEEATableauBlock/View.jsx +++ b/src/Blocks/EmbedEEATableauBlock/View.jsx @@ -16,7 +16,6 @@ const View = (props) => { const data = React.useMemo(() => props.data || {}, [props.data]); const { vis_url = '' } = data; const show_sources = data?.show_sources ?? false; - const version = '2.8.0'; React.useEffect(() => { if (vis_url) { @@ -39,22 +38,12 @@ const View = (props) => { <> {tableau_visualization?.general?.url ? ( <> -
Select your file format.
+ + + +URL required
: ''} {error ?{error}
: ''} @@ -90,7 +89,6 @@ const View = (props) => { loaded={loaded} setError={setError} setLoaded={setLoaded} - version={version} url={url} /> ) : null} diff --git a/src/Widgets/VisualizationWidget.jsx b/src/Widgets/VisualizationWidget.jsx index 12256e0..14b53ad 100644 --- a/src/Widgets/VisualizationWidget.jsx +++ b/src/Widgets/VisualizationWidget.jsx @@ -53,14 +53,6 @@ const VisualizationWidget = (props) => { let schema = Schema(config); React.useEffect(() => { - // if (!intValue?.general) { - // setIntValue({ - // ...intValue, - // general: { - // url: intValue?.general?.url, - // }, - // }); - // } if (!intValue?.options) { setIntValue({ ...intValue, diff --git a/src/downloadHelpers/downloadHelpers.js b/src/downloadHelpers/downloadHelpers.js new file mode 100644 index 0000000..4d3e069 --- /dev/null +++ b/src/downloadHelpers/downloadHelpers.js @@ -0,0 +1,25 @@ +import React from 'react'; + +const useCopyToClipboard = (text) => { + const [copyStatus, setCopyStatus] = React.useState('inactive'); + const copy = React.useCallback(() => { + navigator.clipboard.writeText(text).then( + () => setCopyStatus('copied'), + () => setCopyStatus('failed'), + ); + }, [text]); + + React.useEffect(() => { + if (copyStatus === 'inactive') { + return; + } + + const timeout = setTimeout(() => setCopyStatus('inactive'), 3000); + + return () => clearTimeout(timeout); + }, [copyStatus]); + + return [copyStatus, copy]; +}; + +export default useCopyToClipboard;