X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fimage%2Fdialogs%2Fimage.js;h=c65a8aa1c0c8e1e15249b661699f9365ad9d9ce6;hp=233a291915f90ff84cbd334e61643130e217e7ef;hb=8761695d9b70afe75905deaac88f78c1f8aeb32d;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91 diff --git a/_source/plugins/image/dialogs/image.js b/_source/plugins/image/dialogs/image.js index 233a291..c65a8aa 100644 --- a/_source/plugins/image/dialogs/image.js +++ b/_source/plugins/image/dialogs/image.js @@ -258,6 +258,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Refresh LockRatio button switchLockRatio ( this, true ); } + + // Dont show preview if no URL given. + if ( !CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtUrl' ) ) ) + { + this.preview.removeAttribute( 'src' ); + this.preview.setStyle( 'display', 'none' ); + } }, onOk : function() { @@ -403,6 +410,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license dialog = this.getDialog(); var original = dialog.originalElement; + dialog.preview.removeStyle( 'display' ); + original.setCustomData( 'isReady', 'false' ); // Show loader var loader = CKEDITOR.document.getById( 'ImagePreviewLoader' ); @@ -417,6 +426,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license updatePreview( dialog ); } + // Dont show preview if no URL given. + else if ( dialog.preview ) + { + dialog.preview.removeAttribute( 'src' ); + dialog.preview.setStyle( 'display', 'none' ); + } }, setup : function( type, element ) { @@ -432,6 +447,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license setTimeout( function() { field.setValue( url ); // And call this.onChange() + // Manually set the initial value.(#4191) + field.setInitValue(); field.focus(); }, 0 ); } @@ -448,7 +465,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license element.setAttribute( 'src', '' ); // If removeAttribute doesn't work. element.removeAttribute( 'src' ); } - } + }, + validate : CKEDITOR.dialog.validate.notEmpty( editor.lang.image.urlMissing ) }, { type : 'button',