mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 06:37:06 +00:00
Cleanup audio/video shortcodes in the media modal:
* On the controller's `update`, `replace`, and `close` events, call `detach()` on the frame * Cleanup the HTML ouput of the Underscore templates. * Move some logic from the Underscore template to the `VideoDetails` view class. See #27016. git-svn-id: https://develop.svn.wordpress.org/trunk@27440 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -6237,7 +6237,6 @@
|
||||
|
||||
close : function() {
|
||||
this.mejs.pause();
|
||||
this.remove();
|
||||
},
|
||||
|
||||
player : function (mejs) {
|
||||
@@ -6302,7 +6301,6 @@
|
||||
|
||||
close : function() {
|
||||
this.mejs.pause();
|
||||
this.remove();
|
||||
},
|
||||
|
||||
player : function (mejs) {
|
||||
@@ -6310,7 +6308,7 @@
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var self = this, settings = {
|
||||
var video, self = this, settings = {
|
||||
success : this.player
|
||||
};
|
||||
|
||||
@@ -6321,7 +6319,14 @@
|
||||
media.view.Settings.AttachmentDisplay.prototype.render.apply( this, arguments );
|
||||
setTimeout( function() { self.resetFocus(); }, 10 );
|
||||
|
||||
new MediaElementPlayer( this.$('.wp-video-shortcode').get(0), settings );
|
||||
video = this.$('.wp-video-shortcode').get(0);
|
||||
video.src = [
|
||||
video.src,
|
||||
video.src.indexOf('?') > -1 ? '&' : '?',
|
||||
(new Date()).getTime()
|
||||
].join('');
|
||||
|
||||
new MediaElementPlayer( video, settings );
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
@@ -94,16 +94,24 @@ tinymce.PluginManager.add('wpgallery', function( editor ) {
|
||||
});
|
||||
} else if ( editor.dom.hasClass( node, 'wp-video' ) ) {
|
||||
frame = wp.media.video.edit( data );
|
||||
frame.on( 'close', function () {
|
||||
frame.detach();
|
||||
} );
|
||||
frame.state( 'video-details' ).on( 'update replace', function ( selection ) {
|
||||
var shortcode = wp.media.video.shortcode( selection );
|
||||
editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) );
|
||||
frame.detach();
|
||||
} );
|
||||
frame.open();
|
||||
} else if ( editor.dom.hasClass( node, 'wp-audio' ) ) {
|
||||
frame = wp.media.audio.edit( data );
|
||||
frame.on( 'close', function () {
|
||||
frame.detach();
|
||||
} );
|
||||
frame.state( 'audio-details' ).on( 'update replace', function ( selection ) {
|
||||
var shortcode = wp.media.audio.shortcode( selection );
|
||||
editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) );
|
||||
frame.detach();
|
||||
} );
|
||||
frame.open();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user