When an HTML5 fallback button is pressed in the Audio or Video Details state, filter the library by that specific mime-type when the Add Audio|Video Source is activated.
See #27389. Built from https://develop.svn.wordpress.org/trunk@27658 git-svn-id: http://core.svn.wordpress.org/trunk@27501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
38d1fb971f
commit
86f4061b26
|
@ -1408,8 +1408,9 @@
|
|||
function init() {
|
||||
$(document.body)
|
||||
.on( 'click', '.wp-switch-editor', wp.media.mixin.pauseAllPlayers )
|
||||
.on( 'click', '.add-media-source', function() {
|
||||
media.frame.setState('add-' + media.frame.defaults.id + '-source');
|
||||
.on( 'click', '.add-media-source', function( e ) {
|
||||
media.frame.lastMime = $( e.currentTarget ).data( 'mime' );
|
||||
media.frame.setState( 'add-' + media.frame.defaults.id + '-source' );
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1140,9 +1140,18 @@
|
|||
|
||||
initialize: function( options ) {
|
||||
this.media = options.media;
|
||||
this.set( 'library', media.query({ type: options.type }) );
|
||||
this.type = options.type;
|
||||
this.set( 'library', media.query({ type: this.type }) );
|
||||
|
||||
media.controller.Library.prototype.initialize.apply( this, arguments );
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
if ( media.frame.lastMime ) {
|
||||
this.set( 'library', media.query({ type: media.frame.lastMime }) );
|
||||
delete media.frame.lastMime;
|
||||
}
|
||||
media.controller.Library.prototype.activate.apply( this, arguments );
|
||||
}
|
||||
});
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -771,7 +771,10 @@ function wp_print_media_templates() {
|
|||
</script>
|
||||
|
||||
<script type="text/html" id="tmpl-audio-details">
|
||||
<# var ext, html5types = { mp3: true, ogg: true }; #>
|
||||
<# var ext, html5types = {
|
||||
mp3: wp.media.view.settings.embedMimes.mp3,
|
||||
ogg: wp.media.view.settings.embedMimes.ogg
|
||||
}; #>
|
||||
|
||||
<?php $audio_types = wp_get_audio_extensions(); ?>
|
||||
<div class="media-embed media-embed-details">
|
||||
|
@ -810,8 +813,8 @@ function wp_print_media_templates() {
|
|||
<div class="setting">
|
||||
<span>{{{ wp.media.view.l10n.mediaHTML5Text }}}</span>
|
||||
<div class="button-large">
|
||||
<# _.each( html5types, function (value, type) { #>
|
||||
<button class="button add-media-source">{{ type }}</button>
|
||||
<# _.each( html5types, function (mime, type) { #>
|
||||
<button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
|
||||
<# } ) #>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -847,7 +850,11 @@ function wp_print_media_templates() {
|
|||
</script>
|
||||
|
||||
<script type="text/html" id="tmpl-video-details">
|
||||
<# var ext, html5types = { mp4: true, ogv: true, webm: true }; #>
|
||||
<# var ext, html5types = {
|
||||
mp4: wp.media.view.settings.embedMimes.mp4,
|
||||
ogv: wp.media.view.settings.embedMimes.ogv,
|
||||
webm: wp.media.view.settings.embedMimes.webm
|
||||
}; #>
|
||||
|
||||
<?php $video_types = wp_get_video_extensions(); ?>
|
||||
<div class="media-embed media-embed-details">
|
||||
|
@ -896,8 +903,8 @@ function wp_print_media_templates() {
|
|||
<div class="setting">
|
||||
<span>{{{ wp.media.view.l10n.mediaHTML5Text }}}</span>
|
||||
<div class="button-large">
|
||||
<# _.each( html5types, function (value, type) { #>
|
||||
<button class="button add-media-source">{{ type }}</button>
|
||||
<# _.each( html5types, function (mime, type) { #>
|
||||
<button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
|
||||
<# } ) #>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue