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

Defined in: plugins/selection/plugin.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| CKEDITOR.dom.selection(document) Manipulates the selection in a DOM document.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| createBookmarks(serializable)
| createBookmarks2(normalized)
| getNative() Gets the native selection object from the browser.
| getSelectedElement() Gets the current selected element.
| getStartElement() Gets the DOM element in which the selection starts.
| getType() Gets the type of the current selection.
| lock()
| reset()
| selectBookmarks(bookmarks)
| selectElement(element)
| selectRanges(ranges)
| unlock(restore)

Class Detail
CKEDITOR.dom.selection(document)
Since: 3.0
Manipulates the selection in a DOM document.

Parameters:
{Undefined} document

Method Detail
{Undefined} createBookmarks(serializable)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} serializable

{Undefined} createBookmarks2(normalized)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} normalized

{Object} getNative()
Since: 3.0
Gets the native selection object from the browser.

    var selection = editor.getSelection().getNative();

Returns:
  {Object} The native selection object.

{CKEDITOR.dom.element} getSelectedElement()
Since: 3.0
Gets the current selected element.

    var element = editor.getSelection().getSelectedElement();
    alert( element.getName() );

Returns:
  {CKEDITOR.dom.element} The selected element. Null if no selection is available or the selection type is not CKEDITOR.SELECTION_ELEMENT.

{CKEDITOR.dom.element} getStartElement()
Since: 3.0
Gets the DOM element in which the selection starts.

    var element = editor.getSelection().getStartElement();
    alert( element.getName() );

Returns:
  {CKEDITOR.dom.element} The element at the beginning of the selection.

{Number} getType()
Since: 3.0
Gets the type of the current selection. The following values are available:

- CKEDITOR.SELECTION_NONE (1): No selection.
- CKEDITOR.SELECTION_TEXT (2): Text is selected or collapsed selection.
- CKEDITOR.SELECTION_ELEMENT (3): A element selection.

    if ( editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT )
        alert( 'Text is selected' );

Returns:
  {Number} One of the following constant values: CKEDITOR.SELECTION_NONE, CKEDITOR.SELECTION_TEXT or CKEDITOR.SELECTION_ELEMENT.

{Undefined} lock()
Since: 3.0

    NO EXAMPLE AVAILABLE

{Undefined} reset()
Since: 3.0

    NO EXAMPLE AVAILABLE

{Undefined} selectBookmarks(bookmarks)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} bookmarks

{Undefined} selectElement(element)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} element

{Undefined} selectRanges(ranges)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} ranges

{Undefined} unlock(restore)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} restore

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