Ticket #31412: 31412.8.patch
File 31412.8.patch, 2.3 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/mce-view.js
651 651 var media = wp.media[ this.type ], 652 652 frame = media.edit( text ); 653 653 654 this. stopPlayers && this.stopPlayers();654 this.pausePlayers && this.pausePlayers(); 655 655 656 656 _.each( this.state, function( state ) { 657 657 frame.state( state ).on( 'update', function( selection ) { … … 728 728 self.render(); 729 729 } ) 730 730 .fail( function( response ) { 731 if ( self. type === 'embedURL') {731 if ( self.url ) { 732 732 self.removeMarkers(); 733 733 } else { 734 734 self.setError( response.message || response.statusText, 'admin-media' ); … … 737 737 738 738 this.getEditors( function( editor ) { 739 739 editor.on( 'wpview-selected', function() { 740 self. stopPlayers();740 self.pausePlayers(); 741 741 } ); 742 742 } ); 743 743 }, 744 744 745 stopPlayers: function( remove) {745 pausePlayers: function() { 746 746 this.getNodes( function( editor, node, content ) { 747 747 var win = $( 'iframe.wpview-sandbox', content ).get( 0 ); 748 748 749 749 if ( win && ( win = win.contentWindow ) && win.mejs ) { 750 750 _.each( win.mejs.players, function( player ) { 751 751 try { 752 player [ remove ? 'remove' : 'pause' ]();752 player.pause(); 753 753 } catch ( e ) {} 754 754 } ); 755 755 } … … 762 762 763 763 edit: function( text, update ) { 764 764 var media = wp.media.embed, 765 isURL = 'embedURL' === this.type,766 frame = media.edit( text, isURL );765 frame = media.edit( text, !! this.url ), 766 self = this; 767 767 768 this. stopPlayers();768 this.pausePlayers(); 769 769 770 770 frame.state( 'embed' ).props.on( 'change:url', function( model, url ) { 771 771 if ( url ) { … … 774 774 } ); 775 775 776 776 frame.state( 'embed' ).on( 'select', function() { 777 if ( isURL) {777 if ( self.url ) { 778 778 update( frame.state( 'embed' ).metadata.url ); 779 779 } else { 780 780 update( media.shortcode( frame.state( 'embed' ).metadata ).string() ); … … 808 808 views.register( 'embedURL', _.extend( {}, embed, { 809 809 match: function( content ) { 810 810 var re = /(^|<p>)(https?:\/\/[^\s"]+?)(<\/p>\s*|$)/gi, 811 match = re.exec( tinymce.trim( content ));811 match = re.exec( content ); 812 812 813 813 if ( match ) { 814 814 return {