TinyMCE

Object
TinyMCE_Selection

Class TinyMCE_Selection

Constructor Summary
TinyMCE_Selection(<TinyMCE_Control> inst)
Constructs a Selection instance and binds it to the specificed TinyMCE editor control.
Method Summary
voidgetAbsPosition(<HTMLNode> n)
Returns a global absolute position calculating both the container iframe location and the position within.
TinyMCE_BookmarkgetBookmark(<boolean> simple)
Returns a selection bookmark that can be restored later with moveToBookmark.
HTMLElementgetFocusElement()
Returns the currently selected/focused element.
DOMRangegetRng()
Returns the browsers selections first range instance.
DOMSelectiongetSel()
Returns the browsers selection instance.
stringgetSelectedHTML()
Returns the selected HTML code.
stringgetSelectedText()
Returns the selected text.
booleanmoveToBookmark(<TinyMCE_Bookmark> bookmark)
Restores the selection to the specified bookmark.
voidscrollToNode(<HTMLNode> node)
Scrolls to the specified node location.
voidselectNode(<HTMLNode> node, <boolean> collapse, <boolean> select_text_node, <boolean> to_start)
Selects the specified node.

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

getAbsPosition

void getAbsPosition(<HTMLNode> n)
Returns a global absolute position calculating both the container iframe location and the position within.

Parameters

n - node.

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.