Ticket #5381: 5381.patch

File 5381.patch, 1.7 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    170170                }
    171171        }
    172172
     173        function isBlankParagraph( block )
     174        {
     175                return block.getOuterHtml().match( emptyParagraphRegexp );
     176        }
     177
    173178        var isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true );
    174179
    175180        /**
     
    206211                                first && isNbsp( first ) && first.remove();
    207212                        }
    208213
    209                         // If the fixed block is blank and already followed by a exitable
    210                         // block, we should revert the fix. (#3684)
    211                         if ( fixedBlock.getOuterHtml().match( emptyParagraphRegexp ) )
     214                        // If the fixed block is actually blank and is already followed by an exitable blank
     215                        // block, we should revert the fix and move into the existed one. (#3684)
     216                        if ( isBlankParagraph( fixedBlock ) )
    212217                        {
    213218                                var previousElement = fixedBlock.getPrevious( isNotWhitespace ),
    214219                                        nextElement = fixedBlock.getNext( isNotWhitespace );
    215220
    216221                                if ( previousElement && previousElement.getName
    217222                                         && !( previousElement.getName() in nonExitableElementNames )
     223                                         && isBlankParagraph( previousElement )
    218224                                         && range.moveToElementEditStart( previousElement )
    219225                                         || nextElement && nextElement.getName
    220                                            && !( nextElement.getName() in nonExitableElementNames )
    221                                            && range.moveToElementEditStart( nextElement ) )
     226                                                && !( nextElement.getName() in nonExitableElementNames )
     227                                                && isBlankParagraph( nextElement )
     228                                                && range.moveToElementEditStart( nextElement ) )
    222229                                {
    223230                                        fixedBlock.remove();
    224231                                }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy