Changeset 28182
- Timestamp:
- 04/22/2014 05:52:06 PM (11 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/mce-view.js
r28171 r28182 452 452 className = '.wp-' + this.shortcode.tag + '-shortcode'; 453 453 454 if ( this.player ) {455 this.unsetPlayer();456 }457 458 454 media = $( node ).find( className ); 459 455 … … 496 492 497 493 unbind: function() { 498 var self = this; 499 this.pauseAllPlayers(); 500 _.each( this.players, function (player) { 501 self.removePlayer( player ); 502 } ); 503 this.players = []; 494 this.unsetPlayers(); 504 495 } 505 496 }); … … 548 539 549 540 initialize: function( options ) { 541 this.players = []; 550 542 this.data = {}; 551 543 this.attachments = []; 552 544 this.shortcode = options.shortcode; 553 _.bindAll( this, 'setPlayer' );554 $(this).on('ready', this.setNode);555 },556 557 /**558 * Set the element context for the view, and then fetch the playlist's559 * associated attachments.560 *561 * @param {Event} e562 * @param {HTMLElement} node563 */564 setNode: function(e, node) {565 this.node = node;566 545 this.fetch(); 567 546 }, … … 572 551 fetch: function() { 573 552 this.attachments = wp.media.playlist.attachments( this.shortcode ); 574 this. attachments.more().done( this.setPlayer);553 this.dfd = this.attachments.more().done( _.bind( this.render, this ) ); 575 554 }, 576 555 … … 583 562 * @global tinymce.editors 584 563 */ 585 setPlayer: function() { 586 var p, 587 html = this.getHtml(), 588 t = this.encodedText, 589 self = this; 590 591 this.unsetPlayer(); 564 render: function() { 565 var html = this.getHtml(), self = this; 592 566 593 567 _.each( tinymce.editors, function( editor ) { … … 595 569 if ( editor.plugins.wpview ) { 596 570 doc = editor.getDoc(); 597 $( doc ).find( '[data-wpview-text="' + t + '"]' ).each(function(i, elem) {571 $( doc ).find( '[data-wpview-text="' + this.encodedText + '"]' ).each(function (i, elem) { 598 572 var node = $( elem ); 599 node.html( html ); 600 self.node = elem; 573 574 // The <ins> is used to mark the end of the wrapper div. Needed when comparing 575 // the content as string for preventing extra undo levels. 576 node.html( html ).append( '<ins data-wpview-end="1"></ins>' ); 577 578 if ( ! self.data.tracks ) { 579 return; 580 } 581 582 self.players.push( new WPPlaylistView({ 583 el: $( elem ).find( '.wp-playlist' ).get(0), 584 metadata: self.data 585 }).player ); 601 586 }); 602 587 } 603 588 }, this ); 604 605 if ( ! this.data.tracks ) {606 return;607 }608 609 p = new WPPlaylistView({610 el: $( self.node ).find( '.wp-playlist' ).get(0),611 metadata: this.data612 });613 614 this.player = p.player;615 589 }, 616 590 … … 696 670 697 671 return this.template( options ); 672 }, 673 674 unbind: function() { 675 this.unsetPlayers(); 698 676 } 699 677 }); -
trunk/src/wp-includes/js/media-audiovideo.js
r28084 r28182 163 163 * Examples: modal closes, shortcode properties are removed, etc. 164 164 */ 165 unsetPlayer : function() {166 if ( this.player ) {165 unsetPlayers : function() { 166 if ( this.players && this.players.length ) { 167 167 wp.media.mixin.pauseAllPlayers(); 168 wp.media.mixin.removePlayer( this.player ); 169 this.player = false; 168 _.each( this.players, function (player) { 169 wp.media.mixin.removePlayer( player ); 170 } ); 171 this.players = []; 170 172 } 171 173 } … … 706 708 initialize: function() { 707 709 _.bindAll(this, 'success'); 708 709 this.listenTo( this.controller, 'close', media.mixin.unsetPlayer );710 this.players = []; 711 this.listenTo( this.controller, 'close', media.mixin.unsetPlayers ); 710 712 this.on( 'ready', this.setPlayer ); 711 this.on( 'media:setting:remove', media.mixin.unsetPlayer , this );713 this.on( 'media:setting:remove', media.mixin.unsetPlayers, this ); 712 714 this.on( 'media:setting:remove', this.render ); 713 715 this.on( 'media:setting:remove', this.setPlayer ); … … 765 767 */ 766 768 setPlayer : function() { 767 if ( ! this.player && this.media ) {768 this.player = new MediaElementPlayer( this.media, this.settings);769 if ( ! this.players.length && this.media ) { 770 this.players.push( new MediaElementPlayer( this.media, this.settings ) ); 769 771 } 770 772 }, -
trunk/src/wp-includes/media-template.php
r28144 r28182 17 17 $audio_types = wp_get_audio_extensions(); 18 18 ?> 19 <audio controls 19 <audio style="visibility: hidden" 20 controls 20 21 class="wp-audio-shortcode" 21 22 width="{{ _.isUndefined( data.model.width ) ? 400 : data.model.width }}" -
trunk/src/wp-includes/media.php
r28168 r28182 1354 1354 ?>"<?php if ( 'video' === $safe_type ): 1355 1355 echo ' height="', (int) $theme_height, '"'; 1356 else: 1357 echo ' style="visibility: hidden"'; 1356 1358 endif; ?>></<?php echo $safe_type ?>> 1357 1359 <div class="wp-playlist-next"></div> … … 1556 1558 'autoplay' => $autoplay, 1557 1559 'preload' => $preload, 1558 'style' => 'width: 100% ',1560 'style' => 'width: 100%; visibility: hidden;', 1559 1561 ); 1560 1562
Note: See TracChangeset
for help on using the changeset viewer.