| @@ -18,8 +18,9 @@ | ||
| 18 | 18 | PanelBody, |
| 19 | 19 | PanelRow, |
| 20 | 20 | RangeControl, |
| 21 | 21 | SelectControl, |
| 22 | + Spinner, | |
| 22 | 23 | TextControl, |
| 23 | 24 | TextareaControl, |
| 24 | 25 | ToggleControl |
| 25 | 26 | } from '@wordpress/components'; |
| @@ -45,9 +46,9 @@ | ||
| 45 | 46 | |
| 46 | 47 | const [ isLoading, setIsLoading ] = useState( false ); |
| 47 | 48 | const [ proxyAttributes, setProxyAttributes ] = useState( attributes ); |
| 48 | 49 | |
| 49 | - const AYGServerSideRender = () => ( | |
| 50 | + const MyServerSideRender = () => ( | |
| 50 | 51 | <ServerSideRender |
| 51 | 52 | block="automatic-youtube-gallery/block" |
| 52 | 53 | attributes={ Object.assign( {}, proxyAttributes, { is_admin: true } ) } |
| 53 | 54 | /> |
| @@ -52,9 +53,9 @@ | ||
| 52 | 53 | attributes={ Object.assign( {}, proxyAttributes, { is_admin: true } ) } |
| 53 | 54 | /> |
| 54 | 55 | ); |
| 55 | 56 | |
| 56 | - const MemoizedServerSideRender = useCallback( AYGServerSideRender, [ proxyAttributes ] ); | |
| 57 | + const MemoizedServerSideRender = useCallback( MyServerSideRender, [ proxyAttributes ] ); | |
| 57 | 58 | |
| 58 | 59 | const debounceProxyAttributes = () => { |
| 59 | 60 | setIsLoading( false ); |
| 60 | 61 | setProxyAttributes( { ...attributes } ); |
| @@ -80,10 +81,8 @@ | ||
| 80 | 81 | value={ attributes[ field.name ] } |
| 81 | 82 | min={ field.min } |
| 82 | 83 | max={ field.max } |
| 83 | 84 | onChange={ onChange( field.name ) } |
| 84 | - __nextHasNoMarginBottom={ true } | |
| 85 | - __next40pxDefaultSize={ true } | |
| 86 | 85 | /> |
| 87 | 86 | </PanelRow> |
| 88 | 87 | case 'textarea': |
| 89 | 88 | return <PanelRow key={ index }> |
| @@ -92,9 +91,8 @@ | ||
| 92 | 91 | help={ description } |
| 93 | 92 | placeholder={ placeholder } |
| 94 | 93 | value={ attributes[ field.name ] } |
| 95 | 94 | onChange={ onChange( field.name ) } |
| 96 | - __nextHasNoMarginBottom={ true } | |
| 97 | 95 | /> |
| 98 | 96 | </PanelRow> |
| 99 | 97 | case 'select': |
| 100 | 98 | case 'radio': |
| @@ -113,10 +111,8 @@ | ||
| 113 | 111 | help={ description } |
| 114 | 112 | options={ options } |
| 115 | 113 | value={ attributes[ field.name ] } |
| 116 | 114 | onChange={ onChange( field.name ) } |
| 117 | - __nextHasNoMarginBottom={ true } | |
| 118 | - __next40pxDefaultSize={ true } | |
| 119 | 115 | /> |
| 120 | 116 | </PanelRow> |
| 121 | 117 | case 'checkbox': |
| 122 | 118 | return <PanelRow key={ index }> |
| @@ -124,9 +120,8 @@ | ||
| 124 | 120 | label={ field.label } |
| 125 | 121 | help={ description } |
| 126 | 122 | checked={ attributes[ field.name ] } |
| 127 | 123 | onChange={ toggleAttribute( field.name ) } |
| 128 | - __nextHasNoMarginBottom={ true } | |
| 129 | 124 | /> |
| 130 | 125 | </PanelRow> |
| 131 | 126 | case 'color': |
| 132 | 127 | return <PanelRow key={ index }> |
| @@ -149,10 +144,8 @@ | ||
| 149 | 144 | help={ description } |
| 150 | 145 | placeholder={ placeholder } |
| 151 | 146 | value={ attributes[ field.name ] } |
| 152 | 147 | onChange={ onChange( field.name ) } |
| 153 | - __nextHasNoMarginBottom={ true } | |
| 154 | - __next40pxDefaultSize={ true } | |
| 155 | 148 | /> |
| 156 | 149 | </PanelRow> |
| 157 | 150 | } |
| 158 | 151 | } |
| @@ -165,17 +158,8 @@ | ||
| 165 | 158 | if ( 'video' == attributes.type || 'livestream' == attributes.type ) { |
| 166 | 159 | value = false; |
| 167 | 160 | } |
| 168 | 161 | break; |
| 169 | - case 'search': | |
| 170 | - if ( 'video' == attributes.type || 'livestream' == attributes.type ) { | |
| 171 | - value = false; | |
| 172 | - } | |
| 173 | - | |
| 174 | - if ( 'slider' == attributes.theme || 'slider-popup' == attributes.theme || 'slider-inline' == attributes.theme || 'playlister' == attributes.theme ) { | |
| 175 | - value = false; | |
| 176 | - } | |
| 177 | - break; | |
| 178 | 162 | } |
| 179 | 163 | |
| 180 | 164 | return applyFilters( 'ayg_block_toggle_panels', value, panel, attributes ); |
| 181 | 165 | } |
| @@ -216,8 +200,23 @@ | ||
| 216 | 200 | if ( 'video' == attributes.type || 'livestream' == attributes.type ) { |
| 217 | 201 | value = false; |
| 218 | 202 | } |
| 219 | 203 | break; |
| 204 | + case 'more_button_label': | |
| 205 | + if ( 'pager' == attributes.pagination_type ) { | |
| 206 | + value = false; | |
| 207 | + } | |
| 208 | + break; | |
| 209 | + case 'previous_button_label': | |
| 210 | + case 'next_button_label': | |
| 211 | + if ( 'more' == attributes.pagination_type ) { | |
| 212 | + value = false; | |
| 213 | + } | |
| 214 | + break; | |
| 215 | + case 'privacy_enhanced_mode': | |
| 216 | + case 'origin': | |
| 217 | + value = false; | |
| 218 | + break; | |
| 220 | 219 | } |
| 221 | 220 | |
| 222 | 221 | return applyFilters( 'ayg_block_toggle_controls', value, control, attributes ); |
| 223 | 222 | } |
| @@ -280,8 +279,15 @@ | ||
| 280 | 279 | |
| 281 | 280 | <div { ...blockProps }> |
| 282 | 281 | <Disabled> |
| 283 | 282 | <MemoizedServerSideRender /> |
| 283 | + | |
| 284 | + { isLoading && ( | |
| 285 | + <div className="automatic-youtube-gallery-block-spinner"> | |
| 286 | + <Spinner /> | |
| 287 | + <span>{ ayg_block.i18n.is_loading }</span> | |
| 288 | + </div> | |
| 289 | + ) } | |
| 284 | 290 | </Disabled> |
| 285 | 291 | </div> |
| 286 | 292 | </> |
| 287 | 293 | ); |