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