Ticket #5766: 5766_2.patch

File 5766_2.patch, 1.3 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    1414        var nonExitableElementNames = { table:1,pre:1 };
    1515
    1616        // Matching an empty paragraph at the end of document.
    17         var emptyParagraphRegexp = /\s*<(p|div|address|h\d|center)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\1>)?(?=\s*$|<\/body>)/gi;
     17        var emptyParagraphRegexp = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;
    1818
    1919        var notWhitespaceEval = CKEDITOR.dom.walker.whitespaces( true );
    2020
     
    896896                                                                if ( editor.dataProcessor )
    897897                                                                        data = editor.dataProcessor.toDataFormat( data, fixForBody );
    898898
    899                                                                 // Strip the last blank paragraph within document.
     899                                                                // Reset empty if the document contains only one empty paragraph.
    900900                                                                if ( config.ignoreEmptyParagraph )
    901                                                                         data = data.replace( emptyParagraphRegexp, '' );
     901                                                                        data = data.replace( emptyParagraphRegexp, function( match, lookback ) { return lookback; } );
    902902
    903903                                                                if ( docType )
    904904                                                                        data = docType + '\n' + data;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy