CKEditor 4 Documentation

CKEDITOR.dom.event

Files

Represents a native DOM event object.

Defined By

Properties

CKEDITOR.dom.event
view source
: Objectreadonly

The native DOM event object represented by this class instance.

The native DOM event object represented by this class instance.

Defined By

Methods

CKEDITOR.dom.event
view source
new( domEvent ) : CKEDITOR.dom.event
Creates an event class instance. ...

Creates an event class instance.

Parameters

  • domEvent : Object

    A native DOM event object.

Returns

CKEDITOR.dom.event
view source
( ) : Number
Gets the key code associated to the event. ...

Gets the key code associated to the event.

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

Returns

  • Number

    The key code.

CKEDITOR.dom.event
view source
( ) : Number
Gets a number represeting the combination of the keys pressed during the event. ...

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.event
view source
( ) : Object
Retrieves the coordinates of the mouse pointer relative to the top-left corner of the document, in mouse related event. ...

Retrieves the coordinates of the mouse pointer relative to the top-left corner of the document, in mouse related event.

element.on( 'mousemouse', function( ev ) {
    var pageOffset = ev.data.getPageOffset();
    alert( pageOffset.x );          // page offset X
    alert( pageOffset.y );          // page offset Y
} );

Returns

  • Object

    The object contains the position.

    • x : Number
    • y : Number
CKEDITOR.dom.event
view source
( ) : Number
Returns an integer value that indicates the current processing phase of an event. ...

Returns an integer value that indicates the current processing phase of an event. For browsers that doesn't support event phase, CKEDITOR.EVENT_PHASE_AT_TARGET is always returned.

Returns

Returns the DOM node where the event was targeted to. ...

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.event
view source
( [stopPropagation] )
Prevents the original behavior of the event to happen. ...

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

  • stopPropagation : Boolean (optional)

    Stop propagating this event in the event chain.

    Defaults to: false

CKEDITOR.dom.event
view source
( )
Stops this event propagation in the event chain. ...

Stops this event propagation in the event chain.