Ticket #3153: 3153.patch

File 3153.patch, 4.1 KB (added by Frederico Caldeira Knabben, 15 years ago)
  • _source/core/dtd.js

     
    5252                O = X({param:1},K),
    5353                P = X({form:1},A,D,E,I),
    5454                Q = {li:1};
     55       
     56        var block = {address:1,blockquote:1,center:1,dir:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1};
    5557
    5658    return /** @lends CKEDITOR.dtd */ {
    5759
     
    6264                 * @type Object
    6365                 * @example
    6466                 */
    65                 $block : {address:1,blockquote:1,center:1,dir:1,div:1,dl:1,fieldset:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1},
     67                $block : block,
    6668
     69                $body : X({script:1}, block),
     70
    6771                /**
    6872                 * List of empty (self-closing) elements, like "br" or "img".
    6973                 * @type Object
  • _source/core/htmlparser/fragment.js

     
    5050         * alert( fragment.children[0].name );  "b"
    5151         * alert( fragment.children[1].value );  " Text"
    5252         */
    53         CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml )
     53        CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, fixForBody )
    5454        {
    5555                var parser = new CKEDITOR.htmlParser(),
    5656                        html = [],
     
    9090
    9191                parser.onTagOpen = function( tagName, attributes, selfClosing )
    9292                {
     93                        if ( fixForBody && !currentNode.type && !CKEDITOR.dtd.$body[ tagName ] )
     94                                this.onTagOpen( 'p', {} );
     95
    9396                        var element = new CKEDITOR.htmlParser.element( tagName, attributes );
    9497
    9598                        // "isEmpty" will be always "false" for unknown elements, so we
     
    208211                        }
    209212
    210213                        checkPending();
     214
     215                        if ( fixForBody && !currentNode.type )
     216                                this.onTagOpen( 'p', {} );
     217
    211218                        currentNode.add( new CKEDITOR.htmlParser.text( text ) );
    212219                };
    213220
  • _source/plugins/htmldataprocessor/plugin.js

     
    124124
    125125        CKEDITOR.htmlDataProcessor.prototype =
    126126        {
    127                 toHtml : function( data )
     127                toHtml : function( data, fixForBody )
    128128                {
    129129                        // The source data is already HTML, but we need to clean
    130130                        // it up and apply the filter.
     
    141141
    142142                        // Now use our parser to make further fixes to the structure, as
    143143                        // well as apply the filter.
    144                         var fragment = CKEDITOR.htmlParser.fragment.fromHtml( div.innerHTML ),
     144                        var fragment = CKEDITOR.htmlParser.fragment.fromHtml( div.innerHTML, fixForBody ),
    145145                                writer = new CKEDITOR.htmlParser.basicWriter();
    146146
    147147                        fragment.writeHtml( writer, this.dataFilter );
     
    149149                        return writer.getHtml( true );
    150150                },
    151151
    152                 toDataFormat : function( html )
     152                toDataFormat : function( html, fixForBody )
    153153                {
    154154                        var writer = this.writer,
    155                                 fragment = CKEDITOR.htmlParser.fragment.fromHtml( html );
     155                                fragment = CKEDITOR.htmlParser.fragment.fromHtml( html, fixForBody );
    156156
    157157                        writer.reset();
    158158
  • _source/plugins/wysiwygarea/plugin.js

     
    289289
    290290                                                                // Get the HTML version of the data.
    291291                                                                if ( editor.dataProcessor )
    292                                                                         data = editor.dataProcessor.toHtml( data );
     292                                                                        data = editor.dataProcessor.toHtml( data, ( editor.config.enterMode != CKEDITOR.ENTER_BR ) );
    293293
    294294                                                                data =
    295295                                                                        editor.config.docType +
     
    339339                                                                var data = iframe.$.contentWindow.document.body.innerHTML;
    340340
    341341                                                                if ( editor.dataProcessor )
    342                                                                         data = editor.dataProcessor.toDataFormat( data );
     342                                                                        data = editor.dataProcessor.toDataFormat( data, ( editor.config.enterMode != CKEDITOR.ENTER_BR ) );
    343343
    344344                                                                return data;
    345345                                                        },
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy