Class CKEDITOR.editor
Extends
CKEDITOR.event.
Defined in: core/editor.js.
Constructor Attributes | Constructor Name and Description |
---|---|
CKEDITOR.editor(element)
Represents an editor instance.
|
Field Attributes | Field Name and Description |
---|---|
The configurations for this editor instance.
|
|
The DOM element that has been replaced by this editor instance.
|
|
The current editing mode.
|
|
The editor instance name.
|
|
Namespace containing UI features related to this editor instance.
|
Method Attributes | Method Name and Description |
---|---|
addCommand(commandName, commandDefinition)
Adds a command definition to the editor instance.
|
|
addMode(mode, modeEditor)
Registers an editing mode.
|
|
execCommand(commandName, data)
Executes a command.
|
|
focus()
Moves the selection focus to the editing are space in the editor.
|
|
getData()
Gets the editor data.
|
|
Gets the current selection from the editing area when in WYSIWYG mode.
|
|
setData(data)
Sets the editor data.
|
|
setMode(mode)
Sets the current editing mode in this editor instance.
|
|
Updates the <textarea> element that has been replaced by the editor with
the current data available in the editor.
|
- Methods borrowed from class CKEDITOR.event:
- fire, fireOnce, hasListeners, implementOn, on, removeListener
Class Detail
CKEDITOR.editor(element)
Since:
3.0
Represents an editor instance. This constructor should be rarely used, being
the standard replacement methods preferible.
var myTextarea = CKEDITOR.document.getById( 'myTextarea' ); var myEditor = new CKEDITOR.editor( myTextarea ); CKEDITOR.add( myEditor );
- Parameters:
- {CKEDITOR.dom.element} element
- The original element replaced by this editor instance.
Field Detail
{Object}
config
Since:
3.0
The configurations for this editor instance. It inherits all
settings defined in (@link CKEDITOR.config}, combined with settings
loaded from custom configuration files and those defined inline in
the page when creating the editor.
var editor = CKEDITOR.instances.editor1; alert( editor.config.theme ); "default" e.g.
{CKEDITOR.dom.element}
element
Since:
3.0
The DOM element that has been replaced by this editor instance. This
element holds the editor data on load and post.
var editor = CKEDITOR.instances.editor1; alert( editor.element.getName() ); "textarea"
{String}
mode
Since:
3.0
The current editing mode. An editing mode is basically a viewport for
editing or content viewing. By default the possible values for this
property are "wysiwyg" and "source".
Defined in: plugins/editingblock/plugin.js.
Defined in: plugins/editingblock/plugin.js.
alert( CKEDITOR.instances.editor1.mode ); // "wysiwyg" (e.g.)
{String}
name
Since:
3.0
The editor instance name. It hay be the replaced element id, name or
a default name using a progressive counter (editor1, editor2, ...).
var editor = CKEDITOR.instances.editor1; alert( editor.name ); "editor1"
{CKEDITOR.ui}
ui
Since:
3.0
Namespace containing UI features related to this editor instance.
Method Detail
{Undefined}
addCommand(commandName, commandDefinition)
Since:
3.0
Adds a command definition to the editor instance. Commands added with
this function can be later executed with #execCommand.
editorInstance.addCommand( 'sample', { exec : function( editor ) { alert( 'Executing a command for the editor name "' + editor.name + '"!' ); } });
- Parameters:
- {String} commandName
- The indentifier name of the command.
- {CKEDITOR.commandDefinition} commandDefinition
- The command definition.
{Undefined}
addMode(mode, modeEditor)
Since:
3.0
Registers an editing mode. This function is to be used mainly by plugins.
Defined in: plugins/editingblock/plugin.js.
Defined in: plugins/editingblock/plugin.js.
- Parameters:
- {String} mode
- The mode name.
- {Object} modeEditor
- The mode editor definition.
{Undefined}
execCommand(commandName, data)
Since:
3.0
Executes a command.
editorInstance.execCommand( 'Bold' );
- Parameters:
- {String} commandName
- The indentifier name of the command.
- {Object} data Optional
- Data to be passed to the command
{Undefined}
focus()
Since:
3.0
Moves the selection focus to the editing are space in the editor.
Defined in: plugins/editingblock/plugin.js.
Defined in: plugins/editingblock/plugin.js.
NO EXAMPLE AVAILABLE
{String}
getData()
Since:
3.0
Gets the editor data. The data will be in raw format. It is the same
data that is posted by the editor.
if ( CKEDITOR.instances.editor1.getData() == '' ) alert( 'There is no data available' );
- Returns:
- (String) The editor data.
{CKEDITOR.dom.selection}
getSelection()
Since:
3.0
Gets the current selection from the editing area when in WYSIWYG mode.
Defined in: plugins/selection/plugin.js.
Defined in: plugins/selection/plugin.js.
var selection = CKEDITOR.instances.editor1.getSelection(); alert( selection.getType() );
- Returns:
- {CKEDITOR.dom.selection} A selection object or null if not on WYSIWYG mode or no selection is available.
{Undefined}
setData(data)
Since:
3.0
Sets the editor data. The data must be provided in raw format.
CKEDITOR.instances.editor1.setData( '<p>This is the editor data.</p>' );
- Parameters:
- data
{Undefined}
setMode(mode)
Since:
3.0
Sets the current editing mode in this editor instance.
Defined in: plugins/editingblock/plugin.js.
Defined in: plugins/editingblock/plugin.js.
// Switch to "source" view. CKEDITOR.instances.editor1.setMode( 'source' );
- Parameters:
- {String} mode
- A registered mode name.
{Undefined}
updateElement()
Since:
3.0
Updates the <textarea> element that has been replaced by the editor with
the current data available in the editor.
CKEDITOR.instances.editor1.updateElement(); alert( document.getElementById( 'editor1' ).value ); // The current editor data.