JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.0.1
[ckeditor.git] / _source / plugins / image / dialogs / image.js
index 233a291..c65a8aa 100644 (file)
@@ -258,6 +258,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                        // Refresh LockRatio button\r
                                        switchLockRatio ( this, true );\r
                                }\r
+\r
+                               // Dont show preview if no URL given.\r
+                               if ( !CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtUrl' ) ) )\r
+                               {\r
+                                       this.preview.removeAttribute( 'src' );\r
+                                       this.preview.setStyle( 'display', 'none' );\r
+                               }\r
                        },\r
                        onOk : function()\r
                        {\r
@@ -403,6 +410,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                        dialog = this.getDialog();\r
                                                                                                        var original = dialog.originalElement;\r
 \r
+                                                                                                       dialog.preview.removeStyle( 'display' );\r
+\r
                                                                                                        original.setCustomData( 'isReady', 'false' );\r
                                                                                                        // Show loader\r
                                                                                                        var loader = CKEDITOR.document.getById( 'ImagePreviewLoader' );\r
@@ -417,6 +426,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                                                                                                        updatePreview( dialog );\r
                                                                                                }\r
+                                                                                               // Dont show preview if no URL given.\r
+                                                                                               else if ( dialog.preview )\r
+                                                                                               {\r
+                                                                                                       dialog.preview.removeAttribute( 'src' );\r
+                                                                                                       dialog.preview.setStyle( 'display', 'none' );\r
+                                                                                               }\r
                                                                                        },\r
                                                                                        setup : function( type, element )\r
                                                                                        {\r
@@ -432,6 +447,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                        setTimeout( function()\r
                                                                                                                {\r
                                                                                                                        field.setValue( url );          // And call this.onChange()\r
+                                                                                                                       // Manually set the initial value.(#4191)\r
+                                                                                                                       field.setInitValue();\r
                                                                                                                        field.focus();\r
                                                                                                                }, 0 );\r
                                                                                                }\r
@@ -448,7 +465,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                        element.setAttribute( 'src', '' );      // If removeAttribute doesn't work.\r
                                                                                                        element.removeAttribute( 'src' );\r
                                                                                                }\r
-                                                                                       }\r
+                                                                                       },\r
+                                                                                       validate : CKEDITOR.dialog.validate.notEmpty( editor.lang.image.urlMissing )\r
                                                                                },\r
                                                                                {\r
                                                                                        type : 'button',\r