@likecoin/epub-ts
    Preparing search index...

    Class Contents

    Implements

    Index

    Constructors

    • Parameters

      • doc: Document
      • Optionalcontent: HTMLElement
      • OptionalcfiBase: string
      • OptionalsectionIndex: number

      Returns Contents

    Properties

    __listeners: Record<string, ((...args: any[]) => void)[]> | undefined
    _expanding: boolean
    _layoutStyle: string
    _mediaQueryHandlers: {
        handler: (e: MediaQueryListEvent) => void;
        mql: MediaQueryList;
    }[]
    _onSelectionChange: ((e: Event) => void) | undefined
    _onVisibilityChange: (() => void) | undefined
    _resizeCheck: (() => void) | undefined
    _size: { height: number; width: number }
    _triggerEvent: ((e: Event) => void) | undefined
    active: boolean
    called: number
    cfiBase: string
    content: HTMLElement
    document: Document
    documentElement: HTMLElement
    emit: <K extends string>(type: K, ...args: ContentsEvents[K]) => void
    epubcfi: EpubCFI
    expanding: Timeout | undefined
    observer: ResizeObserver | MutationObserver | undefined
    off: <K extends string>(
        type: K,
        fn?: (...args: ContentsEvents[K]) => void,
    ) => void
    on: <K extends string>(
        type: K,
        fn: (...args: ContentsEvents[K]) => void,
    ) => void
    onResize: ((size: { height: number; width: number }) => void) | undefined
    sectionIndex: number
    selectionEndTimeout: Timeout | undefined
    window: Window

    Accessors

    • get listenedEvents(): readonly [
          "keydown",
          "keyup",
          "keypress",
          "mouseup",
          "mousedown",
          "mousemove",
          "click",
          "dblclick",
          "touchend",
          "touchstart",
          "touchmove",
      ]

      Get DOM events that are listened for and passed along

      Returns readonly [
          "keydown",
          "keyup",
          "keypress",
          "mouseup",
          "mousedown",
          "mousemove",
          "click",
          "dblclick",
          "touchend",
          "touchstart",
          "touchmove",
      ]

    Methods

    • Parameters

      • Optionalkey: string

      Returns false | HTMLStyleElement

    • Add a class to the contents container

      Parameters

      • className: string

      Returns void

    • Append a script tag to the document head

      Parameters

      • src: string

        url

      Returns Promise<boolean>

      loaded

    • Append a stylesheet link to the document head

      Parameters

      • src: string

        url

      Returns Promise<boolean>

    • Append stylesheet css

      Parameters

      • serializedCss: string
      • Optionalkey: string

        If the key is the same, the CSS will be replaced instead of inserted

      Returns boolean

    • Get an EpubCFI from a Dom node

      Parameters

      • node: Node
      • OptionalignoreClass: string

      Returns string

      cfi

    • Get an EpubCFI from a Dom Range

      Parameters

      • range: Range
      • OptionalignoreClass: string

      Returns string

      cfi

    • Apply columns to the contents for pagination

      Parameters

      • width: number
      • height: number
      • columnWidth: number
      • gap: number
      • Optionaldir: string

      Returns void

    • Get or Set height of the contents

      Parameters

      • Optionalh: string | number

      Returns number

      height

    • Get or Set width of the contents

      Parameters

      • Optionalw: string | number

      Returns number

      width

    • Set Css styles on the contents element (typically Body)

      Parameters

      • property: string
      • Optionalvalue: string
      • Optionalpriority: boolean

        set as "important"

      Returns string

    • Set the direction of the text

      Parameters

      • Optionaldir: string

        "rtl" | "ltr"

      Returns void

    • Fit contents into a fixed width and height

      Parameters

      • width: number
      • height: number
      • Optionalsection: Section

      Returns void

    • Get or Set height

      Parameters

      • Optionalh: string | number

      Returns number

      height

    • Get the location offset of a EpubCFI or an #id

      Parameters

      • target: string
      • OptionalignoreClass: string

        for the cfi

      Returns { left: number; top: number }

    • Set overflow css style of the contents

      Parameters

      • Optionaloverflow: string

      Returns string

    • Set overflowX css style of the documentElement

      Parameters

      • Optionaloverflow: string

      Returns string

    • Set overflowY css style of the documentElement

      Parameters

      • Optionaloverflow: string

      Returns string

    • Get a Dom Range from EpubCFI

      Parameters

      • _cfi: string
      • OptionalignoreClass: string

      Returns Range

      range

    • Remove a class from the contents container

      Parameters

      • className: string

        class name to remove

      Returns void

    • Get the documentElement

      Returns HTMLElement | null

      documentElement

    • Scale contents from center

      Parameters

      • scale: number
      • OptionaloffsetX: number
      • OptionaloffsetY: number

      Returns void

    • Get documentElement scrollHeight

      Returns number

      height

    • Get documentElement scrollWidth

      Returns number

      width

    • Size the contents to a given width and height

      Parameters

      • Optionalwidth: number
      • Optionalheight: number

      Returns void

    • Get the height of the text using Range

      Returns number

      height

    • Get the width of the text using Range

      Returns number

      width

    • Get or Set width

      Parameters

      • Optionalw: string | number

      Returns number

      width

    • Set the writingMode of the text

      Parameters

      • Optionalmode: string

        "horizontal-tb" | "vertical-rl" | "vertical-lr"

      Returns string