Ticket #7366: 7366_5.patch

File 7366_5.patch, 2.2 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 "beforepaste" event fired in IE when
     386                                                        // opening browser toolbar/context menu.
     387                                                        var domEvent = evt.data && evt.data.$;
     388                                                        if ( CKEDITOR.env.ie && domEvent && !domEvent.ctrlKey )
     389                                                                return;
     390
    386391                                                        // Fire 'beforePaste' event so clipboard flavor get customized
    387392                                                        // by other plugins.
    388393                                                        var eventData =  { mode : 'html' };
     
    401406                                                        } );
    402407                                                });
    403408
    404                                         // Dismiss the (wrong) 'beforepaste' event fired on context menu open. (#7953)
    405                                         body.on( 'contextmenu', function()
     409                                        // Handle IE's late coming "paste" event when pasting from
     410                                        // browser toolbar/context menu.
     411                                        CKEDITOR.env.ie && body.on( 'paste', function( evt )
    406412                                        {
    407                                                 depressBeforeEvent = 1;
    408                                                 setTimeout( function() { depressBeforeEvent = 0; }, 10 );
    409                                         });
     413                                                if ( !editor.document.getById( 'cke_pastebin' ) )
     414                                                {
     415                                                        // Prevent native paste.
     416                                                        evt.data.preventDefault();
     417
     418                                                        // Resort to the paste command.
     419                                                        pasteCmd.exec( editor );
     420                                                }
     421                                        } );
    410422
    411423                                        body.on( 'beforecut', function() { !depressBeforeEvent && fixCut( editor ); } );
    412424
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy