Index: editor/_source/internals/fcktools_gecko.js
===================================================================
--- editor/_source/internals/fcktools_gecko.js (revision 1092)
+++ editor/_source/internals/fcktools_gecko.js (working copy)
@@ -38,12 +38,21 @@
// Appends a CSS file to a document.
FCKTools._AppendStyleSheet = function( documentElement, cssFileUrl )
{
- var e = documentElement.createElement( 'LINK' ) ;
- e.rel = 'stylesheet' ;
- e.type = 'text/css' ;
- e.href = cssFileUrl ;
- documentElement.getElementsByTagName("HEAD")[0].appendChild( e ) ;
- return e ;
+ var cssText = FCKCSSManager.GetCachedCSS( cssFileUrl ) ;
+
+ if ( cssText == null )
+ {
+ var e = documentElement.createElement( 'LINK' ) ;
+ e.rel = 'stylesheet' ;
+ e.type = 'text/css' ;
+ e.href = cssFileUrl ;
+ documentElement.getElementsByTagName( "HEAD" )[0].appendChild( e ) ;
+ return e ;
+ }
+ else
+ {
+ return FCKTools._AppendStyleString( documentElement, cssText ) ;
+ }
}
// Appends a CSS style string to a document.
Index: editor/_source/internals/fcktools_ie.js
===================================================================
--- editor/_source/internals/fcktools_ie.js (revision 1092)
+++ editor/_source/internals/fcktools_ie.js (working copy)
@@ -29,7 +29,16 @@
// Appends one or more CSS files to a document.
FCKTools._AppendStyleSheet = function( documentElement, cssFileUrl )
{
- return documentElement.createStyleSheet( cssFileUrl ).owningElement ;
+ var cssText = FCKCSSManager.GetCachedCSS( cssFileUrl );
+
+ if ( cssText )
+ {
+ return FCKTools._AppendStyleString( documentElement, cssText ) ;
+ }
+ else
+ {
+ return documentElement.createStyleSheet( cssFileUrl ).owningElement ;
+ }
}
// Appends a CSS style string to a document.
Index: editor/_source/internals/fckcssmanager.js
===================================================================
--- editor/_source/internals/fckcssmanager.js (revision 0)
+++ editor/_source/internals/fckcssmanager.js (revision 0)
@@ -0,0 +1,89 @@
+/*
+* FCKeditor - The text editor for Internet - http://www.fckeditor.net
+* This file copyright (C) 2007 PBwiki, Inc.
+*
+* == BEGIN LICENSE ==
+*
+* Licensed under the terms of any of the following licenses at your
+* choice:
+*
+* - GNU General Public License Version 2 or later (the "GPL")
+* http://www.gnu.org/licenses/gpl.html
+*
+* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
+* http://www.gnu.org/licenses/lgpl.html
+*
+* - Mozilla Public License Version 1.1 or later (the "MPL")
+* http://www.mozilla.org/MPL/MPL-1.1.html
+*
+* == END LICENSE ==
+*
+*/
+
+var FCKCSSManager =
+{
+ CachedCSS : {},
+
+ AddCachedCSS : function( path, value )
+ {
+ FCKCSSManager.CachedCSS[ path ] = value ;
+ },
+
+ _ProcessPath : function( path )
+ {
+ if ( !path )
+ return null ;
+
+ if ( path.substr( 0, FCKConfig.BasePath.length ) == FCKConfig.BasePath )
+ path = path.substr( FCKConfig.BasePath.length ).replace( /^\//, "" ) ;
+
+ return path;
+ },
+
+ GetCachedCSS : function( path )
+ {
+ if ( !path )
+ return null ;
+
+ var relativePath = FCKCSSManager._ProcessPath( path ) ;
+
+ if ( !FCKCSSManager.CachedCSS[ relativePath ] )
+ return null ;
+
+ var cachedCSS = FCKCSSManager.CachedCSS[ relativePath ];
+
+ var pathPrefix = path.replace( /\/[^\/]+\.css$/i, "/" );
+ pathPrefix.replace( /^[^\/]*$/, "" );
+
+ function pathReplace ( str, prefix, path, suffix, cache_path ) {
+ if ( path.match( /^http|^\// ) )
+ return "url(" + prefix + path + suffix + ")" ;
+ else
+ return "url(" + prefix + cache_path + path + suffix + ")" ;
+ }
+
+ cachedCSS = cachedCSS.replace( /url *\(([ '"]*)(.*?)([ "']*)\)/g,
+ ( function( a, b, c, d, e, f, g) { return pathReplace( a, b, c, d, pathPrefix ) ; } ) );
+
+ return cachedCSS ;
+ },
+
+ GetCSSInclude : function( path )
+ {
+ if ( !path )
+ return null ;
+
+ var cachedCSS = FCKCSSManager.GetCachedCSS( path ) ;
+
+ if ( !cachedCSS )
+ return( '' ) ;
+
+ return( '' + cachedCSS + '' ) ;
+ },
+
+ PrintCSSInclude : function( path )
+ {
+ document.write( FCKCSSManager.GetCSSInclude( path ) ) ;
+ }
+} ;
+
Index: editor/fckeditor.html
===================================================================
--- editor/fckeditor.html (revision 1092)
+++ editor/fckeditor.html (working copy)
@@ -43,7 +43,7 @@
function LoadCss( url )
{
- document.write( '' ) ;
+ FCKCSSManager.PrintCSSInclude( url ) ;
}
// Main editor scripts.
@@ -147,6 +147,7 @@
LoadScript( '_source/classes/fckmenublockpanel.js' ) ;
LoadScript( '_source/classes/fckcontextmenu.js' ) ;
LoadScript( '_source/internals/fck_contextmenu.js' ) ;
+LoadScript( '_source/internals/fckcssmanager.js' ) ;
LoadScript( '_source/classes/fckplugin.js' ) ;
LoadScript( '_source/internals/fckplugins.js' ) ;
Index: fckpackager.xml
===================================================================
--- fckpackager.xml (revision 1092)
+++ fckpackager.xml (working copy)
@@ -161,6 +161,15 @@
+
+
+
+
+
@@ -255,8 +264,18 @@
+
+
+
+
+
+
Index: /home/chris/fckeditor/trunk/FCKpackager/trunk/fckpackager.php
===================================================================
--- /home/chris/fckeditor/trunk/FCKpackager/trunk/fckpackager.php (revision 1090)
+++ /home/chris/fckeditor/trunk/FCKpackager/trunk/fckpackager.php (working copy)
@@ -493,10 +493,21 @@
echo ' Adding ' . basename( $file ) . "\n" ;
// Compress (if needed) and process its contents.
- if ( $this->CompactJavaScript )
- $outputData .= FCKJavaScriptCompressor::Compress( FCKPreProcessor::Process( $data ), $this->ConstantsProcessor ) ;
+ if ( preg_match( '/\.js$/', $file ) )
+ {
+ if ( $this->CompactJavaScript )
+ $outputData .= FCKJavaScriptCompressor::Compress( FCKPreProcessor::Process( $data ), $this->ConstantsProcessor ) ;
+ else
+ $outputData .= FCKPreProcessor::Process( $data ) ;
+ }
+ else if ( preg_match( '/\.css$/', $file ) )
+ {
+ $outputData .= FCKCSSProcessor::Process( $data, $file ) ;
+ }
else
- $outputData .= FCKPreProcessor::Process( $data ) ;
+ {
+ echo " Unknown file type, not added!\n";
+ }
// Each file terminates with a CRLF, even if compressed.
$outputData .= "\r\n" ;
@@ -659,7 +670,19 @@
?>
\ No newline at end of file
+?>