Make WordPress Core

Ticket #19666: 19666.patch

File 19666.patch, 1.2 KB (added by mrclay, 13 years ago)

patch for issue 19666: /wp-includes/class-wp-editor.php

  • class-wp-editor.php

     
    314314                                        'extended_valid_elements' => 'article[*],aside[*],audio[*],canvas[*],command[*],datalist[*],details[*],embed[*],figcaption[*],figure[*],footer[*],header[*],hgroup[*],keygen[*],mark[*],meter[*],nav[*],output[*],progress[*],section[*],source[*],summary,time[*],video[*],wbr',
    315315                                        'wpeditimage_disable_captions' => $no_captions,
    316316                                        'wp_fullscreen_content_css' => self::$baseurl . '/plugins/wpfullscreen/css/wp-fullscreen.css',
    317                                         'plugins' => implode( ',', $plugins )
     317                                        'plugins' => implode( ',', $plugins ),
     318                                       
     319                                        // work around http://www.tinymce.com/develop/bugtracker_view.php?id=4918
     320                                        'setup' => "function(ed) {
     321                                                ed.onBeforeSetContent.add(function(ed, o) {
     322                                                        if ( o.content.indexOf('<pre') != -1) {
     323                                                                o.content = o.content.replace(/<pre[^>]*>[\\s\\S]+?<\\/pre>/g, function(a) {
     324                                                                        return a.replace(/(\\r\\n|\\n)/g, '<br />');
     325                                                                });
     326                                                        }
     327                                                });
     328                                        }",
    318329                                );
    319330
    320331                                // load editor_style.css if the current theme supports it