]>
Commit | Line | Data |
---|---|---|
c63493c8 IB |
1 | /** |
2 | * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. | |
3 | * For licensing, see LICENSE.md or http://ckeditor.com/license | |
4 | */ | |
5 | ||
6 | /** | |
7 | * @fileOverview Contains the second part of the {@link CKEDITOR} object | |
8 | * definition, which defines the basic editor features to be available in | |
9 | * the root ckeditor_basic.js file. | |
10 | */ | |
11 | ||
12 | if ( CKEDITOR.status == 'unloaded' ) { | |
13 | ( function() { | |
14 | CKEDITOR.event.implementOn( CKEDITOR ); | |
15 | ||
16 | /** | |
17 | * Forces the full CKEditor core code, in the case only the basic code has been | |
18 | * loaded (`ckeditor_basic.js`). This method self-destroys (becomes undefined) in | |
19 | * the first call or as soon as the full code is available. | |
20 | * | |
21 | * // Check if the full core code has been loaded and load it. | |
22 | * if ( CKEDITOR.loadFullCore ) | |
23 | * CKEDITOR.loadFullCore(); | |
24 | * | |
25 | * @member CKEDITOR | |
26 | */ | |
27 | CKEDITOR.loadFullCore = function() { | |
28 | // If the basic code is not ready, just mark it to be loaded. | |
29 | if ( CKEDITOR.status != 'basic_ready' ) { | |
30 | CKEDITOR.loadFullCore._load = 1; | |
31 | return; | |
32 | } | |
33 | ||
34 | // Destroy this function. | |
35 | delete CKEDITOR.loadFullCore; | |
36 | ||
37 | // Append the script to the head. | |
38 | var script = document.createElement( 'script' ); | |
39 | script.type = 'text/javascript'; | |
40 | script.src = CKEDITOR.basePath + 'ckeditor.js'; | |
41 | script.src = CKEDITOR.basePath + 'ckeditor_source.js'; // %REMOVE_LINE% | |
42 | ||
43 | document.getElementsByTagName( 'head' )[ 0 ].appendChild( script ); | |
44 | }; | |
45 | ||
46 | /** | |
47 | * The time to wait (in seconds) to load the full editor code after the | |
48 | * page load, if the "ckeditor_basic" file is used. If set to zero, the | |
49 | * editor is loaded on demand, as soon as an instance is created. | |
50 | * | |
51 | * This value must be set on the page before the page load completion. | |
52 | * | |
53 | * // Loads the full source after five seconds. | |
54 | * CKEDITOR.loadFullCoreTimeout = 5; | |
55 | * | |
56 | * @property | |
57 | * @member CKEDITOR | |
58 | */ | |
59 | CKEDITOR.loadFullCoreTimeout = 0; | |
60 | ||
61 | // Documented at ckeditor.js. | |
62 | CKEDITOR.add = function( editor ) { | |
63 | // For now, just put the editor in the pending list. It will be | |
64 | // processed as soon as the full code gets loaded. | |
65 | var pending = this._.pending || ( this._.pending = [] ); | |
66 | pending.push( editor ); | |
67 | }; | |
68 | ||
69 | ( function() { | |
70 | var onload = function() { | |
71 | var loadFullCore = CKEDITOR.loadFullCore, | |
72 | loadFullCoreTimeout = CKEDITOR.loadFullCoreTimeout; | |
73 | ||
74 | if ( !loadFullCore ) | |
75 | return; | |
76 | ||
77 | CKEDITOR.status = 'basic_ready'; | |
78 | ||
79 | if ( loadFullCore && loadFullCore._load ) | |
80 | loadFullCore(); | |
81 | else if ( loadFullCoreTimeout ) { | |
82 | setTimeout( function() { | |
83 | if ( CKEDITOR.loadFullCore ) | |
84 | CKEDITOR.loadFullCore(); | |
85 | }, loadFullCoreTimeout * 1000 ); | |
86 | } | |
87 | }; | |
88 | ||
89 | CKEDITOR.domReady( onload ); | |
90 | } )(); | |
91 | ||
92 | CKEDITOR.status = 'basic_loaded'; | |
93 | } )(); | |
94 | } |