summaryrefslogtreecommitdiff
path: root/_source/skins/kama/skin.js
diff options
context:
space:
mode:
authorDaniel Sutcliffe <dansut@users.sourceforge.net>2010-02-02 17:54:17 +0000
committerDaniel Sutcliffe <dansut@users.sourceforge.net>2010-02-02 17:54:17 +0000
commitb1de4b213ba60402d6d13a2a6892d5a422c4f8e4 (patch)
treee4adb31477ee586349cd935365a84aaee50c5899 /_source/skins/kama/skin.js
parent8630f2bc4d63b3320f5469d9532a1cba1dddb7a3 (diff)
downloadckeditor-b1de4b213ba60402d6d13a2a6892d5a422c4f8e4.tar.gz
ckeditor-b1de4b213ba60402d6d13a2a6892d5a422c4f8e4.tar.bz2
ckeditor-b1de4b213ba60402d6d13a2a6892d5a422c4f8e4.zip
Update CKEditor to 3.1 and make work as a bw package
Diffstat (limited to '_source/skins/kama/skin.js')
-rw-r--r--_source/skins/kama/skin.js114
1 files changed, 53 insertions, 61 deletions
diff --git a/_source/skins/kama/skin.js b/_source/skins/kama/skin.js
index 2b01c74..727d1f3 100644
--- a/_source/skins/kama/skin.js
+++ b/_source/skins/kama/skin.js
@@ -1,11 +1,12 @@
/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.skins.add( 'kama', (function()
{
- var preload = [];
+ var preload = [],
+ uiColorStylesheetId = 'cke_ui_color';
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 )
{
@@ -89,12 +90,15 @@ CKEDITOR.skins.add( 'kama', (function()
uiColorMenuCss[ i ] = uiColorMenuCss[ i ].split( '{' );
}
- function addStylesheet( document )
+ function getStylesheet( document )
{
- var node = document.getHead().append( 'style' );
- node.setAttribute( "id", "cke_ui_color" );
- node.setAttribute( "type", "text/css" );
-
+ var node = document.getById( uiColorStylesheetId );
+ if( !node )
+ {
+ node = document.getHead().append( 'style' );
+ node.setAttribute( "id", uiColorStylesheetId );
+ node.setAttribute( "type", "text/css" );
+ }
return node;
}
@@ -105,10 +109,6 @@ CKEDITOR.skins.add( 'kama', (function()
{
if ( CKEDITOR.env.webkit )
{
- // Truncate manually.
- for ( i = 0 ; i < styleNodes[ id ].$.sheet.rules.length ; i++ )
- styleNodes[ id ].$.sheet.removeRule( i );
-
for ( i = 0 ; i < styleContent.length ; i++ )
{
content = styleContent[ i ][ 1 ];
@@ -125,9 +125,9 @@ CKEDITOR.skins.add( 'kama', (function()
content = content.replace( replace[ r ][ 0 ], replace[ r ][ 1 ] );
if ( CKEDITOR.env.ie )
- styleNodes[ id ].$.styleSheet.cssText = content;
+ styleNodes[ id ].$.styleSheet.cssText += content;
else
- styleNodes[ id ].setHtml( content );
+ styleNodes[ id ].$.innerHTML += content;
}
}
}
@@ -146,8 +146,8 @@ CKEDITOR.skins.add( 'kama', (function()
setUiColor : function( color )
{
var cssContent,
- uiStyle = addStylesheet( CKEDITOR.document ),
- cssId = '#cke_' + editor.name.replace('.', '\\.');
+ uiStyle = getStylesheet( CKEDITOR.document ),
+ cssId = '.cke_editor_' + CKEDITOR.tools.escapeCssSelector( editor.name );
var cssSelectors =
[
@@ -186,7 +186,7 @@ CKEDITOR.skins.add( 'kama', (function()
// Add stylesheet if missing.
if ( !iframe.getById( 'cke_ui_color' ) )
{
- var node = addStylesheet( iframe );
+ var node = getStylesheet( iframe );
uiColorMenus.push( node );
var color = editor.getUiColor();
@@ -203,63 +203,55 @@ CKEDITOR.skins.add( 'kama', (function()
};
})() );
-if ( CKEDITOR.dialog )
+(function()
{
- CKEDITOR.dialog.on( 'resize', function( evt )
- {
- var data = evt.data,
- width = data.width,
- height = data.height,
- dialog = data.dialog,
- contents = dialog.parts.contents,
- standardsMode = !CKEDITOR.env.quirks;
+ CKEDITOR.dialog ? dialogSetup() : CKEDITOR.on( 'dialogPluginReady', dialogSetup );
+
+ function dialogSetup()
+ {
+ CKEDITOR.dialog.on( 'resize', function( evt )
+ {
+ var data = evt.data,
+ width = data.width,
+ height = data.height,
+ dialog = data.dialog,
+ contents = dialog.parts.contents;
- if ( data.skin != 'kama' )
- return;
+ if ( data.skin != 'kama' )
+ return;
- contents.setStyles(
- ( CKEDITOR.env.ie || ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) ) ? // IE && FF2
+ contents.setStyles(
{
width : width + 'px',
height : height + 'px'
- }
- :
- {
- // To avoid having scrollbars in the dialogs, we're
- // (for now) using the "min-xxx" properties, for
- // browsers which well support it (#3878).
- 'min-width' : width + 'px',
- 'min-height' : height + 'px'
});
- if ( !CKEDITOR.env.ie )
- return;
-
- // Fix the size of the elements which have flexible lengths.
- setTimeout( function()
- {
- var body = contents.getParent(),
- innerDialog = body.getParent();
+ // Fix the size of the elements which have flexible lengths.
+ setTimeout( function()
+ {
+ var innerDialog = dialog.parts.dialog.getChild( [ 0, 0, 0 ] ),
+ body = innerDialog.getChild( 0 );
- // tc
- var el = innerDialog.getChild( 2 );
- el.setStyle( 'width', ( body.$.offsetWidth ) + 'px' );
+ // tc
+ var el = innerDialog.getChild( 2 );
+ el.setStyle( 'width', ( body.$.offsetWidth ) + 'px' );
- // bc
- el = innerDialog.getChild( 7 );
- el.setStyle( 'width', ( body.$.offsetWidth - 28 ) + 'px' );
+ // bc
+ el = innerDialog.getChild( 7 );
+ el.setStyle( 'width', ( body.$.offsetWidth - 28 ) + 'px' );
- // ml
- el = innerDialog.getChild( 4 );
- el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );
+ // ml
+ el = innerDialog.getChild( 4 );
+ el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );
- // mr
- el = innerDialog.getChild( 5 );
- el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );
- },
- 100 );
- });
-}
+ // mr
+ el = innerDialog.getChild( 5 );
+ el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );
+ },
+ 100 );
+ });
+ }
+})();
/**
* The base user interface color to be used by the editor. Not all skins are