JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.2
[ckeditor.git] / _source / plugins / image / dialogs / image.js
index 4ebfd16..8902f9b 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -115,17 +115,19 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                var switchLockRatio = function( dialog, value )\r
                {\r
+                       if ( !dialog.getContentElement( 'info', 'ratioLock' ) )\r
+                               return null;\r
+\r
                        var oImageOriginal = dialog.originalElement;\r
 \r
                        // Dialog may already closed. (#5505)\r
                        if( !oImageOriginal )\r
                                return null;\r
 \r
-                       var ratioButton = CKEDITOR.document.getById( btnLockSizesId );\r
-\r
-                       if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' )\r
+                       // Check image ratio and original image ratio, but respecting user's preference.\r
+                       if ( value == 'check' )\r
                        {\r
-                               if ( value == 'check' )                 // Check image ratio and original image ratio.\r
+                               if ( !dialog.userlockRatio && oImageOriginal.getCustomData( 'isReady' ) == 'true'  )\r
                                {\r
                                        var width = dialog.getValueOf( 'info', 'txtWidth' ),\r
                                                height = dialog.getValueOf( 'info', 'txtHeight' ),\r
@@ -141,24 +143,29 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        dialog.lockRatio = true;\r
                                        }\r
                                }\r
-                               else if ( value != undefined )\r
-                                       dialog.lockRatio = value;\r
-                               else\r
-                                       dialog.lockRatio = !dialog.lockRatio;\r
                        }\r
-                       else if ( value != 'check' )            // I can't lock ratio if ratio is unknown.\r
-                               dialog.lockRatio = false;\r
+                       else if ( value != undefined )\r
+                               dialog.lockRatio = value;\r
+                       else\r
+                       {\r
+                               dialog.userlockRatio = 1;\r
+                               dialog.lockRatio = !dialog.lockRatio;\r
+                       }\r
 \r
+                       var ratioButton = CKEDITOR.document.getById( btnLockSizesId );\r
                        if ( dialog.lockRatio )\r
                                ratioButton.removeClass( 'cke_btn_unlocked' );\r
                        else\r
                                ratioButton.addClass( 'cke_btn_unlocked' );\r
 \r
-                       var lang = dialog._.editor.lang.image,\r
-                               label =  lang[  dialog.lockRatio ? 'unlockRatio' : 'lockRatio' ];\r
+                       ratioButton.setAttribute( 'aria-checked', dialog.lockRatio );\r
 \r
-                       ratioButton.setAttribute( 'title', label );\r
-                       ratioButton.getFirst().setText( label );\r
+                       // Ratio button hc presentation - WHITE SQUARE / BLACK SQUARE\r
+                       if ( CKEDITOR.env.hc )\r
+                       {\r
+                               var icon = ratioButton.getChild( 0 );\r
+                               icon.setHtml(  dialog.lockRatio ? CKEDITOR.env.ie ? '\u25A0': '\u25A3' : CKEDITOR.env.ie ? '\u25A1' : '\u25A2' );\r
+                       }\r
 \r
                        return dialog.lockRatio;\r
                };\r
@@ -168,8 +175,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        var oImageOriginal = dialog.originalElement;\r
                        if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' )\r
                        {\r
-                               dialog.setValueOf( 'info', 'txtWidth', oImageOriginal.$.width );\r
-                               dialog.setValueOf( 'info', 'txtHeight', oImageOriginal.$.height );\r
+                               var widthField = dialog.getContentElement( 'info', 'txtWidth' ),\r
+                                       heightField = dialog.getContentElement( 'info', 'txtHeight' );\r
+                               widthField && widthField.setValue( oImageOriginal.$.width );\r
+                               heightField && heightField.setValue( oImageOriginal.$.height );\r
                        }\r
                        updatePreview( dialog );\r
                };\r
@@ -196,7 +205,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                        var dialog = this.getDialog(),\r
                                value = '',\r
-                               dimension = (( this.id == 'txtWidth' )? 'width' : 'height' ),\r
+                               dimension = this.id == 'txtWidth' ? 'width' : 'height',\r
                                size = element.getAttribute( dimension );\r
 \r
                        if ( size )\r
@@ -250,7 +259,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        switchLockRatio( this, false ); // Unlock.\r
                };\r
 \r
-               var numbering = function( id ){ return id + CKEDITOR.tools.getNextNumber(); },\r
+               var numbering = function( id )\r
+                       {\r
+                               return CKEDITOR.tools.getNextId() + '_' + id;\r
+                       },\r
                        btnLockSizesId = numbering( 'btnLockSizes' ),\r
                        btnResetSizeId = numbering( 'btnResetSize' ),\r
                        imagePreviewLoaderId = numbering( 'ImagePreviewLoader' ),\r
@@ -259,9 +271,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        previewImageId = numbering( 'previewImage' );\r
 \r
                return {\r
-                       title : ( dialogType == 'image' ) ? editor.lang.image.title : editor.lang.image.titleButton,\r
+                       title : editor.lang.image[ dialogType == 'image' ? 'title' : 'titleButton' ],\r
                        minWidth : 420,\r
-                       minHeight : 310,\r
+                       minHeight : 360,\r
                        onShow : function()\r
                        {\r
                                this.imageElement = false;\r
@@ -272,6 +284,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                this.linkEditMode = false;\r
 \r
                                this.lockRatio = true;\r
+                               this.userlockRatio = 0;\r
                                this.dontResetSize = false;\r
                                this.firstLoad = true;\r
                                this.addLink = false;\r
@@ -316,7 +329,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                this.setupContent( LINK, link );\r
                                }\r
 \r
-                               if ( element && element.getName() == 'img' && !element.getAttribute( '_cke_realelement' )\r
+                               if ( element && element.getName() == 'img' && !element.data( 'cke-realelement' )\r
                                        || element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'image' )\r
                                {\r
                                        this.imageEditMode = element.getName();\r
@@ -332,13 +345,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                                        // Fill out all fields.\r
                                        this.setupContent( IMAGE, this.imageElement );\r
-\r
-                                       // Refresh LockRatio button\r
-                                       switchLockRatio ( this, true );\r
                                }\r
                                else\r
                                        this.imageElement =  editor.document.createElement( 'img' );\r
 \r
+                               // Refresh LockRatio button\r
+                               switchLockRatio ( this, true );\r
+\r
                                // Dont show preview if no URL given.\r
                                if ( !CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtUrl' ) ) )\r
                                {\r
@@ -416,11 +429,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                //Insert a new Link.\r
                                                if ( !this.linkEditMode )\r
                                                {\r
-                                                       editor.insertElement(this.linkElement);\r
-                                                       this.linkElement.append(this.imageElement, false);\r
+                                                       editor.insertElement( this.linkElement );\r
+                                                       this.linkElement.append( this.imageElement, false );\r
                                                }\r
                                                else     //Link already exists, image not.\r
-                                                       editor.insertElement(this.imageElement );\r
+                                                       editor.insertElement( this.imageElement );\r
                                        }\r
                                        else\r
                                                editor.insertElement( this.imageElement );\r
@@ -446,8 +459,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                if ( dialogType != 'image' )\r
                                        this.hidePage( 'Link' );                //Hide Link tab.\r
                                var doc = this._.element.getDocument();\r
-                               this.addFocusable( doc.getById( btnResetSizeId ), 5 );\r
-                               this.addFocusable( doc.getById( btnLockSizesId ), 5 );\r
+\r
+                               if ( this.getContentElement( 'info', 'ratioLock' ) )\r
+                               {\r
+                                       this.addFocusable( doc.getById( btnResetSizeId ), 5 );\r
+                                       this.addFocusable( doc.getById( btnLockSizesId ), 5 );\r
+                               }\r
 \r
                                this.commitContent = commitContent;\r
                        },\r
@@ -530,7 +547,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                        {\r
                                                                                                if ( type == IMAGE )\r
                                                                                                {\r
-                                                                                                       var url = element.getAttribute( '_cke_saved_src' ) || element.getAttribute( 'src' );\r
+                                                                                                       var url = element.data( 'cke-saved-src' ) || element.getAttribute( 'src' );\r
                                                                                                        var field = this;\r
 \r
                                                                                                        this.getDialog().dontResetSize = true;\r
@@ -538,15 +555,14 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                        field.setValue( url );          // And call this.onChange()\r
                                                                                                        // Manually set the initial value.(#4191)\r
                                                                                                        field.setInitValue();\r
-                                                                                                       field.focus();\r
                                                                                                }\r
                                                                                        },\r
                                                                                        commit : function( type, element )\r
                                                                                        {\r
                                                                                                if ( type == IMAGE && ( this.getValue() || this.isChanged() ) )\r
                                                                                                {\r
-                                                                                                       element.setAttribute( '_cke_saved_src', decodeURI( this.getValue() ) );\r
-                                                                                                       element.setAttribute( 'src', decodeURI( this.getValue() ) );\r
+                                                                                                       element.data( 'cke-saved-src', this.getValue() );\r
+                                                                                                       element.setAttribute( 'src', this.getValue() );\r
                                                                                                }\r
                                                                                                else if ( type == CLEANUP )\r
                                                                                                {\r
@@ -575,7 +591,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        id : 'txtAlt',\r
                                                        type : 'text',\r
                                                        label : editor.lang.image.alt,\r
-                                                       accessKey : 'A',\r
+                                                       accessKey : 'T',\r
                                                        'default' : '',\r
                                                        onChange : function()\r
                                                        {\r
@@ -605,17 +621,16 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                },\r
                                                {\r
                                                        type : 'hbox',\r
-                                                       widths : [ '140px', '240px' ],\r
                                                        children :\r
                                                        [\r
                                                                {\r
+                                                                       id : 'basic',\r
                                                                        type : 'vbox',\r
-                                                                       padding : 10,\r
                                                                        children :\r
                                                                        [\r
                                                                                {\r
                                                                                        type : 'hbox',\r
-                                                                                       widths : [ '70%', '30%' ],\r
+                                                                                       widths : [ '50%', '50%' ],\r
                                                                                        children :\r
                                                                                        [\r
                                                                                                {\r
@@ -627,8 +642,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                                        type : 'text',\r
                                                                                                                        width: '40px',\r
                                                                                                                        id : 'txtWidth',\r
-                                                                                                                       labelLayout : 'horizontal',\r
-                                                                                                                       label : editor.lang.image.width,\r
+                                                                                                                       label : editor.lang.common.width,\r
                                                                                                                        onKeyUp : onSizeChange,\r
                                                                                                                        onChange : function()\r
                                                                                                                        {\r
@@ -636,10 +650,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                                        },\r
                                                                                                                        validate : function()\r
                                                                                                                        {\r
-                                                                                                                               var aMatch  =  this.getValue().match( regexGetSizeOrEmpty );\r
-                                                                                                                               if ( !aMatch )\r
-                                                                                                                                       alert( editor.lang.image.validateWidth );\r
-                                                                                                                               return !!aMatch;\r
+                                                                                                                               var aMatch  =  this.getValue().match( regexGetSizeOrEmpty ),\r
+                                                                                                                                       isValid = !!( aMatch && parseInt( aMatch[1], 10 ) !== 0 );\r
+                                                                                                                               if ( !isValid )\r
+                                                                                                                                       alert( editor.lang.common.invalidWidth );\r
+                                                                                                                               return isValid;\r
                                                                                                                        },\r
                                                                                                                        setup : setupDimension,\r
                                                                                                                        commit : function( type, element, internalCommit )\r
@@ -649,7 +664,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                                                {\r
                                                                                                                                        if ( value )\r
                                                                                                                                                element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) );\r
-                                                                                                                                       else if ( !value && this.isChanged( ) )\r
+                                                                                                                                       else\r
                                                                                                                                                element.removeStyle( 'width' );\r
 \r
                                                                                                                                        !internalCommit && element.removeAttribute( 'width' );\r
@@ -664,7 +679,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                                                                        element.setStyle( 'width',  oImageOriginal.$.width + 'px');\r
                                                                                                                                        }\r
                                                                                                                                        else\r
-                                                                                                                                               element.setStyle( 'width', value + 'px');\r
+                                                                                                                                               element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) );\r
                                                                                                                                }\r
                                                                                                                                else if ( type == CLEANUP )\r
                                                                                                                                {\r
@@ -677,8 +692,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                                        type : 'text',\r
                                                                                                                        id : 'txtHeight',\r
                                                                                                                        width: '40px',\r
-                                                                                                                       labelLayout : 'horizontal',\r
-                                                                                                                       label : editor.lang.image.height,\r
+                                                                                                                       label : editor.lang.common.height,\r
                                                                                                                        onKeyUp : onSizeChange,\r
                                                                                                                        onChange : function()\r
                                                                                                                        {\r
@@ -686,10 +700,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                                        },\r
                                                                                                                        validate : function()\r
                                                                                                                        {\r
-                                                                                                                               var aMatch = this.getValue().match( regexGetSizeOrEmpty );\r
-                                                                                                                               if ( !aMatch )\r
-                                                                                                                                       alert( editor.lang.image.validateHeight );\r
-                                                                                                                               return !!aMatch;\r
+                                                                                                                               var aMatch = this.getValue().match( regexGetSizeOrEmpty ),\r
+                                                                                                                                       isValid = !!( aMatch && parseInt( aMatch[1], 10 ) !== 0 );\r
+                                                                                                                               if ( !isValid )\r
+                                                                                                                                       alert( editor.lang.common.invalidHeight );\r
+                                                                                                                               return isValid;\r
                                                                                                                        },\r
                                                                                                                        setup : setupDimension,\r
                                                                                                                        commit : function( type, element, internalCommit )\r
@@ -699,11 +714,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                                                {\r
                                                                                                                                        if ( value )\r
                                                                                                                                                element.setStyle( 'height', CKEDITOR.tools.cssLength( value ) );\r
-                                                                                                                                       else if ( !value && this.isChanged( ) )\r
+                                                                                                                                       else\r
                                                                                                                                                element.removeStyle( 'height' );\r
 \r
-                                                                                                                                       if ( !internalCommit && type == IMAGE )\r
-                                                                                                                                               element.removeAttribute( 'height' );\r
+                                                                                                                                       !internalCommit && element.removeAttribute( 'height' );\r
                                                                                                                                }\r
                                                                                                                                else if ( type == PREVIEW )\r
                                                                                                                                {\r
@@ -715,7 +729,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                                                                        element.setStyle( 'height', oImageOriginal.$.height + 'px' );\r
                                                                                                                                        }\r
                                                                                                                                        else\r
-                                                                                                                                               element.setStyle( 'height', value + 'px' );\r
+                                                                                                                                               element.setStyle( 'height',  CKEDITOR.tools.cssLength( value ) );\r
                                                                                                                                }\r
                                                                                                                                else if ( type == CLEANUP )\r
                                                                                                                                {\r
@@ -727,8 +741,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                        ]\r
                                                                                                },\r
                                                                                                {\r
+                                                                                                       id : 'ratioLock',\r
                                                                                                        type : 'html',\r
-                                                                                                       style : 'margin-top:10px;width:40px;height:40px;',\r
+                                                                                                       style : 'margin-top:30px;width:40px;height:40px;',\r
                                                                                                        onLoad : function()\r
                                                                                                        {\r
                                                                                                                // Activate Reset button\r
@@ -736,10 +751,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                                        ratioButton = CKEDITOR.document.getById( btnLockSizesId );\r
                                                                                                                if ( resetButton )\r
                                                                                                                {\r
-                                                                                                                       resetButton.on( 'click', function(evt)\r
+                                                                                                                       resetButton.on( 'click', function( evt )\r
                                                                                                                                {\r
                                                                                                                                        resetSize( this );\r
-                                                                                                                                       evt.data.preventDefault();\r
+                                                                                                                                       evt.data && evt.data.preventDefault();\r
                                                                                                                                }, this.getDialog() );\r
                                                                                                                        resetButton.on( 'mouseover', function()\r
                                                                                                                                {\r
@@ -768,7 +783,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                                                                        updatePreview( this );\r
                                                                                                                                                }\r
                                                                                                                                        }\r
-                                                                                                                                       evt.data.preventDefault();\r
+                                                                                                                                       evt.data && evt.data.preventDefault();\r
                                                                                                                                }, this.getDialog() );\r
                                                                                                                        ratioButton.on( 'mouseover', function()\r
                                                                                                                                {\r
@@ -781,8 +796,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                                }\r
                                                                                                        },\r
                                                                                                        html : '<div>'+\r
-                                                                                                               '<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.unlockRatio +\r
-                                                                                                               '" class="cke_btn_locked" id="' + btnLockSizesId + '" role="button"><span class="cke_label">' + editor.lang.image.unlockRatio + '</span></a>' +\r
+                                                                                                               '<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.lockRatio +\r
+                                                                                                               '" class="cke_btn_locked" id="' + btnLockSizesId + '" role="checkbox"><span class="cke_icon"></span><span class="cke_label">' + editor.lang.image.lockRatio + '</span></a>' +\r
                                                                                                                '<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.resetSize +\r
                                                                                                                '" class="cke_btn_reset" id="' + btnResetSizeId + '" role="button"><span class="cke_label">' + editor.lang.image.resetSize + '</span></a>'+\r
                                                                                                                '</div>'\r
@@ -798,7 +813,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                        type : 'text',\r
                                                                                                        id : 'txtBorder',\r
                                                                                                        width: '60px',\r
-                                                                                                       labelLayout : 'horizontal',\r
                                                                                                        label : editor.lang.image.border,\r
                                                                                                        'default' : '',\r
                                                                                                        onKeyUp : function()\r
@@ -855,7 +869,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                        type : 'text',\r
                                                                                                        id : 'txtHSpace',\r
                                                                                                        width: '60px',\r
-                                                                                                       labelLayout : 'horizontal',\r
                                                                                                        label : editor.lang.image.hSpace,\r
                                                                                                        'default' : '',\r
                                                                                                        onKeyUp : function()\r
@@ -919,7 +932,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                        type : 'text',\r
                                                                                                        id : 'txtVSpace',\r
                                                                                                        width : '60px',\r
-                                                                                                       labelLayout : 'horizontal',\r
                                                                                                        label : editor.lang.image.vSpace,\r
                                                                                                        'default' : '',\r
                                                                                                        onKeyUp : function()\r
@@ -981,16 +993,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                                {\r
                                                                                                        id : 'cmbAlign',\r
                                                                                                        type : 'select',\r
-                                                                                                       labelLayout : 'horizontal',\r
                                                                                                        widths : [ '35%','65%' ],\r
                                                                                                        style : 'width:90px',\r
-                                                                                                       label : editor.lang.image.align,\r
+                                                                                                       label : editor.lang.common.align,\r
                                                                                                        'default' : '',\r
                                                                                                        items :\r
                                                                                                        [\r
                                                                                                                [ editor.lang.common.notSet , ''],\r
-                                                                                                               [ editor.lang.image.alignLeft , 'left'],\r
-                                                                                                               [ editor.lang.image.alignRight , 'right']\r
+                                                                                                               [ editor.lang.common.alignLeft , 'left'],\r
+                                                                                                               [ editor.lang.common.alignRight , 'right']\r
                                                                                                                // Backward compatible with v2 on setup when specified as attribute value,\r
                                                                                                                // while these values are no more available as select options.\r
                                                                                                                //      [ editor.lang.image.alignAbsBottom , 'absBottom'],\r
@@ -1062,6 +1073,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                        [\r
                                                                                {\r
                                                                                        type : 'html',\r
+                                                                                       id : 'htmlPreview',\r
                                                                                        style : 'width:95%;',\r
                                                                                        html : '<div>' + CKEDITOR.tools.htmlEncode( editor.lang.common.preview ) +'<br>'+\r
                                                                                        '<div id="' + imagePreviewLoaderId + '" class="ImagePreviewLoader" style="display:none"><div class="loading">&nbsp;</div></div>'+\r
@@ -1096,7 +1108,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        {\r
                                                                if ( type == LINK )\r
                                                                {\r
-                                                                       var href = element.getAttribute( '_cke_saved_href' );\r
+                                                                       var href = element.data( 'cke-saved-href' );\r
                                                                        if ( !href )\r
                                                                                href = element.getAttribute( 'href' );\r
                                                                        this.setValue( href );\r
@@ -1108,9 +1120,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                {\r
                                                                        if ( this.getValue() || this.isChanged() )\r
                                                                        {\r
-                                                                               element.setAttribute( '_cke_saved_href', decodeURI( this.getValue() ) );\r
-                                                                               element.setAttribute( 'href', 'javascript:void(0)/*' +\r
-                                                                                       CKEDITOR.tools.getNextNumber() + '*/' );\r
+                                                                               var url = decodeURI( this.getValue() );\r
+                                                                               element.data( 'cke-saved-href', url );\r
+                                                                               element.setAttribute( 'href', url );\r
 \r
                                                                                if ( this.getValue() || !editor.config.image_removeLinkByEmptyURL )\r
                                                                                        this.getDialog().addLink = true;\r
@@ -1125,7 +1137,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        {\r
                                                                action : 'Browse',\r
                                                                target: 'Link:txtUrl',\r
-                                                               url: editor.config.filebrowserImageBrowseLinkUrl || editor.config.filebrowserBrowseUrl\r
+                                                               url: editor.config.filebrowserImageBrowseLinkUrl\r
                                                        },\r
                                                        style : 'float:right',\r
                                                        hidden : true,\r
@@ -1147,7 +1159,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        setup : function( type, element )\r
                                                        {\r
                                                                if ( type == LINK )\r
-                                                                       this.setValue( element.getAttribute( 'target' ) );\r
+                                                                       this.setValue( element.getAttribute( 'target' ) || '' );\r
                                                        },\r
                                                        commit : function( type, element )\r
                                                        {\r
@@ -1337,6 +1349,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        type : 'text',\r
                                                        id : 'txtdlgGenStyle',\r
                                                        label : editor.lang.common.cssStyle,\r
+                                                       validate : CKEDITOR.dialog.validate.inlineStyle( editor.lang.common.invalidInlineStyle ),\r
                                                        'default' : '',\r
                                                        setup : function( type, element )\r
                                                        {\r