| 58 | | /** |
| 59 | | * Handles a button click. |
| 60 | | * @private |
| 61 | | */ |
| 62 | | CKEDITOR.ui.button._ = |
| 63 | | { |
| 64 | | instances : [], |
| 65 | | |
| 66 | | keydown : function( index, ev ) |
| 67 | | { |
| 68 | | var instance = CKEDITOR.ui.button._.instances[ index ]; |
| 69 | | |
| 70 | | if ( instance.onkey ) |
| 71 | | { |
| 72 | | ev = new CKEDITOR.dom.event( ev ); |
| 73 | | return ( instance.onkey( instance, ev.getKeystroke() ) !== false ); |
| 74 | | } |
| 75 | | }, |
| 76 | | |
| 77 | | focus : function( index, ev ) |
| 78 | | { |
| 79 | | var instance = CKEDITOR.ui.button._.instances[ index ], |
| 80 | | retVal; |
| 81 | | |
| 82 | | if ( instance.onfocus ) |
| 83 | | retVal = ( instance.onfocus( instance, new CKEDITOR.dom.event( ev ) ) !== false ); |
| 84 | | |
| 85 | | // FF2: prevent focus event been bubbled up to editor container, which caused unexpected editor focus. |
| 86 | | if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) |
| 87 | | ev.preventBubble(); |
| 88 | | return retVal; |
| 89 | | } |
| 90 | | }; |
| 91 | | |
| | 98 | var keydownFn = CKEDITOR.tools.addFunction( function( ev ) |
| | 99 | { |
| | 100 | if ( instance.onkey ) |
| | 101 | { |
| | 102 | ev = new CKEDITOR.dom.event( ev ); |
| | 103 | return ( instance.onkey( instance, ev.getKeystroke() ) !== false ); |
| | 104 | } |
| | 105 | }); |
| | 106 | |
| | 107 | var focusFn = CKEDITOR.tools.addFunction( function( ev ) |
| | 108 | { |
| | 109 | var retVal; |
| | 110 | |
| | 111 | if ( instance.onfocus ) |
| | 112 | retVal = ( instance.onfocus( instance, new CKEDITOR.dom.event( ev ) ) !== false ); |
| | 113 | |
| | 114 | // FF2: prevent focus event been bubbled up to editor container, which caused unexpected editor focus. |
| | 115 | if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) |
| | 116 | ev.preventBubble(); |
| | 117 | return retVal; |
| | 118 | }); |
| | 119 | |
| 227 | | ' onkeydown="return CKEDITOR.tools.callFunction(', keydownFn, ', ', index, ', event);"' + |
| 228 | | ' onfocus="return CKEDITOR.tools.callFunction(', focusFn,', ', index, ', event);"' + |
| | 210 | ' onkeydown="return CKEDITOR.tools.callFunction(', keydownFn, ', event);"' + |
| | 211 | ' onfocus="return CKEDITOR.tools.callFunction(', focusFn,', event);"' + |