4ad3d87d61e7835796fa761ed5416ebd52351e53
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
7 * @fileOverview Contains the first and essential part of the {@link CKEDITOR}
11 // #### Compressed Code
12 // Must be updated on changes in the script as well as updated in the
13 // ckeditor_source.js and ckeditor_basic_source.js files.
15 // if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.6.1',rev:'7072',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf(':/')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;return d;})(),getUrl:function(d){if(d.indexOf(':/')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/')d+=(d.indexOf('?')>=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();
18 // ATTENTION: read the above "Compressed Code" notes when changing this code.
20 /* @Packager.RemoveLine
21 // Avoid having the editor code initialized twice. (#7588)
22 // Use CKEDITOR.dom to check whether the full ckeditor.js code has been loaded
23 // or just ckeditor_basic.js.
24 // Remove these lines when compressing manually.
25 if ( window.CKEDITOR && window.CKEDITOR.dom )
27 @Packager.RemoveLine */
29 if ( !window
.CKEDITOR
)
33 * @namespace This is the API entry point. The entire CKEditor code runs under this object.
36 window
.CKEDITOR
= (function()
39 /** @lends CKEDITOR */
43 * A constant string unique for each release of CKEditor. Its value
44 * is used, by default, to build the URL for all resources loaded
45 * by the editor code, guaranteeing clean cache results when
49 * alert( CKEDITOR.timestamp ); // e.g. '87dm'
51 // The production implementation contains a fixed timestamp, unique
52 // for each release and generated by the releaser.
53 // (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122)
54 timestamp
: 'B5GJ5GG',
57 * Contains the CKEditor version number.
60 * alert( CKEDITOR.version ); // e.g. 'CKEditor 3.4.1'
65 * Contains the CKEditor revision number.
66 * The revision number is incremented automatically, following each
67 * modification to the CKEditor source code.
70 * alert( CKEDITOR.revision ); // e.g. '3975'
75 * Private object used to hold core stuff. It should not be used outside of
76 * the API code as properties defined here may change at any time
83 * Indicates the API loading status. The following statuses are available:
85 * <li><b>unloaded</b>: the API is not yet loaded.</li>
86 * <li><b>basic_loaded</b>: the basic API features are available.</li>
87 * <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
88 * <li><b>loading</b>: the full API is being loaded.</li>
89 * <li><b>loaded</b>: the API can be fully used.</li>
93 * if ( <b>CKEDITOR.status</b> == 'loaded' )
95 * // The API can now be fully used.
101 * Contains the full URL for the CKEditor installation directory.
102 * It is possible to manually provide the base path by setting a
103 * global variable named CKEDITOR_BASEPATH. This global variable
104 * must be set <strong>before</strong> the editor script loading.
107 * alert( <b>CKEDITOR.basePath</b> ); // "http://www.example.com/ckeditor/" (e.g.)
109 basePath
: (function()
111 // ATTENTION: fixes to this code must be ported to
112 // var basePath in "core/loader.js".
114 // Find out the editor directory path, based on its <script> tag.
115 var path
= window
.CKEDITOR_BASEPATH
|| '';
119 var scripts
= document
.getElementsByTagName( 'script' );
121 for ( var i
= 0 ; i
< scripts
.length
; i
++ )
123 var match
= scripts
[i
].src
.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
133 // In IE (only) the script.src string is the raw value entered in the
134 // HTML source. Other browsers return the full resolved URL instead.
135 if ( path
.indexOf(':/') == -1 )
138 if ( path
.indexOf( '/' ) === 0 )
139 path
= location
.href
.match( /^.*?:\/\/[^\/]*/ )[0] + path
;
142 path
= location
.href
.match( /^[^\?]*\/(?:)/ )[0] + path
;
146 throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';
152 * Gets the full URL for CKEditor resources. By default, URLs
153 * returned by this function contain a querystring parameter ("t")
154 * set to the {@link CKEDITOR.timestamp} value.<br />
156 * It is possible to provide a custom implementation of this
157 * function by setting a global variable named CKEDITOR_GETURL.
158 * This global variable must be set <strong>before</strong> the editor script
159 * loading. If the custom implementation returns nothing (==null), the
160 * default implementation is used.
161 * @param {String} resource The resource whose full URL we want to get.
162 * It may be a full, absolute, or relative URL.
163 * @returns {String} The full URL.
165 * // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
166 * alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
168 * // e.g. http://www.example.com/skins/default/editor.css?t=87dm
169 * alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
171 * // e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
172 * alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
174 getUrl : function( resource
)
176 // If this is not a full or absolute path.
177 if ( resource
.indexOf(':/') == -1 && resource
.indexOf( '/' ) !== 0 )
178 resource
= this.basePath
+ resource
;
180 // Add the timestamp, except for directories.
181 if ( this.timestamp
&& resource
.charAt( resource
.length
- 1 ) != '/' && !(/[&?]t
=/).test( resource
) )
182 resource
+= ( resource
.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + this.timestamp
;
188 // Make it possible to override the getUrl function with a custom
189 // implementation pointing to a global named CKEDITOR_GETURL.
190 var newGetUrl
= window
.CKEDITOR_GETURL
;
193 var originalGetUrl
= CKEDITOR
.getUrl
;
194 CKEDITOR
.getUrl = function ( resource
)
196 return newGetUrl
.call( CKEDITOR
, resource
) ||
197 originalGetUrl
.call( CKEDITOR
, resource
);
206 * Function called upon loading a custom configuration file that can
207 * modify the editor instance configuration ({@link CKEDITOR.editor#config }).
208 * It is usually defined inside the custom configuration files that can
209 * include developer defined settings.
210 * @name CKEDITOR.editorConfig
212 * @param {CKEDITOR.config} config A configuration object containing the
213 * settings defined for a {@link CKEDITOR.editor} instance up to this
214 * function call. Note that not all settings may still be available. See
215 * <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations#Configuration_Loading_Order">Configuration Loading Order</a>
218 * // This is supposed to be placed in the config.js file.
219 * CKEDITOR.editorConfig = function( config )
221 * // Define changes to default configuration here. For example:
222 * config.language = 'fr';
223 * config.uiColor = '#AADC6E';
227 // PACKAGER_RENAME( CKEDITOR )