# CKEditor 3.0 JavaScript API Documentation

Code Index | File Index

## Namespaces

- CKEDITOR
- CKEDITOR.ajax
- CKEDITOR.config
- CKEDITOR.dom
- CKEDITOR.dtd
- CKEDITOR.env
- CKEDITOR.imageCacher
- CKEDITOR.loader
- CKEDITOR.plugins
- CKEDITOR.resourceManager
- CKEDITOR.scriptLoader
- CKEDITOR.skins
- CKEDITOR.test
- CKEDITOR.themes
- CKEDITOR.tools

## Classes

- CKEDITOR.commandDefinition
- CKEDITOR.dialog
- CKEDITOR.dialog.buttonDefinition
- CKEDITOR.dialog.contentDefinition
- CKEDITOR.dialog.contentDefinitionObject
- CKEDITOR.dialog.dialogDefinition
- CKEDITOR.dialog.dialogDefinitionObject
- CKEDITOR.dialog.uiElementDefinition
- CKEDITOR.dialogCommand
- CKEDITOR.dom.document
- CKEDITOR.dom.domObject
- CKEDITOR.dom.element
- CKEDITOR.dom.event
- CKEDITOR.dom.node
- CKEDITOR.dom.selection
- CKEDITOR.dom.text
- CKEDITOR.dom.window
- CKEDITOR.editor
- CKEDITOR.event
- CKEDITOR.eventInfo
- CKEDITOR.focusManager
- CKEDITOR.htmlParser
- CKEDITOR.htmlParser.cdata
- CKEDITOR.htmlParser.comment
- CKEDITOR.htmlParser.element
- CKEDITOR.htmlParser.fragment
- CKEDITOR.htmlParser.text
- CKEDITOR.htmlWriter
- CKEDITOR.keystrokeHandler
- CKEDITOR.pluginDefinition
- CKEDITOR.ui
- CKEDITOR.ui.button
- CKEDITOR.ui.dialog.button
- CKEDITOR.ui.dialog.checkbox
- CKEDITOR.ui.dialog.file
- CKEDITOR.ui.dialog.fileButton
- CKEDITOR.ui.dialog.hbox
- CKEDITOR.ui.dialog.html
- CKEDITOR.ui.dialog.labeledElement
- CKEDITOR.ui.dialog.radio
- CKEDITOR.ui.dialog.select
- CKEDITOR.ui.dialog.textarea
- CKEDITOR.ui.dialog.textInput
- CKEDITOR.ui.dialog.uiElement
- CKEDITOR.ui.dialog.vbox
- CKEDITOR.ui.handlerDefinition
- CKEDITOR.xml

# Class CKEDITOR.commandDefinition

Defined in: core/commanddefinition.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| CKEDITOR.commandDefinition() (Virtual Class) Do not call this constructor.

Field Summary
Field Attributes | Field Name and Description
--- | ---
<static> | CKEDITOR.commandDefinition.async Whether the command is asynchronous, which means the 'afterCommandExec' event will be fired by the command itself manually, and the 'exec' function return value of this command is not to be returned.
<static> | CKEDITOR.commandDefinition.canUndo Whether the command need to be hooked into the redo/undo system.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| exec(editor, data) Executes the command.

Class Detail
CKEDITOR.commandDefinition()
Since: 3.0
(Virtual Class) Do not call this constructor. This class is not really part of the API. It just illustrates the features of command objects to be passed to the CKEDITOR.editor.prototype.addCommand function.
Field Detail
<static> {If defined as 'true', the command is asynchronous.} CKEDITOR.commandDefinition.async
Since: 3.0
Whether the command is asynchronous, which means the 'afterCommandExec' event will be fired by the command itself manually, and the 'exec' function return value of this command is not to be returned.

    editorInstance.addCommand( 'alertName',
    {
        exec : function( editor )
        {
            // Asynchronous operation below.
            CKEDITOR.ajax.loadXml( 'data.xml' );
        },
        async : true    // The command need some time to complete after exec function returns.
    });

<static> {If not defined or 'true' both hook into undo system, set it to 'false' explicitly keep it out.} CKEDITOR.commandDefinition.canUndo
Since: 3.0
Whether the command need to be hooked into the redo/undo system.

    editorInstance.addCommand( 'alertName',
    {
        exec : function( editor )
        {
            alert( editor.name );
        },
        canUndo : false    // No support for undo/redo
    });

Method Detail
{Boolean} exec(editor, data)
Since: 3.0
Executes the command.

    editorInstance.addCommand( 'sample',
    {
        exec : function( editor )
        {
            alert( 'Executing a command for the editor name "' + editor.name + '"!' );
        }
    });

Parameters:
{CKEDITOR.editor} editor
  The editor within which run the command.
{Object} data Optional
  Additional data to be used to execute the command.

Returns:
  {Boolean} Whether the command has been successfully executed. Defaults to "true", if nothing is returned.

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