Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Mode

The namespace for CodeMirror Mode functionality.

Index

Functions

addSpecLoader

  • addSpecLoader(loader: ISpecLoader, rank: number): void
  • Parameters

    Returns void

ensure

  • ensure(mode: string | ISpec): Promise<ISpec | null>
  • Ensure a codemirror mode is available by name or Codemirror spec.

    Parameters

    • mode: string | ISpec

      The mode to ensure. If it is a string, uses [findBest] to get the appropriate spec.

    Returns Promise<ISpec | null>

    A promise that resolves when the mode is available.

findBest

  • Find a codemirror mode by name or CodeMirror spec.

    Parameters

    Returns ISpec

findByExtension

  • findByExtension(ext: string | string[]): ISpec | null
  • Find a codemirror mode by extension.

    Parameters

    • ext: string | string[]

    Returns ISpec | null

findByFileName

  • findByFileName(name: string): ISpec
  • Find a codemirror mode by filename.

    Parameters

    • name: string

    Returns ISpec

findByMIME

  • findByMIME(mime: string): ISpec
  • Find a codemirror mode by MIME.

    Parameters

    • mime: string

    Returns ISpec

findByName

  • findByName(name: string): ISpec
  • Find a codemirror mode by name.

    Parameters

    • name: string

    Returns ISpec

getModeInfo

  • Get the raw list of available modes specs.

    Returns ISpec[]

run

  • run(code: string, mode: string | ISpec, el: HTMLElement): void
  • Running a CodeMirror mode outside of an editor.

    Parameters

    • code: string
    • mode: string | ISpec
    • el: HTMLElement

    Returns void

Generated using TypeDoc