Report an issue
Class

CKEDITOR_Adapters.jQuery

class singleton

The jQuery Adapter allows for easy use of basic CKEditor functions and access to the internal API. To find more information about the jQuery Adapter, go to the jQuery Adapter section of the Developer's Guide or see the "Create Editors with jQuery" sample.

Filtering

Properties

  • editor : editor

    Existing CKEditor instance. Allows to easily use the internal API.

    Note: This is not a jQuery object.

    var editor = $( 'textarea' ).ckeditor().editor;
    
  • promise : Function

    The jQuery Promise object that handles the asynchronous constructor. This promise will be resolved after all of the constructors.

Methods

  • ckeditor( callback, config ) → Object

    chainable

    A jQuery function which triggers the creation of CKEditor with <textarea> and editable elements. Every <textarea> element will be converted to a classic (iframe-based) editor, while any other supported element will be converted to an inline editor. This method binds the callback to the instanceReady event of all instances. If the editor has already been created, the callback is fired straightaway. You can also create multiple editors at once by using $( '.className' ).ckeditor();.

    Note: jQuery chaining and mixed parameter order is allowed.

    Parameters

    callback : Function

    Function to be run on the editor instance. Callback takes the source element as a parameter.

    $( 'textarea' ).ckeditor( function( textarea ) {
        // Callback function code.
    } );
    
    config : Object

    Configuration options for new instance(s) if not already created.

    $( 'textarea' ).ckeditor( {
        uiColor: '#9AB8F3'
    } );
    

    Returns

    Object

    jQuery.fn

  • ckeditorGet() → Object

    deprecated

    Returns an existing CKEditor instance for the first matched element. Allows to easily use the internal API. Does not return a jQuery object.

    Raises an exception if the editor does not exist or is not ready yet.

    Returns

    Object

    CKEDITOR.editor

  • val() → Object

    Overwritten jQuery val() method for <textarea> elements that have bound CKEditor instances. This method gets or sets editor content by using the editor.getData() or editor.setData() methods. To handle the editor.setData() callback (as setData is asynchronous), val( 'some data' ) will return a jQuery Promise object.

    Returns

    Object

    String|Number|Array|jQuery.fn|function(jQuery Promise)

Events

  • dataReady( evt )

    Forwards the CKEditor dataReady event as a jQuery event.

    Parameters

    evt : eventInfo
    Properties
    editor : editor

    Editor instance.

  • destroy( evt )

    Forwards the CKEditor destroy event as a jQuery event.

    Parameters

    evt : eventInfo
    Properties
    editor : editor

    Editor instance.

  • getData( evt )

    Forwards the CKEditor getData event as a jQuery event.

    Parameters

    evt : eventInfo
    Properties
    editor : editor

    Editor instance.

    data : Object
    Properties
    dataValue : String

    The data that will be returned.

  • instanceReady( evt )

    Forwards the CKEditor instanceReady event as a jQuery event.

    Parameters

    evt : eventInfo
    Properties
    editor : editor

    Editor instance.

  • setData( evt )

    Forwards the CKEditor setData event as a jQuery event.

    Parameters

    evt : eventInfo
    Properties
    editor : editor

    Editor instance.

    data : Object
    Properties
    dataValue : String

    The data that will be used.