A custom HTML element responsible displaying a ProseMirror rich text editor.

Hierarchy (view full)

Properties

_internals: ElementInternals

Attached ElementInternals which provides form handling functionality.

_primaryInput: HTMLElement

The primary input (if any). Used to determine what element should receive focus when an associated label is clicked on.

_value: string

The underlying value of the element.

#active: boolean = false

Is the editor in active edit mode?

#editor: ProseMirrorEditor

The ProseMirror editor instance.

#content: HTMLDivElement

Current editor contents

#toggled: boolean

Does this editor function via a toggle button? Or is it always active?

#enriched: string

Enriched content which is optionally used if the editor is toggled.

#button: HTMLButtonElement = null

An optional edit button which activates edit mode for the editor

tagName: string = "prose-mirror"
formAssociated: boolean = true

Declare that this custom element provides form element functionality.

Accessors

  • get form(): HTMLFormElement
  • The form this element belongs to.

    Returns HTMLFormElement

  • get name(): string
  • The input element name.

    Returns string

  • get disabled(): boolean
  • Is this element disabled?

    Returns boolean

  • get editable(): boolean
  • Is this field editable? The field can be neither disabled nor readonly.

    Returns boolean

Methods

  • Actions to take when the custom element is removed from the document.

    Returns void

  • Internal

    Apply key attributes on the containing custom HTML element to input elements contained within it.

    Parameters

    • input: any

    Returns void

  • Protected

    Configure ProseMirror editor plugins.

    Returns Record<string, Plugin>

  • Protected

    Translate user-provided input value into the format that should be stored.

    Parameters

    • value: string

      A new value to assign to the element

    Returns void

    Throws

    An error if the provided value is invalid

  • Protected

    Special handling when the custom element is clicked. This should be implemented to transfer focus to an appropriate internal element.

    Parameters

    • event: PointerEvent

    Returns void

  • Activate the ProseMirror editor.

    Returns Promise<void>

  • Handle clicking the editor activation button.

    Parameters

    • event: PointerEvent

      The triggering event.

    Returns void

  • Handle saving the editor content. Store new parsed HTML into the _value attribute of the element. If the editor is toggled, also deactivate editing mode.

    Returns void