Namespace | tinymce.dom |
Class | Selection |
Method | Defined By |
---|---|
Constructs a new selection instance.
|
Selection |
collapse(to_start:Boolean):void
Collapse the selection to start or end of range.
|
Selection |
getBookmark(type:Number, normalized:Boolean):Object
Returns a bookmark location for the current selection.
|
Selection |
getContent(s:Object):String
Returns the selected contents using the DOM serializer passed in to this class.
|
Selection |
getEnd():Element
Returns the end element of a selection range.
|
Selection |
getNode():Element
Returns the currently selected element or the common ancestor element for both start and end of the selection.
|
Selection |
getRng(w3c:Boolean):Range
Returns the browsers internal range object.
|
Selection |
getSel():Selection
Returns the browsers internal selection object.
|
Selection |
getStart():Element
Returns the start element of a selection range.
|
Selection |
isCollapsed():Boolean
Returns true/false if the selection range is collapsed or not.
|
Selection |
moveToBookmark(bookmark:Object):Boolean
Restores the selection to the specified bookmark.
|
Selection |
select(node:Element, content:Boolean):Element
Selects the specified element.
|
Selection |
selectorChanged(selector:String, callback:function):void
Executes callback of the current selection matches the specified selector or not and passes the state and args to the ca...
|
Selection |
setContent(content:String, args:Object):void
Sets the current selection to the specified content.
|
Selection |
setNode(n:Element):Element
Sets the current selection to the specified DOM element.
|
Selection |
setRng(r:Range):void
Changes the selection to the specified DOM range.
|
Selection |
Event | Defined By |
---|---|
onBeforeGetContent(selection:Selection, args:Object)
This event gets executed before contents is inserted into selection.
|
Selection |
onBeforeSetContent(selection:Selection, args:Object)
This event gets executed before contents is extracted from the selection.
|
Selection |
onGetContent(selection:Selection, args:Object)
This event gets executed when contents is extracted from the selection.
|
Selection |
onSetContent(selection:Selection, args:Object)
This event gets executed when contents is inserted into selection.
|
Selection |
public
function Selection(dom:DOMUtils, win:Window, serializer:Serializer)
dom:DOMUtils | DOMUtils object reference. |
win:Window | Window to bind the selection object to. |
serializer:Serializer | DOM serialization class to use for getContent. |
public
function collapse(to_start:Boolean):void
to_start:Boolean | Optional boolean state if to collapse to end or not. Defaults to start. |
public
function getBookmark(type:Number, normalized:Boolean):Object
type:Number | Optional state if the bookmark should be simple or not. Default is complex. |
normalized:Boolean | Optional state that enables you to get a position that it would be after normalization. |
public
function getContent(s:Object):String
s:Object | Optional settings class with for example output format text or html. |
public
function getEnd():Element
public
function getNode():Element
public
function getRng(w3c:Boolean):Range
w3c:Boolean | Forces a compatible W3C range on IE. |
public
function getSel():Selection
public
function getStart():Element
public
function isCollapsed():Boolean
public
function moveToBookmark(bookmark:Object):Boolean
bookmark:Object | Bookmark to restore selection from. |
public
function select(node:Element, content:Boolean):Element
node:Element | HMTL DOM element to select. |
content:Boolean | Optional bool state if the contents should be selected or not on non IE browser. |
public
function selectorChanged(selector:String, callback:function):void
selector:String | CSS selector to check for. |
callback:function | Callback with state and args when the selector is matches or not. |
public
function setContent(content:String, args:Object):void
content:String | HTML contents to set could also be other formats depending on settings. |
args:Object | Optional settings object with for example data format. |
public
function setNode(n:Element):Element
n:Element | Element to set as the contents of the selection. |
public
function setRng(r:Range):void
r:Range | Range to select. |
public
event onBeforeGetContent(selection:Selection, args:Object)
selection:Selection | Selection object that fired the event. |
args:Object | Contains things like the contents that will be inserted. |
public
event onBeforeSetContent(selection:Selection, args:Object)
selection:Selection | Selection object that fired the event. |
args:Object | Contains things like the contents that will be returned. |