# 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.ui.dialog.uiElement

Defined in: plugins/dialog/plugin.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| CKEDITOR.ui.dialog.uiElement(dialog, elementDefinition, htmlList, nodeNameArg, stylesArg, attributesArg, contentsArg) The base class of all dialog UI elements.

Field Summary
Field Attributes | Field Name and Description
--- | ---
| eventProcessors The event processor list used by CKEDITOR.ui.dialog.uiElement#getInputElement at UI element instantiation.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| accessKeyDown(dialog, key) The default handler for a UI element's access key down event, which tries to put focus to the UI element.
| accessKeyUp(dialog, key) The default handler for a UI element's access key up event, which does nothing.
| disable() Disables a UI element.
| enable() Enables a UI element.
| focus() Puts the focus to the UI object.
| getDialog() Gets the parent dialog object containing this UI element.
| getElement() Gets the root DOM element of this dialog UI object.
| getInputElement() Gets the DOM element that the user inputs values.
| getValue() Gets the current value of this dialog UI object.
| isChanged() Tells whether the UI object's value has changed.
| isEnabled() Determines whether an UI element is enabled or not.
| isFocusable() Determines whether an UI element is focus-able or not.
| isVisible() Determines whether an UI element is visible or not.
| registerEvents(definition) Registers the on* event handlers defined in the element definition.
| selectParentTab() Selects the parent tab of this element.
| setValue(value) Sets the value of this dialog UI object.

Class Detail
CKEDITOR.ui.dialog.uiElement(dialog, elementDefinition, htmlList, nodeNameArg, stylesArg, attributesArg, contentsArg)
Since: 3.0
The base class of all dialog UI elements.

Parameters:
{CKEDITOR.dialog} dialog
  Parent dialog object.
{CKEDITOR.dialog.uiElementDefinition} elementDefinition
  Element definition. Accepted fields:
  - id (Required) The id of the UI element. See {@link CKEDITOR.dialog#getContentElement}
  - type (Required) The type of the UI element. The value to this field specifies which UI element class will be used to generate the final widget.
  - title (Optional) The popup tooltip for the UI element.
  - hidden (Optional) A flag that tells if the element should be initially visible.
  - className (Optional) Additional CSS class names to add to the UI element. Separated by space.
  - style (Optional) Additional CSS inline styles to add to the UI element. A semicolon (;) is required after the last style declaration.
  - accessKey (Optional) The alphanumeric access key for this element. Access keys are automatically prefixed by CTRL.
  - on* (Optional) Any UI element definition field that starts with on followed immediately by a capital letter and probably more letters is an event handler. Event handlers may be further divided into registered event handlers and DOM event handlers. Please refer to CKEDITOR.ui.dialog.uiElement#registerEvents and CKEDITOR.ui.dialog.uiElement#eventProcessors for more information.
{Array} htmlList
  List of HTML code to be added to the dialog's content area.
{Function|String} nodeNameArg
  A function returning a string, or a simple string for the node name for the root DOM node. Default is 'div'.
{Function|Object} stylesArg
  A function returning an object, or a simple object for CSS styles applied to the DOM node. Default is empty object.
{Function|Object} attributesArg
  A fucntion returning an object, or a simple object for attributes applied to the DOM node. Default is empty object.
{Function|String} contentsArg
  A function returning a string, or a simple string for the HTML code inside the root DOM node. Default is empty string.

Field Detail
{Object} eventProcessors
Since: 3.0
The event processor list used by CKEDITOR.ui.dialog.uiElement#getInputElement at UI element instantiation. The default list defines three on* events:

1. onLoad - Called when the element's parent dialog opens for the first time
2. onShow - Called whenever the element's parent dialog opens.
3. onHide - Called whenever the element's parent dialog closes.

    // This connects the 'click' event in CKEDITOR.ui.dialog.button to onClick
    // handlers in the UI element's definitions.
    CKEDITOR.ui.dialog.button.eventProcessors = CKEDITOR.tools.extend( {},
      CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,
      { onClick : function( dialog, func ) { this.on( 'click', func ); } },
      true );

Method Detail
{Undefined} accessKeyDown(dialog, key)
Since: 3.0
The default handler for a UI element's access key down event, which tries to put focus to the UI element.
Can be overridded in child classes for more sophisticaed behavior.

Parameters:
{CKEDITOR.dialog} dialog
  The parent dialog object.
{String} key
  The key combination pressed. Since access keys are defined to always include the CTRL key, its value should always include a 'CTRL+' prefix.

{Undefined} accessKeyUp(dialog, key)
Since: 3.0
The default handler for a UI element's access key up event, which does nothing.
Can be overridded in child classes for more sophisticated behavior.

Parameters:
{CKEDITOR.dialog} dialog
  The parent dialog object.
{String} key
  The key combination pressed. Since access keys are defined to always include the CTRL key, its value should always include a 'CTRL+' prefix.

{Undefined} disable()
Since: 3.0
Disables a UI element.

{Undefined} enable()
Since: 3.0
Enables a UI element.

{CKEDITOR.dialog.uiElement} focus()
Since: 3.0
Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page.

    uiElement.focus();

Returns:
  {CKEDITOR.dialog.uiElement} The current UI element.

{CKEDITOR.dialog} getDialog()
Since: 3.0
Gets the parent dialog object containing this UI element.

    var dialog = uiElement.getDialog();

Returns:
  {CKEDITOR.dialog} Parent dialog object.

{CKEDITOR.dom.element} getElement()
Since: 3.0
Gets the root DOM element of this dialog UI object.

    uiElement.getElement().hide();

Returns:
  {CKEDITOR.dom.element} Root DOM element of UI object.

{CKEDITOR.dom.element} getInputElement()
Since: 3.0
Gets the DOM element that the user inputs values. This function is used by setValue(), getValue() and focus(). It should be overrided in child classes where the input element isn't the root element.

    var rawValue = textInput.getInputElement().$.value;

Returns:
  {CKEDITOR.dom.element} The element where the user input values.

{Object} getValue()
Since: 3.0
Gets the current value of this dialog UI object.

    var myValue = uiElement.getValue();

Returns:
  {Object} The current value.

{Boolean} isChanged()
Since: 3.0
Tells whether the UI object's value has changed.

    if ( uiElement.isChanged() )
      confirm( 'Value changed! Continue?' );

Returns:
  {Boolean} true if changed, false if not changed.

{Boolean} isEnabled()
Since: 3.0
Determines whether an UI element is enabled or not.

Returns:
  {Boolean} Whether the UI element is enabled.

{Boolean} isFocusable()
Since: 3.0
Determines whether an UI element is focus-able or not. Focus-able is defined as being both visible and enabled.

Returns:
  {Boolean} Whether the UI element can be focused.

{Boolean} isVisible()
Since: 3.0
Determines whether an UI element is visible or not.

Returns:
  {Boolean} Whether the UI element is visible.

{CKEDITOR.dialog.uiElement} registerEvents(definition)
Since: 3.0
Registers the on* event handlers defined in the element definition. The default behavior of this function is:

1. If the on* event is defined in the class's eventProcesors list, then the registration is delegated to the corresponding function in the eventProcessors list.
2. If the on* event is not defined in the eventProcessors list, then register the event handler under the corresponding DOM event of the UI element's input DOM element (as defined by the return value of CKEDITOR.ui.dialog.uiElement#getInputElement).

This function is only called at UI element instantiation, but can be overridded in child classes if they require more flexibility.

Parameters:
{CKEDITOR.dialog.uiElementDefinition} definition
  The UI element definition.

Returns:
  {CKEDITOR.dialog.uiElement} The current UI element.

{CKEDITOR.dialog.uiElement} selectParentTab()
Since: 3.0
Selects the parent tab of this element. Usually called by focus() or overridden focus() methods.

    focus : function()
    {
    		this.selectParentTab();
    		// do something else.
    }

Returns:
  {CKEDITOR.dialog.uiElement} The current UI element.

{CKEDITOR.dialog.uiElement} setValue(value)
Since: 3.0
Sets the value of this dialog UI object.

    uiElement.setValue( 'Dingo' );

Parameters:
{Object} value
  The new value.

Returns:
  {CKEDITOR.dialog.uiElement} The current UI element.

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