summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/vr.php')
-rw-r--r--plugins/jetpack/modules/shortcodes/vr.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/plugins/jetpack/modules/shortcodes/vr.php b/plugins/jetpack/modules/shortcodes/vr.php
index 15906c70..12835b8a 100644
--- a/plugins/jetpack/modules/shortcodes/vr.php
+++ b/plugins/jetpack/modules/shortcodes/vr.php
@@ -97,7 +97,6 @@ function jetpack_vr_viewer_get_html( $url_params ) {
* @return html - complete vr viewer html
*/
function jetpack_vr_viewer_shortcode( $atts ) {
-
$params = shortcode_atts( array(
0 => null,
'url' => null,
@@ -129,3 +128,29 @@ function jetpack_vr_viewer_shortcode( $atts ) {
}
add_shortcode( 'vr', 'jetpack_vr_viewer_shortcode' );
+
+// Gutenberg!
+add_action( 'admin_init', 'jetpack_register_block_type_vr' );
+function jetpack_register_block_type_vr() {
+ if ( ! function_exists( 'register_block_type' ) ) {
+ return;
+ }
+
+ wp_register_script(
+ 'jetpack_vr_viewer_shortcode_editor_script',
+ Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/blocks/vr-block.min.js', 'modules/shortcodes/js/blocks/vr-block.js' ),
+ array( 'wp-blocks', 'wp-element', 'wp-i18n' )
+ );
+
+ wp_register_style(
+ 'jetpack_vr_viewer_shortcode_editor_style',
+ plugins_url( 'modules/shortcodes/css/blocks/vr-block.css', JETPACK__PLUGIN_FILE ),
+ array( 'wp-edit-blocks' )
+ );
+
+ register_block_type( 'jetpack/vr', array(
+ 'editor_script' => 'jetpack_vr_viewer_shortcode_editor_script',
+ 'editor_style' => 'jetpack_vr_viewer_shortcode_editor_style',
+ 'render_callback' => 'jetpack_vr_viewer_shortcode',
+ ) );
+} \ No newline at end of file