Editor.Range
Range implementation across browsers.
defined in: range.js
Class
- Editor.Range (document)
Methods
- Editor.Range. checkBoundaryOfElement (checkType, element) <static> Check whether current range is on the inner edge of the specified element.
- Editor.Range. checkEndOfBlock () <static> Check whether current range 's end position is at the end of a block (visible)
- Editor.Range. checkStartOfBlock () <static> Check whether current range 's start position is at the start of a block (visible)
- Editor.Range. clone () <static> Clone current range.
- Editor.Range. cloneContents () <static> Clone html content within range
- Editor.Range. collapse (toStart) <static> Collpase current range
- Editor.Range. createBookmark (serializable) <static> Create bookmark by create bookmark node.
- Editor.Range. createBookmark2 (normalized) <static> Create virtual bookmark by remeber its position index.
- Editor.Range. deleteContents () <static> Remove html content within range
- Editor.Range. enlarge (unit) <static> Enlarge the range as mush as possible
- Editor.Range. extractContents () <static> Extract html content within range.
- Editor.Range. fixBlock (isStart, blockTag) <static> Wrap the content in range which is block-enlarged at the start or end of current range into a block element.
- Editor.Range. getBoundaryNodes () <static> Get two node which are at the edge of current range.
- Editor.Range. getCommonAncestor (includeSelf, ignoreTextNode) <static> Find the node which contains current range completely.
- Editor.Range. getEnclosedNode () <static> Get node which is enclosed by range.
- Editor.Range. insertNode (node) <static> Insert a new node at start position of current range
- Editor.Range. insertNodeByDtd (element) <static> Insert node by dtd.
- Editor.Range. moveToBookmark (bookmark) <static> Move range to previous saved bookmark.
- Editor.Range. moveToElementEditablePosition (el, isMoveToEnd) <static> Move the range to the depth-first start/end editing point inside an element.
- Editor.Range. moveToPosition (node, position) <static> Set the start posititon and then collapse range.
- Editor.Range. optimize () <static> Transforms the startContainer and endContainer properties from text nodes to element nodes, whenever possible.
- Editor.Range. optimizeBookmark () <static> Make edge bookmarks included in current range.
- Editor.Range. selectNodeContents (node) <static> Set range surround current node 's content.
- Editor.Range. setEnd (endNode, endOffset) <static> Sets the end position of a Range.
- Editor.Range. setEndAfter (node) <static> Set range end after node
- Editor.Range. setEndAt (node, position) <static> Sets the end position of a Range by specified rules.
- Editor.Range. setEndBefore (node) <static> Set range end before node
- Editor.Range. setStart (startNode, startOffset) <static> Sets the start position of a Range.
- Editor.Range. setStartAfter (node) <static> Set range start after node
- Editor.Range. setStartAt (node, position) <static> Sets the start position of a Range by specified rules.
- Editor.Range. setStartBefore (node) <static> Set range start before node
- Editor.Range. shrink (mode, selectContents) <static> Shrink range to its innermost element.
- Editor.Range. splitBlock (blockTag) <static> Split current block which current range into two if current range is in the same block.
- Editor.Range. splitElement (toSplit) <static> Split toSplit element into two parts at current range's start position.
- Editor.Range. toString () <static> Range string representation.
- Editor.Range. trim (ignoreStart, ignoreEnd) <static> Pull range out of text edge and split text node if range is in the middle of text node.
Class Detail
-
Editor.Range (document)Range implementation across browsers.
- Parameters
-
- document {Document}
Methods Detail
-
Check whether current range is on the inner edge of the specified element.
- Parameters
-
- checkType {Number} The checking side.
- element {NodeList} The target element to check.
-
Check whether current range 's end position is at the end of a block (visible)
- Returns
-
- Boolean
-
Check whether current range 's start position is at the start of a block (visible)
- Returns
-
- Boolean
-
Clone current range.
- Returns
-
Clone html content within range
-
Collpase current range
- Parameters
-
- toStart {Boolean}
-
Create bookmark by create bookmark node.
- Parameters
-
- [ serializable ] {Boolean}
-
Create virtual bookmark by remeber its position index.
- Parameters
-
- normalized
-
Remove html content within range
-
Enlarge the range as mush as possible
- Parameters
-
- unit {Number}
- Example
-
-
<div><span><span>^1</span>2^</span>x</div> => <div>^<span><span>1</span>2</span>^x</div>
-
-
Extract html content within range.
-
Wrap the content in range which is block-enlarged at the start or end of current range into a block element.
- Parameters
-
- isStart {Boolean} Start or end of current range tobe enlarged.
- blockTag {String} Block element's tag name.
- Returns
-
- {NodeList} Newly generated block element.
-
Get two node which are at the edge of current range.
- Returns
-
- {Object} Map with startNode and endNode as key/value.
-
Find the node which contains current range completely.
- Parameters
-
- includeSelf {Boolean} whether to return the only element with in range
- ignoreTextNode {Boolean} whether to return text node's parent node.
-
Get node which is enclosed by range.
- Example
-
-
^<book/><span/><book/>^ => ^<span/>^ </code>
-
-
Insert a new node at start position of current range
- Parameters
-
- node {NodeList}
-
Insert node by dtd.(not invalidate dtd convention)
- Parameters
-
- element {NodeList}
-
Move range to previous saved bookmark.
- Parameters
-
- bookmark
-
Move the range to the depth-first start/end editing point inside an element.
- Parameters
-
- el {NodeList} The element to find edit point into.
- [ isMoveToEnd ] {Boolean} Find start or end editing point. Set true to find end editing point.
- Returns
-
- {Boolean} Whether find edit point
-
Set the start posititon and then collapse range.
- Parameters
-
- node {NodeList}
- position {Number}
-
Transforms the startContainer and endContainer properties from text nodes to element nodes, whenever possible. This is actually possible if either of the boundary containers point to a text node, and its offset is set to zero, or after the last char in the node.
-
Make edge bookmarks included in current range.
-
Set range surround current node 's content.
- Parameters
-
- node {NodeList}
-
Sets the end position of a Range.
- Parameters
-
- endNode {NodeList} The node to end the range.
- endOffset {Number} An integer greater than or equal to zero representing the offset for the end of the range from the start of endNode.
-
Set range end after node
- Parameters
-
- node {NodeList}
-
Sets the end position of a Range by specified rules.
- Parameters
-
- node {NodeList}
- position {Number}
-
Set range end before node
- Parameters
-
- node {NodeList}
-
Sets the start position of a Range.
- Parameters
-
- startNode {NodeList} The node to start the range.
- startOffset {Number} An integer greater than or equal to zero representing the offset for the start of the range from the start of startNode.
-
Set range start after node
- Parameters
-
- node {NodeList}
-
Sets the start position of a Range by specified rules.
- Parameters
-
- node {NodeList}
- position {Number}
-
Set range start before node
- Parameters
-
- node {NodeList}
-
Shrink range to its innermost element.(make sure text content is unchanged)
- Parameters
-
- mode
- [ selectContents ] {Boolean}
-
Split current block which current range into two if current range is in the same block. Fix block at the start and end position of range if necessary.
- Parameters
-
- blockTag {String} Block tag if need fixBlock
-
Split toSplit element into two parts at current range's start position.
-
Range string representation.
-
Pull range out of text edge and split text node if range is in the middle of text node.
- Parameters
-
- ignoreStart {Boolean}
- ignoreEnd {Boolean}
Classes
- Anim
- Anim.Easing
- Attribute
- Base
- Button
- ComboBox
- ComboBox.LocalDataSource
- ComboBox.RemoteDataSource
- Component
- Component.Container
- Component.Controller
- Component.Manager
- Component.Render
- Component.UIBase
- Component.UIBase.Align
- Component.UIBase.Box
- Component.UIBase.Close
- Component.UIBase.Constrain
- Component.UIBase.ContentBox
- Component.UIBase.Drag
- Component.UIBase.Loading
- Component.UIBase.Mask
- Component.UIBase.Position
- Component.UIBase.Resize
- Component.UIBase.StdMod
- Cookie
- DataLazyload
- DD
- DD.Constrain
- DD.DDM
- DD.Draggable
- DD.DraggableDelegate
- DD.Droppable
- DD.DroppableDelegate
- DD.Proxy
- DD.Scroll
- DOM
- Editor
- Editor.Range
- Editor.Utils
- Editor.Walker
- Event
- Event.Object
- Event.Target
- IO
- IO.XhrObject
- KISSY
- KISSY.Defer
- KISSY.Loader
- KISSY.Loader.Module
- KISSY.Loader.Package
- KISSY.Promise
- Menu
- Menu.FilterMenu
- Menu.Item
- Menu.PopupMenu
- Menu.Separator
- MenuButton
- MenuButton.Option
- MenuButton.Select
- MVC
- MVC.Collection
- MVC.Model
- MVC.Router
- MVC.View
- NodeList
- Overlay
- Overlay.Dialog
- Overlay.Popup
- Resizable
- Tree
- Tree.CheckNode
- Tree.CheckTree
- Tree.Node
- Waterfall
- Waterfall.Loader