ToolJet/frontend/src/Editor/Components/CustomComponent/CustomComponent.jsx

135 lines
4.1 KiB
React
Raw Normal View History

import React, { useEffect, useState, useRef } from 'react';
import { isEqual } from 'lodash';
import iframeContent from './iframe.html';
import { useDataQueries } from '@/_stores/dataQueriesStore';
2023-12-29 08:36:50 +00:00
import { useGridStore } from '@/_stores/gridStore';
Query manager revamp (#6680) * global store init * Moved query data to new component * Removed unwanted code * Removed data queries prop drilling * Moved query state out of editor * Added unsafe to componentWillReceiveProps * Selected first query when the version is changed * Fixed bug on renaming query * Fixed issue on dark theme * Fixed running query on page load in viewer * Query manager refactor init * Added global data source in store * Disabled devtools on production * Fixed bug on selecting query after deletion * Reset store when editor is loaded * Moved query manager to functional component * Fixed conflict issues * Fixed infinite loop on tooljetDB * Set the store name and updated devtools logic * Fixed issue on displaying draft query from data sources * Updated comments on the store * Fixed bug on changing data source and creating query from data source * Fixed bug on showing unsaved changes popup * Fixed issue on showing confirmation modal everytime without any changes * feat: autosave data query functionality * feat: show publish button only when the status in draft state * Fixed issues on query renaming * feat: removed discard popup for data query create/edit widget * stye: reduced autosave api call timeout and added draft tag * feat: added minor style changes * feat: fixed issues with restapi plugin, removed unused api calls * fix: fixed issue that breaks restapi creation * fix: reload selected query details after update query * perf: reduced debounce time for data query update apis * feat: removed full reloading of query list on query renaming * feat: duplicate data query feature added * Fixed issue on creating restAPI query * fix: fixed issue in transforming response from update queyr api * fix: refresh selected query details when the selected query is updated * fix: rename query on click enter * fix: full refresh of query list on update * fix: style changes * fix: subscribing to state to autsave * feat: updated the query manager styles to new design * feat: revamped the querypane header buttons * fix: fixed the padding for query panel maximize button * feat: updated search box style * refactor: moved function to render data source icon to its own component * fix: fixed querymanager widget breaking issue * merged with feat/query-manager-autosave * refactor: removed unused consoles * refactor: removed unused consoles * refactor: removed unused consoles * fix: removed commented code * fix: removed unused code * refactor: removed unused comments * fix: show change datasource select only if valid ds available * Update frontend/src/Editor/Inspector/EventManager.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * Update frontend/src/Editor/QueryManager/Components/DataSourceLister.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * Update frontend/src/Editor/QueryManager/Components/DataSourceLister.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * Update frontend/src/Editor/QueryManager/Components/QueryManagerBody.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * feat: modify behaviour of search icon in query panel * fix: fixed theme color mismatch in query manager * refactor: remove dead code * refactor: updated theme for data source listner * fix: theming in filter and sort popup * refactor: remove unused variables * fix: removed draftQuery logic from query manager * refactor: removed unused varibales * Update frontend/src/Editor/QueryManager/QueryEditors/Restapi/TabParams.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * Update frontend/src/Editor/QueryPanel/QueryCard.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * feat: diable preview for draft queries * fix: added tooltip for query panel button * fix: fixed issues in saving query manager events * fix: moved query save subscriber to QuerPanel component * feat: converted query run api to save and run * fix: made varibale an optional param in updateDataQuery dto * refactor: cleanup update dataquery status api response * refactor: moved query status to constants file * feat: prompt for queryname when creating new query * fix: store new queryname in state on create query pageload * fix: fixed alignment of Tooljet db component form * fix: correct translation and format file * refactor: removed consoles * merge: merge appbuilder-1.2 * style: updated rename input/button UX * style: revamped dataquery create widget styles * style: revamped data source selector styles * fix: removed code added for debugging * style: updated data query filter design * style: Add prop to control visibility of clear button in search box * style: implement new style for query filter * merge appbuilder-1.2 to feat/query-manager-sort-filter * refactor: remove unintended file change * fix: set default value for method in respapi * style: updated copilot info popup style * style: updated quer panel header icons * style: updated button styles * style: fixed query manager button styles * style: smoothened query preview modal view * fix: correct import for some funs * fix: fixed minor UX bugs * style: fixed styling of REST api GDS * style: fixed styleing of sort and filter popup * style: improved data queries sort filter UI/UX * fix: remove click listner when overlay is closed * fix: moved component declaration out of parent component * fix: set selected datasource for default sources * fix: filter DS based on saerch in create dropdown * fix: restrict draft query running to preview mode * fix: query renamed on input change in create screen * fix: set name to state as soon as user renames query * fix: make query notification message consistent * style: correct s3 bucket plugin layout config * fix: fixed issues with cloning of Static DS queries * fix: made change so that newly created query is reflected immediatly * style: updated spacing for query manager components * fix: hide rename input when no query selected * fix: check bothe selected query and DS before rendering query manager * fix: set isSaving to true only for api calls in querymanager * fix: added success message form in qm * fix: filter out draft queries from viewer on running * fix: fixed inconsistent gutter for runpy and runjs editors * fix: reload dataqueris on LDS deletion * fix: redesigned filter/sort popup * fix: fixed issue that resets filter on search * fix: fixed query manager breaking on plugin select * fix: diable json preview for text output * fix: reset to filter and sort main menu on close filter popup * refactor: rename varibales * stye: redesigned query create panel * feat: revert data query status column from backend * style: redesign query picker section * refactor: removed dead code * style: querypanel expand/collapse btn style * style: add query select and query filter popup style redesign * style: updated filter popup style * feat: removed draft query checks everywhere * style: empty dataqueries style changed * style: updated query selector popup and rest options styles * style: removed 100% height to query option remove btn * feat: added the query runnable status check * style: updated query manager footer style * feat: changed DS filter from kind to DS ID * style: minor ui tweaks in filter popup * style: disable DS filter if no DQs created * style: minor ui change * fix: rerender filter popup post DS api call. fixed rest api copy feature * fix: add local DS to filter popup * refactor: removed dead code/comments * add new row is crashing when no data is fed to table (#7102) * fix: fixed condition that blocked GDS run on load * fix: revert name back to og name if update fails in rename query * feat: added tooltip for show query btn * fix: added click interaction for pill btn as well * fix: minor UI tweaks to make UX better * style: fixed the styling of filter popup * style: minor UI tweaks in query filter popup * fix: fixed minor css issue in ds picker * style: wrap overflowing text in queryname * fix: update updated_at after query update api call success * fix: update remove the caller query from event query dropdown * style: minor ui spacing tweaks * fix: fix issue that cuased app crash when tjdb opened * fix: fixed update row styles * fix: fixed info popup dark theme bg * fix: fixed headers styling according to general QM styles * style: fixed stripe QM UI * fix: added tooltip for quernames * feat: add tooltip for select ds options * added consoles to debug debugger issue * fix: fixed :active style of ds select dropdown in QM * fix: fixed DS kind name in data source selector in QM * fix: fixed border color mismatch for ds select dd * fix: change tooltip msg for maximize/minize QM * Fix automation for query manager revamp. (#7223) * Add data-cy to support modified specs * Fix event handler * Fix RunPy and RunJS specs * Fix event handler label * Fix basic components spec * Fix basic components failure * Fix tabel spec failure. * Fix runjs and runpy actions * Fix table column options * Add data-cy * version: version updated to 2.13.0 * Version bump --------- Co-authored-by: Kavin Venkatachalam <kavin.saratha@gmail.com> Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> Co-authored-by: Manish Kushare <37823141+manishkushare@users.noreply.github.com> Co-authored-by: Midhun Kumar E <midhun752@gmail.com>
2023-08-09 12:31:48 +00:00
import { isQueryRunnable } from '@/_helpers/utils';
2023-12-29 08:36:50 +00:00
import { shallow } from 'zustand/shallow';
export const CustomComponent = (props) => {
const { height, properties, styles, id, setExposedVariable, exposedVariables, fireEvent, dataCy, component } = props;
2023-12-29 08:36:50 +00:00
const dataQueries = useDataQueries();
const showPlaceholder = useGridStore((state) => {
const { resizingComponentId, draggingComponentId } = state;
if (
(resizingComponentId === null && draggingComponentId === id) ||
(draggingComponentId === null && resizingComponentId === id) ||
id === 'resizingComponentId'
2023-12-29 08:36:50 +00:00
) {
return true;
}
return false;
}, shallow);
const { visibility, boxShadow } = styles;
const { code, data } = properties;
const [customProps, setCustomProps] = useState(data);
const iFrameRef = useRef(null);
const dataQueryRef = useRef(dataQueries);
const customPropRef = useRef(data);
useEffect(() => {
setCustomProps(data);
customPropRef.current = data;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [JSON.stringify(data)]);
useEffect(() => {
if (!isEqual(exposedVariables.data, customProps)) {
setExposedVariable('data', customProps);
sendMessageToIframe({ message: 'DATA_UPDATED' });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [setExposedVariable, customProps, exposedVariables.data]);
useEffect(() => {
sendMessageToIframe({ message: 'CODE_UPDATED' });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [code]);
useEffect(() => {
dataQueryRef.current = dataQueries;
}, [dataQueries]);
useEffect(() => {
window.addEventListener('message', (e) => {
try {
if (e.data.from === 'customComponent' && e.data.componentId === id) {
if (e.data.message === 'UPDATE_DATA') {
setCustomProps({ ...customPropRef.current, ...e.data.updatedObj });
} else if (e.data.message === 'RUN_QUERY') {
Query manager revamp (#6680) * global store init * Moved query data to new component * Removed unwanted code * Removed data queries prop drilling * Moved query state out of editor * Added unsafe to componentWillReceiveProps * Selected first query when the version is changed * Fixed bug on renaming query * Fixed issue on dark theme * Fixed running query on page load in viewer * Query manager refactor init * Added global data source in store * Disabled devtools on production * Fixed bug on selecting query after deletion * Reset store when editor is loaded * Moved query manager to functional component * Fixed conflict issues * Fixed infinite loop on tooljetDB * Set the store name and updated devtools logic * Fixed issue on displaying draft query from data sources * Updated comments on the store * Fixed bug on changing data source and creating query from data source * Fixed bug on showing unsaved changes popup * Fixed issue on showing confirmation modal everytime without any changes * feat: autosave data query functionality * feat: show publish button only when the status in draft state * Fixed issues on query renaming * feat: removed discard popup for data query create/edit widget * stye: reduced autosave api call timeout and added draft tag * feat: added minor style changes * feat: fixed issues with restapi plugin, removed unused api calls * fix: fixed issue that breaks restapi creation * fix: reload selected query details after update query * perf: reduced debounce time for data query update apis * feat: removed full reloading of query list on query renaming * feat: duplicate data query feature added * Fixed issue on creating restAPI query * fix: fixed issue in transforming response from update queyr api * fix: refresh selected query details when the selected query is updated * fix: rename query on click enter * fix: full refresh of query list on update * fix: style changes * fix: subscribing to state to autsave * feat: updated the query manager styles to new design * feat: revamped the querypane header buttons * fix: fixed the padding for query panel maximize button * feat: updated search box style * refactor: moved function to render data source icon to its own component * fix: fixed querymanager widget breaking issue * merged with feat/query-manager-autosave * refactor: removed unused consoles * refactor: removed unused consoles * refactor: removed unused consoles * fix: removed commented code * fix: removed unused code * refactor: removed unused comments * fix: show change datasource select only if valid ds available * Update frontend/src/Editor/Inspector/EventManager.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * Update frontend/src/Editor/QueryManager/Components/DataSourceLister.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * Update frontend/src/Editor/QueryManager/Components/DataSourceLister.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * Update frontend/src/Editor/QueryManager/Components/QueryManagerBody.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * feat: modify behaviour of search icon in query panel * fix: fixed theme color mismatch in query manager * refactor: remove dead code * refactor: updated theme for data source listner * fix: theming in filter and sort popup * refactor: remove unused variables * fix: removed draftQuery logic from query manager * refactor: removed unused varibales * Update frontend/src/Editor/QueryManager/QueryEditors/Restapi/TabParams.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * Update frontend/src/Editor/QueryPanel/QueryCard.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * feat: diable preview for draft queries * fix: added tooltip for query panel button * fix: fixed issues in saving query manager events * fix: moved query save subscriber to QuerPanel component * feat: converted query run api to save and run * fix: made varibale an optional param in updateDataQuery dto * refactor: cleanup update dataquery status api response * refactor: moved query status to constants file * feat: prompt for queryname when creating new query * fix: store new queryname in state on create query pageload * fix: fixed alignment of Tooljet db component form * fix: correct translation and format file * refactor: removed consoles * merge: merge appbuilder-1.2 * style: updated rename input/button UX * style: revamped dataquery create widget styles * style: revamped data source selector styles * fix: removed code added for debugging * style: updated data query filter design * style: Add prop to control visibility of clear button in search box * style: implement new style for query filter * merge appbuilder-1.2 to feat/query-manager-sort-filter * refactor: remove unintended file change * fix: set default value for method in respapi * style: updated copilot info popup style * style: updated quer panel header icons * style: updated button styles * style: fixed query manager button styles * style: smoothened query preview modal view * fix: correct import for some funs * fix: fixed minor UX bugs * style: fixed styling of REST api GDS * style: fixed styleing of sort and filter popup * style: improved data queries sort filter UI/UX * fix: remove click listner when overlay is closed * fix: moved component declaration out of parent component * fix: set selected datasource for default sources * fix: filter DS based on saerch in create dropdown * fix: restrict draft query running to preview mode * fix: query renamed on input change in create screen * fix: set name to state as soon as user renames query * fix: make query notification message consistent * style: correct s3 bucket plugin layout config * fix: fixed issues with cloning of Static DS queries * fix: made change so that newly created query is reflected immediatly * style: updated spacing for query manager components * fix: hide rename input when no query selected * fix: check bothe selected query and DS before rendering query manager * fix: set isSaving to true only for api calls in querymanager * fix: added success message form in qm * fix: filter out draft queries from viewer on running * fix: fixed inconsistent gutter for runpy and runjs editors * fix: reload dataqueris on LDS deletion * fix: redesigned filter/sort popup * fix: fixed issue that resets filter on search * fix: fixed query manager breaking on plugin select * fix: diable json preview for text output * fix: reset to filter and sort main menu on close filter popup * refactor: rename varibales * stye: redesigned query create panel * feat: revert data query status column from backend * style: redesign query picker section * refactor: removed dead code * style: querypanel expand/collapse btn style * style: add query select and query filter popup style redesign * style: updated filter popup style * feat: removed draft query checks everywhere * style: empty dataqueries style changed * style: updated query selector popup and rest options styles * style: removed 100% height to query option remove btn * feat: added the query runnable status check * style: updated query manager footer style * feat: changed DS filter from kind to DS ID * style: minor ui tweaks in filter popup * style: disable DS filter if no DQs created * style: minor ui change * fix: rerender filter popup post DS api call. fixed rest api copy feature * fix: add local DS to filter popup * refactor: removed dead code/comments * add new row is crashing when no data is fed to table (#7102) * fix: fixed condition that blocked GDS run on load * fix: revert name back to og name if update fails in rename query * feat: added tooltip for show query btn * fix: added click interaction for pill btn as well * fix: minor UI tweaks to make UX better * style: fixed the styling of filter popup * style: minor UI tweaks in query filter popup * fix: fixed minor css issue in ds picker * style: wrap overflowing text in queryname * fix: update updated_at after query update api call success * fix: update remove the caller query from event query dropdown * style: minor ui spacing tweaks * fix: fix issue that cuased app crash when tjdb opened * fix: fixed update row styles * fix: fixed info popup dark theme bg * fix: fixed headers styling according to general QM styles * style: fixed stripe QM UI * fix: added tooltip for quernames * feat: add tooltip for select ds options * added consoles to debug debugger issue * fix: fixed :active style of ds select dropdown in QM * fix: fixed DS kind name in data source selector in QM * fix: fixed border color mismatch for ds select dd * fix: change tooltip msg for maximize/minize QM * Fix automation for query manager revamp. (#7223) * Add data-cy to support modified specs * Fix event handler * Fix RunPy and RunJS specs * Fix event handler label * Fix basic components spec * Fix basic components failure * Fix tabel spec failure. * Fix runjs and runpy actions * Fix table column options * Add data-cy * version: version updated to 2.13.0 * Version bump --------- Co-authored-by: Kavin Venkatachalam <kavin.saratha@gmail.com> Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> Co-authored-by: Manish Kushare <37823141+manishkushare@users.noreply.github.com> Co-authored-by: Midhun Kumar E <midhun752@gmail.com>
2023-08-09 12:31:48 +00:00
const filteredQuery = dataQueryRef.current.filter(
(query) => query.name === e.data.queryName && isQueryRunnable(query)
);
Parameters support on RunJS (#7033) * feat: resolve passed arguments in runjs * feat: added popup form for runs params * fix: fixed issue with close function of popupover with codehinter * feat: added input for runjs args * style: for runjs args * fix: added support for params in custom components * fix: fixed default query param for runjs * fix: remove debuggers * refactor: removed commented code * fix: removed unused code * style: arguments input style in event manager * refactor: Moved argument list to separate component * refactor: moved runjs components to single folder * fix: minor refactorings * fix: renamed arguments to parameters for compoennts * refactor: reanamed argument to parameter in runjs * refactor: removed commented code * fix: added hasPramSupported flag against runjs queries * Update frontend/src/Editor/Inspector/ActionConfigurationPanels/RunjsParamters.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * Update frontend/src/Editor/QueryManager/QueryEditors/Runjs/ParameterForm.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * fix: prevent duplication of name * fix: fixed issue that blocked query params from returning * fix: remove extra params from runjs * fix: updated reference to current satte * fix: updated `query.run()` signature * fix: added duplicate check on param add and update * fix: added additonal null check for params runjs * feat: resolve runjs params default value without currentState * fix: hide defaultvalue of runjs in events form * fix: minor UX experience in runjs params * fix: set runjs default values to events on creation * style: updated the runjs param UI * style: runjs param form minor ux improvement * fix: close modal on add button click again --------- Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com>
2023-07-20 11:05:39 +00:00
const parameters = e.data.parameters ? JSON.parse(e.data.parameters) : {};
filteredQuery.length === 1 &&
Parameters support on RunJS (#7033) * feat: resolve passed arguments in runjs * feat: added popup form for runs params * fix: fixed issue with close function of popupover with codehinter * feat: added input for runjs args * style: for runjs args * fix: added support for params in custom components * fix: fixed default query param for runjs * fix: remove debuggers * refactor: removed commented code * fix: removed unused code * style: arguments input style in event manager * refactor: Moved argument list to separate component * refactor: moved runjs components to single folder * fix: minor refactorings * fix: renamed arguments to parameters for compoennts * refactor: reanamed argument to parameter in runjs * refactor: removed commented code * fix: added hasPramSupported flag against runjs queries * Update frontend/src/Editor/Inspector/ActionConfigurationPanels/RunjsParamters.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * Update frontend/src/Editor/QueryManager/QueryEditors/Runjs/ParameterForm.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * fix: prevent duplication of name * fix: fixed issue that blocked query params from returning * fix: remove extra params from runjs * fix: updated reference to current satte * fix: updated `query.run()` signature * fix: added duplicate check on param add and update * fix: added additonal null check for params runjs * feat: resolve runjs params default value without currentState * fix: hide defaultvalue of runjs in events form * fix: minor UX experience in runjs params * fix: set runjs default values to events on creation * style: updated the runjs param UI * style: runjs param form minor ux improvement * fix: close modal on add button click again --------- Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com>
2023-07-20 11:05:39 +00:00
fireEvent('onTrigger', {
component,
Parameters support on RunJS (#7033) * feat: resolve passed arguments in runjs * feat: added popup form for runs params * fix: fixed issue with close function of popupover with codehinter * feat: added input for runjs args * style: for runjs args * fix: added support for params in custom components * fix: fixed default query param for runjs * fix: remove debuggers * refactor: removed commented code * fix: removed unused code * style: arguments input style in event manager * refactor: Moved argument list to separate component * refactor: moved runjs components to single folder * fix: minor refactorings * fix: renamed arguments to parameters for compoennts * refactor: reanamed argument to parameter in runjs * refactor: removed commented code * fix: added hasPramSupported flag against runjs queries * Update frontend/src/Editor/Inspector/ActionConfigurationPanels/RunjsParamters.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * Update frontend/src/Editor/QueryManager/QueryEditors/Runjs/ParameterForm.jsx Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> * fix: prevent duplication of name * fix: fixed issue that blocked query params from returning * fix: remove extra params from runjs * fix: updated reference to current satte * fix: updated `query.run()` signature * fix: added duplicate check on param add and update * fix: added additonal null check for params runjs * feat: resolve runjs params default value without currentState * fix: hide defaultvalue of runjs in events form * fix: minor UX experience in runjs params * fix: set runjs default values to events on creation * style: updated the runjs param UI * style: runjs param form minor ux improvement * fix: close modal on add button click again --------- Co-authored-by: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com>
2023-07-20 11:05:39 +00:00
queryId: filteredQuery[0].id,
queryName: filteredQuery[0].name,
parameters,
});
} else {
sendMessageToIframe(e.data);
}
}
} catch (err) {
console.log(err);
}
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const sendMessageToIframe = ({ message }) => {
if (!iFrameRef.current) return;
switch (message) {
case 'INIT':
return iFrameRef.current.contentWindow.postMessage(
{
message: 'INIT_RESPONSE',
componentId: id,
data: customProps,
code: code,
},
'*'
);
case 'CODE_UPDATED':
return iFrameRef.current.contentWindow.postMessage(
{
message: 'CODE_UPDATED',
componentId: id,
data: customProps,
code: code,
},
'*'
);
case 'DATA_UPDATED':
return iFrameRef.current.contentWindow.postMessage(
{
message: 'DATA_UPDATED',
componentId: id,
data: customProps,
},
'*'
);
default:
return;
}
};
return (
<div className="card" style={{ display: visibility ? '' : 'none', height, boxShadow }} data-cy={dataCy}>
2023-12-29 08:36:50 +00:00
{showPlaceholder ? null : (
<iframe
srcDoc={iframeContent}
style={{ width: '100%', height: '100%', border: 'none' }}
ref={iFrameRef}
data-id={id}
></iframe>
)}
</div>
);
};