Make WordPress Core

Ticket #31412: 31412.21.patch

File 31412.21.patch, 1.1 KB (added by iseulde, 10 years ago)
  • src/wp-includes/js/mce-view.js

     
    3333        wp.mce = wp.mce || {};
    3434
    3535        /**
     36         * Decode HTML entities in a givin string.
     37         *
     38         * @param {String} html The string to decode.
     39         */
     40        function decodeHTML( html ) {
     41                var textarea = document.createElement( 'textarea' );
     42
     43                textarea.innerHTML = html;
     44
     45                return textarea.value;
     46        }
     47
     48        /**
    3649         * wp.mce.views
    3750         *
    3851         * A set of utilities that simplifies adding custom UI within a TinyMCE editor.
     
    89102                 * @param {String} content The string to scan.
    90103                 */
    91104                setMarkers: function( content ) {
    92                         var pieces = [ { content: content } ],
     105                        var pieces = [ { content: decodeHTML( content ) } ],
    93106                                self = this,
    94107                                current;
    95108
     
    390403                 */
    391404                replaceMarkers: function() {
    392405                        this.getMarkers( function( editor, node ) {
    393                                 if ( $( node ).html() !== this.text ) {
     406                                if ( $( node ).text() !== this.text ) {
    394407                                        editor.dom.setAttrib( node, 'data-wpview-marker', null );
    395408                                        return;
    396409                                }