Class: CodeBlockNode

A lexical node that represents a fenced code block. Use "$createCodeBlockNode" to construct one.

Extends

  • DecoratorNode<JSX.Element>

Constructors

new CodeBlockNode()

new CodeBlockNode(code, language, meta, key?): CodeBlockNode

Parameters

ParameterType
codestring
languagestring
metastring
key?string

Returns

CodeBlockNode

Overrides

DecoratorNode<JSX.Element>.constructor

Methods

createDOM()

createDOM(_config): HTMLDivElement

Parameters

ParameterType
_configEditorConfig

Returns

HTMLDivElement

Overrides

DecoratorNode.createDOM


decorate()

decorate(editor): Element

Parameters

ParameterType
editorLexicalEditor

Returns

Element

Overrides

DecoratorNode.decorate


exportJSON()

exportJSON(): SerializedCodeBlockNode

Returns

SerializedCodeBlockNode

Overrides

DecoratorNode.exportJSON


getCode()

getCode(): string

Returns

string


getLanguage()

getLanguage(): string

Returns

string


getMeta()

getMeta(): string

Returns

string


isInline()

isInline(): boolean

Returns

boolean

Overrides

DecoratorNode.isInline


select()

select(): void

Returns

void


setCode()

setCode(code): void

Parameters

ParameterType
codestring

Returns

void


setLanguage()

setLanguage(language): void

Parameters

ParameterType
languagestring

Returns

void


setMeta()

setMeta(meta): void

Parameters

ParameterType
metastring

Returns

void


updateDOM()

updateDOM(): false

Returns

false

Overrides

DecoratorNode.updateDOM


clone()

static clone(node): CodeBlockNode

Parameters

ParameterType
nodeCodeBlockNode

Returns

CodeBlockNode

Overrides

DecoratorNode.clone


getType()

static getType(): string

Returns

string

Overrides

DecoratorNode.getType


importJSON()

static importJSON(serializedNode): CodeBlockNode

Parameters

ParameterType
serializedNodeSerializedCodeBlockNode

Returns

CodeBlockNode

Overrides

DecoratorNode.importJSON

Properties

PropertyTypeDefault value
__codestringundefined
__focusEmitterobject...
__focusEmitter.publish() => void...
__focusEmitter.subscribe(cb: () => void) => void...
__languagestringundefined
__metastringundefined