JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.0.2
[ckeditor.git] / _source / skins / kama / skin.js
index 63ab4a0..8fd05ee 100644 (file)
@@ -5,7 +5,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
 CKEDITOR.skins.add( 'kama', (function()\r
 {\r
-       var preload = [];\r
+       var preload = [],\r
+               uiColorStylesheetId = 'cke_ui_color';\r
 \r
        if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 )\r
        {\r
@@ -89,12 +90,15 @@ CKEDITOR.skins.add( 'kama', (function()
                                        uiColorMenuCss[ i ] = uiColorMenuCss[ i ].split( '{' );\r
                        }\r
 \r
-                       function addStylesheet( document )\r
+                       function getStylesheet( document )\r
                        {\r
-                               var node = document.getHead().append( 'style' );\r
-                               node.setAttribute( "id", "cke_ui_color" );\r
-                               node.setAttribute( "type", "text/css" );\r
-\r
+                               var node = document.getById( uiColorStylesheetId );\r
+                               if( !node )\r
+                               {\r
+                                       node = document.getHead().append( 'style' );\r
+                                       node.setAttribute( "id", uiColorStylesheetId );\r
+                                       node.setAttribute( "type", "text/css" );\r
+                               }\r
                                return node;\r
                        }\r
 \r
@@ -105,10 +109,6 @@ CKEDITOR.skins.add( 'kama', (function()
                                {\r
                                        if ( CKEDITOR.env.webkit )\r
                                        {\r
-                                               // Truncate manually.\r
-                                               for ( i = 0 ; i < styleNodes[ id ].$.sheet.rules.length ; i++ )\r
-                                                       styleNodes[ id ].$.sheet.removeRule( i );\r
-\r
                                                for ( i = 0 ; i < styleContent.length ; i++ )\r
                                                {\r
                                                        content = styleContent[ i ][ 1 ];\r
@@ -125,9 +125,9 @@ CKEDITOR.skins.add( 'kama', (function()
                                                        content = content.replace( replace[ r ][ 0 ], replace[ r ][ 1 ] );\r
 \r
                                                if ( CKEDITOR.env.ie )\r
-                                                       styleNodes[ id ].$.styleSheet.cssText = content;\r
+                                                       styleNodes[ id ].$.styleSheet.cssText += content;\r
                                                else\r
-                                                       styleNodes[ id ].setHtml( content );\r
+                                                       styleNodes[ id ].$.innerHTML += content;\r
                                        }\r
                                }\r
                        }\r
@@ -146,8 +146,8 @@ CKEDITOR.skins.add( 'kama', (function()
                                setUiColor : function( color )\r
                                {\r
                                        var cssContent,\r
-                                               uiStyle = addStylesheet( CKEDITOR.document ),\r
-                                               cssId = '#cke_' + editor.name.replace('.', '\\.');\r
+                                               uiStyle = getStylesheet( CKEDITOR.document ),\r
+                                               cssId = '#cke_' + CKEDITOR.tools.escapeCssSelector( editor.name );\r
 \r
                                        var cssSelectors =\r
                                                [\r
@@ -186,7 +186,7 @@ CKEDITOR.skins.add( 'kama', (function()
                                // Add stylesheet if missing.\r
                                if ( !iframe.getById( 'cke_ui_color' ) )\r
                                {\r
-                                       var node = addStylesheet( iframe );\r
+                                       var node = getStylesheet( iframe );\r
                                        uiColorMenus.push( node );\r
 \r
                                        var color = editor.getUiColor();\r
@@ -211,35 +211,22 @@ if ( CKEDITOR.dialog )
                                width = data.width,\r
                                height = data.height,\r
                                dialog = data.dialog,\r
-                               contents = dialog.parts.contents,\r
-                               standardsMode = !CKEDITOR.env.quirks;\r
+                               contents = dialog.parts.contents;\r
 \r
                        if ( data.skin != 'kama' )\r
                                return;\r
 \r
                        contents.setStyles(\r
-                               ( CKEDITOR.env.ie || ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) ) ?         // IE && FF2\r
-                                       {\r
-                                               width : width + 'px',\r
-                                               height : height + 'px'\r
-                                       }\r
-                               :\r
-                                       {\r
-                                               // To avoid having scrollbars in the dialogs, we're\r
-                                               // (for now) using the "min-xxx" properties, for\r
-                                               // browsers which well support it (#3878).\r
-                                               'min-width' : width + 'px',\r
-                                               'min-height' : height + 'px'\r
-                                       });\r
-\r
-                       if ( !CKEDITOR.env.ie )\r
-                               return;\r
+                               {\r
+                                       width : width + 'px',\r
+                                       height : height + 'px'\r
+                               });\r
 \r
                        // Fix the size of the elements which have flexible lengths.\r
                        setTimeout( function()\r
                                {\r
-                                       var body = contents.getParent(),\r
-                                               innerDialog = body.getParent();\r
+                                       var innerDialog = dialog.parts.dialog.getChild( [ 0, 0, 0 ] ),\r
+                                               body = innerDialog.getChild( 0 );\r
 \r
                                        // tc\r
                                        var el = innerDialog.getChild( 2 );\r