Ticket #5845: 5845.patch

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

     
    1414        var nonExitableElementNames = { table:1,pre:1 };
    1515
    1616        // Matching an empty paragraph at the end of document.
    17         var emptyParagraphRegexp = /\s*<(p|div|address|h\d|center)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\1>)?\s*(?=$|<\/body>)/gi;
     17        var emptyParagraphRegexp = /\s*<(p|div|address|h\d|center|li)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\1>)?\s*(?=$|<\/body>)/gi;
    1818
    1919        function onInsertHtml( evt )
    2020        {
     
    445445                                                        } );
    446446                                                }
    447447
     448                                                if ( CKEDITOR.env.gecko )
     449                                                {
     450                                                        domDocument.on( 'mouseup', function( ev )
     451                                                        {
     452                                                                if ( ev.data.$.button == 2 )
     453                                                                {
     454                                                                        var target = ev.data.getTarget();
     455
     456                                                                        // Prevent right click from selecting an empty block even
     457                                                                        // when selection is anchored inside it. (#5845)
     458                                                                        if ( !target.getOuterHtml().replace( emptyParagraphRegexp, '' ) )
     459                                                                        {
     460                                                                                var range = new CKEDITOR.dom.range( domDocument );
     461                                                                                range.moveToElementEditStart( target );
     462                                                                                range.select( true );
     463                                                                        }
     464                                                                }
     465                                                        } );
     466                                                }
     467
    448468                                                // Webkit: avoid from editing form control elements content.
    449469                                                if ( CKEDITOR.env.webkit )
    450470                                                {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy