X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdialogui%2Fplugin.js;h=888c015445e60bcb8eb127b237cf43ba82d9d9e9;hb=a272c66d841421f8bf933c16535bdcde1c4649fc;hp=c68c35bbef8516817db38a55fea557538c4dd345;hpb=f0610347140239143439a511ee2bd48cb784f470;p=ckeditor.git diff --git a/_source/plugins/dialogui/plugin.js b/_source/plugins/dialogui/plugin.js index c68c35b..888c015 100644 --- a/_source/plugins/dialogui/plugin.js +++ b/_source/plugins/dialogui/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -157,7 +157,7 @@ CKEDITOR.plugins.add( 'dialogui' ); if ( elementDefinition.labelLayout != 'horizontal' ) html.push( '', @@ -224,7 +224,7 @@ CKEDITOR.plugins.add( 'dialogui' ); initPrivateObject.call( this, elementDefinition ); var domId = this._.inputId = CKEDITOR.tools.getNextId() + '_textInput', - attributes = { 'class' : 'cke_dialog_ui_input_' + elementDefinition.type, id : domId, type : 'text' }, + attributes = { 'class' : 'cke_dialog_ui_input_' + elementDefinition.type, id : domId, type : elementDefinition.type }, i; // Set the validator, if any. @@ -240,30 +240,6 @@ CKEDITOR.plugins.add( 'dialogui' ); if ( elementDefinition.inputStyle ) attributes.style = elementDefinition.inputStyle; - // If user presses Enter in a text box, it implies clicking OK for the dialog. - var me = this, keyPressedOnMe = false; - dialog.on( 'load', function() - { - me.getInputElement().on( 'keydown', function( evt ) - { - if ( evt.data.getKeystroke() == 13 ) - keyPressedOnMe = true; - } ); - - // Lower the priority this 'keyup' since 'ok' will close the dialog.(#3749) - me.getInputElement().on( 'keyup', function( evt ) - { - if ( evt.data.getKeystroke() == 13 && keyPressedOnMe ) - { - dialog.getButton( 'ok' ) && setTimeout( function () - { - dialog.getButton( 'ok' ).click(); - }, 0 ); - keyPressedOnMe = false; - } - }, null, null, 1000 ); - } ); - /** @ignore */ var innerHTML = function() { @@ -475,7 +451,7 @@ CKEDITOR.plugins.add( 'dialogui' ); item[0] ); inputHtmlList.push( inputHtml.join( '' ) ); } - new CKEDITOR.ui.dialog.hbox( dialog, [], inputHtmlList, html ); + new CKEDITOR.ui.dialog.hbox( dialog, children, inputHtmlList, html ); return html.join( '' ); }; @@ -677,6 +653,7 @@ CKEDITOR.plugins.add( 'dialogui' ); ' frameborder="0"' + ' allowtransparency="0"' + ' class="cke_dialog_ui_input_file"' + + ' role="presentation"' + ' id="', _.frameId, '"' + ' title="', elementDefinition.label, '"' + ' src="javascript:void(' ]; @@ -855,7 +832,9 @@ CKEDITOR.plugins.add( 'dialogui' ); var innerHTML = function() { var html = []; - legendLabel && html.push( '' + legendLabel + '' ); + legendLabel && html.push( '' + legendLabel + '' ); for ( var i = 0; i < childHtmlList.length; i++ ) html.push( childHtmlList[ i ] ); return html.join( '' ); @@ -969,7 +948,13 @@ CKEDITOR.plugins.add( 'dialogui' ); /** @ignore */ onClick : function( dialog, func ) { - this.on( 'click', func ); + this.on( 'click', function() + { + // Some browsers (Chrome, IE8, IE7 compat mode) don't move + // focus to clicked button. Force this. + this.getElement().focus(); + func.apply( this, arguments ); + }); } }, true ), @@ -1197,7 +1182,7 @@ CKEDITOR.plugins.add( 'dialogui' ); { onChange : function( dialog, func ) { - if ( !CKEDITOR.env.ie ) + if ( !CKEDITOR.env.ie || ( CKEDITOR.env.version > 8 ) ) return commonEventProcessors.onChange.apply( this, arguments ); else { @@ -1435,11 +1420,17 @@ CKEDITOR.plugins.add( 'dialogui' ); if ( elementDefinition.size ) size = elementDefinition.size - ( CKEDITOR.env.ie ? 7 : 0 ); // "Browse" button is bigger in IE. + var inputId = _.frameId + '_input'; + frameDocument.$.write( [ '', '
', - '', + CKEDITOR.tools.htmlEncode( elementDefinition.label ), + '', + '