Back

50% Statements 4/8
25% Branches 1/4
100% Functions 1/1
50% Lines 4/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36          1x     1x     108x 108x                                              
/**
 * Internal dependencies
 */
import withVideoChaptersEdit from './edit';
 
const VIDEOPRESS_VIDEO_CHAPTERS_FEATURE = 'videopress/video-chapters';
 
export const isVideoChaptersEnabled =
	!! window?.Jetpack_Editor_Initial_State?.available_blocks[ VIDEOPRESS_VIDEO_CHAPTERS_FEATURE ];
 
export default function addVideoPressVideoChaptersSupport( settings, name ) {
	Eif ( ! isVideoChaptersEnabled ) {
		return settings;
	}
 
	if ( name !== 'core/video' ) {
		return settings;
	}
 
	const videoChaptersAttributes = {
		...settings.attributes,
		title: {
			type: 'string',
		},
		description: {
			type: 'string',
		},
	};
 
	return {
		...settings,
		attributes: videoChaptersAttributes,
		edit: withVideoChaptersEdit( settings.edit ),
	};
}