Ticket #3085: 3085_5.patch
File 3085_5.patch, 6.0 KB (added by , 15 years ago) |
---|
-
_source/plugins/contextmenu/plugin.js
10 10 beforeInit : function( editor ) 11 11 { 12 12 editor.contextMenu = new CKEDITOR.plugins.contextMenu( editor ); 13 14 editor.addCommand( 'contextMenu', 15 { 16 exec : function() 17 { 18 editor.contextMenu.show(); 19 } 20 }); 13 21 } 14 22 }); 15 23 … … 31 39 32 40 _ : 33 41 { 34 onMenu : function( domEvent)42 onMenu : function( offsetParent, offsetX, offsetY ) 35 43 { 36 // Cancel the browser context menu.37 domEvent.preventDefault();38 39 44 var menu = this._.menu, 40 45 editor = this.editor; 41 46 … … 47 52 else 48 53 { 49 54 menu = this._.menu = new CKEDITOR.menu( editor ); 50 menu.onClick = function( item )55 menu.onClick = CKEDITOR.tools.bind( function( item ) 51 56 { 52 57 menu.hide(); 53 58 editor.focus(); … … 55 60 if ( item.onClick ) 56 61 item.onClick(); 57 62 else if ( item.command ) 63 { 64 if ( CKEDITOR.env.ie ) 65 this.restoreSelection(); 66 58 67 editor.execCommand( item.command ); 68 } 69 }, this ); 70 71 menu.onEscape = function() 72 { 73 editor.focus(); 59 74 }; 60 75 } 61 76 … … 85 100 } 86 101 } 87 102 88 menu.show( domEvent.getTarget().getDocument().getDocumentElement(), 1, domEvent.$.clientX, domEvent.$.clientY ); 103 if ( CKEDITOR.env.ie ) 104 this.saveSelection(); 105 106 menu.show( offsetParent, 1, offsetX, offsetY ); 89 107 } 90 108 }, 91 109 … … 95 113 { 96 114 element.on( 'contextmenu', function( event ) 97 115 { 98 return this._.onMenu( event.data ); 116 var domEvent = event.data; 117 118 // Cancel the browser context menu. 119 domEvent.preventDefault(); 120 121 var offsetParent = domEvent.getTarget().getDocument().getDocumentElement(); 122 offsetX = domEvent.$.clientX, 123 offsetY = domEvent.$.clientY; 124 125 CKEDITOR.tools.setTimeout( function() 126 { 127 this._.onMenu( offsetParent, offsetX, offsetY ); 128 }, 129 0, this ); 99 130 }, 100 131 this ); 101 132 }, … … 103 134 addListener : function( listenerFn ) 104 135 { 105 136 this._.listeners.push( listenerFn ); 137 }, 138 139 show : function() 140 { 141 this.editor.focus(); 142 this._.onMenu( CKEDITOR.document.getDocumentElement(), 0, 0 ); 143 }, 144 145 /** 146 * Saves the current selection position in the editor. 147 */ 148 saveSelection : function() 149 { 150 if ( this.editor.mode == 'wysiwyg' ) 151 { 152 this.editor.focus(); 153 154 var selection = new CKEDITOR.dom.selection( this.editor.document ); 155 this._.selectedRanges = selection.getRanges(); 156 } 157 else 158 delete this._.selectedRanges; 159 }, 160 161 /** 162 * Restores the editor's selection from the previously saved position in this 163 * dialog. 164 */ 165 restoreSelection : function() 166 { 167 if ( this.editor.mode == 'wysiwyg' && this._.selectedRanges ) 168 { 169 this.editor.focus(); 170 ( new CKEDITOR.dom.selection( this.editor.document ) ).selectRanges( this._.selectedRanges ); 171 } 106 172 } 107 173 } 108 174 }); -
_source/plugins/keystrokes/plugin.js
172 172 [ CKEDITOR.ALT + 121 /*F10*/, 'toolbarFocus' ], 173 173 [ CKEDITOR.ALT + 122 /*F11*/, 'elementsPathFocus' ], 174 174 175 [ CKEDITOR.SHIFT + 121 /*F10*/, 'contextMenu' ], 176 175 177 [ CKEDITOR.CTRL + 90 /*Z*/, 'undo' ], 176 178 [ CKEDITOR.CTRL + 89 /*Y*/, 'redo' ], 177 179 [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 /*Z*/, 'redo' ], -
_source/plugins/menu/plugin.js
125 125 }, 126 126 this._.level); 127 127 128 panel.onEscape = CKEDITOR.tools.bind( function() 129 { 130 this.hide(); 131 this.onEscape && this.onEscape(); 132 }, 133 this ); 134 128 135 // Create an autosize block inside the panel. 129 136 var block = panel.addBlock( this.id ); 130 137 block.autoSize = true; 131 138 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 132 147 element = this._.element = block.element; 133 148 element.addClass( editor.skinClass ); 134 149 element.getDocument().getBody().setStyle( 'overflow', 'hidden' ); … … 253 268 ' class="', classes, '" href="javascript:void(\'', ( this.label || '' ).replace( "'", '' ), '\')"' + 254 269 ' title="', this.label, '"' + 255 270 ' tabindex="-1"' + 271 '_cke_focus=1' + 256 272 ' hidefocus="true"' ); 257 273 258 274 // Some browsers don't cancel key events in the keydown but in the -
_source/skins/default/menu.css
14 14 } 15 15 16 16 .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 18 19 { 19 20 background-color: #8f8f73; 20 21 display:block; … … 41 42 } 42 43 43 44 .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 45 47 { 46 48 background-color: #737357; 47 49 border: solid 4px #737357; … … 60 62 } 61 63 62 64 .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 64 67 { 65 68 color: #fff; 66 69 background-color: #8f8f73;