Ticket #4343: 4343_3.patch

File 4343_3.patch, 1.9 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    479479
    480480                                                // Adds the document body as a context menu target.
    481481                                                if ( editor.contextMenu )
    482                                                         editor.contextMenu.addTarget( domDocument );
     482                                                        editor.contextMenu.addTarget( domDocument, editor.config.browserContextMenuOnCtrl !== false );
    483483
    484484                                                setTimeout( function()
    485485                                                        {
  • _source/plugins/contextmenu/plugin.js

     
    126126
    127127        proto :
    128128        {
    129                 addTarget : function( element )
     129                addTarget : function( element, nativeContextMenuOnCtrl )
    130130                {
    131131                        // Opera doesn't support 'contextmenu' event, we have duo approaches employed here:
    132132                        // 1. Inherit the 'button override' hack we introduced in v2 (#4530), while this require the Opera browser
     
    147147                                                return;
    148148                                        }
    149149
     150                                        if ( nativeContextMenuOnCtrl
     151                                                 && ( evt.$.ctrlKey || evt.$.metaKey ) )
     152                                                return;
     153
    150154                                        var target = evt.getTarget();
    151155
    152156                                        if( !contextMenuOverrideButton )
     
    179183                                {
    180184                                        var domEvent = event.data;
    181185
     186                                        if ( nativeContextMenuOnCtrl
     187                                                 && ( domEvent.$.ctrlKey || domEvent.$.metaKey ) )
     188                                                return;
     189
    182190                                        // Cancel the browser context menu.
    183191                                        domEvent.preventDefault();
    184192
     
    208216        }
    209217});
    210218
     219/**
     220 * Whether preserve browser native context menu when 'Ctrl' or 'Meta' key
     221 * is pressed while open context menu.
     222 * @name CKEDITOR.config.browserContextMenuOnCtrl
     223 * @type Boolean
     224 * @default true
     225 * @example
     226 *  config.browserContextMenuOnCtrl = false;
     227 */
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy