Ticket #3085: 3085_3.patch

File 3085_3.patch, 5.3 KB (added by Frederico Caldeira Knabben, 15 years ago)
  • _source/plugins/contextmenu/plugin.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
     
    1010        beforeInit : function( editor )
    1111        {
    1212                editor.contextMenu = new CKEDITOR.plugins.contextMenu( editor );
     13
     14                editor.addCommand( 'contextMenu',
     15                        {
     16                                exec : function()
     17                                        {
     18                                                editor.contextMenu.show();
     19                                        }
     20                        });
    1321        }
    1422});
    1523
     
    3139
    3240        _ :
    3341        {
    34                 onMenu : function( domEvent )
     42                onMenu : function( offsetParent, offsetX, offsetY )
    3543                {
    36                         // Cancel the browser context menu.
    37                         domEvent.preventDefault();
    38 
    3944                        var menu = this._.menu,
    4045                                editor = this.editor;
    4146
     
    5762                                        else if ( item.command )
    5863                                                editor.execCommand( item.command );
    5964                                };
     65
     66                                menu.onEscape = function()
     67                                {
     68                                        editor.focus();
     69                                };
    6070                        }
    6171
    6272                        var listeners = this._.listeners,
     
    8595                                }
    8696                        }
    8797
    88                         menu.show( domEvent.getTarget().getDocument().getDocumentElement(), 1, domEvent.$.clientX, domEvent.$.clientY );
     98                        menu.show( offsetParent, 1, offsetX, offsetY );
    8999                }
    90100        },
    91101
     
    95105                {
    96106                        element.on( 'contextmenu', function( event )
    97107                                {
    98                                         return this._.onMenu( event.data );
     108                                        var domEvent = event.data;
     109
     110                                        // Cancel the browser context menu.
     111                                        domEvent.preventDefault();
     112
     113                                        var offsetParent = domEvent.getTarget().getDocument().getDocumentElement();
     114                                                offsetX = domEvent.$.clientX,
     115                                                offsetY = domEvent.$.clientY;
     116
     117                                        CKEDITOR.tools.setTimeout( function()
     118                                                {
     119                                                        this.editor.focus();
     120                                                        this._.onMenu( offsetParent, offsetX, offsetY );
     121                                                },
     122                                                0, this );
    99123                                },
    100124                                this );
    101125                },
     
    103127                addListener : function( listenerFn )
    104128                {
    105129                        this._.listeners.push( listenerFn );
     130                },
     131
     132                show : function()
     133                {
     134                        this.editor.focus();
     135                        this._.onMenu( CKEDITOR.document.getDocumentElement(), 0, 0 );
    106136                }
    107137        }
    108138});
  • _source/plugins/keystrokes/plugin.js

     
    172172        [ CKEDITOR.ALT + 121 /*F10*/, 'toolbarFocus' ],
    173173        [ CKEDITOR.ALT + 122 /*F11*/, 'elementsPathFocus' ],
    174174
     175        [ CKEDITOR.SHIFT + 121 /*F10*/, 'contextMenu' ],
     176
    175177        [ CKEDITOR.CTRL + 90 /*Z*/, 'undo' ],
    176178        [ CKEDITOR.CTRL + 89 /*Y*/, 'redo' ],
    177179        [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 /*Z*/, 'redo' ],
  • _source/plugins/menu/plugin.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
     
    125125                                                },
    126126                                                this._.level);
    127127
     128                                        panel.onEscape = CKEDITOR.tools.bind( function()
     129                                        {
     130                                                this.hide();
     131                                                this.onEscape && this.onEscape();
     132                                        },
     133                                        this );
     134
    128135                                        // Create an autosize block inside the panel.
    129136                                        var block = panel.addBlock( this.id );
    130137                                        block.autoSize = true;
    131138
     139                                        var keys = block.keys;
     140                                        keys[ 40 ]      = 'next';                                       // ARROW-DOWN
     141                                        keys[ 9 ]       = 'next';                                       // TAB
     142                                        keys[ 38 ]      = 'prev';                                       // ARROW-UP
     143                                        keys[ CKEDITOR.SHIFT + 9 ]      = 'prev';       // SHIFT + TAB
     144                                        keys[ 32 ]      = 'click';                                      // SPACE
     145                                        keys[ 39 ]      = 'click';                                      // ARROW-RIGHT
     146
    132147                                        element = this._.element = block.element;
    133148                                        element.addClass( editor.skinClass );
    134149                                        element.getDocument().getBody().setStyle( 'overflow', 'hidden' );
     
    253268                                        ' class="', classes, '" href="javascript:void(\'', ( this.label || '' ).replace( "'", '' ), '\')"' +
    254269                                        ' title="', this.label, '"' +
    255270                                        ' tabindex="-1"' +
     271                                        '_cke_focus=1' +
    256272                                        ' hidefocus="true"' );
    257273
    258274                        // Some browsers don't cancel key events in the keydown but in the
  • _source/skins/default/menu.css

     
    1414}
    1515
    1616.cke_skin_default .cke_menuitem a:hover,
    17 .cke_skin_default .cke_menuitem a:focus
     17.cke_skin_default .cke_menuitem a:focus,
     18.cke_skin_default .cke_menuitem a:active
    1819{
    1920        background-color: #8f8f73;
    2021        display:block;
     
    4142}
    4243
    4344.cke_skin_default .cke_menuitem a:hover .cke_icon,
    44 .cke_skin_default .cke_menuitem a:focus .cke_icon
     45.cke_skin_default .cke_menuitem a:focus .cke_icon,
     46.cke_skin_default .cke_menuitem a:active .cke_icon
    4547{
    4648        background-color: #737357;
    4749        border: solid 4px #737357;
     
    6062}
    6163
    6264.cke_skin_default .cke_menuitem a:hover .cke_label,
    63 .cke_skin_default .cke_menuitem a:focus .cke_label
     65.cke_skin_default .cke_menuitem a:focus .cke_label,
     66.cke_skin_default .cke_menuitem a:active .cke_label
    6467{
    6568        color: #fff;
    6669        background-color: #8f8f73;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy