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.
|
Field Attributes | Field Name and Description |
---|---|
Gets the native selection object from the browser.
|
|
Gets the type of the current selection.
|
Method Attributes | Method Name and Description |
---|---|
Gets the current selected element.
|
|
Gets the DOM element in which the selection starts.
|
Class Detail
CKEDITOR.dom.selection(document)
Since:
3.0
Manipulates the selection in a DOM document.
- Parameters:
- document
Field Detail
{Object}
getNative
Since:
3.0
Gets the native selection object from the browser.
var selection = editor.getSelection().getNative();
{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' );
Method Detail
{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.