PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.3.65
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.3.65
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
leadin / scripts / gutenberg / Common / StylesheetErrorBondary.tsx

StylesheetErrorBondary.tsx in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.3.65, at scripts/gutenberg/Common/StylesheetErrorBondary.tsx

24 lines 765 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React from 'react';
2 import { leadinPluginVersion, pluginPath } from '../../constants/leadinConfig';
3 import { useRefEffect } from '@wordpress/compose';
4
5 function StylesheetErrorBondary({ children }: React.PropsWithChildren) {
6 const ref = useRefEffect(element => {
7 const { ownerDocument } = element;
8 if (
9 ownerDocument &&
10 !ownerDocument.getElementById('leadin-gutenberg-css')
11 ) {
12 const link = ownerDocument.createElement('link');
13 link.id = 'leadin-gutenberg-css';
14 link.rel = 'stylesheet';
15 link.href = `${pluginPath}/build/gutenberg.css?ver=${leadinPluginVersion}`;
16 ownerDocument.head.appendChild(link);
17 }
18 }, []);
19
20 return <div ref={ref}>{children}</div>;
21 }
22
23 export default StylesheetErrorBondary;
24