Class CodeMirrorEditor

CodeMirror editor.

Hierarchy

  • CodeMirrorEditor

Implements

  • IEditor

Constructors

Properties

_configurator: any
_editor: any
_evtBlur: any

Handle blur events for the editor.

_evtFocus: any

Handle focus events for the editor.

_isDisposed: any
_language: any
_languages: any
_model: any
_onCursorActivity: any

Handles a cursor activity event.

_onDocChanged: any

Handles document changes.

_onMimeTypeChanged: any

Handles a mime type change.

_toCodeMirrorPosition: any

Convert an editor position to a code mirror position.

_toPosition: any

Convert a code mirror position to an editor position.

_toSelection: any

Converts a code mirror selection to an editor selection.

_uuid: any
edgeRequested: Signal<CodeMirrorEditor, EdgeLocation>

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

The DOM node that hosts the editor.

Accessors

  • get charWidth(): number
  • The widget of a character in the editor in pixels.

    Returns number

  • get doc(): Text
  • Get the codemirror doc wrapped by the widget.

    Returns Text

  • get editor(): EditorView
  • Get the codemirror editor wrapped by the editor.

    Returns EditorView

  • get isDisposed(): boolean
  • Tests whether the editor is disposed.

    Returns boolean

  • get lineCount(): number
  • Get the number of lines in the editor.

    Returns number

  • get lineHeight(): number
  • The height of a line in the editor in pixels.

    Returns number

  • get model(): IModel
  • Returns a model for this editor.

    Returns IModel

  • get state(): EditorState
  • Returns EditorState

  • get uuid(): string
  • The uuid of this editor;

    Returns string

  • set uuid(value): void
  • Parameters

    • value: string

    Returns void

Methods

  • Explicitly blur the editor.

    Returns void

  • Clear the undo history.

    Returns void

  • Parameters

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

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

    • bottom: number
    • left: number
    • top: number
  • Dispose of the resources held by the widget.

    Returns void

  • Execute a codemirror command on the editor.

    Parameters

    • command: Command | StateCommand

      The name of the command to execute.

    Returns void

  • Returns number

  • Brings browser focus to this editor text.

    Returns void

  • Get the window coordinates given a cursor position.

    Parameters

    • position: IPosition

    Returns ICoordinate

  • Returns the primary position of the cursor, never null.

    Returns IPosition

  • Returns the content for the given line number.

    Parameters

    • line: number

    Returns string

  • Find an offset for the given position.

    Parameters

    • position: IPosition

    Returns number

  • Get a config option for the editor.

    Parameters

    • option: string

    Returns unknown

  • Find a position for the given offset.

    Parameters

    • offset: number

    Returns IPosition

  • Get the cursor position given window coordinates.

    Parameters

    • coordinate: ICoordinate

      The desired coordinate.

    Returns IPosition

    The position of the coordinates, or null if not contained in the editor.

  • Parameters

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

    Returns string

  • Returns the primary selection, never null.

    Returns ITextSelection

  • Gets the selections for all the cursors, never null or empty.

    Returns ITextSelection[]

  • Get the token at a given editor position.

    Parameters

    • offset: number

    Returns IToken

  • Get the token a the cursor position.

    Returns IToken

  • Get a list of tokens for the current editor text content.

    Returns IToken[]

  • 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

  • Test whether the editor has keyboard focus.

    Returns boolean

  • Whether the option exists or not.

    Parameters

    • option: string

    Returns boolean

  • Alpha Experimental

    Inject an extension into the editor

    Parameters

    Returns void

  • Returns number

  • Insert a new indented line at the current cursor position.

    Returns void

  • Parameters

    Returns void

  • Handle keydown events from the editor.

    Parameters

    Returns boolean

  • Redo one undone edit.

    Returns void

  • Replaces the current selection with the given text.

    Behaviour for multiple selections is undefined.

    Parameters

    • text: string

      The text to be inserted.

    Returns void

  • Reveal the given position in the editor.

    Parameters

    • position: IPosition

    Returns void

  • Reveal the given selection in the editor.

    Parameters

    • selection: IRange

    Returns void

  • Set the primary position of the cursor.

    Notes

    This will remove any secondary cursors.

    Deprecated

    options bias and origin are not used

    Parameters

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

    Returns void

  • Set a config option for the editor.

    Parameters

    • option: string
    • value: unknown

    Returns void

  • 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

  • Set the primary selection. This will remove any secondary cursors.

    Parameters

    • selection: IRange

    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

    • selections: IRange[]

    Returns void

  • Undo one edit (if any undo events are stored).

    Returns void

Generated using TypeDoc