General code cleanup and improving video sizing in the admin:
* Abstract the setting of a primary button and its callback in `wp.media.view.MediaFrame.MediaDetails` * Account for the existence or non-existence of `$content_width` in the TinyMCE views for video * Make sure video models always have dimensions, even if they are the defaults * For browsers that are not Firefox, don't use a timeout when setting the `MediaElementPlayer` instance in TinyMCE views See #27320. Built from https://develop.svn.wordpress.org/trunk@27655 git-svn-id: http://core.svn.wordpress.org/trunk@27498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1197,8 +1197,8 @@ function wp_get_playlist( $attr, $type ) {
|
||||
$default_width = 640;
|
||||
$default_height = 360;
|
||||
|
||||
$theme_width = $content_width - $outer;
|
||||
$theme_height = round( ( $default_height * $theme_width ) / $default_width );
|
||||
$theme_width = empty( $content_width ) ? $default_width : ( $content_width - $outer );
|
||||
$theme_height = empty( $content_width ) ? $default_height : round( ( $default_height * $theme_width ) / $default_width );
|
||||
|
||||
$data = compact( 'type', 'style' );
|
||||
|
||||
@@ -1585,7 +1585,7 @@ function wp_video_shortcode( $attr, $content = '' ) {
|
||||
}
|
||||
} else {
|
||||
// if the video is bigger than the theme
|
||||
if ( $width > $content_width ) {
|
||||
if ( ! empty( $content_width ) && $width > $content_width ) {
|
||||
$height = round( ( $height * $content_width ) / $width );
|
||||
$width = $content_width;
|
||||
}
|
||||
@@ -2381,6 +2381,8 @@ function wp_enqueue_media( $args = array() ) {
|
||||
if ( did_action( 'wp_enqueue_media' ) )
|
||||
return;
|
||||
|
||||
global $content_width;
|
||||
|
||||
$defaults = array(
|
||||
'post' => null,
|
||||
);
|
||||
@@ -2431,7 +2433,8 @@ function wp_enqueue_media( $args = array() ) {
|
||||
'defaultProps' => $props,
|
||||
'attachmentCounts' => wp_count_attachments(),
|
||||
'embedExts' => $exts,
|
||||
'embedMimes' => $ext_mimes
|
||||
'embedMimes' => $ext_mimes,
|
||||
'contentWidth' => $content_width,
|
||||
);
|
||||
|
||||
$post = null;
|
||||
|
||||
Reference in New Issue
Block a user