Class: CodeNode
@lexical/code.CodeNode
Hierarchy
-
↳
CodeNode
Constructors
constructor
• new CodeNode(language?
, key?
): CodeNode
Parameters
Name | Type |
---|---|
language? | null | string |
key? | string |
Returns
Overrides
Defined in
packages/lexical-code/src/CodeNode.ts:86
Methods
canIndent
▸ canIndent(): false
Returns
false
Overrides
Defined in
packages/lexical-code/src/CodeNode.ts:311
collapseAtStart
▸ collapseAtStart(): boolean
Returns
boolean
Overrides
Defined in
packages/lexical-code/src/CodeNode.ts:315
createDOM
▸ createDOM(config
): HTMLElement
Parameters
Name | Type |
---|---|
config | EditorConfig |
Returns
HTMLElement
Overrides
ElementNode.createDOM
Defined in
packages/lexical-code/src/CodeNode.ts:93
exportDOM
▸ exportDOM(editor
): DOMExportOutput
Parameters
Name | Type |
---|---|
editor | LexicalEditor |
Returns
Overrides
ElementNode.exportDOM
Defined in
packages/lexical-code/src/CodeNode.ts:133
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
packages/lexical-code/src/CodeNode.ts:223
getIsSyntaxHighlightSupported
▸ getIsSyntaxHighlightSupported(): boolean
Returns
boolean
Defined in
packages/lexical-code/src/CodeNode.ts:334
getLanguage
▸ getLanguage(): undefined
| null
| string
Returns
undefined
| null
| string
Defined in
packages/lexical-code/src/CodeNode.ts:330
insertNewAfter
▸ insertNewAfter(selection
, restoreSelection?
): null
| ParagraphNode
| TabNode
| CodeHighlightNode
Parameters
Name | Type | Default value |
---|---|---|
selection | RangeSelection | undefined |
restoreSelection | boolean | true |
Returns
null
| ParagraphNode
| TabNode
| CodeHighlightNode
Overrides
Defined in
packages/lexical-code/src/CodeNode.ts:233
setLanguage
▸ setLanguage(language
): void
Parameters
Name | Type |
---|---|
language | string |
Returns
void
Defined in
packages/lexical-code/src/CodeNode.ts:323
updateDOM
▸ updateDOM(prevNode
, dom
, config
): boolean
Parameters
Name | Type |
---|---|
prevNode | CodeNode |
dom | HTMLElement |
config | EditorConfig |
Returns
boolean
Overrides
ElementNode.updateDOM
Defined in
packages/lexical-code/src/CodeNode.ts:107
clone
▸ clone(node
): CodeNode
Parameters
Name | Type |
---|---|
node | CodeNode |
Returns
Overrides
ElementNode.clone
Defined in
packages/lexical-code/src/CodeNode.ts:82
getType
▸ getType(): string
Returns
string
Overrides
ElementNode.getType
Defined in
packages/lexical-code/src/CodeNode.ts:78
importDOM
▸ importDOM(): null
| DOMConversionMap
Returns
null
| DOMConversionMap
Overrides
ElementNode.importDOM
Defined in
packages/lexical-code/src/CodeNode.ts:148
importJSON
▸ importJSON(serializedNode
): CodeNode
Parameters
Name | Type |
---|---|
serializedNode | SerializedCodeNode |
Returns
Overrides
ElementNode.importJSON