PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
← All changes | modules/videopress/class.videopress-gutenberg.php +12 -4 13.1.5 → 16.3-beta View file →
@@ -7,9 +7,14 @@
7 7
8 8 use Automattic\Jetpack\Assets;
9 9 use Automattic\Jetpack\Blocks;
10 10 use Automattic\Jetpack\Current_Plan as Jetpack_Plan;
11 +use Automattic\Jetpack\VideoPress\Block_Replacement;
11 12
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit( 0 );
15 +}
16 +
12 17 /**
13 18 * Register a VideoPress extension to replace the default Core Video block.
14 19 */
15 20 class VideoPress_Gutenberg {
@@ -32,12 +37,15 @@
32 37 *
33 38 * Initialize the VideoPress Gutenberg extension
34 39 */
35 40 private function __construct() {
36 - add_action( 'init', array( $this, 'register_video_block_with_videopress' ) );
41 + // Run late to avoid race condition with other plugins that register the video block
42 + // Jetpack's jetpack_register_block function bails if the block is already registered
43 + add_action( 'init', array( $this, 'register_video_block_with_videopress' ), 99 );
37 44 add_action( 'jetpack_register_gutenberg_extensions', array( $this, 'set_extension_availability' ) );
38 45 add_action( 'enqueue_block_editor_assets', array( $this, 'override_video_upload' ) );
39 46 add_action( 'enqueue_block_editor_assets', array( $this, 'add_resumable_upload_support' ) );
47 + Block_Replacement::init();
40 48 }
41 49
42 50 /**
43 51 * Get site's ID.
@@ -102,11 +110,11 @@
102 110 */
103 111 public function set_extension_availability() {
104 112 $availability = $this->check_videopress_availability();
105 113 if ( $availability['available'] ) {
106 - Jetpack_Gutenberg::set_extension_available( 'jetpack/videopress' );
114 + Jetpack_Gutenberg::set_extension_available( 'videopress' );
107 115 } else {
108 - Jetpack_Gutenberg::set_extension_unavailable( 'jetpack/videopress', $availability['unavailable_reason'] );
116 + Jetpack_Gutenberg::set_extension_unavailable( 'videopress', $availability['unavailable_reason'] );
109 117 }
110 118 }
111 119
112 120 /**
@@ -195,9 +203,9 @@
195 203 Assets::get_file_url_for_environment(
196 204 '_inc/build/videopress/js/gutenberg-video-upload.min.js',
197 205 'modules/videopress/js/gutenberg-video-upload.js'
198 206 ),
199 - array( 'wp-api-fetch', 'wp-polyfill', 'lodash' ),
207 + array( 'wp-api-fetch', 'wp-polyfill' ),
200 208 JETPACK__VERSION,
201 209 false
202 210 );
203 211 }