PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.3.75
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.3.75
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
← All changes | scripts/gutenberg/FormBlock/registerFormBlock.tsx +24 -8 11.1.2111.3.75 View file →
@@ -1,7 +1,8 @@
1 1 import React from 'react';
2 2 import * as WpBlocksApi from '@wordpress/blocks';
3 3 import SprocketIcon from '../Common/SprocketIcon';
4 +import StylesheetErrorBondary from '../Common/StylesheetErrorBondary';
4 5 import FormBlockSave from './FormBlockSave';
5 6 import { connectionStatus } from '../../constants/leadinConfig';
6 7 import FormGutenbergPreview from './FormGutenbergPreview';
7 8 import ErrorHandler from '../../shared/Common/ErrorHandler';
@@ -15,8 +16,9 @@
15 16 portalId: string;
16 17 formId: string;
17 18 preview?: boolean;
18 19 formName: string;
20 + embedVersion?: string;
19 21 };
20 22 }
21 23
22 24 export interface IFormBlockProps extends IFormBlockAttributes {
@@ -26,19 +28,30 @@
26 28 }
27 29
28 30 export default function registerFormBlock() {
29 31 const editComponent = (props: IFormBlockProps) => {
30 - if (props.attributes.preview) {
31 - return <FormGutenbergPreview />;
32 - } else if (connectionStatus === ConnectionStatus.Connected) {
33 - return <FormEdit {...props} origin="gutenberg" preview={true} />;
34 - } else {
35 - return <ErrorHandler status={401} />;
36 - }
32 + const isPreview = props.attributes.preview;
33 + const isConnected = connectionStatus === ConnectionStatus.Connected;
34 + return (
35 + <StylesheetErrorBondary>
36 + {isPreview ? (
37 + <FormGutenbergPreview />
38 + ) : isConnected ? (
39 + <FormEdit
40 + {...props}
41 + origin="gutenberg"
42 + preview={true}
43 + fullSiteEditor={isFullSiteEditor()}
44 + />
45 + ) : (
46 + <ErrorHandler status={401} />
47 + )}
48 + </StylesheetErrorBondary>
49 + );
37 50 };
38 51
39 52 // We do not support the full site editor: https://issues.hubspotcentral.com/browse/WP-1033
40 - if (!WpBlocksApi || isFullSiteEditor()) {
53 + if (!WpBlocksApi) {
41 54 return null;
42 55 }
43 56
44 57 WpBlocksApi.registerBlockType('leadin/hubspot-form-block', {
@@ -54,8 +67,11 @@
54 67 formId: {
55 68 type: 'string',
56 69 } as WpBlocksApi.BlockAttribute<string>,
57 70 formName: {
71 + type: 'string',
72 + } as WpBlocksApi.BlockAttribute<string>,
73 + embedVersion: {
58 74 type: 'string',
59 75 } as WpBlocksApi.BlockAttribute<string>,
60 76 preview: {
61 77 type: 'boolean',