Ticket #7087: 7087_3.patch

File 7087_3.patch, 3.9 KB (added by Garry Yao, 13 years ago)
  • _source/core/dom/walker.js

     
    436436                {
    437437                        return isBookmark( node )
    438438                                        || isWhitespaces( node )
    439                                         || node.type == CKEDITOR.NODE_ELEMENT && node.getName() in CKEDITOR.dtd.$removeEmpty;
     439                                        || node.type == CKEDITOR.NODE_ELEMENT
     440                                        && node.getName() in CKEDITOR.dtd.$inline
     441                                        && !( node.getName() in CKEDITOR.dtd.$empty );
    440442                };
    441443
    442444        // Check if there's a filler node at the end of an element, and return it.
    443445        CKEDITOR.dom.element.prototype.getBogus = function()
    444446        {
    445                 // Bogus are not always at the end, e.g. <p><strong>text<br /></strong></p> (#7070).
     447                // Bogus are not always at the end, e.g. <p><a>text<br /></a></p> (#7070).
    446448                var tail = this;
    447449                do { tail = tail.getPreviousSourceNode(); }
    448450                while ( toSkip( tail ) )
  • _source/plugins/styles/plugin.js

     
    430430                var dtd = CKEDITOR.dtd[ elementName ] || ( isUnknownElement = true, CKEDITOR.dtd.span );
    431431
    432432                // Expand the range.
    433                 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );
     433                range.enlarge( CKEDITOR.ENLARGE_ELEMENT, 1 );
    434434                range.trim();
    435435
    436436                // Get the first node to be processed and the last, which concludes the
     
    657657                 * Make sure our range has included all "collpased" parent inline nodes so
    658658                 * that our operation logic can be simpler.
    659659                 */
    660                 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );
     660                range.enlarge( CKEDITOR.ENLARGE_ELEMENT, 1 );
    661661
    662662                var bookmark = range.createBookmark(),
    663663                        startNode = bookmark.startNode;
  • _source/core/dom/range.js

     
    823823                        }
    824824                },
    825825
    826                 enlarge : function( unit )
     826                enlarge : function( unit, excludeBrs )
    827827                {
    828828                        switch ( unit )
    829829                        {
     
    944944                                                                // If this is a visible element.
    945945                                                                // We need to check for the bookmark attribute because IE insists on
    946946                                                                // rendering the display:none nodes we use for bookmarks. (#3363)
    947                                                                 if ( sibling.$.offsetWidth > 0 && !sibling.data( 'cke-bookmark' ) )
     947                                                                // Line-breaks (br) are rendered with zero width, which we don't want to include. (#7041)
     948                                                                if ( ( sibling.$.offsetWidth > 0 || excludeBrs && sibling.is( 'br' ) ) && !sibling.data( 'cke-bookmark' ) )
    948949                                                                {
    949950                                                                        // We'll accept it only if we need
    950951                                                                        // whitespace, and this is an inline
     
    10791080                                                                if ( commonReached )
    10801081                                                                        endTop = enlargeable;
    10811082                                                                else if ( enlargeable )
    1082                                                                 {
    1083                                                                         var bogus = enlargeable.isBlockBoundary() && enlargeable.getBogus();
    1084 
    1085                                                                         // Exclude bogus <br /> at the end of block.
    1086                                                                         if ( bogus )
    1087                                                                                 this.setEndBefore( bogus );
    1088                                                                         else
    1089                                                                                 this.setEndAfter( enlargeable );
    1090                                                                 }
    1091                                                         }
     1083                                                                        this.setEndAfter( enlargeable );
     1084                                                        }
    10921085
    10931086                                                        sibling = enlargeable.getNext();
    10941087                                                }
     
    11111104                                                                // If this is a visible element.
    11121105                                                                // We need to check for the bookmark attribute because IE insists on
    11131106                                                                // rendering the display:none nodes we use for bookmarks. (#3363)
    1114                                                                 if ( sibling.$.offsetWidth > 0 && !sibling.data( 'cke-bookmark' ) )
     1107                                                                // Line-breaks (br) are rendered with zero width, which we don't want to include. (#7041)
     1108                                                                if ( ( sibling.$.offsetWidth > 0 || excludeBrs && sibling.is( 'br' ) ) && !sibling.data( 'cke-bookmark' ) )
    11151109                                                                {
    11161110                                                                        // We'll accept it only if we need
    11171111                                                                        // whitespace, and this is an inline
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy