JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.1
[ckeditor.git] / _source / skins / office2003 / skin.js
1 /*\r
2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license\r
4 */\r
5 \r
6 CKEDITOR.skins.add( 'office2003', (function()\r
7 {\r
8         var preload = [];\r
9 \r
10         if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 )\r
11         {\r
12                 // For IE6, we need to preload some images, otherwhise they will be\r
13                 // downloaded several times (CSS background bug).\r
14                 preload.push( 'icons.png', 'images/sprites_ie6.png', 'images/dialog_sides.gif' );\r
15         }\r
16 \r
17         return {\r
18                 preload         : preload,\r
19                 editor          : { css : [ 'editor.css' ] },\r
20                 dialog          : { css : [ 'dialog.css' ] },\r
21                 templates       : { css : [ 'templates.css' ] },\r
22                 margins         : [ 0, 14, 18, 14 ]\r
23         };\r
24 })() );\r
25 \r
26 (function()\r
27 {\r
28         CKEDITOR.dialog ? dialogSetup() : CKEDITOR.on( 'dialogPluginReady', dialogSetup );\r
29 \r
30         function dialogSetup()\r
31         {\r
32                 CKEDITOR.dialog.on( 'resize', function( evt )\r
33                         {\r
34                                 var data = evt.data,\r
35                                         width = data.width,\r
36                                         height = data.height,\r
37                                         dialog = data.dialog,\r
38                                         contents = dialog.parts.contents;\r
39 \r
40                                 if ( data.skin != 'office2003' )\r
41                                         return;\r
42 \r
43                                 contents.setStyles(\r
44                                         {\r
45                                                 width : width + 'px',\r
46                                                 height : height + 'px'\r
47                                         });\r
48 \r
49                                 if ( !CKEDITOR.env.ie )\r
50                                         return;\r
51 \r
52                                 // Fix the size of the elements which have flexible lengths.\r
53                                 var fixSize = function()\r
54                                         {\r
55                                                 var innerDialog = dialog.parts.dialog.getChild( [ 0, 0, 0 ] ),\r
56                                                         body = innerDialog.getChild( 0 );\r
57 \r
58                                                 // tc\r
59                                                 var el = innerDialog.getChild( 2 );\r
60                                                 el.setStyle( 'width', ( body.$.offsetWidth ) + 'px' );\r
61 \r
62                                                 // bc\r
63                                                 el = innerDialog.getChild( 7 );\r
64                                                 el.setStyle( 'width', ( body.$.offsetWidth - 28 ) + 'px' );\r
65 \r
66                                                 // ml\r
67                                                 el = innerDialog.getChild( 4 );\r
68                                                 el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );\r
69 \r
70                                                 // mr\r
71                                                 el = innerDialog.getChild( 5 );\r
72                                                 el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );\r
73                                         };\r
74                                 setTimeout( fixSize, 100 );\r
75 \r
76                                 // Ensure size is correct for RTL mode. (#4003)\r
77                                 if ( evt.editor.lang.dir == 'rtl' )\r
78                                         setTimeout( fixSize, 1000 );\r
79                         });\r
80         }\r
81 })();\r