Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "wed/caret-movement"

Index

Type aliases

Direction

Direction: "right" | "left" | "up" | "down"

Functions

bothDecorated

  • bothDecorated(prev: Node | undefined, next: Node | undefined): boolean
  • Parameters

    • prev: Node | undefined
    • next: Node | undefined

    Returns boolean

    true if prev and next are both decorated; false otherwise.

determineContainer

  • determineContainer(docRoot: Document | Element): Element
  • Determines what should be used as the "container" for caret movement purposes. The "container" is the element within which caret movements are constrained. (The caret cannot move out of it.)

    Parameters

    • docRoot: Document | Element

      The root element of the document being edited by wed.

    Returns Element

    A container that can be used by the caret movement functions.

findNext

  • findNext(haystack: NodeList, ref: Node): Node | undefined
  • Find the first node in a set of nodes which is such that the reference node precedes it.

    Parameters

    • haystack: NodeList

      The nodes to search.

    • ref: Node

      The reference node.

    Returns Node | undefined

    The first node in haystack which does not precede ref.

insideEditableContent

  • insideEditableContent(element: Element, offset: number, modeTree: ModeTree): boolean
  • Determine whether a position is within the editable content of an element or outside of it. Modes often decorate elements by adding decorations before and after the content of the element. These are not editable, and should be skipped by caret movement.

    Parameters

    • element: Element

      The element in which the caret is appearing.

    • offset: number

      The offset into the element at which the caret is positioned.

    • modeTree: ModeTree

      The mode tree from which to get a mode.

    Returns boolean

    true if we are inside editable content, false otherwise.

moveInAttributes

  • moveInAttributes(node: Node, modeTree: ModeTree): boolean

moveOutOfPlaceholder

  • moveOutOfPlaceholder(pos: DLoc, root: Element | Document, after: boolean): DLoc
  • Parameters

    • pos: DLoc

      The position form which we start.

    • root: Element | Document

      The root of the DOM tree within which we move.

    • after: boolean

      Whether we are to move after the placeholder (true) or not (false).

    Returns DLoc

    If called with a position inside a placeholder, return a position outside of the placeholder. Otherwise, return the position unchanged.

newPosition

  • newPosition(pos: DLoc | undefined | null, direction: Direction, docRoot: Document | Element, modeTree: ModeTree): DLoc | undefined

positionDown

  • positionDown(pos: DLoc | undefined | null, docRoot: Document | Element, modeTree: ModeTree): DLoc | undefined
  • Compute the position under a starting position. This function takes into account wed-specific needs. For instance, it knows how start and end labels are structured.

    Parameters

    • pos: DLoc | undefined | null

      The position at which we start.

    • docRoot: Document | Element

      The element within which caret movement is to be constrained.

    • modeTree: ModeTree

      The mode tree from which to get a mode.

    Returns DLoc | undefined

    The new position, or undefined if there is no such position.

positionLeft

  • positionLeft(pos: DLoc | undefined | null, docRoot: Document | Element, modeTree: ModeTree): DLoc | undefined
  • Compute the position to the left of a starting position. This function takes into account wed-specific needs. For instance, it knows how start and end labels are structured.

    Parameters

    • pos: DLoc | undefined | null

      The position at which we start.

    • docRoot: Document | Element

      The element within which caret movement is to be constrained.

    • modeTree: ModeTree

      The mode tree from which to get a mode.

    Returns DLoc | undefined

    The new position, or undefined if there is no such position.

positionRight

  • positionRight(pos: DLoc | undefined | null, docRoot: Document | Element, modeTree: ModeTree): DLoc | undefined
  • Compute the position to the right of a starting position. This function takes into account wed-specific needs. For instance, it knows how start and end labels are structured.

    Parameters

    • pos: DLoc | undefined | null

      The position at which we start.

    • docRoot: Document | Element

      The element within which caret movement is to be constrained.

    • modeTree: ModeTree

      The mode tree from which to get a mode.

    Returns DLoc | undefined

    The new position, or undefined if there is no such position.

positionUp

  • positionUp(pos: DLoc | undefined | null, docRoot: Document | Element, modeTree: ModeTree): DLoc | undefined
  • Compute the position above a starting position. This function takes into account wed-specific needs. For instance, it knows how start and end labels are structured.

    Parameters

    • pos: DLoc | undefined | null

      The position at which we start.

    • docRoot: Document | Element

      The element within which caret movement is to be constrained.

    • modeTree: ModeTree

      The mode tree from which to get a mode.

    Returns DLoc | undefined

    The new position, or undefined if there is no such position.

Object literals

Const directionToFunction

directionToFunction: object

down

down: positionDown = positionDown

left

left: positionLeft = positionLeft

right

right: positionRight = positionRight

up

up: positionUp = positionUp

Generated using TypeDoc