UNPKG

codejar-async

Version:

An embeddable code editor for the browser

32 lines (31 loc) 900 B
type Options = { tab: string; spellcheck: boolean; catchTab: boolean; preserveIdent: boolean; addClosing: boolean; history: boolean; window: Window; autoclose: { open: string; close: string; }; }; export type Position = { start: number; end: number; dir?: '->' | '<-'; }; export type CodeJar = ReturnType<typeof CodeJar>; export declare function CodeJar(editor: HTMLElement, highlight: (e: HTMLElement) => Promise<string>, opt?: Partial<Options>): { updateOptions(newOptions: Partial<Options>): void; updateCode(code: string, callOnUpdate?: boolean): void; onUpdate(callback: (code: string) => void): void; onHighlight(callback: (e: HTMLElement) => void): void; toString: () => string; save: () => Position; restore: (pos: Position) => void; recordHistory: () => void; destroy(): void; }; export {};