Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Edit = ( { attributes, className, clientId, isSelected, setAttributes } ) => {
const { imageBefore, imageAfter, caption, orientation } = attributes;
// Check for useResizeObserver, not available in older Gutenberg.
let resizeListener = null;
let sizes = null;
if ( useResizeObserver ) {
// Let's look for resize so we can trigger the thing.
[ resizeListener, sizes ] = useResizeObserver();
useDebounce(
sz => {
if ( sz > 0 ) {
if ( typeof juxtapose !== 'undefined' && juxtapose.sliders ) {
// only update for *this* slide
juxtapose.sliders.forEach( elem => {
const parentElem = elem.wrapper.parentElement;
if ( parentElem.id === clientId ) {
elem.optimizeWrapper( sz );
}
} );
}
}
},
200,