# 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.dom.event

Defined in: core/dom/event.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| CKEDITOR.dom.event(domEvent) Represents a native DOM event object.

Field Summary
Field Attributes | Field Name and Description
--- | ---
| $ The native DOM event object represented by this class instance.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| getKey() Gets the key code associated to the event.
| getKeystroke() Gets a number represeting the combination of the keys pressed during the event.
| getTarget() Returns the DOM node where the event was targeted to.
| preventDefault(stopPropagation) Prevents the original behavior of the event to happen.

Class Detail
CKEDITOR.dom.event(domEvent)
Since: 3.0
Represents a native DOM event object.

Parameters:
{Object} domEvent
  A native DOM event object.

Field Detail
{Object} $
Since: 3.0
The native DOM event object represented by this class instance.
Method Detail
{Number} getKey()
Since: 3.0
Gets the key code associated to the event.

    alert( event.getKey() );  "65" is "a" has been pressed

Returns:
  {Number} The key code.

{Number} getKeystroke()
Since: 3.0
Gets a number represeting the combination of the keys pressed during the event. It is the sum with the current key code and the CKEDITOR.CTRL, CKEDITOR.SHIFT and CKEDITOR.ALT constants.

    alert( event.getKeystroke() == 65 );                                   // "a" key
    alert( event.getKeystroke() == CKEDITOR.CTRL + 65 );                   // CTRL + "a" key
    alert( event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65 );  // CTRL + SHIFT + "a" key

Returns:
  {Number} The number representing the keys combination.

{CKEDITOR.dom.node} getTarget()
Since: 3.0
Returns the DOM node where the event was targeted to.

    var element = CKEDITOR.document.getById( 'myElement' );
    element.on( 'click', function( ev )
        {
            // The DOM event object is passed by the "data" property.
            var domEvent = ev.data;
            // Add a CSS class to the event target.
            domEvent.getTarget().addClass( 'clicked' );
        });

Returns:
  {CKEDITOR.dom.node} The target DOM node.

{Undefined} preventDefault(stopPropagation)
Since: 3.0
Prevents the original behavior of the event to happen. It can optionally stop propagating the event in the event chain.

    var element = CKEDITOR.document.getById( 'myElement' );
    element.on( 'click', function( ev )
        {
            // The DOM event object is passed by the "data" property.
            var domEvent = ev.data;
            // Prevent the click to chave any effect in the element.
            domEvent.preventDefault();
        });

Parameters:
{Boolean} stopPropagation Optional
  Stop propagating this event in the event chain.

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