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

Defined in: plugins/dialog/plugin.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| CKEDITOR.dialog(editor, dialogName) This is the base class for runtime dialog objects.

Field Summary
Field Attributes | Field Name and Description
--- | ---
<static> | CKEDITOR.dialog.cancelButton The default cancel button for dialogs.
<static> | CKEDITOR.dialog.okButton The default OK button for dialogs.
| reset Resets all input values in the dialog.

Method Summary
Method Attributes | Method Name and Description
--- | ---
<static> | CKEDITOR.dialog.add(name, dialogDefinition) Registers a dialog.
<static> | CKEDITOR.dialog.addIframe(name, title, src, width, height, onContentLoad)
<static> | CKEDITOR.dialog.addUIElement(typeName, builder) Registers a dialog UI element.
<static> | CKEDITOR.dialog.exists(name)
<static> | CKEDITOR.dialog.getCurrent()
<inner> | changeFocus(forward)
<inner> | focusKeydownHandler(evt)
<inner> | iterContents(func)
| addPage(contents) Adds a tabbed page into the dialog.
| click(id) Simulates a click to a dialog button in the dialog's button row.
| commitContent()
| disableButton(id) Disables a dialog button.
| enableButton(id) Enables a dialog button.
| foreach(fn) Executes a function for each UI element.
| getButton(id) Gets the UI element of a button in the dialog's button row.
| getContentElement(pageId, elementId) Gets a dialog UI element object from a dialog page.
| getElement() Gets the root DOM element of the dialog.
| getName() Gets the name of the dialog.
| getPageCount() Gets the number of pages in the dialog.
| getParentEditor() Gets the editor instance which opened this dialog.
| getPosition() Gets the dialog's position in the window.
| getSelectedElement() Gets the element that was selected when opening the dialog, if any.
| getSize() Gets the current size of the dialog in pixels.
| getValueOf(pageId, elementId) Gets the value of a dialog UI element.
| hide() Hides the dialog box.
| hidePage(id) Hides a page's tab away from the dialog.
| move(x, y) Moves the dialog to an (x, y) coordinate relative to the window.
| resize(width, height) Resizes the dialog.
| selectPage(id) Activates a tab page in the dialog by its id.
| setupContent()
| setValueOf(pageId, elementId, value) Sets the value of a dialog UI element.
| show() Shows the dialog box.
| showPage(id) Unhides a page's tab.

Class Detail
CKEDITOR.dialog(editor, dialogName)
Since: 3.0
This is the base class for runtime dialog objects. An instance of this class represents a single named dialog for a single editor instance.

    var dialogObj = new CKEDITOR.dialog( editor, 'smiley' );

Parameters:
{Object} editor
  The editor which created the dialog.
{String} dialogName
  The dialog's registered name.

Field Detail
<static> {Function} CKEDITOR.dialog.cancelButton
Since: 3.0
The default cancel button for dialogs. Fires the "cancel" event and closes the dialog if no UI element value changed.

<static> {Function} CKEDITOR.dialog.okButton
Since: 3.0
The default OK button for dialogs. Fires the "ok" event and closes the dialog if the event succeeds.

{CKEDITOR.dialog} reset
Since: 3.0
Resets all input values in the dialog.

    dialogObj.reset();

Method Detail
<static> {Undefined} CKEDITOR.dialog.add(name, dialogDefinition)
Since: 3.0
Registers a dialog.

Parameters:
{String} name
  The dialog's name.
{Function|String} dialogDefinition
  A function returning the dialog's definition, or the URL to the .js file holding the function. The function should accept an argument "editor" which is the current editor instance, and return an object conforming to CKEDITOR.dialog.dialogDefinition.

See:
  CKEDITOR.dialog.dialogDefinition

<static> {Undefined} CKEDITOR.dialog.addIframe(name, title, src, width, height, onContentLoad)
Since: 3.0
Defined in: plugins/iframedialog/plugin.js.

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} name
{Undefined} title
{Undefined} src
{Undefined} width
{Undefined} height
{Undefined} onContentLoad

<static> {Undefined} CKEDITOR.dialog.addUIElement(typeName, builder)
Since: 3.0
Registers a dialog UI element.

Parameters:
{String} typeName
  The name of the UI element.
{Function} builder
  The function to build the UI element.

<static> {Undefined} CKEDITOR.dialog.exists(name)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} name

<static> {Undefined} CKEDITOR.dialog.getCurrent()
Since: 3.0

    NO EXAMPLE AVAILABLE

<inner> {Undefined} changeFocus(forward)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} forward

<inner> {Undefined} focusKeydownHandler(evt)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} evt

<inner> {Undefined} iterContents(func)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} func

{Undefined} addPage(contents)
Since: 3.0
Adds a tabbed page into the dialog.

Parameters:
{Object} contents
  Content definition.

{Undefined} click(id)
Since: 3.0
Simulates a click to a dialog button in the dialog's button row.

Parameters:
{String} id
  The id of the button.

Returns:
  {Undefined} The return value of the dialog's "click" event.

{Undefined} commitContent()
Since: 3.0

    NO EXAMPLE AVAILABLE

{Undefined} disableButton(id)
Since: 3.0
Disables a dialog button.

Parameters:
{String} id
  The id of the button.

{Undefined} enableButton(id)
Since: 3.0
Enables a dialog button.

Parameters:
{String} id
  The id of the button.

{CKEDITOR.dialog} foreach(fn)
Since: 3.0
Executes a function for each UI element.

    NO EXAMPLE AVAILABLE

Parameters:
{Function} fn
  Function to execute for each UI element.

Returns:
  {CKEDITOR.dialog} The current dialog object.

{CKEDITOR.ui.dialog.button} getButton(id)
Since: 3.0
Gets the UI element of a button in the dialog's button row.

Parameters:
{String} id
  The id of the button.

Returns:
  {CKEDITOR.ui.dialog.button} The button object.

{CKEDITOR.ui.dialog.uiElement} getContentElement(pageId, elementId)
Since: 3.0
Gets a dialog UI element object from a dialog page.

Parameters:
{String} pageId
  id of dialog page.
{String} elementId
  id of UI element.

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

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

    var dialogElement = dialogObj.getElement().getFirst();
    dialogElement.setStyle( 'padding', '5px' );

Returns:
  {CKEDITOR.dom.element} The <span> element containing this dialog.

{String} getName()
Since: 3.0
Gets the name of the dialog.

    var dialogName = dialogObj.getName();

Returns:
  {String} The name of this dialog.

{Number} getPageCount()
Since: 3.0
Gets the number of pages in the dialog.

    NO EXAMPLE AVAILABLE

Returns:
  {Number} Page count.

{CKEDITOR.editor} getParentEditor()
Since: 3.0
Gets the editor instance which opened this dialog.

    NO EXAMPLE AVAILABLE

Returns:
  {CKEDITOR.editor} Parent editor instances.

{Object} getPosition()
Since: 3.0
Gets the dialog's position in the window.

    var dialogX = dialogObj.getPosition().x;

Returns:
  {Object} An object with "x" and "y" properties.

{CKEDITOR.dom.element} getSelectedElement()
Since: 3.0
Gets the element that was selected when opening the dialog, if any.

    NO EXAMPLE AVAILABLE

Returns:
  {CKEDITOR.dom.element} The element that was selected, or null.

{Object} getSize()
Since: 3.0
Gets the current size of the dialog in pixels.

    var width = dialogObj.getSize().width;

Returns:
  {Object} An object with "width" and "height" properties.

{Object} getValueOf(pageId, elementId)
Since: 3.0
Gets the value of a dialog UI element.

Parameters:
{String} pageId
  id of dialog page.
{String} elementId
  id of UI element.

Returns:
  {Object} The value of the UI element.

{Undefined} hide()
Since: 3.0
Hides the dialog box.

    dialogObj.hide();

{Undefined} hidePage(id)
Since: 3.0
Hides a page's tab away from the dialog.

    dialog.hidePage( 'tab_3' );

Parameters:
{String} id
  The page's Id.

{Undefined} move(x, y)
Since: 3.0
Moves the dialog to an (x, y) coordinate relative to the window.

    dialogObj.move( 10, 40 );

Parameters:
{Number} x
  The target x-coordinate.
{Number} y
  The target y-coordinate.

{Undefined} resize(width, height)
Since: 3.0
Resizes the dialog.

    dialogObj.resize( 800, 640 );

Parameters:
{Number} width
  The width of the dialog in pixels.
{Number} height
  The height of the dialog in pixels.

{Undefined} selectPage(id)
Since: 3.0
Activates a tab page in the dialog by its id.

    dialogObj.selectPage( 'tab_1' );

Parameters:
{String} id
  The id of the dialog tab to be activated.

{Undefined} setupContent()
Since: 3.0

    NO EXAMPLE AVAILABLE

{Undefined} setValueOf(pageId, elementId, value)
Since: 3.0
Sets the value of a dialog UI element.

Parameters:
{String} pageId
  id of the dialog page.
{String} elementId
  id of the UI element.
{Object} value
  The new value of the UI element.

{Undefined} show()
Since: 3.0
Shows the dialog box.

    dialogObj.show();

{Undefined} showPage(id)
Since: 3.0
Unhides a page's tab.

    dialog.showPage( 'tab_2' );

Parameters:
{String} id
  The page's Id.

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