Class: CodeNode
@lexical/code.CodeNode
Hierarchy
↳
CodeNode
Constructors
constructor
• new CodeNode(language?
, key?
)
Parameters
Name | Type |
---|---|
language? | null | string |
key? | string |
Overrides
Defined in
lexical-code/src/CodeNode.ts:97
Methods
canIndent
▸ canIndent(): false
Returns
false
Overrides
Defined in
lexical-code/src/CodeNode.ts:287
collapseAtStart
▸ collapseAtStart(): boolean
Returns
boolean
Overrides
Defined in
lexical-code/src/CodeNode.ts:291
createDOM
▸ createDOM(config
): HTMLElement
Parameters
Name | Type |
---|---|
config | EditorConfig |
Returns
HTMLElement
Overrides
ElementNode.createDOM
Defined in
lexical-code/src/CodeNode.ts:103
exportJSON
▸ exportJSON(): SerializedCodeNode
Controls how the this node is serialized to JSON. This is important for copy and paste between Lexical editors sharing the same namespace. It's also important if you're serializing to JSON for persistent storage somewhere. See Serialization & Deserialization.
Returns
Overrides
Defined in
lexical-code/src/CodeNode.ts:212
getLanguage
▸ getLanguage(): undefined
| null
| string
Returns
undefined
| null
| string
Defined in
lexical-code/src/CodeNode.ts:304
insertNewAfter
▸ insertNewAfter(selection
, restoreSelection?
): null
| ParagraphNode
| CodeTabNode
| CodeHighlightNode
Parameters
Name | Type | Default value |
---|---|---|
selection | RangeSelection | undefined |
restoreSelection | boolean | true |
Returns
null
| ParagraphNode
| CodeTabNode
| CodeHighlightNode
Overrides
Defined in
lexical-code/src/CodeNode.ts:222
setLanguage
▸ setLanguage(language
): void
Parameters
Name | Type |
---|---|
language | string |
Returns
void
Defined in
lexical-code/src/CodeNode.ts:299
updateDOM
▸ updateDOM(prevNode
, dom
, config
): boolean
Parameters
Name | Type |
---|---|
prevNode | CodeNode |
dom | HTMLElement |
config | EditorConfig |
Returns
boolean
Overrides
ElementNode.updateDOM
Defined in
lexical-code/src/CodeNode.ts:113
clone
▸ Static
clone(node
): CodeNode
Parameters
Name | Type |
---|---|
node | CodeNode |
Returns
Overrides
ElementNode.clone
Defined in
lexical-code/src/CodeNode.ts:93
getType
▸ Static
getType(): string
Returns
string
Overrides
ElementNode.getType
Defined in
lexical-code/src/CodeNode.ts:89
importDOM
▸ Static
importDOM(): null
| DOMConversionMap
<HTMLElement
>
Returns
null
| DOMConversionMap
<HTMLElement
>
Defined in
lexical-code/src/CodeNode.ts:131
importJSON
▸ Static
importJSON(serializedNode
): CodeNode
Parameters
Name | Type |
---|---|
serializedNode | SerializedCodeNode |
Returns
Overrides
ElementNode.importJSON
Defined in
lexical-code/src/CodeNode.ts:204