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/shared/Form
File: FormEdit.tsx
import React, { Fragment, useEffect } from 'react';
[0] Fix | Delete
import { portalId, refreshToken } from '../../constants/leadinConfig';
[1] Fix | Delete
import UISpacer from '../UIComponents/UISpacer';
[2] Fix | Delete
import PreviewForm from './PreviewForm';
[3] Fix | Delete
import FormSelect from './FormSelect';
[4] Fix | Delete
import { IFormBlockProps } from '../../gutenberg/FormBlock/registerFormBlock';
[5] Fix | Delete
import {
[6] Fix | Delete
usePostBackgroundMessage,
[7] Fix | Delete
BackgroudAppContext,
[8] Fix | Delete
useBackgroundAppContext,
[9] Fix | Delete
} from '../../iframe/useBackgroundApp';
[10] Fix | Delete
import { ProxyMessages } from '../../iframe/integratedMessages';
[11] Fix | Delete
import LoadingBlock from '../Common/LoadingBlock';
[12] Fix | Delete
import { getOrCreateBackgroundApp } from '../../utils/backgroundAppUtils';
[13] Fix | Delete
[14] Fix | Delete
interface IFormEditProps extends IFormBlockProps {
[15] Fix | Delete
preview: boolean;
[16] Fix | Delete
origin: 'gutenberg' | 'elementor';
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
function FormEdit({
[20] Fix | Delete
attributes,
[21] Fix | Delete
isSelected,
[22] Fix | Delete
setAttributes,
[23] Fix | Delete
preview = true,
[24] Fix | Delete
origin = 'gutenberg',
[25] Fix | Delete
}: IFormEditProps) {
[26] Fix | Delete
const { formId, formName } = attributes;
[27] Fix | Delete
const formSelected = portalId && formId;
[28] Fix | Delete
[29] Fix | Delete
const isBackgroundAppReady = useBackgroundAppContext();
[30] Fix | Delete
const monitorFormPreviewRender = usePostBackgroundMessage();
[31] Fix | Delete
[32] Fix | Delete
const handleChange = (selectedForm: { value: string; label: string }) => {
[33] Fix | Delete
setAttributes({
[34] Fix | Delete
portalId,
[35] Fix | Delete
formId: selectedForm.value,
[36] Fix | Delete
formName: selectedForm.label,
[37] Fix | Delete
});
[38] Fix | Delete
};
[39] Fix | Delete
[40] Fix | Delete
useEffect(() => {
[41] Fix | Delete
monitorFormPreviewRender({
[42] Fix | Delete
key: ProxyMessages.TrackFormPreviewRender,
[43] Fix | Delete
payload: {
[44] Fix | Delete
origin,
[45] Fix | Delete
},
[46] Fix | Delete
});
[47] Fix | Delete
}, [origin]);
[48] Fix | Delete
[49] Fix | Delete
return !isBackgroundAppReady ? (
[50] Fix | Delete
<LoadingBlock />
[51] Fix | Delete
) : (
[52] Fix | Delete
<Fragment>
[53] Fix | Delete
{(isSelected || !formSelected) && (
[54] Fix | Delete
<FormSelect
[55] Fix | Delete
formId={formId}
[56] Fix | Delete
formName={formName}
[57] Fix | Delete
handleChange={handleChange}
[58] Fix | Delete
origin={origin}
[59] Fix | Delete
/>
[60] Fix | Delete
)}
[61] Fix | Delete
{formSelected && (
[62] Fix | Delete
<Fragment>
[63] Fix | Delete
{isSelected && <UISpacer />}
[64] Fix | Delete
{preview && <PreviewForm portalId={portalId} formId={formId} />}
[65] Fix | Delete
</Fragment>
[66] Fix | Delete
)}
[67] Fix | Delete
</Fragment>
[68] Fix | Delete
);
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
export default function FormEditContainer(props: IFormEditProps) {
[72] Fix | Delete
return (
[73] Fix | Delete
<BackgroudAppContext.Provider
[74] Fix | Delete
value={refreshToken && getOrCreateBackgroundApp(refreshToken)}
[75] Fix | Delete
>
[76] Fix | Delete
<FormEdit {...props} />
[77] Fix | Delete
</BackgroudAppContext.Provider>
[78] Fix | Delete
);
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function