diff --git a/modules/shortcodes/tweet.php b/modules/shortcodes/tweet.php index 9a6a679a8dbdc..6d384698f5f19 100644 --- a/modules/shortcodes/tweet.php +++ b/modules/shortcodes/tweet.php @@ -17,6 +17,7 @@ */ add_shortcode( 'tweet', array( 'Jetpack_Tweet', 'jetpack_tweet_shortcode' ) ); +add_action( 'enqueue_block_editor_assets', array( 'Jetpack_Tweet', 'enqueue_block_editor_assets' ) ); class Jetpack_Tweet { @@ -142,4 +143,191 @@ static public function jetpack_tweet_shortcode_script() { } } + static public function enqueue_block_editor_assets() { + wp_register_script( + 'jetpack-shortcode-tweet-gutenberg', + null, + array( 'wp-blocks', 'wp-i18n', 'wp-element', 'shortcode' ) + ); + wp_enqueue_script( 'jetpack-shortcode-tweet-gutenberg' ); + + ob_start(); + self::jetpack_shortcode_tweet_gutenberg_script(); + $content = ob_get_clean(); + + wp_script_add_data( 'jetpack-shortcode-tweet-gutenberg', 'data', $content ); + } + + static public function jetpack_shortcode_tweet_gutenberg_script() { +?> +// +