Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/leadin/scripts/gutenber.../FormBloc...
File: registerFormBlock.tsx
import React from 'react';
[0] Fix | Delete
import * as WpBlocksApi from '@wordpress/blocks';
[1] Fix | Delete
import SprocketIcon from '../Common/SprocketIcon';
[2] Fix | Delete
import FormBlockSave from './FormBlockSave';
[3] Fix | Delete
import { connectionStatus } from '../../constants/leadinConfig';
[4] Fix | Delete
import FormGutenbergPreview from './FormGutenbergPreview';
[5] Fix | Delete
import ErrorHandler from '../../shared/Common/ErrorHandler';
[6] Fix | Delete
import FormEdit from '../../shared/Form/FormEdit';
[7] Fix | Delete
import ConnectionStatus from '../../shared/enums/connectionStatus';
[8] Fix | Delete
import { __ } from '@wordpress/i18n';
[9] Fix | Delete
import { isFullSiteEditor } from '../../utils/withMetaData';
[10] Fix | Delete
[11] Fix | Delete
export interface IFormBlockAttributes {
[12] Fix | Delete
attributes: {
[13] Fix | Delete
portalId: string;
[14] Fix | Delete
formId: string;
[15] Fix | Delete
preview?: boolean;
[16] Fix | Delete
formName: string;
[17] Fix | Delete
};
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
export interface IFormBlockProps extends IFormBlockAttributes {
[21] Fix | Delete
setAttributes: Function;
[22] Fix | Delete
isSelected: boolean;
[23] Fix | Delete
context?: any;
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
export default function registerFormBlock() {
[27] Fix | Delete
const editComponent = (props: IFormBlockProps) => {
[28] Fix | Delete
if (props.attributes.preview) {
[29] Fix | Delete
return <FormGutenbergPreview />;
[30] Fix | Delete
} else if (connectionStatus === ConnectionStatus.Connected) {
[31] Fix | Delete
return <FormEdit {...props} origin="gutenberg" preview={true} />;
[32] Fix | Delete
} else {
[33] Fix | Delete
return <ErrorHandler status={401} />;
[34] Fix | Delete
}
[35] Fix | Delete
};
[36] Fix | Delete
[37] Fix | Delete
// We do not support the full site editor: https://issues.hubspotcentral.com/browse/WP-1033
[38] Fix | Delete
if (!WpBlocksApi || isFullSiteEditor()) {
[39] Fix | Delete
return null;
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
WpBlocksApi.registerBlockType('leadin/hubspot-form-block', {
[43] Fix | Delete
title: __('HubSpot Form', 'leadin'),
[44] Fix | Delete
description: __('Select and embed a HubSpot form', 'leadin'),
[45] Fix | Delete
icon: SprocketIcon,
[46] Fix | Delete
category: 'leadin-blocks',
[47] Fix | Delete
attributes: {
[48] Fix | Delete
portalId: {
[49] Fix | Delete
type: 'string',
[50] Fix | Delete
default: '',
[51] Fix | Delete
} as WpBlocksApi.BlockAttribute<string>,
[52] Fix | Delete
formId: {
[53] Fix | Delete
type: 'string',
[54] Fix | Delete
} as WpBlocksApi.BlockAttribute<string>,
[55] Fix | Delete
formName: {
[56] Fix | Delete
type: 'string',
[57] Fix | Delete
} as WpBlocksApi.BlockAttribute<string>,
[58] Fix | Delete
preview: {
[59] Fix | Delete
type: 'boolean',
[60] Fix | Delete
default: false,
[61] Fix | Delete
} as WpBlocksApi.BlockAttribute<boolean>,
[62] Fix | Delete
},
[63] Fix | Delete
example: {
[64] Fix | Delete
attributes: {
[65] Fix | Delete
preview: true,
[66] Fix | Delete
},
[67] Fix | Delete
},
[68] Fix | Delete
edit: editComponent,
[69] Fix | Delete
save: props => <FormBlockSave {...props} />,
[70] Fix | Delete
});
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function