Class: CodeBlockNode

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

Hierarchy

  • DecoratorNode<JSX.Element>

    CodeBlockNode

Table of contents

Constructors

Methods

Properties

Constructors

constructor

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

Parameters

NameType
codestring
languagestring
metastring
key?string

Returns

CodeBlockNode

Overrides

DecoratorNode&lt;JSX.Element&gt;.constructor

Methods

createDOM

createDOM(_config): HTMLDivElement

Parameters

NameType
_configEditorConfig

Returns

HTMLDivElement

Overrides

DecoratorNode.createDOM


decorate

decorate(editor): Element

Parameters

NameType
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

NameType
codestring

Returns

void


setLanguage

setLanguage(language): void

Parameters

NameType
languagestring

Returns

void


setMeta

setMeta(meta): void

Parameters

NameType
metastring

Returns

void


updateDOM

updateDOM(): false

Returns

false

Overrides

DecoratorNode.updateDOM


clone

clone(node): CodeBlockNode

Parameters

NameType
nodeCodeBlockNode

Returns

CodeBlockNode

Overrides

DecoratorNode.clone


getType

getType(): string

Returns

string

Overrides

DecoratorNode.getType


importJSON

importJSON(serializedNode): CodeBlockNode

Parameters

NameType
serializedNodeSerializedCodeBlockNode

Returns

CodeBlockNode

Overrides

DecoratorNode.importJSON

Properties

__code

__code: string


__focusEmitter

__focusEmitter: Object

Type declaration

NameType
publish() => void
subscribe(cb: () => void) => void

__language

__language: string


__meta

__meta: string