Ticket #8304: 8304.patch

File 8304.patch, 1.9 KB (added by Frederico Caldeira Knabben, 13 years ago)

Incomplete patch.

  • _source/plugins/enterkey/plugin.js

     
    324324                                range.deleteContents();
    325325                                range.insertNode( lineBreak );
    326326
     327                                var startBlockParent = startBlock && startBlock.getParent();
     328                                if ( startBlockParent && startBlockParent.is( 'blockquote' ) )
     329                                {
     330                                        var previous = lineBreak.getPrevious( CKEDITOR.dom.walker.whitespaces(1) ),
     331                                                next = lineBreak.getNext( CKEDITOR.dom.walker.whitespaces(1) );
     332
     333                                        var isStartOfParent = range.checkBoundaryOfElement( startBlockParent, CKEDITOR.START ),
     334                                                isEndOfParent = range.checkBoundaryOfElement( startBlockParent, CKEDITOR.END ),
     335                                                isStartOfLine = isStartOfParent || ( previous && previous.is && previous.is( 'br' ) ),
     336                                                isEndOfLine = isEndOfParent || ( next && next.is && next.is( 'br' ) );
     337
     338                                        if ( isStartOfLine && isEndOfLine )
     339                                        {
     340                                                if ( isStartOfParent )
     341                                                        lineBreak.remove().insertBefore( startBlockParent );
     342                                                else if ( isEndOfParent )
     343                                                        lineBreak.remove().insertAfter( startBlockParent );
     344                                                else
     345                                                        lineBreak.breakParent( startBlockParent );
     346
     347                                                isStartOfParent && isEndOfParent && startBlockParent.remove();
     348
     349                                                // The "next" <br> is not needed any more at this point.
     350                                                next && next.remove();
     351
     352                                                // Except on IE, the previous and the new <br> will remain as bogus <br>s.
     353                                                if ( CKEDITOR.env.ie && previous )
     354                                                        previous.remove();
     355
     356                                                range.moveToPosition( lineBreak, CKEDITOR.POSITION_BEFORE_START );
     357
     358                                                if ( CKEDITOR.env.ie )
     359                                                        lineBreak.remove();
     360
     361                                                range.select();
     362                                                return;
     363                                        }
     364                                }
     365
    327366                                // IE has different behavior regarding position.
    328367                                if ( CKEDITOR.env.ie )
    329368                                        range.setStartAt( lineBreak, CKEDITOR.POSITION_AFTER_END );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy