@lobehub/editor
Version:
A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.
64 lines (63 loc) • 1.9 kB
TypeScript
export declare const AllLang: never[];
export interface Options {
className?: string;
foldGutter?: boolean;
history?: any;
indentWithTabs?: boolean;
lineNumbers?: boolean;
lineWrapping?: boolean;
mode?: string;
preventCopy?: boolean;
readOnly?: boolean;
tabSize?: number;
theme?: 'default';
value?: string;
}
export interface ICodeMirrorInstance {
blur(): void;
clearHistory(): void;
destroy(): void;
focus(): void;
foldGutter?: boolean;
foldLines(): number[];
foldLines(lines: number[]): void;
formatAll(): void;
getHistory(): any;
getLine(line: number): string;
getSelection(): string;
getValue: () => string;
historyRedoDepth(): number;
historyUndoDepth(): number;
lineCount(): number;
on(event: 'change' | 'blur' | 'focus' | 'keyup' | 'fold' | 'unfold' | 'keydown' | 'rightOut' | 'leftOut', handler: (...args: any[]) => void): void;
optionHelper: {
theme: {
reconfigure: (theme: any) => void;
};
};
redoSelection(): void;
replaceSelection(text: string): void;
setOption(option: keyof Options, value: any): void;
setSelection(anchor: number, header: number): void;
setSelectionToEnd(): void;
setSelectionToStart(): void;
setValue(value: string): void;
undoSelection(): void;
view: {
constructor: {
theme: (options: any, settings: any) => any;
};
dispatch: (params: {
effects: any;
}) => void;
};
}
export interface ICodeMirror {
fromTextArea: (textarea: HTMLTextAreaElement, options?: Options) => ICodeMirrorInstance;
new (dom: HTMLElement, options?: Options): ICodeMirrorInstance;
}
/**
* 从 CDN 加载 CodeMirror
* @param cdnUrl - 可选的自定义 CDN URL
*/
export declare function loadCodeMirror(cdnUrl?: string): Promise<ICodeMirror>;