Skip to main content

@lexical/code-core

Interfaces

CodeGutterConfig

Defined in: packages/lexical-code-core/src/CodeGutter.ts:231

Properties

disabled

disabled: boolean

Defined in: packages/lexical-code-core/src/CodeGutter.ts:237

When true, the gutter mutation listener is not registered on the editor. This signal can be flipped at runtime to enable or disable gutter rendering without rebuilding the editor.

Variables

CodeGutterExtension

const CodeGutterExtension: LexicalExtension<CodeGutterConfig, "@lexical/code-gutter", NamedSignalsOutput<CodeGutterConfig>, unknown>

Defined in: packages/lexical-code-core/src/CodeGutter.ts:251

Manages the line-number gutter for "@lexical/code-core".CodeNode blocks (both classic data-gutter mode and the word-wrap mode that uses real DOM .code-gutter / .code-content children).

Both "@lexical/code-shiki".CodeShikiExtension and "@lexical/code-prism".CodePrismExtension declare this as a dependency, mirroring how "@lexical/code-core".CodeIndentExtension is consumed, so the gutter is activated automatically alongside either highlighter.

Functions

registerCodeGutter()

registerCodeGutter(editor): () => void

Defined in: packages/lexical-code-core/src/CodeGutter.ts:167

Register a CodeNode mutation listener that keeps the code block gutter (line numbers + their heights in word-wrap mode) in sync with the editor state.

Previously this code was duplicated inside both @lexical/code-prism and @lexical/code-shiki; consolidating it here lets either highlighter — or any other consumer that depends on @lexical/code-core — share the same DOM contract established by CodeNode#createDOM.

In headless mode this is a no-op (no DOM to update); the returned cleanup function is still safe to call.

Parameters

editor

LexicalEditor

Returns

() => void

References

$createCodeHighlightNode

Re-exports $createCodeHighlightNode


$createCodeNode

Re-exports $createCodeNode


$getCodeLineDirection

Re-exports $getCodeLineDirection


$getEndOfCodeInLine

Re-exports $getEndOfCodeInLine


$getFirstCodeNodeOfLine

Re-exports $getFirstCodeNodeOfLine


$getLastCodeNodeOfLine

Re-exports $getLastCodeNodeOfLine


$getStartOfCodeInLine

Re-exports $getStartOfCodeInLine


$isCodeHighlightNode

Re-exports $isCodeHighlightNode


$isCodeNode

Re-exports $isCodeNode


$outdentLeadingSpaces

Re-exports $outdentLeadingSpaces


CodeExtension

Re-exports CodeExtension


CodeHighlightNode

Re-exports CodeHighlightNode


CodeIndentConfig

Re-exports CodeIndentConfig


CodeIndentExtension

Re-exports CodeIndentExtension


CodeNode

Re-exports CodeNode


DEFAULT_CODE_LANGUAGE

Re-exports DEFAULT_CODE_LANGUAGE


getDefaultCodeLanguage

Re-exports getDefaultCodeLanguage


SerializedCodeNode

Re-exports SerializedCodeNode