tinymce.dom.Selection

This class handles text and control selection it's an crossbrowser utility class. Consult the TinyMCE Wiki API for more details and examples on how to use this class.

Examples

// Getting the currently selected node for the active editor
alert(tinymce.activeEditor.selection.getNode().nodeName);

Events

Event Defined By
This event gets executed before contents is extracted from the selection.
tinymce.dom.Selection
This event gets executed before contents is inserted into selection.
tinymce.dom.Selection
This event gets executed when contents is inserted into selection.
tinymce.dom.Selection
This event gets executed when contents is extracted from the selection.
tinymce.dom.Selection

Methods

Method Defined By
Constructs a new selection instance.
tinymce.dom.Selection
Returns the selected contents using the DOM serializer passed in to this class.
tinymce.dom.Selection
Sets the current selection to the specified content.
tinymce.dom.Selection
Returns the start element of a selection range.
tinymce.dom.Selection
Returns the end element of a selection range.
tinymce.dom.Selection
Returns a bookmark location for the current selection.
tinymce.dom.Selection
Restores the selection to the specified bookmark.
tinymce.dom.Selection
Selects the specified element.
tinymce.dom.Selection
Returns true/false if the selection range is collapsed or not.
tinymce.dom.Selection
Collapse the selection to start or end of range.
tinymce.dom.Selection
Returns the browsers internal selection object.
tinymce.dom.Selection
Returns the browsers internal range object.
tinymce.dom.Selection
Changes the selection to the specified DOM range.
tinymce.dom.Selection
Sets the current selection to the specified DOM element.
tinymce.dom.Selection
Returns the currently selected element or the common ancestor element for both start and end of the selection.
tinymce.dom.Selection
Executes callback of the current selection matches the specified selector or not and passes the state and args to the ca...
tinymce.dom.Selection