diff --git a/assets/js/src/block.js b/assets/js/src/block.js index fc4212d..3fde1e4 100644 --- a/assets/js/src/block.js +++ b/assets/js/src/block.js @@ -48,7 +48,6 @@ var sizing = props.attributes.sizing || 'responsive'; var aspectRatio = props.attributes.aspect_ratio || '16:9'; - const width = props.attributes.width || '640px'; const height = props.attributes.height || '360px'; @@ -70,49 +69,13 @@ } }, [aspectRatio]); - // element.useEffect(() => { - // if (!maxHeight) { - // let newMaxHeight; - // if (aspectRatio === '16:9') { - // newMaxHeight = '360px'; - // } else if (aspectRatio === '4:3') { - // newMaxHeight = '480px'; - // } else { - // newMaxHeight = height; - // } - - // props.setAttributes({ - // ...props.attributes, - // max_height: height === '100%' && newMaxHeight ? newMaxHeight : height, - // }); - // } - // }, []); - - // element.useEffect(() => { - // if (sizing === 'responsive' && !inPageExperienceId) { - // let newMaxHeight; - // if (aspectRatio === '16:9') { - // newMaxHeight = '360px'; - // } else if (aspectRatio === '4:3') { - // newMaxHeight = '480px'; - // } else { - // newMaxHeight = height; - // } - - // props.setAttributes({ - // ...props.attributes, - // max_height: newMaxHeight, - // }); - // } - // }, [height, sizing, aspectRatio, inPageExperienceId]); - element.useEffect(() => { if (!experienceId) { let newMaxHeight; if (aspectRatio === '16:9') { - newMaxHeight = parseInt(parseInt(width) * (9 / 16)) + 'px'; + newMaxHeight = parseInt(parseInt(width, 10) * (9 / 16), 10) + 'px'; } else if (aspectRatio === '4:3') { - newMaxHeight = parseInt(parseInt(width) * (3 / 4)) + 'px'; + newMaxHeight = parseInt(parseInt(width, 10) * (3 / 4), 10) + 'px'; } else { newMaxHeight = height; } @@ -130,7 +93,6 @@ (width === '100%' || height === '100%') && !inPageExperienceId ) { - props.setAttributes({ ...props.attributes, width: width === '100%' ? maxWidth : undefined, @@ -352,14 +314,6 @@ playlistId; } - if (typeof height === 'undefined') { - height = maxHeight || 250; - } - - if (typeof width === 'undefined') { - width = maxWidth || 500; - } - const players = wpbc.players[accountId] .filter((player) => { return playlistId ? player.is_playlist : !player.is_playlist; @@ -586,10 +540,9 @@ }, ], onChange: function (value) { - props.setAttributes({ ...props.attributes, - aspect_ratio: value + aspect_ratio: value, }); }, }),