Ticket #31412: 31412.24.patch
File 31412.24.patch, 2.3 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/mce-view.js
91 91 setMarkers: function( content ) { 92 92 var pieces = [ { content: content } ], 93 93 self = this, 94 instance, 94 95 current; 95 96 96 97 _.each( views, function( view, type ) { … … 115 116 pieces.push( { content: remaining.substring( 0, result.index ) } ); 116 117 } 117 118 118 self.createInstance( type, result.content, result.options );119 instance = self.createInstance( type, result.content, result.options ); 119 120 120 121 // Add the processed piece for the match. 121 122 pieces.push( { 122 content: '<p data-wpview-marker="' + encodeURIComponent( result.content ) + '">' + result.content + '</p>',123 content: '<p data-wpview-marker="' + instance.encodedText + '">' + instance.text + '</p>', 123 124 processed: true 124 125 } ); 125 126 … … 149 150 */ 150 151 createInstance: function( type, text, options ) { 151 152 var View = this.get( type ), 152 encodedText = encodeURIComponent( text ), 153 instance = this.getInstance( encodedText ); 153 encodedText, 154 instance; 155 156 text = tinymce.DOM.decode( text ), 157 encodedText = encodeURIComponent( text ), 158 instance = this.getInstance( encodedText ); 154 159 155 160 if ( instance ) { 156 161 return instance; … … 754 759 if ( this.url ) { 755 760 this.loader = false; 756 761 this.shortcode = wp.media.embed.shortcode( { 757 url: this. url762 url: this.text 758 763 } ); 759 764 } 760 765 … … 804 809 805 810 edit: function( text, update ) { 806 811 var media = wp.media.embed, 807 frame = media.edit( text, !!this.url ),812 frame = media.edit( text, this.url ), 808 813 self = this, 809 814 events = 'change:url change:width change:height'; 810 815 … … 819 824 frame.state( 'embed' ).on( 'select', function() { 820 825 var data = frame.state( 'embed' ).metadata; 821 826 822 if ( data.width ) { 823 delete self.url; 824 } else { 825 self.url = data.url; 826 } 827 828 if ( self.url ) { 827 if ( self.url && ! data.width ) { 829 828 update( data.url ); 830 829 } else { 831 830 update( media.shortcode( data ).string() ); … … 866 865 index: match.index + match[1].length, 867 866 content: match[2], 868 867 options: { 869 url: match[2]868 url: true 870 869 } 871 870 }; 872 871 }