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 +13 -4 12.2.3 → 16.3-beta View file →
@@ -6,9 +6,15 @@
6 6 */
7 7
8 8 use Automattic\Jetpack\Assets;
9 9 use Automattic\Jetpack\Blocks;
10 +use Automattic\Jetpack\Current_Plan as Jetpack_Plan;
11 +use Automattic\Jetpack\VideoPress\Block_Replacement;
10 12
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit( 0 );
15 +}
16 +
11 17 /**
12 18 * Register a VideoPress extension to replace the default Core Video block.
13 19 */
14 20 class VideoPress_Gutenberg {
@@ -31,12 +37,15 @@
31 37 *
32 38 * Initialize the VideoPress Gutenberg extension
33 39 */
34 40 private function __construct() {
35 - 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 );
36 44 add_action( 'jetpack_register_gutenberg_extensions', array( $this, 'set_extension_availability' ) );
37 45 add_action( 'enqueue_block_editor_assets', array( $this, 'override_video_upload' ) );
38 46 add_action( 'enqueue_block_editor_assets', array( $this, 'add_resumable_upload_support' ) );
47 + Block_Replacement::init();
39 48 }
40 49
41 50 /**
42 51 * Get site's ID.
@@ -101,11 +110,11 @@
101 110 */
102 111 public function set_extension_availability() {
103 112 $availability = $this->check_videopress_availability();
104 113 if ( $availability['available'] ) {
105 - Jetpack_Gutenberg::set_extension_available( 'jetpack/videopress' );
114 + Jetpack_Gutenberg::set_extension_available( 'videopress' );
106 115 } else {
107 - Jetpack_Gutenberg::set_extension_unavailable( 'jetpack/videopress', $availability['unavailable_reason'] );
116 + Jetpack_Gutenberg::set_extension_unavailable( 'videopress', $availability['unavailable_reason'] );
108 117 }
109 118 }
110 119
111 120 /**
@@ -194,9 +203,9 @@
194 203 Assets::get_file_url_for_environment(
195 204 '_inc/build/videopress/js/gutenberg-video-upload.min.js',
196 205 'modules/videopress/js/gutenberg-video-upload.js'
197 206 ),
198 - array( 'wp-api-fetch', 'wp-polyfill', 'lodash' ),
207 + array( 'wp-api-fetch', 'wp-polyfill' ),
199 208 JETPACK__VERSION,
200 209 false
201 210 );
202 211 }