Add custom image sizes to image and gallery blocks in block editor

<?php
/**
 * Expose custom images to block editor.
 *
 * @param array $sizes The default sizes array.
 */
function wd_block_editor_image_sizes( $sizes ) {

	// Add image sizes to include in block editor.
	return array_merge(
		$sizes,
		[
			'size-name' => __( 'Size Display Name', 'wd-starter' ),
		]
	);
}
add_filter( 'image_size_names_choose', 'wd_block_editor_image_sizes' );