A class responsible for building a menu for a ProseMirror instance.

Hierarchy (View Summary)

Constructors

  • Parameters

    • schema: Schema

      The ProseMirror schema to build a menu for.

    • view: EditorView

      The editor view.

    • Optionaloptions: any = {}

      Additional options to configure the plugin's behaviour.

    Returns ProseMirrorMenu

Properties

options: ProseMirrorMenuOptions

Additional options to configure the plugin's behaviour.

_MENU_ITEM_SCOPES: { BOTH: string; HTML: string; TEXT: string } = ...

An enumeration of editor scopes in which a menu item can appear

Accessors

  • get editingSource(): boolean

    Track whether we are currently in a state of editing the HTML source.

    Returns boolean

Methods

  • Attach event listeners.

    Parameters

    • html: HTMLMenuElement

      The root menu element.

    Returns void

  • Called when the view is destroyed or receives a state with different plugins.

    Returns void

  • Called whenever the view's state is updated.

    Parameters

    • view: EditorView

      The current editor state.

    • prevState: EditorView

      The previous editor state.

    Returns void

  • Protected

    Clear any marks from the current selection.

    Returns void

  • Protected

    Instantiate the ProseMirrorDropDown instances and configure them with the defined menu items.

    Returns void

  • Protected

    Handle requests to save the editor contents

    Returns any

  • Protected

    Display the insert image prompt.

    Returns Promise<void>

  • Protected

    Display the insert link prompt.

    Returns Promise<void>

  • Protected

    Display the insert table prompt.

    Returns Promise<void>

  • Protected

    Determine whether the given menu item is currently active or not.

    Parameters

    Returns boolean

    Whether the cursor or selection is in a state represented by the given menu item.

  • Protected

    Determine whether the given menu item representing a mark is active or not.

    Parameters

    Returns boolean

    Whether the cursor or selection is in a state represented by the given mark.

  • Protected

    Determine whether the given menu item representing a node is active or not.

    Parameters

    Returns boolean

    Whether the cursor or selection is currently within a block of this menu item's node type.

  • Protected

    Handle a button press.

    Parameters

    • event: MouseEvent

      The click event.

    Returns void

  • Protected

    Create a dialog for a menu button.

    Parameters

    • action: string

      The unique menu button action.

    • template: string

      The dialog's template.

    • Optionaloptions: { data?: object } = {}

      Additional options to configure the dialog's behaviour.

      • Optionaldata?: object

        Data to pass to the template.

    Returns HTMLDialogElement

  • Protected

    Toggle the given selection by wrapping it in a given block or lifting it out of one.

    Parameters

    • node: NodeType

      The type of node being interacted with.

    • wrap: MenuToggleBlockWrapCommand

      The wrap command specific to the given node.

    • Optionaloptions: { attrs?: object } = {}

      Additional options to configure behaviour.

      • Optionalattrs?: object

        Attributes for the node.

    Returns void

  • Protected

    Toggle link recommendations

    Returns Promise<void>

  • Protected

    Toggle the given selection by wrapping it in a given text block, or reverting to a paragraph block.

    Parameters

    • node: NodeType

      The type of node being interacted with.

    • Optionaloptions: { attrs?: object } = {}

      Additional options to configure behaviour.

      • Optionalattrs?: object

        Attributes for the node.

    Returns void

  • Protected

    Wrap the editor view element and inject our template ready to be rendered into.

    Returns void

  • Build the plugin.

    Parameters

    • schema: any

      The ProseMirror schema to build the plugin against.

    • options: {} = {}

      Additional options to pass to the plugin.

    Returns Plugin<any>

  • Global listeners for the drop-down menu.

    Returns void