Ticket #3684: 3684_4.patch

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

     
    154154                        }
    155155
    156156                        selection.selectBookmarks( bms );
    157                 }
     157
     158                        // If the fixed block is blank and is already followed by a enter block,
     159                        // we should drop it and move to the next block(#3684).
     160                        var children = fixedBlock.getChildren(),
     161                                count = children.count(),
     162                                firstChild,
     163                                previousElement = fixedBlock.getPrevious( true ),
     164                                nextElement = fixedBlock.getNext( true ),
     165                                enterBlock;
     166                        if ( !previousElement.is( nonExitableElementNames ) )
     167                                enterBlock = previousElement;
     168                        else if ( !nextElement.is ( nonExitableElementNames ) )
     169                                enterBlock = nextElement;
     170
     171                        if( ( !count
     172                                  || ( firstChild = children.getItem( 0 ) ) && firstChild.is && firstChild.is( 'br' ) )
     173                                && enterBlock )
     174                        {
     175                                fixedBlock.remove();
     176                                range.moveToElementEditStart( enterBlock );
     177                                range.select();
     178                        }
     179                }
    158180
    159181                // Inserting the padding-br before body if it's preceded by an
    160182                // unexitable block.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy