Skip to main content

Class: CodeNode

@lexical/code.CodeNode

Hierarchy

Constructors

constructor

new CodeNode(language?, preserve?, key?)

Parameters

NameType
language?null | string
preserve?null | boolean
key?string

Overrides

ElementNode.constructor

Defined in

lexical-code/src/CodeNode.ts:95

Properties

__preserve

__preserve: undefined | null | boolean

Defined in

lexical-code/src/CodeNode.ts:85

Methods

canIndent

canIndent(): false

Returns

false

Overrides

ElementNode.canIndent

Defined in

lexical-code/src/CodeNode.ts:278


canInsertTab

canInsertTab(): boolean

Returns

boolean

Overrides

ElementNode.canInsertTab

Defined in

lexical-code/src/CodeNode.ts:270


collapseAtStart

collapseAtStart(): true

Returns

true

Overrides

ElementNode.collapseAtStart

Defined in

lexical-code/src/CodeNode.ts:282


createDOM

createDOM(config): HTMLElement

Parameters

NameType
configEditorConfig

Returns

HTMLElement

Overrides

ElementNode.createDOM

Defined in

lexical-code/src/CodeNode.ts:106


exportJSON

exportJSON(): SerializedCodeNode

Returns

SerializedCodeNode

Overrides

ElementNode.exportJSON

Defined in

lexical-code/src/CodeNode.ts:211


getLanguage

getLanguage(): undefined | null | string

Returns

undefined | null | string

Defined in

lexical-code/src/CodeNode.ts:297


getPreserve

getPreserve(): undefined | null | boolean

Returns

undefined | null | boolean

Defined in

lexical-code/src/CodeNode.ts:306


insertNewAfter

insertNewAfter(selection): null | ParagraphNode | CodeHighlightNode

Parameters

NameType
selectionRangeSelection

Returns

null | ParagraphNode | CodeHighlightNode

Overrides

ElementNode.insertNewAfter

Defined in

lexical-code/src/CodeNode.ts:222


setLanguage

setLanguage(language): void

Parameters

NameType
languagestring

Returns

void

Defined in

lexical-code/src/CodeNode.ts:292


setPreserve

setPreserve(preserve): void

Parameters

NameType
preserveboolean

Returns

void

Defined in

lexical-code/src/CodeNode.ts:301


updateDOM

updateDOM(prevNode, dom): boolean

Parameters

NameType
prevNodeCodeNode
domHTMLElement

Returns

boolean

Overrides

ElementNode.updateDOM

Defined in

lexical-code/src/CodeNode.ts:116


clone

Static clone(node): CodeNode

Parameters

NameType
nodeCodeNode

Returns

CodeNode

Overrides

ElementNode.clone

Defined in

lexical-code/src/CodeNode.ts:91


getType

Static getType(): string

Returns

string

Overrides

ElementNode.getType

Defined in

lexical-code/src/CodeNode.ts:87


importDOM

Static importDOM(): null | DOMConversionMap<HTMLElement>

Returns

null | DOMConversionMap<HTMLElement>

Defined in

lexical-code/src/CodeNode.ts:130


importJSON

Static importJSON(serializedNode): CodeNode

Parameters

NameType
serializedNodeSerializedCodeNode

Returns

CodeNode

Overrides

ElementNode.importJSON

Defined in

lexical-code/src/CodeNode.ts:203