Ticket #7366: 7366_2.patch

File 7366_2.patch, 2.1 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
     
    2929                body.on( command, onExec );
    3030
    3131                // IE6/7: document.execCommand has problem to paste into positioned element.
    32                 ( CKEDITOR.env.version > 7 ? doc.$ : doc.$.selection.createRange() ) [ 'execCommand' ]( command );
     32                doc.$.selection.createRange()[ 'execCommand' ]( command )
    3333
    3434                body.removeListener( command, onExec );
    3535
     
    281281        }
    282282
    283283        var depressBeforeEvent;
     284        var depressPasteEvent;
    284285        function stateFromNamedCommand( command, editor )
    285286        {
    286287                // IE Bug: queryCommandEnabled('paste') fires also 'beforepaste(copy/cut)',
     
    382383                                        var body = editor.document.getBody();
    383384                                        body.on( CKEDITOR.env.webkit ? 'paste' : 'beforepaste', function( evt )
    384385                                                {
    385                                                         if ( depressBeforeEvent )
     386                                                        // To dismiss some wrong ones in IE, e.g. when menu is opened.
     387                                                        if ( depressBeforeEvent ||
     388                                                                 evt.data && evt.data.$ && ( evt.data.$.offsetY < 0 || evt.data.$.offsetX < 0 ) )
     389                                                        {
    386390                                                                return;
     391                                                        }
    387392
    388393                                                        // Fire 'beforePaste' event so clipboard flavor get customized
    389394                                                        // by other plugins.
     
    403408                                                        } );
    404409                                                });
    405410
    406                                         // Dismiss the (wrong) 'beforepaste' event fired on context menu open. (#7953)
     411                                        // Handle paste from browser toolbar menu which misses the "beforepaste" event.
     412                                        CKEDITOR.env.ie && body.on( 'paste', function( evt )
     413                                        {
     414                                                if ( ! ( depressPasteEvent || editor.document.getById( 'cke_pastebin' ) ) )
     415                                                {
     416                                                        // Prevent native paste.
     417                                                        evt.data.preventDefault();
     418
     419                                                        depressPasteEvent = 1;
     420                                                        window.setTimeout( function() { depressPasteEvent = 0; } );
     421
     422                                                        // Resort to the paste command.
     423                                                        pasteCmd.exec( editor );
     424                                                }
     425                                        });
     426
     427                                        // Dismiss the (wrong) 'beforepaste' event fired on context menu open.
    407428                                        body.on( 'contextmenu', function()
    408429                                        {
    409430                                                depressBeforeEvent = 1;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy