Interface IExtensionsHandler

Interface of CodeMirror editor extensions handler

Notes

This handler is instantiated for each editor to manage its own set of extensions.

interface IExtensionsHandler {
    configChanged: ISignal<IExtensionsHandler, Record<string, any>>;
    isDisposed: boolean;
    dispose(): void;
    getInitialExtensions(): Extension[];
    getOption(option): unknown;
    hasOption(option): boolean;
    injectExtension(view, extension): void;
    reconfigureExtension<T>(view, key, value): void;
    reconfigureExtensions(view, configuration): void;
    setOption(option, value): void;
    setOptions(options): void;
}

Hierarchy

Implemented by

Properties

configChanged: ISignal<IExtensionsHandler, Record<string, any>>

Signal triggered when the editor configuration changes. It provides the mapping of the new configuration (only those that changed).

It should result in a call to IExtensionsHandler.reconfigureExtensions.

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

Methods

  • Dispose of the resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

  • Alpha

    Appends extensions to the top-level configuration of the editor.

    Parameters

    • view: EditorView

      Editor view

    • extension: Extension

      Editor extension to inject

    Returns void

  • Reconfigures the extension mapped with key with the provided value.

    Type Parameters

    • T

    Parameters

    • view: EditorView

      Editor view

    • key: string

      Parameter unique key

    • value: T

      Parameter value to be applied

    Returns void

  • Reconfigures all the extensions mapped with the options from the provided partial configuration.

    Parameters

    • view: EditorView

      Editor view

    • configuration: Record<string, any>

      Editor configuration

    Returns void

  • Set a config option for the editor.

    You will need to reconfigure the editor extensions by listening to IExtensionsHandler.configChanged.

    Parameters

    • option: string
    • value: unknown

    Returns void

  • Set config options for the editor.

    You will need to reconfigure the editor extensions by listening to IExtensionsHandler.configChanged.

    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