Editor.Range

Range implementation across browsers.

defined in: range.js

Class

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

  • Editor.Range. checkBoundaryOfElement (checkType, element) <static> view source
    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.
  • Editor.Range. checkEndOfBlock () <static> view source
    Check whether current range 's end position is at the end of a block (visible)
    Returns
    • Boolean
  • Editor.Range. checkStartOfBlock () <static> view source
    Check whether current range 's start position is at the start of a block (visible)
    Returns
    • Boolean
  • Editor.Range. clone () <static> view source
    Clone current range.
    Returns
  • Editor.Range. cloneContents () <static> view source
    Clone html content within range
  • Editor.Range. collapse (toStart) <static> view source
    Collpase current range
    Parameters
    •   toStart {Boolean}
  • Editor.Range. createBookmark (serializable) <static> view source
    Create bookmark by create bookmark node.
    Parameters
    • [ serializable ] {Boolean}
  • Editor.Range. createBookmark2 (normalized) <static> view source
    Create virtual bookmark by remeber its position index.
    Parameters
    •   normalized
  • Editor.Range. deleteContents () <static> view source
    Remove html content within range
  • Editor.Range. enlarge (unit) <static> view source
    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>
      
  • Editor.Range. extractContents () <static> view source
    Extract html content within range.
  • Editor.Range. fixBlock (isStart, blockTag) <static> view source
    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.
  • Editor.Range. getBoundaryNodes () <static> view source
    Get two node which are at the edge of current range.
    Returns
    • {Object} Map with startNode and endNode as key/value.
  • Editor.Range. getCommonAncestor (includeSelf, ignoreTextNode) <static> view source
    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.
  • Editor.Range. getEnclosedNode () <static> view source
    Get node which is enclosed by range.
    Example
    • 
      ^<book/><span/><book/>^
      =>
      ^<span/>^
      </code>
  • Editor.Range. insertNode (node) <static> view source
    Insert a new node at start position of current range
    Parameters
  • Editor.Range. insertNodeByDtd (element) <static> view source
    Insert node by dtd.(not invalidate dtd convention)
    Parameters
  • Editor.Range. moveToBookmark (bookmark) <static> view source
    Move range to previous saved bookmark.
    Parameters
    •   bookmark
  • Editor.Range. moveToElementEditablePosition (el, isMoveToEnd) <static> view source
    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
  • Editor.Range. moveToPosition (node, position) <static> view source
    Set the start posititon and then collapse range.
    Parameters
    •   node {NodeList}
    •   position {Number}
  • Editor.Range. optimize () <static> view source
    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.
  • Editor.Range. optimizeBookmark () <static> view source
    Make edge bookmarks included in current range.
  • Editor.Range. selectNodeContents (node) <static> view source
    Set range surround current node 's content.
    Parameters
  • Editor.Range. setEnd (endNode, endOffset) <static> view source
    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.
  • Editor.Range. setEndAfter (node) <static> view source
    Set range end after node
    Parameters
  • Editor.Range. setEndAt (node, position) <static> view source
    Sets the end position of a Range by specified rules.
    Parameters
    •   node {NodeList}
    •   position {Number}
  • Editor.Range. setEndBefore (node) <static> view source
    Set range end before node
    Parameters
  • Editor.Range. setStart (startNode, startOffset) <static> view source
    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.
  • Editor.Range. setStartAfter (node) <static> view source
    Set range start after node
    Parameters
  • Editor.Range. setStartAt (node, position) <static> view source
    Sets the start position of a Range by specified rules.
    Parameters
    •   node {NodeList}
    •   position {Number}
  • Editor.Range. setStartBefore (node) <static> view source
    Set range start before node
    Parameters
  • Editor.Range. shrink (mode, selectContents) <static> view source
    Shrink range to its innermost element.(make sure text content is unchanged)
    Parameters
    •   mode
    • [ selectContents ] {Boolean}
  • Editor.Range. splitBlock (blockTag) <static> view source
    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
  • Editor.Range. splitElement (toSplit) <static> view source
    Split toSplit element into two parts at current range's start position.
    Parameters
    •   toSplit {NodeList} Element to split.
    Returns
    • {NodeList} The second newly generated element.
  • Editor.Range. toString () <static> view source
    Range string representation.
  • Editor.Range. trim (ignoreStart, ignoreEnd) <static> view source
    Pull range out of text edge and split text node if range is in the middle of text node.
    Parameters
    •   ignoreStart {Boolean}
    •   ignoreEnd {Boolean}
blog comments powered by Disqus
Top