Code Index | File Index

Namespaces

Classes


Namespace CKEDITOR

This is the API entry point. The entire CKEditor code runs under this object.
Defined in: core/ckeditor_base.js.

Constants Summary
Constant Attributes Constant Name and Description
<static>  
CKEDITOR.ALT
ALT key (0x440000).
<static>  
CKEDITOR.CTRL
CTRL key (0x110000).
<static>  
Only allow vertical resizing for this dialog, disable horizontal resizing.
<static>  
No resize for this dialog.
<static>  
Only allow horizontal resizing for this dialog, disable vertical resizing.
<static>  
The editor is to be created inside the element.
<static>  
No element is linked to the editor instance.
<static>  
The element is to be replaced by the editor instance.
<static>  
CKEDITOR.ENTER_BR
Used in conjunction with CKEDITOR.config.enterMode and CKEDITOR.config.shiftEnterMode configuration settings to make the editor produce <br> tags when using the Enter key.
<static>  
CKEDITOR.ENTER_DIV
Used in conjunction with CKEDITOR.config.enterMode and CKEDITOR.config.shiftEnterMode configuration settings to make the editor produce <div> tags when using the Enter key.
<static>  
CKEDITOR.ENTER_P
Used in conjunction with CKEDITOR.config.enterMode and CKEDITOR.config.shiftEnterMode configuration settings to make the editor produce <p> tags when using the Enter key.
<static>  
CKEDITOR.NODE_COMMENT
Comment node type.
<static>  
CKEDITOR.NODE_DOCUMENT
Document node type.
<static>  
CKEDITOR.NODE_ELEMENT
Element node type.
<static>  
CKEDITOR.NODE_TEXT
Text node type.
<static>  
Element selection.
<static>  
CKEDITOR.SELECTION_NONE
No selection.
<static>  
CKEDITOR.SELECTION_TEXT
A text or a collapsed selection.
<static>  
CKEDITOR.SHIFT
SHIFT key (0x220000).
<static>  
Used to indicate DISABLED state.
<static>  
CKEDITOR.TRISTATE_OFF
Used to indicate the OFF or NON ACTIVE state.
<static>  
CKEDITOR.TRISTATE_ON
Used to indicate the ON or ACTIVE state.
<static>  
CKEDITOR.UI_BUTTON
Button UI element.
<static>  
CKEDITOR.UI_MENUBUTTON
Button UI element.
<static>  
CKEDITOR.UI_PANEL
Panel UI element.
<static>  
CKEDITOR.UI_PANELBUTTON
Button UI element.
<static>  
CKEDITOR.UI_RICHCOMBO
Button UI element.
Field Summary
Field Attributes Field Name and Description
<static>  
CKEDITOR.basePath
Contains the full URL for the CKEditor installation directory.
<static>  
CKEDITOR.currentInstance
The editor which is currently active (have user focus).
<static>  
CKEDITOR.document
The document of the window holding the CKEDITOR object.
<static>  
CKEDITOR.instances
Holds references to all editor instances created.
<static>  
The time to wait (in seconds) to load the full editor code after the page load, if the "ckeditor_basic" file is used.
<static>  
Enables the replacement of all textareas with class name matching CKEDITOR.replaceClass.
<static>  
CKEDITOR.replaceClass
The class name used to identify <textarea> elements to be replace by CKEditor instances.
<static>  
CKEDITOR.revision
Contains the CKEditor revision number.
<static>  
CKEDITOR.rnd
A 3-digit random integer, valid for the entire life of the CKEDITOR object.
<static>  
CKEDITOR.status
Indicates the API loading status.
<static>  
CKEDITOR.timestamp
A constant string unique for each release of CKEditor.
<static>  
CKEDITOR.version
Contains the CKEditor version number.
Method Summary
Method Attributes Method Name and Description
<static>  
CKEDITOR.add(editor)
Adds an editor instance to the global CKEDITOR object.
<static>  
CKEDITOR.addTemplates(name, definition)
<static>  
CKEDITOR.appendTo(elementOrId, config, data)
Creates a new editor instance inside a specific DOM element.
<static>  
CKEDITOR.BBCodeParser()
<static>  
CKEDITOR.cleanWord(data, editor)
<static>  
CKEDITOR.editorConfig(config)
Function called upon loading a custom configuration file that can modify the editor instance configuration (CKEDITOR.editor#config).
<static>  
CKEDITOR.getTemplates(name)
<static>  
CKEDITOR.getUrl(resource)
Gets the full URL for CKEditor resources.
<static>  
CKEDITOR.htmlDataProcessor(editor)
<static>  
CKEDITOR.loadFullCore()
Forces the full CKEditor core code, in the case only the basic code has been loaded (ckeditor_basic.js).
<static>  
CKEDITOR.loadStylesSet(name, url, callback)
<static>  
CKEDITOR.loadTemplates(templateFiles, callback)
<static>  
CKEDITOR.remove(editor)
Removes an editor instance from the global CKEDITOR object.
<static>  
<static>  
CKEDITOR.replace(elementOrIdOrName, config)
Replaces a <textarea> or a DOM element (DIV) with a CKEditor instance.
<static>  
CKEDITOR.replaceAll()
Replace all <textarea> elements available in the document with editor instances.
<static>  
CKEDITOR.style(styleDefinition, variablesValues)
<static>  
CKEDITOR.styleCommand(style)
<static>  
CKEDITOR.unlinkCommand()
Event Summary
Event Attributes Event Name and Description
 
Fired when a panel is added to the document
 
Fired when the CKEDITOR.currentInstance object reference changes.
 
Fired when a dialog definition is about to be used to create a dialog into an editor instance.
 
Fired when a CKEDITOR instance is created, but still before initializing it.
 
Fired when a CKEDITOR instance is destroyed.
 
Fired when a CKEDITOR instance is created, fully initialized and ready for interaction.
 
Fired when a CKEDITOR core object is fully loaded and ready for interaction.
 
Fired when the last instance has been destroyed.
Field Detail
<static> {String} CKEDITOR.basePath
Since: 3.0
Contains the full URL for the CKEditor installation directory. It is possible to manually provide the base path by setting a global variable named CKEDITOR_BASEPATH. This global variable must be set before the editor script loading.
alert( CKEDITOR.basePath );  // "http://www.example.com/ckeditor/" (e.g.)

<static> {CKEDITOR.editor} CKEDITOR.currentInstance
Since: 3.0
The editor which is currently active (have user focus).
Defined in: core/ckeditor.js.
function showCurrentEditorName()
{
    if ( CKEDITOR.currentInstance )
        alert( CKEDITOR.currentInstance.name );
    else
        alert( 'Please focus an editor first.' );
}
See:
CKEDITOR#currentInstance

<static> {Undefined} CKEDITOR.document
Since: 3.0
The document of the window holding the CKEDITOR object.
Defined in: core/ckeditor.js.
alert( CKEDITOR.document.getBody().getName() );  // "body"

<static> {Undefined} CKEDITOR.instances
Since: 3.0
Holds references to all editor instances created. The name of the properties in this object correspond to instance names, and their values contains the CKEDITOR.editor object representing them.
Defined in: core/ckeditor.js.
alert( CKEDITOR.instances.editor1.name );  // "editor1"

<static> {Number} CKEDITOR.loadFullCoreTimeout
Since: 3.0
The time to wait (in seconds) to load the full editor code after the page load, if the "ckeditor_basic" file is used. If set to zero, the editor is loaded on demand, as soon as an instance is created. This value must be set on the page before the page load completion.
Defined in: core/ckeditor_basic.js.
// Loads the full source after five seconds.
CKEDITOR.loadFullCoreTimeout = 5;
Default Value:
0 (zero)

<static> {Boolean} CKEDITOR.replaceByClassEnabled
Since: 3.0
Enables the replacement of all textareas with class name matching CKEDITOR.replaceClass.
Defined in: core/ckeditor_basic.js.
// Disable the auto-replace feature.
CKEDITOR.replaceByClassEnabled = false;
Default Value:
true

<static> {String} CKEDITOR.replaceClass
Since: 3.0
The class name used to identify <textarea> elements to be replace by CKEditor instances.
Defined in: core/ckeditor_basic.js.
CKEDITOR.replaceClass = 'rich_editor';
Default Value:
'ckeditor'

<static> {String} CKEDITOR.revision
Since: 3.0
Contains the CKEditor revision number. The revision number is incremented automatically, following each modification to the CKEditor source code.
alert( CKEDITOR.revision );  // e.g. '3975'

<static> {Number} CKEDITOR.rnd
Since: 3.0
A 3-digit random integer, valid for the entire life of the CKEDITOR object.
alert( CKEDITOR.rnd );  // e.g. '319'

<static> {String} CKEDITOR.status
Since: 3.0
Indicates the API loading status. The following statuses are available:
if ( CKEDITOR.status == 'loaded' )
{
    // The API can now be fully used.
}

<static> {String} CKEDITOR.timestamp
Since: 3.0
A constant string unique for each release of CKEditor. Its value is used, by default, to build the URL for all resources loaded by the editor code, guaranteeing clean cache results when upgrading.
alert( CKEDITOR.timestamp );  // e.g. '87dm'

<static> {String} CKEDITOR.version
Since: 3.0
Contains the CKEditor version number.
alert( CKEDITOR.version );  // e.g. 'CKEditor 3.4.1'
Method Detail
<static> {Undefined} CKEDITOR.add(editor)
Since: 3.0
Adds an editor instance to the global CKEDITOR object. This function is available for internal use mainly.
Defined in: core/ckeditor.js.
Parameters:
{CKEDITOR.editor} editor
The editor instance to be added.

<static> {Undefined} CKEDITOR.addTemplates(name, definition)
Since: 3.0

Defined in: plugins/templates/plugin.js.
NO EXAMPLE AVAILABLE
Parameters:
{Undefined} name
{Undefined} definition

<static> {CKEDITOR.editor} CKEDITOR.appendTo(elementOrId, config, data)
Since: 3.0
Creates a new editor instance inside a specific DOM element.
Defined in: core/ckeditor_basic.js.
<div id="editorSpace"><:/div>
...
CKEDITOR.appendTo( 'editorSpace' );
Parameters:
{Object|String} elementOrId
The DOM element or its ID.
{Object} config Optional
The specific configurations to apply to this editor instance. Configurations set here will override global CKEditor settings.
{String} data Optional
Since 3.3. Initial value for the instance.
Returns:
{CKEDITOR.editor} The editor instance created.

<static> {Undefined} CKEDITOR.BBCodeParser()
Since: 3.0

Defined in: plugins/bbcode/plugin.js.
NO EXAMPLE AVAILABLE

<static> {Undefined} CKEDITOR.cleanWord(data, editor)
Since: 3.0

Defined in: plugins/pastefromword/filter/default.js.
NO EXAMPLE AVAILABLE
Parameters:
{Undefined} data
{Undefined} editor

<static> {Undefined} CKEDITOR.editorConfig(config)
Since: 3.0
Function called upon loading a custom configuration file that can modify the editor instance configuration (CKEDITOR.editor#config). It is usually defined inside the custom configuration files that can include developer defined settings.
// This is supposed to be placed in the config.js file.
CKEDITOR.editorConfig = function( config )
{
    // Define changes to default configuration here. For example:
    config.language = 'fr';
    config.uiColor = '#AADC6E';
};
Parameters:
{CKEDITOR.config} config
A configuration object containing the settings defined for a CKEDITOR.editor instance up to this function call. Note that not all settings may still be available. See Configuration Loading Order for details.

<static> {Undefined} CKEDITOR.getTemplates(name)
Since: 3.0

Defined in: plugins/templates/plugin.js.
NO EXAMPLE AVAILABLE
Parameters:
{Undefined} name

<static> {String} CKEDITOR.getUrl(resource)
Since: 3.0
Gets the full URL for CKEditor resources. By default, URLs returned by this function contain a querystring parameter ("t") set to the CKEDITOR.timestamp value.

It is possible to provide a custom implementation of this function by setting a global variable named CKEDITOR_GETURL. This global variable must be set before the editor script loading. If the custom implementation returns nothing (==null), the default implementation is used.
// e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
// e.g. http://www.example.com/skins/default/editor.css?t=87dm
alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
// e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
Parameters:
{String} resource
The resource whose full URL we want to get. It may be a full, absolute, or relative URL.
Returns:
{String} The full URL.

<static> {Undefined} CKEDITOR.htmlDataProcessor(editor)
Since: 3.0

Defined in: plugins/htmldataprocessor/plugin.js.
NO EXAMPLE AVAILABLE
Parameters:
{Undefined} editor

<static> {Undefined} CKEDITOR.loadFullCore()
Since: 3.0
Forces the full CKEditor core code, in the case only the basic code has been loaded (ckeditor_basic.js). This method self-destroys (becomes undefined) in the first call or as soon as the full code is available.
Defined in: core/ckeditor_basic.js.
// Check if the full core code has been loaded and load it.
if ( CKEDITOR.loadFullCore )
    CKEDITOR.loadFullCore();

<static> {Undefined} CKEDITOR.loadStylesSet(name, url, callback)
Since: 3.0

Defined in: plugins/styles/plugin.js.
NO EXAMPLE AVAILABLE
Parameters:
{Undefined} name
{Undefined} url
{Undefined} callback

<static> {Undefined} CKEDITOR.loadTemplates(templateFiles, callback)
Since: 3.0

Defined in: plugins/templates/plugin.js.
NO EXAMPLE AVAILABLE
Parameters:
{Undefined} templateFiles
{Undefined} callback

<static> {Undefined} CKEDITOR.remove(editor)
Since: 3.0
Removes an editor instance from the global CKEDITOR object. This function is available for internal use only. External code must use CKEDITOR.editor.prototype.destroy to avoid memory leaks.
Defined in: core/ckeditor.js.
Parameters:
{CKEDITOR.editor} editor
The editor instance to be removed.

<static> {Undefined} CKEDITOR.removeAnchorCommand()
Since: 3.0

Defined in: plugins/link/plugin.js.
NO EXAMPLE AVAILABLE

<static> {CKEDITOR.editor} CKEDITOR.replace(elementOrIdOrName, config)
Since: 3.0
Replaces a <textarea> or a DOM element (DIV) with a CKEditor instance. For textareas, the initial value in the editor will be the textarea value. For DOM elements, their innerHTML will be used instead. We recommend using TEXTAREA and DIV elements only.
Defined in: core/ckeditor_basic.js.
<textarea id="myfield" name="myfield"><:/textarea>
...
CKEDITOR.replace( 'myfield' );
var textarea = document.body.appendChild( document.createElement( 'textarea' ) );
CKEDITOR.replace( textarea );
Parameters:
{Object|String} elementOrIdOrName
The DOM element (textarea), its ID or name.
{Object} config Optional
The specific configurations to apply to this editor instance. Configurations set here will override global CKEditor settings.
Returns:
{CKEDITOR.editor} The editor instance created.

<static> {Undefined} CKEDITOR.replaceAll()
Since: 3.0
Replace all <textarea> elements available in the document with editor instances.
Defined in: core/ckeditor_basic.js.
// Replace all <textarea> elements in the page.
CKEDITOR.replaceAll();
// Replace all <textarea class="myClassName"> elements in the page.
CKEDITOR.replaceAll( 'myClassName' );
// Selectively replace <textarea> elements, based on custom assertions.
CKEDITOR.replaceAll( function( textarea, config )
    {
        // Custom code to evaluate the replace, returning false
        // if it must not be done.
        // It also passes the "config" parameter, so the
        // developer can customize the instance.
    } );

<static> {Undefined} CKEDITOR.style(styleDefinition, variablesValues)
Since: 3.0

Defined in: plugins/styles/plugin.js.
NO EXAMPLE AVAILABLE
Parameters:
{Undefined} styleDefinition
{Undefined} variablesValues

<static> {Undefined} CKEDITOR.styleCommand(style)
Since: 3.0

Defined in: plugins/styles/plugin.js.
NO EXAMPLE AVAILABLE
Parameters:
{Undefined} style

<static> {Undefined} CKEDITOR.unlinkCommand()
Since: 3.0

Defined in: plugins/link/plugin.js.
NO EXAMPLE AVAILABLE
Event Detail
ariaWidget : <object>.on( 'ariaWidget', function( e ){ ... } )
Since: 3.0
Fired when a panel is added to the document
Defined in: plugin.js.
NO EXAMPLE AVAILABLE
Parameters:
{CKEDITOR.eventInfo} e
The standard event object passed to event listeners.
{Object} e.holder
The element wrapping the panel

currentInstance : <object>.on( 'currentInstance', function( e ){ ... } )
Since: 3.0
Fired when the CKEDITOR.currentInstance object reference changes. This may happen when setting the focus on different editor instances in the page.
Defined in: ckeditor.js.
NO EXAMPLE AVAILABLE
Parameters:
{CKEDITOR.eventInfo} e
The standard event object passed to event listeners.

dialogDefinition : <object>.on( 'dialogDefinition', function( e ){ ... } )
Since: 3.0
Fired when a dialog definition is about to be used to create a dialog into an editor instance. This event makes it possible to customize the definition before creating it.

Note that this event is called only the first time a specific dialog is opened. Successive openings will use the cached dialog, and this event will not get fired.


Defined in: plugin.js.
NO EXAMPLE AVAILABLE
Parameters:
{CKEDITOR.eventInfo} e
The standard event object passed to event listeners.
{CKEDITOR.dialog.definition} e.data
The dialog defination that is being loaded.
{CKEDITOR.editor} e.editor
The editor instance that will use the dialog.

instanceCreated : <object>.on( 'instanceCreated', function( e ){ ... } )
Since: 3.0
Fired when a CKEDITOR instance is created, but still before initializing it. To interact with a fully initialized instance, use the CKEDITOR#instanceReady event instead.
Defined in: editor.js.
NO EXAMPLE AVAILABLE
Parameters:
{CKEDITOR.eventInfo} e
The standard event object passed to event listeners.
{CKEDITOR.editor} e.editor
The editor instance that has been created.

instanceDestroyed : <object>.on( 'instanceDestroyed', function( e ){ ... } )
Since: 3.0
Fired when a CKEDITOR instance is destroyed.
Defined in: editor.js.
NO EXAMPLE AVAILABLE
Parameters:
{CKEDITOR.eventInfo} e
The standard event object passed to event listeners.
{CKEDITOR.editor} e.editor
The editor instance that has been destroyed.

instanceReady : <object>.on( 'instanceReady', function( e ){ ... } )
Since: 3.0
Fired when a CKEDITOR instance is created, fully initialized and ready for interaction.
Defined in: plugin.js.
NO EXAMPLE AVAILABLE
Parameters:
{CKEDITOR.eventInfo} e
The standard event object passed to event listeners.
{CKEDITOR.editor} e.editor
The editor instance that has been created.

loaded : <object>.on( 'loaded', function( e ){ ... } )
Since: 3.0
Fired when a CKEDITOR core object is fully loaded and ready for interaction.
Defined in: _bootstrap.js.
NO EXAMPLE AVAILABLE
Parameters:
{CKEDITOR.eventInfo} e
The standard event object passed to event listeners.

reset : <object>.on( 'reset', function( e ){ ... } )
Since: 3.0
Fired when the last instance has been destroyed. This event is used to perform global memory clean up.
Defined in: ckeditor.js.
NO EXAMPLE AVAILABLE
Parameters:
{CKEDITOR.eventInfo} e
The standard event object passed to event listeners.

Copyright © 2003-2010, CKSource - Frederico Knabben. All rights reserved.