JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.3
[ckeditor.git] / _source / plugins / image / dialogs / image.js
index 3833e03..992d700 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -158,11 +158,14 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        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
@@ -263,7 +266,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        btnLockSizesId = numbering( 'btnLockSizes' ),\r
                        btnResetSizeId = numbering( 'btnResetSize' ),\r
                        imagePreviewLoaderId = numbering( 'ImagePreviewLoader' ),\r
-                       imagePreviewBoxId = numbering( 'ImagePreviewBox' ),\r
                        previewLinkId = numbering( 'previewLink' ),\r
                        previewImageId = numbering( 'previewImage' );\r
 \r
@@ -287,8 +289,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                this.addLink = false;\r
 \r
                                var editor = this.getParentEditor(),\r
-                                       sel = this.getParentEditor().getSelection(),\r
-                                       element = sel.getSelectedElement(),\r
+                                       sel = editor.getSelection(),\r
+                                       element = sel && sel.getSelectedElement(),\r
                                        link = element && element.getAscendant( 'a' );\r
 \r
                                //Hide loader.\r
@@ -780,7 +782,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
@@ -793,8 +795,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
@@ -1074,7 +1076,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                        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
-                                                                                       '<div id="' + imagePreviewBoxId + '" class="ImagePreviewBox"><table><tr><td>'+\r
+                                                                                       '<div class="ImagePreviewBox"><table><tr><td>'+\r
                                                                                        '<a href="javascript:void(0)" target="_blank" onclick="return false;" id="' + previewLinkId + '">'+\r
                                                                                        '<img id="' + previewImageId + '" alt="" /></a>' +\r
                                                                                        ( editor.config.image_previewText ||\r
@@ -1346,6 +1348,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