IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
240 | 240 | if ( elementDefinition.inputStyle ) |
241 | 241 | attributes.style = elementDefinition.inputStyle; |
242 | 242 | |
243 | | // If user presses Enter in a text box, it implies clicking OK for the dialog. |
244 | | var me = this, keyPressedOnMe = false; |
245 | | dialog.on( 'load', function() |
246 | | { |
247 | | me.getInputElement().on( 'keydown', function( evt ) |
248 | | { |
249 | | if ( evt.data.getKeystroke() == 13 ) |
250 | | keyPressedOnMe = true; |
251 | | } ); |
252 | | |
253 | | // Lower the priority this 'keyup' since 'ok' will close the dialog.(#3749) |
254 | | me.getInputElement().on( 'keyup', function( evt ) |
255 | | { |
256 | | if ( evt.data.getKeystroke() == 13 && keyPressedOnMe ) |
257 | | { |
258 | | dialog.getButton( 'ok' ) && setTimeout( function () |
259 | | { |
260 | | dialog.getButton( 'ok' ).click(); |
261 | | }, 0 ); |
262 | | keyPressedOnMe = false; |
263 | | } |
264 | | }, null, null, 1000 ); |
265 | | } ); |
266 | | |
267 | 243 | /** @ignore */ |
268 | 244 | var innerHTML = function() |
269 | 245 | { |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
397 | 397 | this.changeFocus = changeFocus; |
398 | 398 | |
399 | 399 | |
400 | | function focusKeydownHandler( evt ) |
| 400 | function keydownHandler( evt ) |
401 | 401 | { |
402 | 402 | // If I'm not the top dialog, ignore. |
403 | 403 | if ( me != CKEDITOR.dialog._.currentTop ) |
… |
… |
|
450 | 450 | changeFocus( 1 ); |
451 | 451 | processed = 1; |
452 | 452 | } |
| 453 | // If user presses enter key in a text box, it implies clicking OK for the dialog. |
| 454 | else if ( keystroke == 13 ) |
| 455 | { |
| 456 | // Find the currently focused element. |
| 457 | var focused; |
| 458 | this.foreach( function( widget ) |
| 459 | { |
| 460 | if ( this._.currentFocusIndex == widget.focusIndex ) |
| 461 | focused = widget; |
| 462 | }); |
453 | 463 | |
| 464 | if ( focused && focused.type == 'text' ) |
| 465 | { |
| 466 | var okBtn = this.getButton( 'ok' ); |
| 467 | CKEDITOR.tools.setTimeout( okBtn.click, 0, okBtn ); |
| 468 | } |
| 469 | } |
| 470 | |
454 | 471 | if ( processed ) |
455 | 472 | { |
456 | 473 | evt.stop(); |
… |
… |
|
458 | 475 | } |
459 | 476 | } |
460 | 477 | |
461 | | function focusKeyPressHandler( evt ) |
| 478 | function keyPressHandler( evt ) |
462 | 479 | { |
463 | 480 | processed && evt.data.preventDefault(); |
464 | 481 | } |
… |
… |
|
467 | 484 | // Add the dialog keyboard handlers. |
468 | 485 | this.on( 'show', function() |
469 | 486 | { |
470 | | dialogElement.on( 'keydown', focusKeydownHandler, this, null, 0 ); |
| 487 | dialogElement.on( 'keydown', keydownHandler, this, null, 0 ); |
471 | 488 | // Some browsers instead, don't cancel key events in the keydown, but in the |
472 | 489 | // keypress. So we must do a longer trip in those cases. (#4531) |
473 | 490 | if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) |
474 | | dialogElement.on( 'keypress', focusKeyPressHandler, this ); |
| 491 | dialogElement.on( 'keypress', keyPressHandler, this ); |
475 | 492 | |
476 | 493 | } ); |
477 | 494 | this.on( 'hide', function() |
478 | 495 | { |
479 | | dialogElement.removeListener( 'keydown', focusKeydownHandler ); |
| 496 | dialogElement.removeListener( 'keydown', keydownHandler ); |
480 | 497 | if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) |
481 | | dialogElement.removeListener( 'keypress', focusKeyPressHandler ); |
| 498 | dialogElement.removeListener( 'keypress', keyPressHandler ); |
482 | 499 | |
483 | 500 | // Reset fields state when closing dialog. |
484 | 501 | iterContents( function( item ) { resetField.apply( item ); } ); |
… |
… |
|
486 | 503 | this.on( 'iframeAdded', function( evt ) |
487 | 504 | { |
488 | 505 | var doc = new CKEDITOR.dom.document( evt.data.iframe.$.contentWindow.document ); |
489 | | doc.on( 'keydown', focusKeydownHandler, this, null, 0 ); |
| 506 | doc.on( 'keydown', keydownHandler, this, null, 0 ); |
490 | 507 | } ); |
491 | 508 | |
492 | 509 | // Auto-focus logic in dialog. |