Wraps some common Selection/Range functionality into a simple object
_swap
n
tag
Defined in
editor/js/editor-selection.js:624
Swap an element, with another element
n
HTMLElement
The node to swap
tag
String
The tag to use when creating the new element.
The new node
_wrap
n
tag
Defined in
editor/js/editor-selection.js:609
Wrap an element, with another element
n
HTMLElement
The node to wrap
tag
String
The tag to use when creating the new element.
The wrapped node
_wrapBlock
Defined in
editor/js/editor-selection.js:335
Wraps an array of elements in a Block level tag
cleanCursor
Defined in
editor/js/editor-selection.js:517
Called from Editor keydown to remove the "extra" space before the cursor.
createRange
Defined in
editor/js/editor-selection.js:876
Wrapper for the different range creation methods.
filter
Defined in
editor/js/editor-selection.js:142
Performs a prefilter on all nodes in the editor. Looks for nodes with a style: fontFamily or font face It then creates a dynamic class assigns it and removed the property. This is so that we don't lose the fontFamily when selecting nodes.
filterBlocks
Defined in
editor/js/editor-selection.js:236
Method attempts to replace all "orphined" text nodes in the main body by wrapping them with a
. Called from filter.
focusCursor
Defined in
editor/js/editor-selection.js:968
Gets a stored cursor and focuses it for editing, must be called sometime after setCursor
getCursor
Defined in
editor/js/editor-selection.js:942
Get the placeholder in the DOM at the current cursor position.
getEditorOffset
[node]
Defined in
editor/js/editor-selection.js:996
Available since 3.13.0
Gets the offset of the selection for the selection within the current editor
[node]
Y.Node
optional
Element used to measure the offset to
Number Number of characters the selection is from the beginning
getSelected
Defined in
editor/js/editor-selection.js:638
Get all the nodes in the current selection. This method will actually perform a filter first. Then it calls doc.execCommand('fontname', null, 'yui-tmp') to touch all nodes in the selection. The it compiles a list of all nodes affected by the execCommand and builds a NodeList to return.
A NodeList of all items in the selection.
getText
node
Defined in
editor/js/editor-selection.js:440
Returns the innerHTML of a node with all HTML tags removed.
node
Node
The Node instance to remove the HTML from
The string of text
insertAtCursor
html
node
offset
collapse
Defined in
editor/js/editor-selection.js:675
Insert HTML at the current cursor position, this method gives you control over the text node to insert into and the offset where to put it.
The inserted Node.
insertContent
html
Defined in
editor/js/editor-selection.js:666
Insert HTML at the current cursor position and return a Node instance of the newly inserted element.
html
String
The HTML to insert.
The inserted Node.
remove
Defined in
editor/js/editor-selection.js:864
Destroy the range.
removeCursor
keep
Defined in
editor/js/editor-selection.js:950
Remove the cursor placeholder from the DOM.
keep
Boolean
Setting this to true will keep the node, but remove the unique parts that make it the cursor.
removeFontFamily
Defined in
editor/js/editor-selection.js:125
Utility method to remove dead font-family styles from an element.
replace
se
re
Defined in
editor/js/editor-selection.js:835
Find and replace a string inside a text node and replace it with HTML focusing the node after to allow you to continue to type.
The node inserted.
resolve
n
Defined in
editor/js/editor-selection.js:415
Resolve a node from the selection object and return a Node instance
n
HTMLElement
The HTMLElement to resolve. Might be a TextNode, gives parentNode.
The Resolved node
selectNode
node
collapse
Defined in
editor/js/editor-selection.js:888
Select a Node (hilighting it).
setCursor
Defined in
editor/js/editor-selection.js:933
Put a placeholder in the DOM at the current cursor position.
toString
Defined in
editor/js/editor-selection.js:987
Generic toString for logging.
unfilter
Defined in
editor/js/editor-selection.js:355
Undoes what filter does enough to return the HTML from the Editor, then re-applies the filter.
The filtered HTML
wrapContent
tag
Defined in
editor/js/editor-selection.js:784
Get all elements inside a selection and wrap them with a new element and return a NodeList of all elements touched.
tag
String
The tag to wrap all selected items with.
A NodeList of all items in the selection.
_selection
Defined in
editor/js/editor-selection.js:603
The actual Selection/Range object
ALL
Defined in
editor/js/editor-selection.js:457
The selector to use when looking for Nodes to cache the value of: [style],font[face]
anchorNode
Defined in
editor/js/editor-selection.js:567
A Node instance of the parentNode of the anchorNode of the range
anchorTextNode
Defined in
editor/js/editor-selection.js:579
A Node instance of the actual textNode of the range.
BLOCKS
Defined in
editor/js/editor-selection.js:464
The selector to use when looking for block level items.
CUR_WRAPID
Defined in
editor/js/editor-selection.js:490
The id used to wrap the inner space of the cursor position
CURID
Defined in
editor/js/editor-selection.js:483
The id of the outer cursor wrapper
CURSOR
Defined in
editor/js/editor-selection.js:497
The default HTML used to focus the cursor..
DEFAULT_TAG
Defined in
editor/js/editor-selection.js:476
The default tag to use when creating elements: span
focusNode
Defined in
editor/js/editor-selection.js:585
A Node instance of the parentNode of the focusNode of the range
focusTextNode
Defined in
editor/js/editor-selection.js:597
A Node instance of the actual textNode of the range.
isCollapsed
Defined in
editor/js/editor-selection.js:561
Flag to show if the range is collapsed or not
REG_CHAR
Defined in
editor/js/editor-selection.js:313
Regular Expression to determine if a string has a character in it
REG_FONTFAMILY
Defined in
editor/js/editor-selection.js:306
Regular Expression used to find dead font-family styles
REG_NOHTML
Defined in
editor/js/editor-selection.js:327
Regular Expression to remove all HTML from a string
REG_NON
Defined in
editor/js/editor-selection.js:320
Regular Expression to determine if a string has a non-character in it
ROOT
Defined in
editor/js/editor-selection.js:504
The default HTML element from which data will be retrieved. Default: body
TMP
Defined in
editor/js/editor-selection.js:470
The temporary fontname applied to a selection to retrieve their values: yui-tmp