Skip to content

Commit

Permalink
Gutenberg: Set a default width and height.
Browse files Browse the repository at this point in the history
See #13.
  • Loading branch information
r-a-y committed Apr 14, 2020
1 parent 4dc9f92 commit a7e732a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion block.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,11 @@
value: props.attributes.link,
onChange: function( url ) {
console.log( url );
props.setAttributes( { link: url } );
props.setAttributes( {
link: url,
width: rayGDriveProps.defaultWidth,
height: rayGDriveProps.defaultHeight
} );
}
} )
)
Expand Down
4 changes: 3 additions & 1 deletion gdocs-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ function ray_google_docs_enqueue_block_assets() {
$help_url = apply_filters( 'ray_gdoc_help_url', 'https://github.com/cuny-academic-commons/google-docs-shortcode/wiki/Sharing-a-Google-Drive-file-and-getting-the-link' );

wp_localize_script( 'ray-gdoc-block', 'rayGDriveProps', array(
'helpUrl' => esc_url_raw( $help_url )
'helpUrl' => esc_url_raw( $help_url ),
'defaultWidth' => ! empty( $GLOBALS['content_width'] ) ? $GLOBALS['content_width'] : 640,
'defaultHeight' => 300
) );
}
add_action( 'enqueue_block_editor_assets', 'ray_google_docs_enqueue_block_assets', 11 );
Expand Down

0 comments on commit a7e732a

Please sign in to comment.