Ticket #7266: 7266.patch
File 7266.patch, 2.0 KB (added by , 12 years ago) |
---|
-
_source/plugins/dialog/plugin.js
93 93 } 94 94 } 95 95 96 // Handle dialog element validation state UI changes. 97 function handleFieldValidated( isValid, msg ) 98 { 99 var input = this.getInputElement(); 100 if ( input ) 101 { 102 isValid ? input.removeAttribute( 'aria-invalid' ) 103 : input.setAttribute( 'aria-invalid', true ); 104 } 105 106 this.fire( 'validated', { valid : isValid, msg : msg } ); 107 } 108 109 function resetField() 110 { 111 var input = this.getInputElement(); 112 input.removeAttribute( 'aria-invalid' ); 113 } 114 115 96 116 /** 97 117 * This is the base class for runtime dialog objects. An instance of this 98 118 * class represents a single named dialog for a single editor instance. … … 273 293 { 274 294 if ( item.validate ) 275 295 { 276 var isValid = item.validate( this ); 296 var retval = item.validate( this ), 297 isValid = retval === true ; 277 298 278 if ( typeof isValid == 'string')299 if ( !isValid ) 279 300 { 280 alert( isValid );281 isValid = false;282 }283 284 if ( isValid === false )285 {286 301 if ( item.select ) 287 302 item.select(); 288 303 else … … 290 305 291 306 evt.data.hide = false; 292 307 evt.stop(); 293 return true;294 308 } 309 310 handleFieldValidated.call( item, isValid, typeof retval == 'string' ? retval : undefined ); 311 return !isValid; 295 312 } 296 313 }); 297 314 }, this, null, 0 ); … … 454 471 dialogElement.removeListener( 'keydown', focusKeydownHandler ); 455 472 if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) 456 473 dialogElement.removeListener( 'keypress', focusKeyPressHandler ); 474 475 // Reset fields state when closing dialog. 476 iterContents( function( item ) { resetField.apply( item ); } ); 457 477 } ); 458 478 this.on( 'iframeAdded', function( evt ) 459 479 {