Ticket #4874: 4874_2.patch

File 4874_2.patch, 2.6 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/clipboard/plugin.js

     
    303303                                        body.on( ( mode == 'text' && CKEDITOR.env.ie ) ? 'paste' : 'beforepaste',
    304304                                                function( evt )
    305305                                                {
     306                                                        if( depressBeforePasteEvent )
     307                                                                return;
     308
    306309                                                        getClipboardData.call( editor, evt, mode, function ( data )
    307310                                                        {
    308311                                                                // The very last guard to make sure the
     
    321324                                // If the "contextmenu" plugin is loaded, register the listeners.
    322325                                if ( editor.contextMenu )
    323326                                {
     327                                        var depressBeforePasteEvent;
    324328                                        function stateFromNamedCommand( command )
    325329                                        {
    326                                                 return editor.document.$.queryCommandEnabled( command ) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED;
     330                                                // IE Bug: queryCommandEnabled('paste') fires also 'beforepaste',
     331                                                // guard to distinguish from the ordinary sources( either
     332                                                // keyboard paste or execCommand ) (#4874).
     333                                                CKEDITOR.env.ie && command == 'Paste'&& ( depressBeforePasteEvent = 1 );
     334
     335                                                var retval = editor.document.$.queryCommandEnabled( command ) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED;
     336                                                depressBeforePasteEvent = 0;
     337                                                return retval;
    327338                                        }
    328339
    329340                                        editor.contextMenu.addListener( function()
  • _source/plugins/contextmenu/plugin.js

     
    177177                                } );
    178178                        }
    179179
    180                         // Certain forms of IE selection changes on 'contextmenu' event,
    181                         // lock the selection before that.(#4041)
    182                         if ( CKEDITOR.env.ie )
    183                         {
    184                                 element.on( 'mousedown', function( event )
    185                                 {
    186                                         if ( event.data.$.button == 2 )
    187                                         {
    188                                                 var selection = this.editor.getSelection();
    189                                                 selection && selection.lock();
    190                                         }
    191                                 }, this );
    192                         }
    193 
    194180                        element.on( 'contextmenu', function( event )
    195181                                {
    196182                                        var domEvent = event.data;
     
    201187                                             ( CKEDITOR.env.webkit ? holdCtrlKey : domEvent.$.ctrlKey || domEvent.$.metaKey ) )
    202188                                                return;
    203189
     190                                        // Selection will be unavailable after context menu shows up
     191                                        // in IE, lock it now.
     192                                        if ( CKEDITOR.env.ie )
     193                                        {
     194                                                var selection = this.editor.getSelection();
     195                                                selection && selection.lock();
     196                                        }
     197
    204198                                        // Cancel the browser context menu.
    205199                                        domEvent.preventDefault();
    206200
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy