Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

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

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    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

    • get key(): PluginKey<any>

      A unique key for this plugin that can be used to identify a plugin instance in any given editor.

      Returns PluginKey<any>

    Methods

    • Attach event listeners.

      Parameters

      • html: HTMLMenuElement

        The root menu element.

      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

      Clear a specific mark from the selection.

      Parameters

      • markType: MarkType

        The mark to remove.

      Returns void

    • Protected

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

      Returns void

    • Protected

      Display a prompt for font color.

      Returns Promise<void>

    • Protected

      Display a prompt for a custom font size.

      Returns Promise<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

      Handle collapsing various menu items to accommodate the menu's available width.

      Parameters

      • entries: ResizeObserverEntry[]

      Returns void

    • Protected

      Place the given insert into the ProseMirror Document.

      Parameters

      • state: EditorState

        The editor state.

      • dispatch: Function

        Dispatch changes to the editor state.

      • view: EditorView

        The editor view.

      • html: string

        The insert's markup.

      • Optionaloptions: { inline?: boolean } = {}
        • Optionalinline?: boolean

          Whether the insert contains inline content, otherwise block content is assumed.

      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 a mark in the selection. Unlike the built-in toggleMark command, this will check for exact attribute matches to determine toggling behavior.

      Parameters

      • markType: MarkType

        The mark to apply.

      • attrs: any = null

        The mark's attributes.

      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

    • Protected

      Get the visible element from its action.

      Parameters

      • action: string

        The action.

      Returns HTMLElement

    • Global listeners for the drop-down menu.

      Parameters

      • document: Document

        The document to bind to.

      • __namedParameters: { _deprecated?: boolean } = {}

      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>