Skip to main content

Module: @lexical/code

Classes

Variables

CODE_LANGUAGE_FRIENDLY_NAME_MAP

Const CODE_LANGUAGE_FRIENDLY_NAME_MAP: Record<string, string>

Defined in

lexical-code/src/CodeHighlightNode.ts:51


CODE_LANGUAGE_MAP

Const CODE_LANGUAGE_MAP: Record<string, string>

Defined in

lexical-code/src/CodeHighlightNode.ts:67


DEFAULT_CODE_LANGUAGE

Const DEFAULT_CODE_LANGUAGE: "javascript"

Defined in

lexical-code/src/CodeHighlightNode.ts:40

Functions

$createCodeHighlightNode

$createCodeHighlightNode(text, highlightType?): CodeHighlightNode

Parameters

NameType
textstring
highlightType?null | string

Returns

CodeHighlightNode

Defined in

lexical-code/src/CodeHighlightNode.ts:202


$createCodeNode

$createCodeNode(language?): CodeNode

Parameters

NameType
language?null | string

Returns

CodeNode

Defined in

lexical-code/src/CodeNode.ts:280


$isCodeHighlightNode

$isCodeHighlightNode(node): node is CodeHighlightNode

Parameters

NameType
nodeundefined | null | LexicalNode | CodeHighlightNode

Returns

node is CodeHighlightNode

Defined in

lexical-code/src/CodeHighlightNode.ts:209


$isCodeNode

$isCodeNode(node): node is CodeNode

Parameters

NameType
nodeundefined | null | LexicalNode

Returns

node is CodeNode

Defined in

lexical-code/src/CodeNode.ts:286


getCodeLanguages

getCodeLanguages(): string[]

Returns

string[]

Defined in

lexical-code/src/CodeHighlightNode.ts:86


getDefaultCodeLanguage

getDefaultCodeLanguage(): string

Returns

string

Defined in

lexical-code/src/CodeHighlightNode.ts:84


getEndOfCodeInLine

getEndOfCodeInLine(anchor): Object

Parameters

NameType
anchorLexicalNode

Returns

Object

NameType
nodeTextNode | null
offsetnumber

Defined in

lexical-code/src/CodeHighlighter.ts:136


getFirstCodeHighlightNodeOfLine

getFirstCodeHighlightNodeOfLine(anchor): CodeHighlightNode | null | undefined

Parameters

NameType
anchorLexicalNode

Returns

CodeHighlightNode | null | undefined

Defined in

lexical-code/src/CodeHighlightNode.ts:215


getLanguageFriendlyName

getLanguageFriendlyName(lang): string

Parameters

NameType
langstring

Returns

string

Defined in

lexical-code/src/CodeHighlightNode.ts:79


getLastCodeHighlightNodeOfLine

getLastCodeHighlightNodeOfLine(anchor): CodeHighlightNode | null | undefined

Parameters

NameType
anchorLexicalNode

Returns

CodeHighlightNode | null | undefined

Defined in

lexical-code/src/CodeHighlightNode.ts:234


getStartOfCodeInLine

getStartOfCodeInLine(anchor): Object

Parameters

NameType
anchorLexicalNode

Returns

Object

NameType
nodeTextNode | null
offsetnumber

Defined in

lexical-code/src/CodeHighlighter.ts:88


normalizeCodeLang

normalizeCodeLang(lang): string

Parameters

NameType
langstring

Returns

string

Defined in

lexical-code/src/CodeHighlightNode.ts:75


registerCodeHighlighting

registerCodeHighlighting(editor): () => void

Parameters

NameType
editorLexicalEditor

Returns

fn

▸ (): void

Returns

void

Defined in

lexical-code/src/CodeHighlighter.ts:640