Options
All
  • Public
  • Public/Protected
  • All
Menu

Manages the editing menus for a specific editing view. An "editing menu" is a menu that appears in the editing pane. The context menu and completion menu are editing menus.

Only one editing menu may be shown at any given time.

Hierarchy

  • EditingMenuManager

Index

Constructors

constructor

Properties

Private caretManager

caretManager: CaretManager

Private currentDropdown

currentDropdown: ContextMenu | undefined

Private currentTypeahead

currentTypeahead: TypeaheadPopup | undefined

Private dataRoot

dataRoot: Document | Element

Private doc

doc: HTMLDocument

Private editor

editor: Editor

The editor for which the manager is created.

Private guiRoot

guiRoot: HTMLDocument | HTMLElement

Private modeTree

modeTree: ModeTree

Methods

computeMenuPosition

  • computeMenuPosition(e: JQueryEventObject | undefined, bottom?: boolean): object
  • Computes where a menu should show up, depending on the event that triggered it.

    Parameters

    • e: JQueryEventObject | undefined

      The event that triggered the menu. If no event is passed, it is assumed that the menu was not triggered by a mouse event.

    • Default value bottom: boolean = false

      Only used when the event was not triggered by a mouse event (e === undefined). If bottom is true, use the bottom of the DOM entity used to compute the left coordinate. Otherwise, use its middle to determine the left coordinate.

    Returns object

    The top and left coordinates where the menu should appear.

    • left: number
    • top: number

contextMenuHandler

  • contextMenuHandler(e: JQueryEventObject): boolean
  • This is the default menu handler called when the user right-clicks in the contents of a document or uses the keyboard shortcut.

    The menu handler which is invoked when a user right-clicks on an element start or end label is defined by the decorator that the mode is using.

    Parameters

    • e: JQueryEventObject

    Returns boolean

dismiss

  • dismiss(): void

displayContextMenu

  • displayContextMenu(cmClass: ActionContextMenu, x: number, y: number, items: Item[], readonly: boolean): void
  • Display a context menu.

    Parameters

    • cmClass: ActionContextMenu

      The class to use to create the menu.

    • x: number

      The position of the menu.

    • y: number

      The position of the menu.

    • items: Item[]

      The menu items to show.

    • readonly: boolean

      If true, don't include in the menu any operation that would trigger a Transformation.

    Returns void

displayTypeaheadPopup

  • displayTypeaheadPopup(x: number, y: number, width: number, placeholder: string, options: any, dismissCallback: function): TypeaheadPopup
  • Brings up a typeahead popup.

    Parameters

    • x: number

      The position of the popup.

    • y: number

      The position of the popup.

    • width: number

      The width of the popup.

    • placeholder: string

      Placeholder text to put in the input field.

    • options: any

      Options for Twitter Typeahead.

    • dismissCallback: function

      The callback to be called upon dismissal. It will be called with the object that was selected, if any.

        • (obj?: undefined | object): void
        • Parameters

          • Optional obj: undefined | object

          Returns void

    Returns TypeaheadPopup

    The popup that was created.

Private getMenuItemsForAttribute

  • getMenuItemsForAttribute(): Action<__type>[]

Private getMenuItemsForElement

  • getMenuItemsForElement(node: HTMLElement, offset: number, wrap: boolean): Item[]

Private getPossibleAttributeValues

  • getPossibleAttributeValues(): string[]

makeCommonItems

  • makeCommonItems(dataNode: Node): Item[]
  • Make the menu items that should appear in all contextual menus.

    Parameters

    • dataNode: Node

      The element for which we are creating the menu.

    Returns Item[]

    Menu items.

makeDocumentationMenuItem

  • makeDocumentationMenuItem(docURL: string): HTMLElement
  • Makes an HTML link to open the documentation of an element.

    Parameters

    • docURL: string

    Returns HTMLElement

    A &lt;a> element that links to the documentation.

makeMenuItemForAction

  • makeMenuItemForAction<D>(action: Action<D>, data: D, start?: undefined | true | false): HTMLElement
  • Make a standardized menu item for a specific action. This method formats the menu item and sets an even handler appropriate to invoke the action's event handler.

    Type parameters

    • D

    Parameters

    • action: Action<D>

      The action for which we make a menu item.

    • data: D

      The data that accompanies the action.

    • Optional start: undefined | true | false

      This parameter determines whether we are creating an item for a start label (true) an end label (false) or something which is neither a start or end label (undefined).

    Returns HTMLElement

    A HTML element which is fit to serve as a menu item.

setupCompletionMenu

  • setupCompletionMenu(): void

setupContextMenu

  • setupContextMenu(cmClass: ActionContextMenu, items: Item[], readonly: boolean, e: JQueryEventObject | undefined, bottom?: undefined | true | false): void

setupReplacementMenu

  • setupReplacementMenu(): void

setupTypeaheadPopup

  • setupTypeaheadPopup(width: number, placeholder: string, options: any, dismissCallback: function, e: JQueryEventObject | undefined, bottom?: undefined | true | false): TypeaheadPopup

Generated using TypeDoc