diff options
Diffstat (limited to 'sources/core/editor_basic.js')
-rw-r--r-- | sources/core/editor_basic.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sources/core/editor_basic.js b/sources/core/editor_basic.js new file mode 100644 index 00000000..f81efb35 --- /dev/null +++ b/sources/core/editor_basic.js | |||
@@ -0,0 +1,36 @@ | |||
1 | /** | ||
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | ||
3 | * For licensing, see LICENSE.md or http://ckeditor.com/license | ||
4 | */ | ||
5 | |||
6 | if ( !CKEDITOR.editor ) { | ||
7 | // Documented at editor.js. | ||
8 | CKEDITOR.editor = function() { | ||
9 | // Push this editor to the pending list. It'll be processed later once | ||
10 | // the full editor code is loaded. | ||
11 | CKEDITOR._.pending.push( [ this, arguments ] ); | ||
12 | |||
13 | // Call the CKEDITOR.event constructor to initialize this instance. | ||
14 | CKEDITOR.event.call( this ); | ||
15 | }; | ||
16 | |||
17 | // Both fire and fireOnce will always pass this editor instance as the | ||
18 | // "editor" param in CKEDITOR.event.fire. So, we override it to do that | ||
19 | // automaticaly. | ||
20 | CKEDITOR.editor.prototype.fire = function( eventName, data ) { | ||
21 | if ( eventName in { instanceReady: 1, loaded: 1 } ) | ||
22 | this[ eventName ] = true; | ||
23 | |||
24 | return CKEDITOR.event.prototype.fire.call( this, eventName, data, this ); | ||
25 | }; | ||
26 | |||
27 | CKEDITOR.editor.prototype.fireOnce = function( eventName, data ) { | ||
28 | if ( eventName in { instanceReady: 1, loaded: 1 } ) | ||
29 | this[ eventName ] = true; | ||
30 | |||
31 | return CKEDITOR.event.prototype.fireOnce.call( this, eventName, data, this ); | ||
32 | }; | ||
33 | |||
34 | // "Inherit" (copy actually) from CKEDITOR.event. | ||
35 | CKEDITOR.event.implementOn( CKEDITOR.editor.prototype ); | ||
36 | } | ||