Changeset 31548
- Timestamp:
- 02/26/2015 12:30:35 AM (10 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/mce-view.js
r31546 r31548 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 ) { … … 729 729 } ) 730 730 .fail( function( response ) { 731 if ( self. type === 'embedURL') {731 if ( self.url ) { 732 732 self.removeMarkers(); 733 733 } else { … … 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 ); … … 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 } ); … … 763 763 edit: function( text, update ) { 764 764 var media = wp.media.embed, 765 isURL = 'embedURL' === this.type,766 frame = media.edit( text, isURL );767 768 this. stopPlayers();765 frame = media.edit( text, !! this.url ), 766 self = this; 767 768 this.pausePlayers(); 769 769 770 770 frame.state( 'embed' ).props.on( 'change:url', function( model, url ) { … … 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 { … … 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 ) { -
trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js
r31546 r31548 35 35 } 36 36 37 /**38 * Get the text/shortcode string for a view.39 *40 * @param view The view wrapper's node41 * @returns string The text/shoercode string of the view42 */43 function getViewText( view ) {44 if ( view = getView( view ) ) {45 return window.decodeURIComponent( editor.dom.getAttrib( view, 'data-wpview-text' ) || '' );46 }47 48 return '';49 }50 51 /**52 * Set the view's original text/shortcode string53 *54 * @param view The view wrapper's HTML id or node55 * @param text The text string to be set56 */57 function setViewText( view, text ) {58 view = getView( view );59 60 if ( view ) {61 editor.dom.setAttrib( view, 'data-wpview-text', window.encodeURIComponent( text || '' ) );62 return true;63 }64 65 return false;66 }67 68 37 function _stop( event ) { 69 38 event.stopPropagation(); … … 139 108 'class': 'wpview-clipboard', 140 109 'contenteditable': 'true' 141 }, getViewText( viewNode) );110 }, decodeURIComponent( editor.dom.getAttrib( viewNode, 'data-wpview-text' ) ) ); 142 111 143 112 editor.dom.select( '.wpview-body', viewNode )[0].appendChild( clipboard ); … … 198 167 if ( typeof wp === 'undefined' || ! wp.mce ) { 199 168 return { 200 getViewText: _noop,201 setViewText: _noop,202 169 getView: _noop 203 170 }; … … 722 689 723 690 return { 724 getViewText: getViewText,725 setViewText: setViewText,726 691 getView: getView 727 692 };
Note: See TracChangeset
for help on using the changeset viewer.