## Class TinyMCE_Selection

    Object
       |
       +--TinyMCE_Selection

class TinyMCE_Selection

Defined in TinyMCE_Selection.class.js

Field Summary
`Object` | `instance`

Constructor Summary
`TinyMCE_Selection (<TinyMCE_Control> inst)` Constructs a Selection instance and binds it to the specificed TinyMCE editor control.

Method Summary
`TinyMCE_Bookmark` | `getBookmark(<boolean> simple)` Returns a selection bookmark that can be restored later with moveToBookmark.
`HTMLElement` | `getFocusElement()` Returns the currently selected/focused element.
`DOMRange` | `getRng()` Returns the browsers selections first range instance.
`DOMSelection` | `getSel()` Returns the browsers selection instance.
`string` | `getSelectedHTML()` Returns the selected HTML code.
`string` | `getSelectedText()` Returns the selected text.
`boolean` | `moveToBookmark(<TinyMCE_Bookmark> bookmark)` Restores the selection to the specified bookmark.
`void` | `scrollToNode(<HTMLNode> node)` Scrolls to the specified node location.
`void` | `selectNode(<HTMLNode> node, <boolean> collapse, <boolean> select_text_node, <boolean> to_start)` Selects the specified node.

Field Detail

### instance

    Object instance

Constructor Detail

### TinyMCE_Selection

    TinyMCE_Selection(<TinyMCE_Control> inst)

Constructs a Selection instance and binds it to the specificed TinyMCE editor control.

Parameters:

`inst` - TinyMCE editor control instance.

Method Detail

### getBookmark

    TinyMCE_Bookmark getBookmark(<boolean> simple)

Returns a selection bookmark that can be restored later with moveToBookmark. This acts much like the one MSIE has built in but this one is persistent if between DOM tree rewritings. The simple mode enables a quicker and non persistent bookmark.

Parameters:

`simple` - If this is set to true, the selection bookmark will not me dom persistent.

Returns:

Selection bookmark that can be restored later with moveToBookmark.

### getFocusElement

    HTMLElement getFocusElement()

Returns the currently selected/focused element.

Returns:

Currently selected element.

### getRng

    DOMRange getRng()

Returns the browsers selections first range instance.

Returns:

Browsers selections first range instance.

### getSel

    DOMSelection getSel()

Returns the browsers selection instance.

Returns:

Browser selection instance.

### getSelectedHTML

    string getSelectedHTML()

Returns the selected HTML code.

Returns:

Selected HTML contents.

### getSelectedText

    string getSelectedText()

Returns the selected text.

Returns:

Selected text contents.

### moveToBookmark

    boolean moveToBookmark(<TinyMCE_Bookmark> bookmark)

Restores the selection to the specified bookmark.

Parameters:

`bookmark` - Bookmark to restore selection from.

Returns:

true/false if it was successful or not.

### scrollToNode

    void scrollToNode(<HTMLNode> node)

Scrolls to the specified node location.

Parameters:

`node` - Node to scroll to.

### selectNode

    void selectNode(<HTMLNode> node, <boolean> collapse, <boolean> select_text_node, <boolean> to_start)

Selects the specified node.

Parameters:

`node` - Node object to move selection to.

`collapse` - True/false if it will be collasped.

`select_text_node` - True/false if the text contents should be selected or not.

`to_start` - True/false if the collapse should be to start or end of range.

Documentation generated by JSDoc on Fri Apr 14 21:59:23 2006