A class responsible for creating a drop-down.

Constructors

  • A class responsible for rendering a menu drop-down.

    Parameters

    • title: string

      The default title.

    • items: ProseMirrorDropDownEntry[]

      The configured menu items.

    • Optionaloptions: { cssClass?: string; icon?: string; onAction?: (arg0: MouseEvent) => any } = {}
      • OptionalcssClass?: string

        The menu CSS class name. Required if providing an action.

      • Optionalicon?: string

        Use an icon for the dropdown rather than a text label.

      • OptionalonAction?: (arg0: MouseEvent) => any

        A callback to fire when a menu item is clicked.

    Returns ProseMirrorDropDown

Methods

  • Attach event listeners.

    Parameters

    • html: HTMLMenuElement

      The root menu element.

    Returns void

  • Recurse through the menu structure and apply a function to each item in it.

    Parameters

    • fn: (arg0: ProseMirrorDropDownEntry) => boolean

      The function to call on each item. Return false to prevent iterating over any further items.

    Returns void

  • Construct the drop-down menu's HTML.

    Returns string

    HTML contents as a string.

  • Protected

    Handle spawning a drop-down menu.

    Parameters

    • event: PointerEvent

      The triggering event.

    Returns void