Interface: CodeBlockEditorContextValue

A set of functions that modify the underlying code block node. Access this with the useCodeBlockEditorContext hook in your custom code editor components.

Table of contents

Properties

Properties

lexicalNode

lexicalNode: CodeBlockNode

The Lexical node that's being edited.


setCode

setCode: (code: string) => void

Updates the code contents of the code block.

Type declaration

▸ (code): void

Updates the code contents of the code block.

Parameters
NameType
codestring
Returns

void


setLanguage

setLanguage: (language: string) => void

Updates the language of the code block. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting for language examples.

Type declaration

▸ (language): void

Updates the language of the code block. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting for language examples.

Parameters
NameType
languagestring
Returns

void


setMeta

setMeta: (meta: string) => void

Updates the meta of the code block. The meta is the additional string that comes after the code block language.

Type declaration

▸ (meta): void

Updates the meta of the code block. The meta is the additional string that comes after the code block language.

Parameters
NameType
metastring
Returns

void