UNPKG

@lobehub/editor

Version:

A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.

47 lines (46 loc) 1.85 kB
import { DOMConversionMap, DOMExportOutput, DecoratorNode, EditorConfig, LexicalEditor, LexicalNode, SerializedLexicalNode, Spread } from 'lexical'; export interface CodeMirrorOptions { indentWithTabs: boolean; lineNumbers: boolean; tabSize: number; } export type SerializedCodeMirrorNode = Spread<{ code: string; codeTheme: string; language: string; options: { indentWithTabs: boolean; lineNumbers: boolean; tabSize: number; }; }, SerializedLexicalNode>; export declare class CodeMirrorNode extends DecoratorNode<any> { private __lang; private __code; private __codeTheme; private __options; static getType(): string; static clone(node: CodeMirrorNode): CodeMirrorNode; static importJSON(serializedNode: SerializedCodeMirrorNode): CodeMirrorNode; static importDOM(): DOMConversionMap | null; constructor(lang: string, code: string, codeTheme: string, options: CodeMirrorOptions, key?: string); get lang(): string; get code(): string; get codeTheme(): string; get options(): CodeMirrorOptions; exportDOM(editor: LexicalEditor): DOMExportOutput; exportJSON(): SerializedCodeMirrorNode; setLang(lang: string): this; setCode(code: string): this; setCodeTheme(codeTheme: string): this; setTabSize(tabSize: number): this; setIndentWithTabs(indentWithTabs: boolean): this; setLineNumbers(lineNumbers: boolean): this; createDOM(config: EditorConfig): HTMLElement; getTextContent(): string; isInline(): false; updateDOM(): boolean; decorate(editor: LexicalEditor): any; } export declare function $createCodeMirrorNode(lang: string, code?: string, codeTheme?: string, options?: CodeMirrorOptions): CodeMirrorNode; export declare function $isCodeMirrorNode(node: LexicalNode): node is CodeMirrorNode;