/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import { type DOMConversionOutput, type DOMExportOutput, type EditorConfig, ElementNode, type LexicalEditor, type LexicalNode, type LexicalParseJSON, type NodeKey, type ParagraphNode, type RangeSelection, type SerializedElementNode, type SerializedPartial, type Spread, type TabNode } from 'lexical'; import { type CodeHighlightNode } from './CodeHighlightNode.js'; export type SerializedCodeNode = Spread<{ language: string | null | undefined; theme?: string | undefined; }, SerializedElementNode>; export declare const DEFAULT_CODE_LANGUAGE = "javascript"; /** @internal Configurable through the extensions. */ export declare const getDefaultCodeLanguage: () => string; export interface CodeNode { exportJSON(compact?: false): SerializedCodeNode; exportJSON(compact: boolean): SerializedPartial; updateFromJSON(serializedNode: LexicalParseJSON): this; } /** @noInheritDoc */ export declare class CodeNode extends ElementNode { /** @internal */ __language: string | null | undefined; /** @internal */ __theme: string | undefined; /** @internal */ __isSyntaxHighlightSupported: boolean; $config(): import("lexical").BaseStaticNodeConfig & import("lexical").StaticNodeConfigAccessor<{ readonly $transform: (node: ElementNode) => void; readonly extends: typeof LexicalNode; readonly generated: import("lexical").GeneratedJSONFactory; readonly json: import("lexical").NodeSerializationSchema; }> & { readonly code?: { readonly children: "inline"; readonly extends: typeof ElementNode; readonly generated: import("lexical").GeneratedJSONFactory; readonly importDOM: { readonly code: (node: Node) => { conversion: typeof $convertPreElement; priority: 1; } | null; readonly div: () => { conversion: typeof $convertDivElement; priority: 1; }; readonly pre: () => { conversion: typeof $convertPreElement; priority: 0; }; readonly table: (node: Node) => { conversion: typeof $convertTableElement; priority: 3; } | null; readonly td: (node: Node) => { conversion: typeof convertCodeNoop; priority: 3; } | null; readonly tr: (node: Node) => { conversion: typeof convertCodeNoop; priority: 3; } | null; }; readonly json: import("lexical").NodeSerializationSchema; } | undefined; } & import("lexical").StaticNodeTypeAccessor<"code"> & import("lexical").StaticNodeConfigAccessor<{ readonly children: "inline"; readonly extends: typeof ElementNode; readonly generated: import("lexical").GeneratedJSONFactory; readonly importDOM: { readonly code: (node: Node) => { conversion: typeof $convertPreElement; priority: 1; } | null; readonly div: () => { conversion: typeof $convertDivElement; priority: 1; }; readonly pre: () => { conversion: typeof $convertPreElement; priority: 0; }; readonly table: (node: Node) => { conversion: typeof $convertTableElement; priority: 3; } | null; readonly td: (node: Node) => { conversion: typeof convertCodeNoop; priority: 3; } | null; readonly tr: (node: Node) => { conversion: typeof convertCodeNoop; priority: 3; } | null; }; readonly json: import("lexical").NodeSerializationSchema; }>; constructor(language?: string | null | undefined, key?: NodeKey); afterCloneFrom(prevNode: this): void; createDOM(config: EditorConfig): HTMLElement; updateDOM(prevNode: this, dom: HTMLElement, config: EditorConfig): boolean; exportDOM(editor: LexicalEditor): DOMExportOutput; insertNewAfter(selection: RangeSelection, restoreSelection?: boolean): null | ParagraphNode | CodeHighlightNode | TabNode; canIndent(): false; collapseAtStart(): boolean; setLanguage(language: string | null | undefined): this; getLanguage(): string | null | undefined; setIsSyntaxHighlightSupported(isSupported: boolean): this; getIsSyntaxHighlightSupported(): boolean; setTheme(theme: string | null | undefined): this; getTheme(): string | undefined; } export declare function $createCodeNode(language?: string | null | undefined, theme?: string | null | undefined): CodeNode; export declare function $isCodeNode(node: LexicalNode | null | undefined): node is CodeNode; declare function $convertPreElement(domNode: HTMLElement): DOMConversionOutput; declare function $convertDivElement(domNode: Node): DOMConversionOutput; declare function $convertTableElement(): DOMConversionOutput; declare function convertCodeNoop(): DOMConversionOutput; export declare function $exitCodeNodeOnEnter(selection: RangeSelection): null | ParagraphNode; export {};