Ticket #3473: 3473_3.patch

File 3473_3.patch, 1.3 KB (added by Garry Yao, 15 years ago)
  • _source/core/dom/element.js

     
    239239                        var lastChild = this.getLast() ;
    240240
    241241                        // Ignore empty/spaces text.
    242                         while ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.rtrim( lastChild.getText() ) )
     242                        while ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT
     243                                && !CKEDITOR.tools.rtrim( lastChild.getText() ) )
    243244                                lastChild = lastChild.getPrevious();
    244245
    245                         if ( !lastChild || ( lastChild.is && ( !lastChild.is( 'br' ) || !lastChild.getAttribute( '_cke_bogus' ) ) ) )
     246                        // Padding br already existed?
     247                        if ( !lastChild || ( lastChild.is && !lastChild.is( 'br' ) ) )
    246248                        {
    247                                 this.append(
    248                                         CKEDITOR.env.opera ?
    249                                                 this.getDocument().createText('') :
    250                                                 this.getDocument().createElement( 'br', { attributes : { _cke_bogus : 1 } } ) );
     249                                // See whether the block has some line content,
     250                                // empty spaces are ingnored since it's unable to establish line height.
     251                                if ( !CKEDITOR.tools.trim( this.getText() ) )
     252                                        this.append( this.getDocument().createElement( 'br', { attributes : { _cke_bogus : 1 } } ) );
    251253                        }
    252254                },
    253255
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy