e402b235649b4d51f89e3144669505e4b0b884be.svn-base
3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Contains the third and last part of the {@link CKEDITOR} object
* definition.
*/
// Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic.
delete CKEDITOR.loadFullCore;
/**
* Holds references to all editor instances created. The name of the properties
* in this object correspond to instance names, and their values contains the
* {@link CKEDITOR.editor} object representing them.
* @type {Object}
* @example
* alert( <b>CKEDITOR.instances</b>.editor1.name ); // "editor1"
*/
CKEDITOR.instances = {};
/**
* The document of the window holding the CKEDITOR object.
* @type {CKEDITOR.dom.document}
* @example
* alert( <b>CKEDITOR.document</b>.getBody().getName() ); // "body"
*/
CKEDITOR.document = new CKEDITOR.dom.document( document );
/**
* Adds an editor instance to the global {@link CKEDITOR} object. This function
* is available for internal use mainly.
* @param {CKEDITOR.editor} editor The editor instance to be added.
* @example
*/
CKEDITOR.add = function( editor )
{
CKEDITOR.instances[ editor.name ] = editor;
editor.on( 'focus', function()
{
if ( CKEDITOR.currentInstance != editor )
{
CKEDITOR.currentInstance = editor;
CKEDITOR.fire( 'currentInstance' );
}
});
editor.on( 'blur', function()
{
if ( CKEDITOR.currentInstance == editor )
{
CKEDITOR.currentInstance = null;
CKEDITOR.fire( 'currentInstance' );
}
});
};
/**
* Removes an editor instance from the global {@link CKEDITOR} object. This function
* is available for internal use only. External code must use {@link CKEDITOR.editor.prototype.destroy}
* to avoid memory leaks.
* @param {CKEDITOR.editor} editor The editor instance to be removed.
* @example
*/
CKEDITOR.remove = function( editor )
{
delete CKEDITOR.instances[ editor.name ];
};
/**
* Perform global clean up to free as much memory as possible
* when there are no instances left
*/
CKEDITOR.on( 'instanceDestroyed', function ()
{
if ( CKEDITOR.tools.isEmpty( this.instances ) )
CKEDITOR.fire( 'reset' );
});
// Load the bootstrap script.
CKEDITOR.loader.load( 'core/_bootstrap' ); // @Packager.RemoveLine
// Tri-state constants.
/**
* Used to indicate the ON or ACTIVE state.
* @constant
* @example
*/
CKEDITOR.TRISTATE_ON = 1;
/**
* Used to indicate the OFF or NON ACTIVE state.
* @constant
* @example
*/
CKEDITOR.TRISTATE_OFF = 2;
/**
* Used to indicate DISABLED state.
* @constant
* @example
*/
CKEDITOR.TRISTATE_DISABLED = 0;
/**
* The editor which is currently active (have user focus).
* @name CKEDITOR.currentInstance
* @type CKEDITOR.editor
* @see CKEDITOR#currentInstance
* @example
* function showCurrentEditorName()
* {
* if ( CKEDITOR.currentInstance )
* alert( CKEDITOR.currentInstance.name );
* else
* alert( 'Please focus an editor first.' );
* }
*/
/**
* Fired when the CKEDITOR.currentInstance object reference changes. This may
* happen when setting the focus on different editor instances in the page.
* @name CKEDITOR#currentInstance
* @event
* var editor; // Variable to hold a reference to the current editor.
* CKEDITOR.on( 'currentInstance' , function( e )
* {
* editor = CKEDITOR.currentInstance;
* });
*/
/**
* Fired when the last instance has been destroyed. This event is used to perform
* global memory clean up.
* @name CKEDITOR#reset
* @event
*/