Ticket #6966: 6966_2.patch

File 6966_2.patch, 1.3 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    811811                                                                        }
    812812                                                                } );
    813813                                                        }
    814                                                 }
     814
     815                                                        // Prevent IE from leaving new paragraph after deleting all contents in body. (#6966)
     816                                                        editor.config.enterMode != CKEDITOR.ENTER_P
     817                                                                && domDocument.on( 'selectionchange', function()
     818                                                                {
     819                                                                        var body = domDocument.getBody(),
     820                                                                                range = editor.getSelection().getRanges()[ 0 ];
     821
     822                                                                        if ( body.getHtml().match( /^<p>&nbsp;<\/p>$/i )
     823                                                                                && range.startContainer.equals( body ) )
     824                                                                        {
     825                                                                                // Avoid the ambiguity from a real user cursor position.
     826                                                                                setTimeout( function ()
     827                                                                                {
     828                                                                                        range = editor.getSelection().getRanges()[ 0 ];
     829                                                                                        if ( !range.startContainer.equals ( 'body' ) )
     830                                                                                        {
     831                                                                                                body.getFirst().remove( 1 );
     832                                                                                                range.moveToElementEditEnd( body );
     833                                                                                                range.select( 1 );
     834                                                                                        }
     835                                                                                }, 0 );
     836                                                                        }
     837                                                                });
     838                                                }
    815839
    816840                                                // Adds the document body as a context menu target.
    817841                                                if ( editor.contextMenu )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy