Class CKEDITOR.dom.selection
Defined in: plugins/selection/plugin.js.
Constructor Attributes | Constructor Name and Description |
---|---|
CKEDITOR.dom.selection(document)
Manipulates the selection in a DOM document.
|
Method Attributes | Method Name and Description |
---|---|
Gets the native selection object from the browser.
|
|
Gets the current selected element.
|
|
Gets the DOM element in which the selection starts.
|
|
getType()
Gets the type of the current selection.
|
|
reset()
|
|
selectBookmarks(bookmarks)
|
Class Detail
CKEDITOR.dom.selection(document)
Since:
3.0
Manipulates the selection in a DOM document.
- Parameters:
- {Undefined} document
Method Detail
{Undefined}
createBookmarks()
Since:
3.0
NO EXAMPLE AVAILABLE
{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}
reset()
Since:
3.0
NO EXAMPLE AVAILABLE
{Undefined}
selectBookmarks(bookmarks)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} bookmarks