From cc2f08450a4a88b2fd7b48d6411d96d4452386e9 Mon Sep 17 00:00:00 2001 From: Oscar Sanchez S Date: Mon, 12 Jun 2023 20:51:38 -0500 Subject: [PATCH 1/3] Bugfix: playlist experience not rendering correctly in frontend --- includes/class-bc-utility.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-bc-utility.php b/includes/class-bc-utility.php index 3549697f..b1089e2b 100644 --- a/includes/class-bc-utility.php +++ b/includes/class-bc-utility.php @@ -860,12 +860,12 @@ public static function get_experience_player( $atts ) { $video_ids = ''; $playlist_id = ''; - if ( isset( $atts['video_ids'] ) ) { + if ( ! empty( $atts['video_ids'] ) ) { $video_ids = sanitize_text_field( $atts['video_ids'] ); $js_attr = 'data-video-ids="' . esc_attr( $video_ids ) . '"'; $url_attr = 'videoIds=' . esc_attr( $video_ids ); } else { - $atts['playlist_id'] = isset( $atts['playlist_id'] ) ? $atts['playlist_id'] : ''; + $atts['playlist_id'] = ! empty( $atts['playlist_id'] ) ? $atts['playlist_id'] : ''; $playlist_id = sanitize_text_field( $atts['playlist_id'] ); $js_attr = 'data-playlist-id="' . esc_attr( $playlist_id ) . '"'; $url_attr = 'playlistId=' . esc_attr( $playlist_id ); From ce5b54ace70a3f63bfaf8b4c1fcf25fdde8063b3 Mon Sep 17 00:00:00 2001 From: Oscar Sanchez S Date: Thu, 15 Jun 2023 19:01:11 -0500 Subject: [PATCH 2/3] Fixes switch between javascript and iframe embeds and disable non avail options bug --- assets/js/src/block.js | 131 +++++++++++++------------- includes/admin/class-bc-templates.php | 4 +- includes/class-bc-utility.php | 2 +- 3 files changed, 71 insertions(+), 66 deletions(-) diff --git a/assets/js/src/block.js b/assets/js/src/block.js index c74021d4..f05214d5 100644 --- a/assets/js/src/block.js +++ b/assets/js/src/block.js @@ -356,24 +356,63 @@ }, ]; }, []); + const muteField = (autoplay) => { + const field = el(components.CheckboxControl, { + label: __('Mute', 'brightcove'), + checked: mute !== '' || autoplay !== '', + onChange: function (value) { + props.setAttributes({ + ...props.attributes, + mute: value && 'muted', + }); + }, + }); + + if (autoplay === 'autoplay') { + return el(components.Disabled, { style: { marginBottom: '24px' } }, field); + } + return field; + }; + + const playsinlineField = (autoplay) => { + const field = el(components.CheckboxControl, { + label: __('Plays in line', 'brightcove'), + checked: playsinline !== '' || autoplay !== '', + onChange: function (value) { + props.setAttributes({ + ...props.attributes, + playsinline: value && 'playsinline', + }); + }, + }); + + if (autoplay === 'autoplay') { + return el(components.Disabled, { style: { marginBottom: '24px' } }, field); + } + return field; + }; + + const isExperience = inPageExperienceId || experienceId; let embedStyleOptions = [{ label: __('iFrame', 'brightcove'), value: 'iframe' }]; - embedStyleOptions = playlistId - ? [ - ...embedStyleOptions, - { - label: __('JavaScript Horizontal', 'brightcove'), - value: 'in-page-horizontal', - }, - { - label: __('JavaScript Vertical', 'brightcove'), - value: 'in-page-vertical', - }, - ] - : [ - { label: __('JavaScript', 'brightcove'), value: 'in-page' }, - ...embedStyleOptions, - ]; + + embedStyleOptions = + playlistId && !isExperience + ? [ + ...embedStyleOptions, + { + label: __('JavaScript Horizontal', 'brightcove'), + value: 'in-page-horizontal', + }, + { + label: __('JavaScript Vertical', 'brightcove'), + value: 'in-page-vertical', + }, + ] + : [ + { label: __('JavaScript', 'brightcove'), value: 'in-page' }, + ...embedStyleOptions, + ]; const sizingField = el(components.RadioControl, { label: __('Sizing', 'brightcove'), @@ -393,28 +432,6 @@ }, }); - const muteField = el(components.CheckboxControl, { - label: __('Mute', 'brightcove'), - checked: mute !== '' || autoplay !== '', - onChange: function (value) { - props.setAttributes({ - ...props.attributes, - mute: value && 'muted', - }); - }, - }); - - const playsinlineField = el(components.CheckboxControl, { - label: __('Plays in line', 'brightcove'), - checked: playsinline !== '' || autoplay !== '', - onChange: function (value) { - props.setAttributes({ - ...props.attributes, - playsinline: value && 'playsinline', - }); - }, - }); - const embedStyleField = el(components.RadioControl, { label: __('Embed Style', 'brightcove'), selected: embed, @@ -427,7 +444,6 @@ }, }); - const isExperience = inPageExperienceId || experienceId; return [ userPermission ? controls : '', @@ -489,20 +505,8 @@ }); }, }), - !isExperience && autoplay === 'autoplay' - ? el( - components.Disabled, - { style: { marginBottom: '24px' } }, - muteField, - ) - : muteField, - !isExperience && autoplay === 'autoplay' - ? el( - components.Disabled, - { style: { marginBottom: '24px' } }, - playsinlineField, - ) - : playsinlineField, + !isExperience && muteField(autoplay), + !isExperience && playsinlineField(autoplay), !playlistId && !isExperience && el(components.CheckboxControl, { @@ -515,16 +519,17 @@ }); }, }), - el(components.CheckboxControl, { - label: __('Enable Language Detection', 'brightcove'), - checked: languageDetection, - onChange: function (value) { - props.setAttributes({ - ...props.attributes, - language_detection: value && 'languagedetection', - }); - }, - }), + !isExperience && + el(components.CheckboxControl, { + label: __('Enable Language Detection', 'brightcove'), + checked: languageDetection, + onChange: function (value) { + props.setAttributes({ + ...props.attributes, + language_detection: value && 'languagedetection', + }); + }, + }), languageDetection === 'languagedetection' || pictureinpicture === 'pictureinpicture' ? el( diff --git a/includes/admin/class-bc-templates.php b/includes/admin/class-bc-templates.php index 37ce75e5..2210404b 100644 --- a/includes/admin/class-bc-templates.php +++ b/includes/admin/class-bc-templates.php @@ -908,7 +908,7 @@ class="brightcove-datetime brightcove-end-date"
- +
@@ -986,7 +986,7 @@ class="brightcove-datetime brightcove-end-date"
- +
diff --git a/includes/class-bc-utility.php b/includes/class-bc-utility.php index b1089e2b..5006a953 100644 --- a/includes/class-bc-utility.php +++ b/includes/class-bc-utility.php @@ -876,7 +876,7 @@ public static function get_experience_player( $atts ) {
Date: Fri, 16 Jun 2023 10:27:20 -0500 Subject: [PATCH 3/3] Fix JS lint --- assets/js/src/block.js | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/js/src/block.js b/assets/js/src/block.js index f05214d5..6eefca0b 100644 --- a/assets/js/src/block.js +++ b/assets/js/src/block.js @@ -444,7 +444,6 @@ }, }); - return [ userPermission ? controls : '', el('iframe', {