<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[27733] trunk/src/wp-includes: Don't make `mce-view` a dependency for `media-audiovideo`.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/27733">27733</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-03-26 12:10:21 +0000 (Wed, 26 Mar 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Don't make `mce-view` a dependency for `media-audiovideo`. Make `media-audiovideo` and `wp-playlist` dependencies for `mce-view` and only enqueue `mce-view` in the admin in `wp_enqueue_media()`. MCE views don't need to be included when media is loaded on the front end.
Fixes <a href="http://core.trac.wordpress.org/ticket/27509">#27509</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesjsmceviewjs">trunk/src/wp-includes/js/mce-view.js</a></li>
<li><a href="#trunksrcwpincludesjsmediaaudiovideojs">trunk/src/wp-includes/js/media-audiovideo.js</a></li>
<li><a href="#trunksrcwpincludesmediatemplatephp">trunk/src/wp-includes/media-template.php</a></li>
<li><a href="#trunksrcwpincludesmediaphp">trunk/src/wp-includes/media.php</a></li>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesjsmceviewjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/mce-view.js (27732 => 27733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/mce-view.js 2014-03-26 05:51:45 UTC (rev 27732)
+++ trunk/src/wp-includes/js/mce-view.js 2014-03-26 12:10:21 UTC (rev 27733)
</span><span class="lines">@@ -317,4 +317,362 @@
</span><span class="cx">
</span><span class="cx"> };
</span><span class="cx"> wp.mce.views.register( 'gallery', wp.mce.gallery );
</span><ins>+
+ /**
+ * Tiny MCE Views for Audio / Video
+ *
+ */
+
+ /**
+ * These are base methods that are shared by each shortcode's MCE controller
+ *
+ * @mixin
+ */
+ wp.mce.media = {
+ /**
+ * @global wp.shortcode
+ *
+ * @param {string} content
+ * @returns {Object}
+ */
+ toView: function( content ) {
+ var match = wp.shortcode.next( this.shortcode, content );
+
+ if ( ! match ) {
+ return;
+ }
+
+ return {
+ index: match.index,
+ content: match.content,
+ options: {
+ shortcode: match.shortcode
+ }
+ };
+ },
+
+ /**
+ * Called when a TinyMCE view is clicked for editing.
+ * - Parses the shortcode out of the element's data attribute
+ * - Calls the `edit` method on the shortcode model
+ * - Launches the model window
+ * - Bind's an `update` callback which updates the element's data attribute
+ * re-renders the view
+ *
+ * @param {HTMLElement} node
+ */
+ edit: function( node ) {
+ var media = wp.media[ this.shortcode ],
+ self = this,
+ frame, data;
+
+ wp.media.mixin.pauseAllPlayers();
+
+ data = window.decodeURIComponent( $( node ).attr('data-wpview-text') );
+ frame = media.edit( data );
+ frame.on( 'close', function() {
+ frame.detach();
+ } );
+ frame.state( self.state ).on( 'update', function( selection ) {
+ var shortcode = wp.media[ self.shortcode ].shortcode( selection ).string();
+ $( node ).attr( 'data-wpview-text', window.encodeURIComponent( shortcode ) );
+ wp.mce.views.refreshView( self, shortcode );
+ frame.detach();
+ } );
+ frame.open();
+ }
+ };
+
+ /**
+ * Base View class for audio and video shortcodes
+ *
+ * @constructor
+ * @augments wp.mce.View
+ * @mixes wp.media.mixin
+ */
+ wp.mce.media.View = wp.mce.View.extend({
+ initialize: function( options ) {
+ this.shortcode = options.shortcode;
+ _.bindAll( this, 'setPlayer' );
+ $(this).on( 'ready', this.setPlayer );
+ },
+
+ /**
+ * Creates the player instance for the current node
+ *
+ * @global MediaElementPlayer
+ * @global _wpmejsSettings
+ *
+ * @param {Event} e
+ * @param {HTMLElement} node
+ */
+ setPlayer: function(e, node) {
+ // if the ready event fires on an empty node
+ if ( ! node ) {
+ return;
+ }
+
+ var self = this,
+ media,
+ firefox = this.ua.is( 'ff' ),
+ className = '.wp-' + this.shortcode.tag + '-shortcode';
+
+ if ( this.player ) {
+ this.unsetPlayer();
+ }
+
+ media = $( node ).find( className );
+
+ if ( ! this.isCompatible( media ) ) {
+ media.closest( '.wpview-wrap' ).addClass( 'wont-play' );
+ if ( ! media.parent().hasClass( 'wpview-wrap' ) ) {
+ media.parent().replaceWith( media );
+ }
+ media.replaceWith( '<p>' + media.find( 'source' ).eq(0).prop( 'src' ) + '</p>' );
+ return;
+ } else {
+ media.closest( '.wpview-wrap' ).removeClass( 'wont-play' );
+ if ( firefox ) {
+ media.prop( 'preload', 'metadata' );
+ } else {
+ media.prop( 'preload', 'none' );
+ }
+ }
+
+ media = wp.media.view.MediaDetails.prepareSrc( media.get(0) );
+
+ // Thanks, Firefox!
+ if ( firefox ) {
+ setTimeout( function() {
+ self.player = new MediaElementPlayer( media, this.mejsSettings );
+ }, 50 );
+ } else {
+ this.player = new MediaElementPlayer( media, this.mejsSettings );
+ }
+ },
+
+ /**
+ * Pass data to the View's Underscore template and return the compiled output
+ *
+ * @returns {string}
+ */
+ getHtml: function() {
+ var attrs = _.defaults(
+ this.shortcode.attrs.named,
+ wp.media[ this.shortcode.tag ].defaults
+ );
+ return this.template({ model: attrs });
+ }
+ });
+ _.extend( wp.mce.media.View.prototype, wp.media.mixin );
+
+ /**
+ * TinyMCE handler for the video shortcode
+ *
+ * @mixes wp.mce.media
+ */
+ wp.mce.video = _.extend( {}, wp.mce.media, {
+ shortcode: 'video',
+ state: 'video-details',
+ View: wp.mce.media.View.extend({
+ className: 'editor-video',
+ template: media.template('editor-video')
+ })
+ } );
+ wp.mce.views.register( 'video', wp.mce.video );
+
+ /**
+ * TinyMCE handler for the audio shortcode
+ *
+ * @mixes wp.mce.media
+ */
+ wp.mce.audio = _.extend( {}, wp.mce.media, {
+ shortcode: 'audio',
+ state: 'audio-details',
+ View: wp.mce.media.View.extend({
+ className: 'editor-audio',
+ template: media.template('editor-audio')
+ })
+ } );
+ wp.mce.views.register( 'audio', wp.mce.audio );
+
+ /**
+ * Base View class for playlist shortcodes
+ *
+ * @constructor
+ * @augments wp.mce.View
+ * @mixes wp.media.mixin
+ */
+ wp.mce.media.PlaylistView = wp.mce.View.extend({
+ className: 'editor-playlist',
+ template: media.template('editor-playlist'),
+
+ initialize: function( options ) {
+ this.data = {};
+ this.attachments = [];
+ this.shortcode = options.shortcode;
+ _.bindAll( this, 'setPlayer' );
+ $(this).on('ready', this.setNode);
+ },
+
+ /**
+ * Set the element context for the view, and then fetch the playlist's
+ * associated attachments.
+ *
+ * @param {Event} e
+ * @param {HTMLElement} node
+ */
+ setNode: function(e, node) {
+ this.node = node;
+ this.fetch();
+ },
+
+ /**
+ * Asynchronously fetch the shortcode's attachments
+ */
+ fetch: function() {
+ this.attachments = wp.media[ this.shortcode.tag ].attachments( this.shortcode );
+ this.attachments.more().done( this.setPlayer );
+ },
+
+ /**
+ * Get the HTML for the view (which also set's the data), replace the
+ * current HTML, and then invoke the WPPlaylistView instance to render
+ * the playlist in the editor
+ *
+ * @global WPPlaylistView
+ * @global tinymce.editors
+ */
+ setPlayer: function() {
+ var p,
+ html = this.getHtml(),
+ t = this.encodedText,
+ self = this;
+
+ this.unsetPlayer();
+
+ _.each( tinymce.editors, function( editor ) {
+ var doc;
+ if ( editor.plugins.wpview ) {
+ doc = editor.getDoc();
+ $( doc ).find( '[data-wpview-text="' + t + '"]' ).each(function(i, elem) {
+ var node = $( elem );
+ node.html( html );
+ self.node = elem;
+ });
+ }
+ }, this );
+
+ p = new WPPlaylistView({
+ el: $( self.node ).find( '.wp-playlist' ).get(0),
+ metadata: this.data
+ });
+
+ this.player = p._player;
+ },
+
+ /**
+ * Set the data that will be used to compile the Underscore template,
+ * compile the template, and then return it.
+ *
+ * @returns {string}
+ */
+ getHtml: function() {
+ var data = this.shortcode.attrs.named,
+ model = wp.media[ this.shortcode.tag ],
+ type = 'playlist' === this.shortcode.tag ? 'audio' : 'video',
+ options,
+ attachments,
+ tracks = [];
+
+ if ( ! this.attachments.length ) {
+ return;
+ }
+
+ _.each( model.defaults, function( value, key ) {
+ data[ key ] = model.coerce( data, key );
+ });
+
+ attachments = this.attachments.toJSON();
+
+ options = {
+ type: type,
+ style: data.style,
+ tracklist: data.tracklist,
+ tracknumbers: data.tracknumbers,
+ images: data.images,
+ artists: data.artists
+ };
+
+ _.each( attachments, function( attachment ) {
+ var size = {}, resize = {}, track = {
+ src : attachment.url,
+ type : attachment.mime,
+ title : attachment.title,
+ caption : attachment.caption,
+ description : attachment.description,
+ meta : attachment.meta
+ };
+
+ if ( 'video' === type ) {
+ size.width = attachment.width;
+ size.height = attachment.height;
+ if ( media.view.settings.contentWidth ) {
+ resize.width = media.view.settings.contentWidth - 22;
+ resize.height = Math.ceil( ( size.height * resize.width ) / size.width );
+ if ( ! options.width ) {
+ options.width = resize.width;
+ options.height = resize.height;
+ }
+ } else {
+ if ( ! options.width ) {
+ options.width = attachment.width;
+ options.height = attachment.height;
+ }
+ }
+ track.dimensions = {
+ original : size,
+ resized : _.isEmpty( resize ) ? size : resize
+ };
+ } else {
+ options.width = 400;
+ }
+
+ track.image = attachment.image;
+ track.thumb = attachment.thumb;
+
+ tracks.push( track );
+ } );
+
+ options.tracks = tracks;
+ this.data = options;
+
+ return this.template( options );
+ }
+ });
+ _.extend( wp.mce.media.PlaylistView.prototype, wp.media.mixin );
+
+ /**
+ * TinyMCE handler for the playlist shortcode
+ *
+ * @mixes wp.mce.media
+ */
+ wp.mce.playlist = _.extend( {}, wp.mce.media, {
+ shortcode: 'playlist',
+ state: 'playlist-edit',
+ View: wp.mce.media.PlaylistView
+ } );
+ wp.mce.views.register( 'playlist', wp.mce.playlist );
+
+ /**
+ * TinyMCE handler for the video-playlist shortcode
+ *
+ * @mixes wp.mce.media
+ */
+ wp.mce['video-playlist'] = _.extend( {}, wp.mce.media, {
+ shortcode: 'video-playlist',
+ state: 'video-playlist-edit',
+ View: wp.mce.media.PlaylistView
+ } );
+ wp.mce.views.register( 'video-playlist', wp.mce['video-playlist'] );
</ins><span class="cx"> }(jQuery));
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediaaudiovideojs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-audiovideo.js (27732 => 27733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-audiovideo.js 2014-03-26 05:51:45 UTC (rev 27732)
+++ trunk/src/wp-includes/js/media-audiovideo.js 2014-03-26 12:10:21 UTC (rev 27733)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx"> * @mixin
</span><span class="cx"> */
</span><span class="cx"> wp.media.mixin = {
</span><del>-
</del><ins>+ mejsSettings: baseSettings,
</ins><span class="cx"> /**
</span><span class="cx"> * Pauses every instance of MediaElementPlayer
</span><span class="cx"> */
</span><span class="lines">@@ -217,7 +217,8 @@
</span><span class="cx"> loop : false,
</span><span class="cx"> autoplay : false,
</span><span class="cx"> preload : 'none',
</span><del>- caption : ''
</del><ins>+ caption : '',
+ width : 400
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> edit : function( data ) {
</span><span class="lines">@@ -1045,364 +1046,6 @@
</span><span class="cx"> } );
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Tiny MCE Views
- *
- */
-
- /**
- * These are base methods that are shared by each shortcode's MCE controller
- *
- * @mixin
- */
- wp.mce.media = {
- /**
- * @global wp.shortcode
- *
- * @param {string} content
- * @returns {Object}
- */
- toView: function( content ) {
- var match = wp.shortcode.next( this.shortcode, content );
-
- if ( ! match ) {
- return;
- }
-
- return {
- index: match.index,
- content: match.content,
- options: {
- shortcode: match.shortcode
- }
- };
- },
-
- /**
- * Called when a TinyMCE view is clicked for editing.
- * - Parses the shortcode out of the element's data attribute
- * - Calls the `edit` method on the shortcode model
- * - Launches the model window
- * - Bind's an `update` callback which updates the element's data attribute
- * re-renders the view
- *
- * @param {HTMLElement} node
- */
- edit: function( node ) {
- var media = wp.media[ this.shortcode ],
- self = this,
- frame, data;
-
- wp.media.mixin.pauseAllPlayers();
-
- data = window.decodeURIComponent( $( node ).attr('data-wpview-text') );
- frame = media.edit( data );
- frame.on( 'close', function() {
- frame.detach();
- } );
- frame.state( self.state ).on( 'update', function( selection ) {
- var shortcode = wp.media[ self.shortcode ].shortcode( selection ).string();
- $( node ).attr( 'data-wpview-text', window.encodeURIComponent( shortcode ) );
- wp.mce.views.refreshView( self, shortcode );
- frame.detach();
- } );
- frame.open();
- }
- };
-
- /**
- * Base View class for audio and video shortcodes
- *
- * @constructor
- * @augments wp.mce.View
- * @mixes wp.media.mixin
- */
- wp.mce.media.View = wp.mce.View.extend({
- initialize: function( options ) {
- this.shortcode = options.shortcode;
- _.bindAll( this, 'setPlayer' );
- $(this).on( 'ready', this.setPlayer );
- },
-
- /**
- * Creates the player instance for the current node
- *
- * @global MediaElementPlayer
- * @global _wpmejsSettings
- *
- * @param {Event} e
- * @param {HTMLElement} node
- */
- setPlayer: function(e, node) {
- // if the ready event fires on an empty node
- if ( ! node ) {
- return;
- }
-
- var self = this,
- media,
- firefox = this.ua.is( 'ff' ),
- className = '.wp-' + this.shortcode.tag + '-shortcode';
-
- if ( this.player ) {
- this.unsetPlayer();
- }
-
- media = $( node ).find( className );
-
- if ( ! this.isCompatible( media ) ) {
- media.closest( '.wpview-wrap' ).addClass( 'wont-play' );
- if ( ! media.parent().hasClass( 'wpview-wrap' ) ) {
- media.parent().replaceWith( media );
- }
- media.replaceWith( '<p>' + media.find( 'source' ).eq(0).prop( 'src' ) + '</p>' );
- return;
- } else {
- media.closest( '.wpview-wrap' ).removeClass( 'wont-play' );
- if ( firefox ) {
- media.prop( 'preload', 'metadata' );
- } else {
- media.prop( 'preload', 'none' );
- }
- }
-
- media = wp.media.view.MediaDetails.prepareSrc( media.get(0) );
-
- // Thanks, Firefox!
- if ( firefox ) {
- setTimeout( function() {
- self.player = new MediaElementPlayer( media, baseSettings );
- }, 50 );
- } else {
- this.player = new MediaElementPlayer( media, baseSettings );
- }
- },
-
- /**
- * Pass data to the View's Underscore template and return the compiled output
- *
- * @returns {string}
- */
- getHtml: function() {
- var attrs = _.defaults(
- this.shortcode.attrs.named,
- wp.media[ this.shortcode.tag ].defaults
- );
- return this.template({ model: attrs });
- }
- });
- _.extend( wp.mce.media.View.prototype, wp.media.mixin );
-
- /**
- * TinyMCE handler for the video shortcode
- *
- * @mixes wp.mce.media
- */
- wp.mce.video = _.extend( {}, wp.mce.media, {
- shortcode: 'video',
- state: 'video-details',
- View: wp.mce.media.View.extend({
- className: 'editor-video',
- template: media.template('editor-video')
- })
- } );
- wp.mce.views.register( 'video', wp.mce.video );
-
- /**
- * TinyMCE handler for the audio shortcode
- *
- * @mixes wp.mce.media
- */
- wp.mce.audio = _.extend( {}, wp.mce.media, {
- shortcode: 'audio',
- state: 'audio-details',
- View: wp.mce.media.View.extend({
- className: 'editor-audio',
- template: media.template('editor-audio')
- })
- } );
- wp.mce.views.register( 'audio', wp.mce.audio );
-
- /**
- * Base View class for playlist shortcodes
- *
- * @constructor
- * @augments wp.mce.View
- * @mixes wp.media.mixin
- */
- wp.mce.media.PlaylistView = wp.mce.View.extend({
- className: 'editor-playlist',
- template: media.template('editor-playlist'),
-
- initialize: function( options ) {
- this.data = {};
- this.attachments = [];
- this.shortcode = options.shortcode;
- _.bindAll( this, 'setPlayer' );
- $(this).on('ready', this.setNode);
- },
-
- /**
- * Set the element context for the view, and then fetch the playlist's
- * associated attachments.
- *
- * @param {Event} e
- * @param {HTMLElement} node
- */
- setNode: function(e, node) {
- this.node = node;
- this.fetch();
- },
-
- /**
- * Asynchronously fetch the shortcode's attachments
- */
- fetch: function() {
- this.attachments = wp.media[ this.shortcode.tag ].attachments( this.shortcode );
- this.attachments.more().done( this.setPlayer );
- },
-
- /**
- * Get the HTML for the view (which also set's the data), replace the
- * current HTML, and then invoke the WPPlaylistView instance to render
- * the playlist in the editor
- *
- * @global WPPlaylistView
- * @global tinymce.editors
- */
- setPlayer: function() {
- var p,
- html = this.getHtml(),
- t = this.encodedText,
- self = this;
-
- this.unsetPlayer();
-
- _.each( tinymce.editors, function( editor ) {
- var doc;
- if ( editor.plugins.wpview ) {
- doc = editor.getDoc();
- $( doc ).find( '[data-wpview-text="' + t + '"]' ).each(function(i, elem) {
- var node = $( elem );
- node.html( html );
- self.node = elem;
- });
- }
- }, this );
-
- p = new WPPlaylistView({
- el: $( self.node ).find( '.wp-playlist' ).get(0),
- metadata: this.data
- });
-
- this.player = p._player;
- },
-
- /**
- * Set the data that will be used to compile the Underscore template,
- * compile the template, and then return it.
- *
- * @returns {string}
- */
- getHtml: function() {
- var data = this.shortcode.attrs.named,
- model = wp.media[ this.shortcode.tag ],
- type = 'playlist' === this.shortcode.tag ? 'audio' : 'video',
- options,
- attachments,
- tracks = [];
-
- if ( ! this.attachments.length ) {
- return;
- }
-
- _.each( model.defaults, function( value, key ) {
- data[ key ] = model.coerce( data, key );
- });
-
- attachments = this.attachments.toJSON();
-
- options = {
- type: type,
- style: data.style,
- tracklist: data.tracklist,
- tracknumbers: data.tracknumbers,
- images: data.images,
- artists: data.artists
- };
-
- _.each( attachments, function( attachment ) {
- var size = {}, resize = {}, track = {
- src : attachment.url,
- type : attachment.mime,
- title : attachment.title,
- caption : attachment.caption,
- description : attachment.description,
- meta : attachment.meta
- };
-
- if ( 'video' === type ) {
- size.width = attachment.width;
- size.height = attachment.height;
- if ( media.view.settings.contentWidth ) {
- resize.width = media.view.settings.contentWidth - 22;
- resize.height = Math.ceil( ( size.height * resize.width ) / size.width );
- if ( ! options.width ) {
- options.width = resize.width;
- options.height = resize.height;
- }
- } else {
- if ( ! options.width ) {
- options.width = attachment.width;
- options.height = attachment.height;
- }
- }
- track.dimensions = {
- original : size,
- resized : _.isEmpty( resize ) ? size : resize
- };
- } else {
- options.width = 400;
- }
-
- track.image = attachment.image;
- track.thumb = attachment.thumb;
-
- tracks.push( track );
- } );
-
- options.tracks = tracks;
- this.data = options;
-
- return this.template( options );
- }
- });
- _.extend( wp.mce.media.PlaylistView.prototype, wp.media.mixin );
-
- /**
- * TinyMCE handler for the playlist shortcode
- *
- * @mixes wp.mce.media
- */
- wp.mce.playlist = _.extend( {}, wp.mce.media, {
- shortcode: 'playlist',
- state: 'playlist-edit',
- View: wp.mce.media.PlaylistView
- } );
- wp.mce.views.register( 'playlist', wp.mce.playlist );
-
- /**
- * TinyMCE handler for the video-playlist shortcode
- *
- * @mixes wp.mce.media
- */
- wp.mce['video-playlist'] = _.extend( {}, wp.mce.media, {
- shortcode: 'video-playlist',
- state: 'video-playlist-edit',
- View: wp.mce.media.PlaylistView
- } );
- wp.mce.views.register( 'video-playlist', wp.mce['video-playlist'] );
-
- /**
</del><span class="cx"> * Event binding
</span><span class="cx"> */
</span><span class="cx"> function init() {
</span></span></pre></div>
<a id="trunksrcwpincludesmediatemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/media-template.php (27732 => 27733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/media-template.php 2014-03-26 05:51:45 UTC (rev 27732)
+++ trunk/src/wp-includes/media-template.php 2014-03-26 12:10:21 UTC (rev 27733)
</span><span class="lines">@@ -18,6 +18,7 @@
</span><span class="cx"> ?>
</span><span class="cx"> <audio controls
</span><span class="cx"> class="wp-audio-shortcode"
</span><ins>+ width="{{ _.isUndefined( data.model.width ) ? 400 : data.model.width }}"
</ins><span class="cx"> preload="{{ _.isUndefined( data.model.preload ) ? 'none' : data.model.preload }}"
</span><span class="cx"> <#
</span><span class="cx"> <?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
</span></span></pre></div>
<a id="trunksrcwpincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/media.php (27732 => 27733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/media.php 2014-03-26 05:51:45 UTC (rev 27732)
+++ trunk/src/wp-includes/media.php 2014-03-26 12:10:21 UTC (rev 27733)
</span><span class="lines">@@ -2574,6 +2574,7 @@
</span><span class="cx"> wp_enqueue_script( 'media-audiovideo' );
</span><span class="cx"> wp_enqueue_style( 'media-views' );
</span><span class="cx"> if ( is_admin() ) {
</span><ins>+ wp_enqueue_script( 'mce-view' );
</ins><span class="cx"> wp_enqueue_script( 'image-edit' );
</span><span class="cx"> }
</span><span class="cx"> wp_enqueue_style( 'imgareaselect' );
</span></span></pre></div>
<a id="trunksrcwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/script-loader.php (27732 => 27733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/script-loader.php 2014-03-26 05:51:45 UTC (rev 27732)
+++ trunk/src/wp-includes/script-loader.php 2014-03-26 12:10:21 UTC (rev 27733)
</span><span class="lines">@@ -412,8 +412,8 @@
</span><span class="cx"> // Both rely on numerous settings, styles, and templates to operate correctly.
</span><span class="cx"> $scripts->add( 'media-views', "/wp-includes/js/media-views$suffix.js", array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement' ), false, 1 );
</span><span class="cx"> $scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
</span><del>- $scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor', 'mce-view', 'wp-playlist' ), false, 1 );
- $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'media-models' ), false, 1 );
</del><ins>+ $scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
+ $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'media-models', 'media-audiovideo', 'wp-playlist' ), false, 1 );
</ins><span class="cx">
</span><span class="cx"> if ( is_admin() ) {
</span><span class="cx"> $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery', 'wp-ajax-response'), false, 1 );
</span></span></pre>
</div>
</div>
</body>
</html>