TurnstileBlockEdit.js
2 years ago
TurnstileOptions.js
2 years ago
TurnstileProvider.js
2 years ago
main.js
2 years ago
preview.js
2 years ago
variation.js
2 years ago
TurnstileBlockEdit.js
56 lines
| 1 | import TurnstileOptions from './TurnstileOptions'; |
| 2 | import preview from './preview'; |
| 3 | |
| 4 | const { |
| 5 | __, |
| 6 | } = wp.i18n; |
| 7 | const { |
| 8 | ToggleControl, |
| 9 | BaseHelp, |
| 10 | } = JetFBComponents; |
| 11 | const { |
| 12 | useCaptchaProvider, |
| 13 | } = JetFBHooks; |
| 14 | let { |
| 15 | TextControl, |
| 16 | NumberControl, |
| 17 | __experimentalNumberControl, |
| 18 | } = wp.components; |
| 19 | |
| 20 | const { |
| 21 | InspectorControls, |
| 22 | useBlockProps, |
| 23 | } = wp.blockEditor; |
| 24 | |
| 25 | NumberControl = NumberControl || __experimentalNumberControl; |
| 26 | |
| 27 | function TurnstileBlockEdit( { isSelected, attributes } ) { |
| 28 | const blockProps = useBlockProps(); |
| 29 | |
| 30 | if ( attributes.isPreview ) { |
| 31 | return <div style={ { |
| 32 | width: '100%', |
| 33 | display: 'flex', |
| 34 | justifyContent: 'center', |
| 35 | } }> |
| 36 | { preview } |
| 37 | </div>; |
| 38 | } |
| 39 | |
| 40 | return <> |
| 41 | <div { ...blockProps }> |
| 42 | { isSelected |
| 43 | ? <div style={ { padding: '20px' } }> |
| 44 | <TurnstileOptions/> |
| 45 | </div> |
| 46 | : preview } |
| 47 | </div> |
| 48 | <InspectorControls> |
| 49 | <div style={ { padding: '20px' } }> |
| 50 | <TurnstileOptions/> |
| 51 | </div> |
| 52 | </InspectorControls> |
| 53 | </>; |
| 54 | } |
| 55 | |
| 56 | export default TurnstileBlockEdit; |