1 | /*
|
---|
2 | Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
---|
3 | For licensing, see LICENSE.html or http://ckeditor.com/license
|
---|
4 | */
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * @fileOverview Contains the first and essential part of the {@link CKEDITOR}
|
---|
8 | * object definition.
|
---|
9 | */
|
---|
10 |
|
---|
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.
|
---|
14 |
|
---|
15 | // if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.6.2',rev:'7275',_:{},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;})();
|
---|
16 |
|
---|
17 | // #### Raw code
|
---|
18 | // ATTENTION: read the above "Compressed Code" notes when changing this code.
|
---|
19 |
|
---|
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 )
|
---|
26 | return;
|
---|
27 | @Packager.RemoveLine */
|
---|
28 |
|
---|
29 | if ( !window.CKEDITOR )
|
---|
30 | {
|
---|
31 | /**
|
---|
32 | * @name CKEDITOR
|
---|
33 | * @namespace This is the API entry point. The entire CKEditor code runs under this object.
|
---|
34 | * @example
|
---|
35 | */
|
---|
36 | window.CKEDITOR = (function()
|
---|
37 | {
|
---|
38 | var CKEDITOR =
|
---|
39 | /** @lends CKEDITOR */
|
---|
40 | {
|
---|
41 |
|
---|
42 | /**
|
---|
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
|
---|
46 | * upgrading.
|
---|
47 | * @type String
|
---|
48 | * @example
|
---|
49 | * alert( CKEDITOR.timestamp ); // e.g. '87dm'
|
---|
50 | */
|
---|
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 : 'B8DJ5M3',
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Contains the CKEditor version number.
|
---|
58 | * @type String
|
---|
59 | * @example
|
---|
60 | * alert( CKEDITOR.version ); // e.g. 'CKEditor 3.4.1'
|
---|
61 | */
|
---|
62 | version : '3.6.2',
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Contains the CKEditor revision number.
|
---|
66 | * The revision number is incremented automatically, following each
|
---|
67 | * modification to the CKEditor source code.
|
---|
68 | * @type String
|
---|
69 | * @example
|
---|
70 | * alert( CKEDITOR.revision ); // e.g. '3975'
|
---|
71 | */
|
---|
72 | revision : '7275',
|
---|
73 |
|
---|
74 | /**
|
---|
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
|
---|
77 | * without notice.
|
---|
78 | * @private
|
---|
79 | */
|
---|
80 | _ : {},
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Indicates the API loading status. The following statuses are available:
|
---|
84 | * <ul>
|
---|
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>
|
---|
90 | * </ul>
|
---|
91 | * @type String
|
---|
92 | * @example
|
---|
93 | * if ( <b>CKEDITOR.status</b> == 'loaded' )
|
---|
94 | * {
|
---|
95 | * // The API can now be fully used.
|
---|
96 | * }
|
---|
97 | */
|
---|
98 | status : 'unloaded',
|
---|
99 |
|
---|
100 | /**
|
---|
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.
|
---|
105 | * @type String
|
---|
106 | * @example
|
---|
107 | * alert( <b>CKEDITOR.basePath</b> ); // "http://www.example.com/ckeditor/" (e.g.)
|
---|
108 | */
|
---|
109 | basePath : (function()
|
---|
110 | {
|
---|
111 | // ATTENTION: fixes to this code must be ported to
|
---|
112 | // var basePath in "core/loader.js".
|
---|
113 |
|
---|
114 | // Find out the editor directory path, based on its <script> tag.
|
---|
115 | var path = window.CKEDITOR_BASEPATH || '';
|
---|
116 |
|
---|
117 | if ( !path )
|
---|
118 | {
|
---|
119 | var scripts = document.getElementsByTagName( 'script' );
|
---|
120 |
|
---|
121 | for ( var i = 0 ; i < scripts.length ; i++ )
|
---|
122 | {
|
---|
123 | var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
|
---|
124 |
|
---|
125 | if ( match )
|
---|
126 | {
|
---|
127 | path = match[1];
|
---|
128 | break;
|
---|
129 | }
|
---|
130 | }
|
---|
131 | }
|
---|
132 |
|
---|
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 )
|
---|
136 | {
|
---|
137 | // Absolute path.
|
---|
138 | if ( path.indexOf( '/' ) === 0 )
|
---|
139 | path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
|
---|
140 | // Relative path.
|
---|
141 | else
|
---|
142 | path = location.href.match( /^[^\?]*\/(?:)/ )[0] + path;
|
---|
143 | }
|
---|
144 |
|
---|
145 | if ( !path )
|
---|
146 | throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';
|
---|
147 |
|
---|
148 | return path;
|
---|
149 | })(),
|
---|
150 |
|
---|
151 | /**
|
---|
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 />
|
---|
155 | * <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.
|
---|
164 | * @example
|
---|
165 | * // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
|
---|
166 | * alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
|
---|
167 | * @example
|
---|
168 | * // e.g. http://www.example.com/skins/default/editor.css?t=87dm
|
---|
169 | * alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
|
---|
170 | * @example
|
---|
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' ) );
|
---|
173 | */
|
---|
174 | getUrl : function( resource )
|
---|
175 | {
|
---|
176 | // If this is not a full or absolute path.
|
---|
177 | if ( resource.indexOf(':/') == -1 && resource.indexOf( '/' ) !== 0 )
|
---|
178 | resource = this.basePath + resource;
|
---|
179 |
|
---|
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;
|
---|
183 |
|
---|
184 | return resource;
|
---|
185 | }
|
---|
186 | };
|
---|
187 |
|
---|
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;
|
---|
191 | if ( newGetUrl )
|
---|
192 | {
|
---|
193 | var originalGetUrl = CKEDITOR.getUrl;
|
---|
194 | CKEDITOR.getUrl = function ( resource )
|
---|
195 | {
|
---|
196 | return newGetUrl.call( CKEDITOR, resource ) ||
|
---|
197 | originalGetUrl.call( CKEDITOR, resource );
|
---|
198 | };
|
---|
199 | }
|
---|
200 |
|
---|
201 | return CKEDITOR;
|
---|
202 | })();
|
---|
203 | }
|
---|
204 |
|
---|
205 | /**
|
---|
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
|
---|
211 | * @function
|
---|
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>
|
---|
216 | * for details.
|
---|
217 | * @example
|
---|
218 | * // This is supposed to be placed in the config.js file.
|
---|
219 | * CKEDITOR.editorConfig = function( config )
|
---|
220 | * {
|
---|
221 | * // Define changes to default configuration here. For example:
|
---|
222 | * config.language = 'fr';
|
---|
223 | * config.uiColor = '#AADC6E';
|
---|
224 | * };
|
---|
225 | */
|
---|
226 |
|
---|
227 | // PACKAGER_RENAME( CKEDITOR )
|
---|