Ticket #7366: 7366_6.patch

File 7366_6.patch, 2.6 KB (added by Garry Yao, 12 years ago)
  • _source/plugins/clipboard/plugin.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    135135
    136136                                var body = this.document.getBody();
    137137
    138                                 // Simulate 'beforepaste' event for all none-IEs.
    139                                 if ( !CKEDITOR.env.ie && body.fire( 'beforepaste' ) )
    140                                         event.cancel();
    141138                                // Simulate 'paste' event for Opera/Firefox2.
    142                                 else if ( CKEDITOR.env.opera
     139                                if ( CKEDITOR.env.opera
    143140                                                 || CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 )
    144141                                        body.fire( 'paste' );
    145142                                return;
     
    378375                                editor.on( 'contentDom', function()
    379376                                {
    380377                                        var body = editor.document.getBody();
    381                                         body.on( CKEDITOR.env.webkit ? 'paste' : 'beforepaste', function( evt )
     378
     379                                        // Intercept the paste before it actually takes place.
     380                                        body.on( !CKEDITOR.env.ie ? 'paste' : 'beforepaste', function( evt )
    382381                                                {
    383382                                                        if ( depressBeforeEvent )
    384383                                                                return;
    385384
     385                                                        // Dismiss the (wrong) 'beforepaste' event fired on toolbar menu open.
     386                                                        var domEvent = evt.data && evt.data.$;
     387                                                        if ( CKEDITOR.env.ie && domEvent && !domEvent.ctrlKey )
     388                                                                return;
     389
    386390                                                        // Fire 'beforePaste' event so clipboard flavor get customized
    387391                                                        // by other plugins.
    388392                                                        var eventData =  { mode : 'html' };
     
    401405                                                        } );
    402406                                                });
    403407
    404                                         // Dismiss the (wrong) 'beforepaste' event fired on context menu open. (#7953)
    405                                         body.on( 'contextmenu', function()
    406                                         {
    407                                                 depressBeforeEvent = 1;
    408                                                 setTimeout( function() { depressBeforeEvent = 0; }, 10 );
    409                                         });
     408                                        if ( CKEDITOR.env.ie )
     409                                        {
     410                                                // Dismiss the (wrong) 'beforepaste' event fired on context menu open. (#7953)
     411                                                body.on( 'contextmenu', function()
     412                                                {
     413                                                        depressBeforeEvent = 1;
     414                                                        // Important: The following timeout will be called only after menu closed.
     415                                                        setTimeout( function() { depressBeforeEvent = 0; }, 0 );
     416                                                } );
     417
     418                                                // Handle IE's late coming "paste" event when pasting from
     419                                                // browser toolbar/context menu.
     420                                                body.on( 'paste', function( evt )
     421                                                {
     422                                                        if ( !editor.document.getById( 'cke_pastebin' ) )
     423                                                        {
     424                                                                // Prevent native paste.
     425                                                                evt.data.preventDefault();
     426
     427                                                                depressBeforeEvent = 0;
     428                                                                // Resort to the paste command.
     429                                                                pasteCmd.exec( editor );
     430                                                        }
     431                                                } );
     432                                        }
    410433
    411434                                        body.on( 'beforecut', function() { !depressBeforeEvent && fixCut( editor ); } );
    412435
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy