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