| 7 | | before `item.execute()` in `itemKeystroke` function (`toolbar.js`) should do the job. |
| | 7 | before `item.execute()` in `itemKeystroke` function (toolbar plugin) should do the job. |
| | 8 | |
| | 9 | ---- |
| | 10 | |
| | 11 | '''Edit''': A better place for the fix could be the button plugin. The trick would correspond with the [https://github.com/ckeditor/ckeditor-dev/blob/d9438ebb67f8c9cbbc4efec30ac846c4a04b750d/plugins/richcombo/plugin.js#L190-L193 similar code] in richcombo if extended those [https://github.com/ckeditor/ckeditor-dev/blob/d9438ebb67f8c9cbbc4efec30ac846c4a04b750d/plugins/button/plugin.js#L142-L147 existing lines]: |
| | 12 | |
| | 13 | {{{ |
| | 14 | var keydownFn = CKEDITOR.tools.addFunction( function( ev ) { |
| | 15 | if ( instance.onkey ) { |
| | 16 | ev = new CKEDITOR.dom.event( ev ); |
| | 17 | var keystroke = ev.getKeystroke(); |
| | 18 | |
| | 19 | if ( keystroke == 40 && instance.button.hasArrow ) { |
| | 20 | editor.once( 'panelShow', function( evt ) { |
| | 21 | evt.data._.panel._.currentBlock.onKeyDown( 40 ); |
| | 22 | } ); |
| | 23 | |
| | 24 | return CKEDITOR.tools.callFunction( clickFn, CKEDITOR.document.getById( id ) ); |
| | 25 | } |
| | 26 | else |
| | 27 | return ( instance.onkey( instance, ev.getKeystroke() ) !== false ); |
| | 28 | } |
| | 29 | }); |
| | 30 | }}} |
| | 31 | |
| | 32 | This approach seems semantically correct because custom keystroke handling should belong to the button, not to the toolbar. |