Module: @lexical/code
Classes
Type Aliases
SerializedCodeNode
Ƭ SerializedCodeNode: Spread
<{ language
: string
| null
| undefined
}, SerializedElementNode
>
Defined in
packages/lexical-code/src/CodeNode.ts:45
Variables
CODE_LANGUAGE_FRIENDLY_NAME_MAP
• Const
CODE_LANGUAGE_FRIENDLY_NAME_MAP: Record
<string
, string
>
Defined in
packages/lexical-code/src/CodeHighlightNode.ts:45
CODE_LANGUAGE_MAP
• Const
CODE_LANGUAGE_MAP: Record
<string
, string
>
Defined in
packages/lexical-code/src/CodeHighlightNode.ts:65
DEFAULT_CODE_LANGUAGE
• Const
DEFAULT_CODE_LANGUAGE: "javascript"
Defined in
packages/lexical-code/src/CodeHighlightNode.ts:36
PrismTokenizer
• Const
PrismTokenizer: Tokenizer
Defined in
packages/lexical-code/src/CodeHighlighter.ts:70
Functions
$createCodeHighlightNode
▸ $createCodeHighlightNode(text
, highlightType?
): CodeHighlightNode
Parameters
Name | Type |
---|---|
text | string |
highlightType? | null | string |
Returns
Defined in
packages/lexical-code/src/CodeHighlightNode.ts:215
$createCodeNode
▸ $createCodeNode(language?
): CodeNode
Parameters
Name | Type |
---|---|
language? | null | string |
Returns
Defined in
packages/lexical-code/src/CodeNode.ts:344
$isCodeHighlightNode
▸ $isCodeHighlightNode(node
): node is CodeHighlightNode
Parameters
Name | Type |
---|---|
node | undefined | null | LexicalNode | CodeHighlightNode |
Returns
node is CodeHighlightNode
Defined in
packages/lexical-code/src/CodeHighlightNode.ts:222
$isCodeNode
▸ $isCodeNode(node
): node is CodeNode
Parameters
Name | Type |
---|---|
node | undefined | null | LexicalNode |
Returns
node is CodeNode
Defined in
packages/lexical-code/src/CodeNode.ts:350
getCodeLanguages
▸ getCodeLanguages(): string
[]
Returns
string
[]
Defined in
packages/lexical-code/src/CodeHighlightNode.ts:87
getDefaultCodeLanguage
▸ getDefaultCodeLanguage(): string
Returns
string
Defined in
packages/lexical-code/src/CodeHighlightNode.ts:85
getEndOfCodeInLine
▸ getEndOfCodeInLine(anchor
): CodeHighlightNode
| TabNode
Parameters
Name | Type |
---|---|
anchor | TabNode | CodeHighlightNode |
Returns
Defined in
packages/lexical-code/src/CodeHighlighter.ts:193
getFirstCodeNodeOfLine
▸ getFirstCodeNodeOfLine(anchor
): null
| CodeHighlightNode
| TabNode
| LineBreakNode
Parameters
Name | Type |
---|---|
anchor | LineBreakNode | TabNode | CodeHighlightNode |
Returns
null
| CodeHighlightNode
| TabNode
| LineBreakNode
Defined in
packages/lexical-code/src/CodeHighlightNode.ts:228
getLanguageFriendlyName
▸ getLanguageFriendlyName(lang
): string
Parameters
Name | Type |
---|---|
lang | string |
Returns
string
Defined in
packages/lexical-code/src/CodeHighlightNode.ts:80
getLastCodeNodeOfLine
▸ getLastCodeNodeOfLine(anchor
): CodeHighlightNode
| TabNode
| LineBreakNode
Parameters
Name | Type |
---|---|
anchor | LineBreakNode | TabNode | CodeHighlightNode |
Returns
CodeHighlightNode
| TabNode
| LineBreakNode
Defined in
packages/lexical-code/src/CodeHighlightNode.ts:240
getStartOfCodeInLine
▸ getStartOfCodeInLine(anchor
, offset
): null
| { node
: CodeHighlightNode
| TabNode
| LineBreakNode
; offset
: number
}
Parameters
Name | Type |
---|---|
anchor | TabNode | CodeHighlightNode |
offset | number |
Returns
null
| { node
: CodeHighlightNode
| TabNode
| LineBreakNode
; offset
: number
}
Defined in
packages/lexical-code/src/CodeHighlighter.ts:80
normalizeCodeLang
▸ normalizeCodeLang(lang
): string
Parameters
Name | Type |
---|---|
lang | string |
Returns
string
Defined in
packages/lexical-code/src/CodeHighlightNode.ts:76
registerCodeHighlighting
▸ registerCodeHighlighting(editor
, tokenizer?
): () => void
Parameters
Name | Type |
---|---|
editor | LexicalEditor |
tokenizer? | Tokenizer |
Returns
fn
▸ (): void
Returns
void