← All changes
|
scripts/elementor/FormWidget/ElementorFormSelect.tsx
+4
-39
11.3.64
→
11.3.75
View file →
| @@ -1,15 +1,10 @@ | ||
| 1 | -import React, { Fragment } from 'react'; | |
| 2 | 1 | import { portalId } from '../../constants/leadinConfig'; |
| 3 | 2 | import { __ } from '@wordpress/i18n'; |
| 4 | 3 | import ElementorBanner from '../Common/ElementorBanner'; |
| 5 | 4 | import UISpinner from '../../shared/UIComponents/UISpinner'; |
| 6 | -import { | |
| 7 | - BackgroudAppContext, | |
| 8 | - useBackgroundAppContext, | |
| 9 | -} from '../../iframe/useBackgroundApp'; | |
| 10 | 5 | import useForms from './hooks/useForms'; |
| 11 | -import { useGetEmbedder } from '../../utils/useGetEmbedder'; | |
| 6 | +import EmbedderContainer from '../../shared/Common/EmbedderContainer'; | |
| 12 | 7 | |
| 13 | 8 | interface IElementorFormSelectProps { |
| 14 | 9 | formId: string; |
| 15 | 10 | setAttributes: Function; |
| @@ -57,43 +52,13 @@ | ||
| 57 | 52 | </select> |
| 58 | 53 | ); |
| 59 | 54 | } |
| 60 | 55 | |
| 61 | -function ElementorFormSelectWrapper(props: IElementorFormSelectProps) { | |
| 62 | - const isBackgroundAppReady = useBackgroundAppContext(); | |
| 63 | - | |
| 64 | - return ( | |
| 65 | - <Fragment> | |
| 66 | - {!isBackgroundAppReady ? ( | |
| 67 | - <div> | |
| 68 | - <UISpinner /> | |
| 69 | - </div> | |
| 70 | - ) : ( | |
| 71 | - <ElementorFormSelect {...props} /> | |
| 72 | - )} | |
| 73 | - </Fragment> | |
| 74 | - ); | |
| 75 | -} | |
| 76 | - | |
| 77 | 56 | export default function ElementorFormSelectContainer( |
| 78 | 57 | props: IElementorFormSelectProps |
| 79 | 58 | ) { |
| 80 | - const { embedder, errorElement, isLoading } = useGetEmbedder(); | |
| 81 | - | |
| 82 | - if (errorElement) { | |
| 83 | - return errorElement; | |
| 84 | - } | |
| 85 | - | |
| 86 | - if (isLoading) { | |
| 87 | - return ( | |
| 88 | - <div> | |
| 89 | - <UISpinner /> | |
| 90 | - </div> | |
| 91 | - ); | |
| 92 | - } | |
| 93 | - | |
| 94 | 59 | return ( |
| 95 | - <BackgroudAppContext.Provider value={embedder}> | |
| 96 | - <ElementorFormSelectWrapper {...props} /> | |
| 97 | - </BackgroudAppContext.Provider> | |
| 60 | + <EmbedderContainer> | |
| 61 | + <ElementorFormSelect {...props} /> | |
| 62 | + </EmbedderContainer> | |
| 98 | 63 | ); |
| 99 | 64 | } |