Namespace CKEDITOR
This is the API entry point. The entire CKEditor code runs under this object.
Defined in: core/ckeditor_base.js.
Constructor Attributes | Constructor Name and Description |
---|---|
This is the API entry point.
|
Field Attributes | Field Name and Description |
---|---|
<static> <constant> |
CKEDITOR.SELECTION_ELEMENT
Element selection.
|
<static> <constant> |
CKEDITOR.SELECTION_NONE
No selection.
|
<static> <constant> |
CKEDITOR.SELECTION_TEXT
Text or collapsed selection.
|
<static> <constant> |
CKEDITOR.UI_BUTTON
Button UI element.
|
<static> |
CKEDITOR.basePath
Contains the full URL for the CKEditor installation directory.
|
<static> |
CKEDITOR.document
The document of the window holding the CKEDITOR object.
|
<static> |
CKEDITOR.instances
Holds references to all editor instances created.
|
<static> |
CKEDITOR.replaceByClassEnabled
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.status
Indicates the API loading status.
|
<static> |
CKEDITOR.timestamp
A constant string unique for each release of CKEditor.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
CKEDITOR.add(editor)
Adds an editor instance to the global CKEDITOR object.
|
<static> |
CKEDITOR.getUrl(resource)
Gets the full URL for CKEditor resources.
|
<static> |
CKEDITOR.loadFullCore()
Forces the full CKEditor core code, in the case only the basic code has been
loaded (ckeditor_basic.js).
|
<static> |
CKEDITOR.replace(elementOrIdOrName, config)
Replaces a specific <textarea> with a CKEditor instance.
|
<static> |
CKEDITOR.replaceAll()
Replace all <textarea> elements available in the document with
editor instances.
|
Namespace Detail
CKEDITOR
Since:
3.0
This is the API entry point. The entire CKEditor code runs under this object.
Field Detail
<static> <constant>
{Undefined}
CKEDITOR.SELECTION_ELEMENT
Since:
3.0
Element selection.
Defined in: plugins/selection/plugin.js.
Defined in: plugins/selection/plugin.js.
if ( editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT ) alert( 'An element is selected' );
<static> <constant>
{Undefined}
CKEDITOR.SELECTION_NONE
Since:
3.0
No selection.
Defined in: plugins/selection/plugin.js.
Defined in: plugins/selection/plugin.js.
if ( editor.getSelection().getType() == CKEDITOR.SELECTION_NONE ) alert( 'Nothing is selected' );
<static> <constant>
{Undefined}
CKEDITOR.SELECTION_TEXT
Since:
3.0
Text or collapsed selection.
Defined in: plugins/selection/plugin.js.
Defined in: plugins/selection/plugin.js.
if ( editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT ) alert( 'Text is selected' );
<static> <constant>
{Undefined}
CKEDITOR.UI_BUTTON
Since:
3.0
Button UI element.
Defined in: plugins/button/plugin.js.
Defined in: plugins/button/plugin.js.
<static>
{String}
CKEDITOR.basePath
Since:
3.0
Contains the full URL for the CKEditor installation directory.
alert( CKEDITOR.basePath ); // "http://www.example.com/ckeditor/" (e.g.)
<static>
CKEDITOR.document
Since:
3.0
The document of the window holding the CKEDITOR object.
Defined in: core/ckeditor.js.
Defined in: core/ckeditor.js.
alert( CKEDITOR.document.getBody().getName() ); // "body"
<static>
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.
Defined in: core/ckeditor.js.
alert( CKEDITOR.instances.editor1.name ); // "editor1"
<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.
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.
Defined in: core/ckeditor_basic.js.
CKEDITOR.replaceClass = 'rich_editor';
- Default Value:
- 'ckeditor'
<static>
{String}
CKEDITOR.status
Since:
3.0
Indicates the API loading status. The following status are available:
- unloaded: the API is not yet loaded.
- basic_loaded: the basic API features are available.
- basic_ready: the basic API is ready to load the full core code.
- loading: the full API is being loaded.
- ready: the API can be fully used.
if ( CKEDITOR.status == 'ready' ) { // 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, guaranteing clean cache results when
upgrading.
alert( CKEDITOR.timestamp ); // e.g. '87dm'
Method Detail
<static>
{Undefined}
CKEDITOR.add(editor)
Since:
3.0
Adds an editor instance to the global CKEDITOR object. It also fires
the effective creation of the editor interface.
Defined in: core/ckeditor.js.
Defined in: core/ckeditor.js.
var myTextarea = CKEDITOR.document.getById( 'myTextarea' ); var myEditor = new CKEDITOR.editor( myTextarea ); CKEDITOR.add( myEditor );
- Parameters:
- {CKEDITOR.editor} editor
- The editor instance to be added.
<static>
{String}
CKEDITOR.getUrl(resource)
Since:
3.0
Gets the full URL for CKEditor resources. By default, URLs
returned by this function contains a querystring parameter ("t")
set to the CKEDITOR.timestamp value.
// 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:
- resource
- Returns:
- {String} The full URL.
<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.
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.replace(elementOrIdOrName, config)
Since:
3.0
Replaces a specific <textarea> with a CKEditor instance.
Defined in: core/ckeditor_basic.js.
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.
<static>
{Undefined}
CKEDITOR.replaceAll()
Since:
3.0
Replace all <textarea> elements available in the document with
editor instances.
Defined in: core/ckeditor_basic.js.
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. } );