Options
All
  • Public
  • Public/Protected
  • All
Menu

A helper class to provide DOM access APIs

Hierarchy

  • DOMHelper

Index

Methods

calculateZoomScale

  • calculateZoomScale(): number

findClosestBlockElement

  • findClosestBlockElement(startFrom: Node): HTMLElement

findClosestElementAncestor

  • findClosestElementAncestor<T>(node: Node, selector?: T): HTMLElementTagNameMap[T]
  • findClosestElementAncestor(node: Node, selector?: string): HTMLElement
  • Find closest element ancestor start from the given node which matches the given selector

    Type parameters

    • T: keyof HTMLElementTagNameMap

    Parameters

    • node: Node

      Find ancestor start from this node

    • Optional selector: T

      The expected selector. If null, return the first HTML Element found from start node

    Returns HTMLElementTagNameMap[T]

    An HTML element which matches the given selector. If the given start node matches the selector, returns the given node

  • Find closest element ancestor start from the given node which matches the given selector

    Parameters

    • node: Node

      Find ancestor start from this node

    • Optional selector: string

      The expected selector. If null, return the first HTML Element found from start node

    Returns HTMLElement

    An HTML element which matches the given selector. If the given start node matches the selector, returns the given node

getClientWidth

  • getClientWidth(): number

getClonedRoot

  • getClonedRoot(): HTMLElement

getContainerFormat

getDomAttribute

  • getDomAttribute(name: string): string

getDomStyle

  • getDomStyle<T>(style: T): CSSStyleDeclaration[T]

getRangesByText

  • getRangesByText(text: string, matchCase: boolean, wholeWord: boolean): Range[]
  • Get text ranges by searching for a specific text, with options to match case and whole word. This will only search within editable elements.

    Parameters

    • text: string

      The text to search for

    • matchCase: boolean

      Whether to match case

    • wholeWord: boolean

      Whether to match whole word

    Returns Range[]

    An array of Ranges that match the search criteria

getTextContent

  • getTextContent(): string

hasFocus

  • hasFocus(): boolean

isNodeInEditor

  • isNodeInEditor(node: Node, excludeRoot?: boolean): boolean

isRightToLeft

  • isRightToLeft(): boolean

queryElements

  • queryElements<TTag>(tag: TTag): HTMLElementTagNameMap[TTag][]
  • queryElements(selector: string): HTMLElement[]
  • Query HTML elements in editor by tag name. Be careful of this function since it will also return element under entity.

    Type parameters

    • TTag: keyof HTMLElementTagNameMap

    Parameters

    • tag: TTag

      Tag name of the element to query

    Returns HTMLElementTagNameMap[TTag][]

    HTML Element array of the query result

  • Query HTML elements in editor by a selector string Be careful of this function since it will also return element under entity.

    Parameters

    • selector: string

      Selector string to query

    Returns HTMLElement[]

    HTML Element array of the query result

setDomAttribute

  • setDomAttribute(name: string, value: string): void

Generated using TypeDoc