Options
All
  • Public
  • Public/Protected
  • All
Menu

A helper class to provide DOM access APIs

Hierarchy

  • DOMHelper

Index

Methods

calculateZoomScale

  • calculateZoomScale(): number

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

getDomAttribute

  • getDomAttribute(name: string): string

getDomStyle

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

getTextContent

  • getTextContent(): string

hasFocus

  • hasFocus(): boolean

isNodeInEditor

  • isNodeInEditor(node: Node): 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