Module: @lexical/code
Classes
Type Aliases
SerializedCodeNode
Ƭ SerializedCodeNode: Spread
<{ language
: string
| null
| undefined
}, SerializedElementNode
>
Defined in
lexical-code/src/CodeNode.ts:56
SerializedCodeTabNode
Ƭ SerializedCodeTabNode: SerializedTabNode
Defined in
lexical-code/src/CodeTabNode.ts:18
Variables
CODE_LANGUAGE_FRIENDLY_NAME_MAP
• Const
CODE_LANGUAGE_FRIENDLY_NAME_MAP: Record
<string
, string
>
Defined in
lexical-code/src/CodeHighlightNode.ts:53
CODE_LANGUAGE_MAP
• Const
CODE_LANGUAGE_MAP: Record
<string
, string
>
Defined in
lexical-code/src/CodeHighlightNode.ts:72
DEFAULT_CODE_LANGUAGE
• Const
DEFAULT_CODE_LANGUAGE: "javascript"
Defined in
lexical-code/src/CodeHighlightNode.ts:44
PrismTokenizer
• Const
PrismTokenizer: Tokenizer
Defined in
lexical-code/src/CodeHighlighter.ts:87
Functions
$createCodeHighlightNode
▸ $createCodeHighlightNode(text
, highlightType?
): CodeHighlightNode
Parameters
Name | Type |
---|---|
text | string |
highlightType? | null | string |
Returns
Defined in
lexical-code/src/CodeHighlightNode.ts:218
$createCodeNode
▸ $createCodeNode(language?
): CodeNode
Parameters
Name | Type |
---|---|
language? | null | string |
Returns
Defined in
lexical-code/src/CodeNode.ts:309
$createCodeTabNode
▸ $createCodeTabNode(): CodeTabNode
Returns
Defined in
lexical-code/src/CodeTabNode.ts:62
$isCodeHighlightNode
▸ $isCodeHighlightNode(node
): node is CodeHighlightNode
Parameters
Name | Type |
---|---|
node | undefined | null | LexicalNode | CodeHighlightNode |
Returns
node is CodeHighlightNode
Defined in
lexical-code/src/CodeHighlightNode.ts:225
$isCodeNode
▸ $isCodeNode(node
): node is CodeNode
Parameters
Name | Type |
---|---|
node | undefined | null | LexicalNode |
Returns
node is CodeNode
Defined in
lexical-code/src/CodeNode.ts:315
$isCodeTabNode
▸ $isCodeTabNode(node
): node is CodeTabNode
Parameters
Name | Type |
---|---|
node | undefined | null | LexicalNode |
Returns
node is CodeTabNode
Defined in
lexical-code/src/CodeTabNode.ts:66
getCodeLanguages
▸ getCodeLanguages(): string
[]
Returns
string
[]
Defined in
lexical-code/src/CodeHighlightNode.ts:94
getDefaultCodeLanguage
▸ getDefaultCodeLanguage(): string
Returns
string
Defined in
lexical-code/src/CodeHighlightNode.ts:92
getEndOfCodeInLine
▸ getEndOfCodeInLine(anchor
): CodeHighlightNode
| CodeTabNode
Parameters
Name | Type |
---|---|
anchor | CodeTabNode | CodeHighlightNode |
Returns
CodeHighlightNode
| CodeTabNode
Defined in
lexical-code/src/CodeHighlighter.ts:210
getFirstCodeNodeOfLine
▸ getFirstCodeNodeOfLine(anchor
): null
| CodeHighlightNode
| CodeTabNode
| LineBreakNode
Parameters
Name | Type |
---|---|
anchor | LineBreakNode | CodeTabNode | CodeHighlightNode |
Returns
null
| CodeHighlightNode
| CodeTabNode
| LineBreakNode
Defined in
lexical-code/src/CodeHighlightNode.ts:231
getLanguageFriendlyName
▸ getLanguageFriendlyName(lang
): string
Parameters
Name | Type |
---|---|
lang | string |
Returns
string
Defined in
lexical-code/src/CodeHighlightNode.ts:87
getLastCodeNodeOfLine
▸ getLastCodeNodeOfLine(anchor
): CodeHighlightNode
| CodeTabNode
| LineBreakNode
Parameters
Name | Type |
---|---|
anchor | LineBreakNode | CodeTabNode | CodeHighlightNode |
Returns
CodeHighlightNode
| CodeTabNode
| LineBreakNode
Defined in
lexical-code/src/CodeHighlightNode.ts:243
getStartOfCodeInLine
▸ getStartOfCodeInLine(anchor
, offset
): null
| { node
: CodeHighlightNode
| CodeTabNode
| LineBreakNode
; offset
: number
}
Parameters
Name | Type |
---|---|
anchor | CodeTabNode | CodeHighlightNode |
offset | number |
Returns
null
| { node
: CodeHighlightNode
| CodeTabNode
| LineBreakNode
; offset
: number
}
Defined in
lexical-code/src/CodeHighlighter.ts:97
normalizeCodeLang
▸ normalizeCodeLang(lang
): string
Parameters
Name | Type |
---|---|
lang | string |
Returns
string
Defined in
lexical-code/src/CodeHighlightNode.ts:83
registerCodeHighlighting
▸ registerCodeHighlighting(editor
, tokenizer?
): () => void
Parameters
Name | Type |
---|---|
editor | LexicalEditor |
tokenizer? | Tokenizer |
Returns
fn
▸ (): void
Returns
void
Defined in
lexical-code/src/CodeHighlighter.ts:845