Ticket #6966: 6966.patch

File 6966.patch, 1.5 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                                                                                newContent;
     822
     823                                                                        if ( domDocument.getCustomData( 'cke_fully_selected' ) )
     824                                                                        {
     825                                                                                domDocument.removeCustomData( 'cke_fully_selected' );
     826                                                                                if ( range.collapsed && ( newContent = body.getHtml().match( /^<p>(?:(.)|&nbsp;)<\/p>$/i ) ) )
     827                                                                                {
     828                                                                                        body.setHtml( newContent[ 1 ] ? newContent[ 1 ] : '' );
     829                                                                                        range.moveToElementEditEnd( body );
     830                                                                                        range.select( 1 );
     831                                                                                        return;
     832                                                                                }
     833                                                                        }
    815834
     835                                                                        if ( range.checkEndOfBlock( body ) && range.checkStartOfBlock( body ) )
     836                                                                                domDocument.setCustomData( 'cke_fully_selected', 1 );
     837                                                                });
     838                                                }
     839
    816840                                                // Adds the document body as a context menu target.
    817841                                                if ( editor.contextMenu )
    818842                                                        editor.contextMenu.addTarget( domDocument, editor.config.browserContextMenuOnCtrl !== false );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy