Make WordPress Core

Changeset 31689


Ignore:
Timestamp:
03/09/2015 07:08:05 PM (10 years ago)
Author:
azaozz
Message:

TinyMCE wpView: decode HTML entities before trying to match the wpView text string. Props iseulde. See #31412.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/mce-view.js

    r31667 r31689  
    9292            var pieces = [ { content: content } ],
    9393                self = this,
     94                instance,
    9495                current;
    9596
     
    116117                        }
    117118
    118                         self.createInstance( type, result.content, result.options );
     119                        instance = self.createInstance( type, result.content, result.options );
    119120
    120121                        // Add the processed piece for the match.
    121122                        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>',
    123124                            processed: true
    124125                        } );
     
    150151        createInstance: function( type, text, options ) {
    151152            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 );
    154159
    155160            if ( instance ) {
     
    755760                this.loader = false;
    756761                this.shortcode = wp.media.embed.shortcode( {
    757                     url: this.url
     762                    url: this.text
    758763                } );
    759764            }
     
    805810        edit: function( text, update ) {
    806811            var media = wp.media.embed,
    807                 frame = media.edit( text, !! this.url ),
     812                frame = media.edit( text, this.url ),
    808813                self = this,
    809814                events = 'change:url change:width change:height';
     
    820825                var data = frame.state( 'embed' ).metadata;
    821826
    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 ) {
    829828                    update( data.url );
    830829                } else {
     
    867866                    content: match[2],
    868867                    options: {
    869                         url: match[2]
     868                        url: true
    870869                    }
    871870                };
Note: See TracChangeset for help on using the changeset viewer.