Ticket #4397: 4397_2.patch

File 4397_2.patch, 2.7 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    367367                                                domWindow       = editor.window         = new CKEDITOR.dom.window( domWindow );
    368368                                                domDocument     = editor.document       = new CKEDITOR.dom.document( domDocument );
    369369
    370                                                 // Gecko need a key event to 'wake up' the editing
    371                                                 // ability when document is empty.(#3864)
    372                                                 var firstNode = domDocument.getBody().getFirst();
    373                                                 if ( CKEDITOR.env.gecko
    374                                                         && firstNode && firstNode.is
    375                                                         && firstNode.is( 'br' ) && firstNode.hasAttribute( '_moz_editor_bogus_node' ) )
    376                                                 {
    377                                                         var keyEventSimulate = domDocument.$.createEvent( "KeyEvents" );
    378                                                         keyEventSimulate.initKeyEvent( 'keypress', true, true, domWindow.$, false,
    379                                                                 false, false, false, 0, 32 );
    380                                                         domDocument.$.dispatchEvent( keyEventSimulate );
    381                                                         var bogusText = domDocument.getBody().getFirst() ;
    382                                                         // Compensate the line maintaining <br> if enterMode is not block.
    383                                                         if ( editor.config.enterMode == CKEDITOR.ENTER_BR )
    384                                                                 domDocument.createElement( 'br', { attributes: { '_moz_dirty' : "" } } )
    385                                                                         .replace( bogusText );
    386                                                         else
    387                                                                 bogusText.remove();
    388                                                 }
    389 
    390370                                                // Gecko/Webkit need some help when selecting control type elements. (#3448)
    391371                                                if ( !( CKEDITOR.env.ie || CKEDITOR.env.opera) )
    392372                                                {
     
    426406
    427407                                                focusTarget.on( 'focus', function()
    428408                                                        {
     409                                                                // Gecko need a key event to 'wake up' the editing
     410                                                                // ability when document is empty.(#3864)
     411                                                                if ( CKEDITOR.env.gecko )
     412                                                                {
     413                                                                        var first = body;
     414                                                                        while( first.firstChild )
     415                                                                                first = first.firstChild;
     416
     417                                                                        if( !first.nextSibling
     418                                                                                && ( 'BR' == first.tagName )
     419                                                                                && first.hasAttribute( '_moz_editor_bogus_node' ) )
     420                                                                        {
     421                                                                                var keyEventSimulate = domDocument.$.createEvent( "KeyEvents" );
     422                                                                                        keyEventSimulate.initKeyEvent( 'keypress', true, true, domWindow.$, false,
     423                                                                                                false, false, false, 0, 32 );
     424                                                                                        domDocument.$.dispatchEvent( keyEventSimulate );
     425                                                                                        var bogusText = domDocument.getBody().getFirst() ;
     426                                                                                        // Compensate the line maintaining <br> if enterMode is not block.
     427                                                                                        if ( editor.config.enterMode == CKEDITOR.ENTER_BR )
     428                                                                                                domDocument.createElement( 'br', { attributes: { '_moz_dirty' : "" } } )
     429                                                                                                        .replace( bogusText );
     430                                                                                        else
     431                                                                                                bogusText.remove();
     432
     433                                                                        }
     434                                                                }
     435
    429436                                                                editor.focusManager.focus();
    430437                                                        });
    431438
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy