CodeMirror editor.

Implements

Constructors

Properties

_configurator: IExtensionsHandler
_editor: EditorView
_isDisposed: boolean = false
_language: Compartment = ...
_uuid: string = ''
edgeRequested: Signal<CodeMirrorEditor, EdgeLocation> = ...

A signal emitted when either the top or bottom edge is requested.

The DOM node that hosts the editor.

Accessors

Methods

  • Convert an editor position to a code mirror position.

    Parameters

    Returns {
        ch: number;
        line: number;
    }

    • ch: number
    • line: number
  • Convert a code mirror position to an editor position.

    Parameters

    • position: {
          ch: number;
          line: number;
      }
      • ch: number
      • line: number

    Returns {
        column: number;
        line: number;
    }

    • column: number
    • line: number
  • Converts a code mirror selection to an editor selection.

    Parameters

    • selection: {
          anchor: {
              ch: number;
              line: number;
          };
          head: {
              ch: number;
              line: number;
          };
      }
      • anchor: {
            ch: number;
            line: number;
        }
        • ch: number
        • line: number
      • head: {
            ch: number;
            line: number;
        }
        • ch: number
        • line: number

    Returns ITextSelection

  • Parameters

    • where: boolean
    • Optional mode: "window" | "page" | "local"

    Returns {
        bottom: number;
        left: number;
        top: number;
    }

    • bottom: number
    • left: number
    • top: number
  • Execute a codemirror command on the editor.

    Parameters

    • command: Command | StateCommand

      The name of the command to execute.

    Returns void

  • Parameters

    • from: {
          ch: number;
          line: number;
      }
      • ch: number
      • line: number
    • to: {
          ch: number;
          line: number;
      }
      • ch: number
      • line: number
    • Optional separator: string

    Returns string

  • Handle the DOM events for the editor.

    Parameters

    • event: Event

      The DOM event sent to the editor.

      Notes

      This method implements the DOM EventListener interface and is called in response to events on the editor's DOM node. It should not be called directly by user code.

    Returns void

  • Set the primary position of the cursor.

    Notes

    This will remove any secondary cursors.

    Parameters

    • position: IPosition
    • options: {
          bias?: number;
          origin?: string;
          scroll?: boolean;
      } = {}
      • Optional bias?: number
      • Optional origin?: string
      • Optional scroll?: boolean

    Returns void

    Deprecated

    options bias and origin are not used

  • Set config options for the editor.

    This method is preferred when setting several options. The options are set within an operation, which only performs the costly update at the end, and not after every option is set.

    Parameters

    Returns void

  • Sets the selections for all the cursors, should not be empty. Cursors will be removed or added, as necessary. Passing an empty array resets a cursor position to the start of a document.

    Parameters

    Returns void