Ticket #4812: 4812.patch
File 4812.patch, 3.1 KB (added by , 14 years ago) |
---|
-
_source/plugins/dialog/plugin.js
654 654 parentElement.$.style.zIndex -= Math.floor( this._.editor.config.baseFloatZIndex / 2 ); 655 655 CKEDITOR.dialog._.currentTop = this; 656 656 } 657 658 // Register the Esc hotkeys. 659 registerAccessKey( this, this, '\x1b', null, function() 660 { 661 this.getButton( 'cancel' ) && this.getButton( 'cancel' ).click(); 662 } ); 663 657 664 658 // Reset the hasFocus state. 665 659 this._.hasFocus = false; 666 660 … … 1825 1819 var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey, 1826 1820 alt = evt.data.$.altKey, 1827 1821 shift = evt.data.$.shiftKey, 1828 key = String.fromCharCode( evt.data. $.keyCode),1822 key = String.fromCharCode( evt.data.getKey() ), 1829 1823 keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key]; 1830 1824 1831 1825 if ( !keyProcessor || !keyProcessor.length ) 1832 1826 return; 1833 1827 1834 1828 keyProcessor = keyProcessor[keyProcessor.length - 1]; 1835 keyProcessor.keyup && keyProcessor.keyup.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key ); 1836 evt.data.preventDefault(); 1829 if( keyProcessor.keyup ) 1830 { 1831 keyProcessor.keyup.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key ); 1832 evt.data.preventDefault(); 1833 } 1837 1834 }; 1838 1835 1839 1836 var registerAccessKey = function( uiElement, dialog, key, downFunc, upFunc ) -
_source/plugins/dialogui/plugin.js
207 207 if ( elementDefinition.size ) 208 208 attributes.size = elementDefinition.size; 209 209 210 // If user presses Enter in a text box, it implies clicking OKfor the dialog.211 var me = this, keyPressedOnMe = false ;210 // If user presses Enter/Esc in a text box, it implies clicking OK/Cancel button for the dialog. 211 var me = this, keyPressedOnMe = false, keyMap = { 13: 'ok', 27: 'cancel' }; 212 212 dialog.on( 'load', function() 213 213 { 214 214 me.getInputElement().on( 'keydown', function( evt ) 215 215 { 216 if ( evt.data.getKeystroke() == 13)216 if ( evt.data.getKeystroke() in keyMap ) 217 217 keyPressedOnMe = true; 218 218 } ); 219 219 220 220 // Lower the priority this 'keyup' since 'ok' will close the dialog.(#3749) 221 me.getInputElement().on( 'key up', function( evt )221 me.getInputElement().on( 'keypress', function( evt ) 222 222 { 223 if ( evt.data.getKeystroke() == 13 && keyPressedOnMe ) 223 var keyCode = evt.data.getKeystroke(); 224 if ( keyCode in keyMap && keyPressedOnMe ) 224 225 { 225 dialog.getButton( 'ok' ) && setTimeout( function () 226 { 227 dialog.getButton( 'ok' ).click(); 228 }, 0 ); 226 var button = dialog.getButton( keyMap[ keyCode ] ); 227 button && button.click(); 229 228 keyPressedOnMe = false; 230 229 } 231 230 }, null, null, 1000 );