X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fdialog%2Fplugin.js;h=b41cd1078eaea0ac89b745cac675fe60b4ca6e9d;hp=c052120dcb0c6119e0aff1dd9ee387e97097ae27;hb=8761695d9b70afe75905deaac88f78c1f8aeb32d;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91 diff --git a/_source/plugins/dialog/plugin.js b/_source/plugins/dialog/plugin.js index c052120..b41cd10 100644 --- a/_source/plugins/dialog/plugin.js +++ b/_source/plugins/dialog/plugin.js @@ -272,6 +272,10 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; break; } focusList[ currentIndex ].focus(); + + // Select whole field content. + if ( focusList[ currentIndex ].type == 'text' ) + focusList[ currentIndex ].select(); } function focusKeydownHandler( evt ) @@ -623,6 +627,10 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; CKEDITOR.document.on( 'keydown', accessKeyDownHandler ); CKEDITOR.document.on( 'keyup', accessKeyUpHandler ); + + // Prevent some keys from bubbling up. (#4269) + for ( var event in { keyup :1, keydown :1, keypress :1 } ) + CKEDITOR.document.on( event, preventKeyBubbling ); } else { @@ -749,6 +757,11 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; // Remove access key handlers. CKEDITOR.document.removeListener( 'keydown', accessKeyDownHandler ); CKEDITOR.document.removeListener( 'keyup', accessKeyUpHandler ); + CKEDITOR.document.removeListener( 'keypress', accessKeyUpHandler ); + + // Remove bubbling-prevention handler. (#4269) + for ( var event in { keyup :1, keydown :1, keypress :1 } ) + CKEDITOR.document.removeListener( event, preventKeyBubbling ); var editor = this._.editor; editor.focus(); @@ -1426,6 +1439,9 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; magnetDistance = editor.config.dialog_magnetDistance, margins = skinData[ editor.skinName ].margins || [ 0, 0, 0, 0 ]; + if ( typeof magnetDistance == 'undefined' ) + magnetDistance = 20; + function mouseMoveHandler( evt ) { var dialogSize = dialog.getSize(), @@ -1649,7 +1665,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; '
' ]; @@ -1741,7 +1757,10 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; }, 0 ); scrollFunc(); } - element.setOpacity( editor.config.dialog_backgroundCoverOpacity ); + + var opacity = editor.config.dialog_backgroundCoverOpacity; + element.setOpacity( typeof opacity != 'undefined' ? opacity : 0.5 ); + element.appendTo( CKEDITOR.document.getBody() ); }; @@ -1836,6 +1855,14 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; { }; + // ESC, ENTER + var preventKeyBubblingKeys = { 27 :1, 13 :1 }; + var preventKeyBubbling = function( e ) + { + if ( e.data.getKeystroke() in preventKeyBubblingKeys ) + e.data.stopPropagation(); + }; + (function() { CKEDITOR.ui.dialog = @@ -2714,29 +2741,29 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, /** * The color of the dialog background cover. It should be a valid CSS color * string. + * @name CKEDITOR.config.dialog_backgroundCoverColor * @type String - * @default white + * @default 'white' * @example * config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; */ -CKEDITOR.config.dialog_backgroundCoverColor = 'white'; /** * The opacity of the dialog background cover. It should be a number within the * range [0.0, 1.0]. + * @name CKEDITOR.config.dialog_backgroundCoverOpacity * @type Number * @default 0.5 * @example * config.dialog_backgroundCoverOpacity = 0.7; */ -CKEDITOR.config.dialog_backgroundCoverOpacity = 0.5; /** * The distance of magnetic borders used in moving and resizing dialogs, * measured in pixels. + * @name CKEDITOR.config.dialog_magnetDistance * @type Number * @default 20 * @example * config.dialog_magnetDistance = 30; */ -CKEDITOR.config.dialog_magnetDistance = 20;