Interface: CodeBlockEditorDescriptor

Implement this interface to create a custom code block editor. Pass the object in the codeBlockPlugin parameters.

Table of contents

Properties

Properties

Editor

Editor: ComponentType<CodeBlockEditorProps>

The React component to be used. See CodeBlockEditorProps for the props passed to the component.


match

match: (language: undefined | null | string, meta: undefined | null | string) => boolean

A function that returns true if the descriptor's editor should be used for the given code block.

Param

The language of the code block.

Param

The meta of the code block.

Type declaration

▸ (language, meta): boolean

A function that returns true if the descriptor's editor should be used for the given code block.

Parameters
NameTypeDescription
languageundefined | null | stringThe language of the code block.
metaundefined | null | stringThe meta of the code block.
Returns

boolean


priority

priority: number

The priority of the descriptor when descriptors are matched against a given code block. Lower number means lower priority. This allows you to implement a catch-all generic editor and a more specific editor for a given language / meta.