Skip to main content

extension-codemirror5

package @remirror/extension-codemirror5

class CodeMirrorExtension

Signature:

export declare class CodeMirrorExtension extends NodeExtension<CodeMirrorExtensionOptions> 

Extends: NodeExtension<CodeMirrorExtensionOptions>

(Some inherited members may not be shown because they are not represented in the documentation.)

property name

Signature:

get name(): "codeMirror";

property tags

Signature:

readonly tags: ("code" | "block")[];

method createCodeMirror

Creates a CodeMirror block at the current position.

commands.createCodeMirror({ language: 'js' });

Signature:

createCodeMirror(attributes: CodeMirrorExtensionAttributes): CommandFunction;

Parameters:

ParameterTypeDescription
attributesCodeMirrorExtensionAttributes

Returns:

CommandFunction

method createKeymap

Signature:

createKeymap(): PrioritizedKeyBindings;

Returns:

PrioritizedKeyBindings

method createNodeSpec

Signature:

createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): NodeExtensionSpec;

Parameters:

ParameterTypeDescription
extraApplySchemaAttributes
overrideNodeSpecOverride

Returns:

NodeExtensionSpec

method createNodeViews

Signature:

createNodeViews(): NodeViewMethod;

Returns:

NodeViewMethod

method init

Signature:

init(): void;

Returns:

void

method updateCodeMirror

Update the code block at the current position. Primarily this is used to change the language.

if (commands.updateCodeMirror.enabled()) {
commands.updateCodeMirror({ language: 'markdown' });
}

Signature:

updateCodeMirror(attributes: CodeMirrorExtensionAttributes): CommandFunction;

Parameters:

ParameterTypeDescription
attributesCodeMirrorExtensionAttributes

Returns:

CommandFunction

interface CodeMirrorExtensionAttributes

Signature:

export interface CodeMirrorExtensionAttributes extends ProsemirrorAttributes 

Extends: ProsemirrorAttributes

(Some inherited members may not be shown because they are not represented in the documentation.)

property codeMirrorConfig

Configuration for the inner CodeMirror editor.

Signature:

codeMirrorConfig?: CodeMirror.EditorConfiguration;

property language

A string to represent the language, which will be passed into CodeMirror's findModeByName function. Note that you can also specify the language by editing codeMirrorConfig.mode directly.

Signature:

language?: string;

interface CodeMirrorExtensionOptions

Signature:

export interface CodeMirrorExtensionOptions 

property CodeMirror

The instance of codemirror to use.

Signature:

CodeMirror?: Static<typeof CodeMirror>;

property defaultCodeMirrorConfig

Configuration for the inner CodeMirror editor.

Signature:

defaultCodeMirrorConfig?: CodeMirror.EditorConfiguration | null;