Ticket #3684: 3684_3.patch

File 3684_3.patch, 1.6 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    130130                        selection = evt.data.selection,
    131131                        range = selection.getRanges()[0],
    132132                        body = editor.document.getBody(),
    133                         enterMode = editor.config.enterMode;
     133                        enterMode = editor.config.enterMode,
     134                        enterBlockName = enterMode == CKEDITOR.ENTER_P ? 'p' : 'div';
    134135
    135136                // When enterMode set to block, we'll establing new paragraph only if we're
    136137                // selecting inline contents right under body. (#3657)
     
    154155                        }
    155156
    156157                        selection.selectBookmarks( bms );
    157                 }
     158
     159                        // If the fixed block is blank and is already followed by a enter block,
     160                        // we should drop it and move to the next block(#3684).
     161                        var children = fixedBlock.getChildren(),
     162                                count = children.count(),
     163                                firstChild,
     164                                previousElement = fixedBlock.getPrevious( true ),
     165                                nextElement = fixedBlock.getNext( true ),
     166                                enterBlock;
     167                        if ( previousElement.is( enterBlockName ) )
     168                                enterBlock = previousElement;
     169                        else if ( nextElement.is ( enterBlockName ) )
     170                                enterBlock = nextElement;
     171
     172                        if( ( !count
     173                                  || ( firstChild = children.getItem( 0 ) ) && firstChild.is && firstChild.is( 'br' ) )
     174                                && enterBlock )
     175                        {
     176                                fixedBlock.remove();
     177                                range.moveToElementEditStart( enterBlock );
     178                                range.select();
     179                        }
     180                }
    158181
    159182                // Inserting the padding-br before body if it's preceded by an
    160183                // unexitable block.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy