Make WordPress Core

Ticket #38511: 38511.4.patch

File 38511.4.patch, 1.4 KB (added by gitlost, 9 years ago)

Remove newlines in pastepreprocess and workaround refreshContentEditable.

  • src/wp-includes/js/mce-view.js

     
    511511                                        }, '\u200B' );
    512512                                }
    513513
     514                                // For Firefox, do this here to make sure there's a selection so it's a noop later.
     515                                editor.quirks.refreshContentEditable();
     516
    514517                                // Seems the browsers need a bit of time to insert/set the view nodes,
    515518                                // or the iframe will fail especially when switching Text => Visual.
    516519                                setTimeout( function() {
  • src/wp-includes/js/tinymce/plugins/wpview/plugin.js

     
    132132
    133133                                if ( /^https?:\/\/\S+$/i.test( content ) ) {
    134134                                        event.content = content;
     135                                } else {
     136                                        // Firefox prettyprints text/html into the clipboard, inserting newlines to wrap long lines.
     137                                        // This messes up shortcodes with attributes (they get autoped and won't parse), so remove them.
     138                                        var match;
     139                                        if ( content.indexOf( '\u000a' ) !== -1 && ( match = /^\[[^\]]+?\]/.exec( content ) ) !== null ) {
     140                                                event.content = match[0].replace( /\u000a/g, '' ) + content.slice( match[0].length );
     141                                        }
    135142                                }
    136143                        }
    137144                } );