itutor-mathlive
Version:
Beautifully typeset math made easy
110 lines (103 loc) • 3.96 kB
TypeScript
export const latexToMarkup: (text: string, mathStyle: string, format?: string) => string;
export const latexToAST: (latex: string) => any;
export const latexToMathML: (latex: string, options: LatexToMathMLOptions) => string;
export const latexToSpeakableText: () => string;
export const makeMathField: (el: HTMLElement, config?: MakeMathFieldConfig) => MathField;
export const renderMathInDocument: Function;
export const renderMathInElement: (el: HTMLElement, options?: MakeMathInElementOptions) => any;
export const revertToOriginalContent: Function;
// iTutor APIs
export const setVariableGetter: (getter: () => string[]) => void;
export const setExpressionGetter: (getter: () => string[]) => void;
export interface LatexToMathMLOptions {
generateID?: boolean;
}
export interface MathfieldWithDirectionCallback {
(direction: number): boolean;
}
export interface MakeMathFieldConfig {
namespace?: string;
substituteTextArea?: () => HTMLElement;
onFocus?: Function;
onBlur?: Function;
onKeystroke?: Function;
overrideDefaultInlineShortcuts?: boolean;
inlineShortcuts?: { [shortcuts: string]: string };
smartFence?: boolean;
virtualKeyboardToggleGlyph?: string;
virtualKeyboardMode?: 'manual' | 'onfocus';
virtualKeyboards?: string;
virtualKeyboardRomanLayout?: 'qwerty' | 'azerty' | 'qwertz' | 'dvorak' | 'colemak';
customVirtualKeyboardLayers?: any;
customVirtualKeyboards?: any;
virtualKeyboardTheme?: boolean;
keypressVibration?: boolean;
keypressSound?: boolean;
plonkSound?: string;
textToSpeechRules?: string;
textToSpeechMarkup?: string;
textToSpeechRulesOptions?: any;
speechEngine?: string;
speechEngineVoice?: string;
speechEngineRate?: string;
onMoveOutOf?: MathfieldWithDirectionCallback;
onTabOutOf?: MathfieldWithDirectionCallback;
onDeleteOutOf?: MathfieldWithDirectionCallback;
onSelectOutOf?: MathfieldWithDirectionCallback;
onUpOutOf?: Function;
onDownOutOf?: Function;
onEnter?: Function;
onContentWillChange?: Function;
onContentDidChange?: Function;
onSelectionWillChange?: Function;
onSelectionDidChange?: Function;
onVirtualKeyboardToggle?: Function;
onReadAloudStatus?: Function;
handleSpeak?: Function;
handleReadAloud?: Function;
}
export interface MakeMathInElementOptions {
namespace?: string;
macros?: any[];
skipTags?: string[];
ignoreClass?: string;
processClass?: string;
preserveOriginalContent?: boolean;
readAloud?: boolean;
TeX?: {
processEnvironments?: boolean;
delimiters?: {
inline?: any[];
display?: any[]
}
};
}
export interface MathLive {
latexToAST: (latex: string) => any;
latexToMarkup: (text: string, displayMode: string, format?: string) => string;
latexToMathML: (latex: string, options: LatexToMathMLOptions) => string;
latexToSpeakableText: () => string;
makeMathField: (el: HTMLElement, config?: MakeMathFieldConfig) => MathField;
renderMathInDocument: Function;
renderMathInElement: (el: HTMLElement, options?: MakeMathInElementOptions) => any;
revertToOriginalContent: Function;
}
export interface MathField extends HTMLElement {
el: () => HTMLElement;
insert: (s: string, options?: { focus?: boolean; feedback?: boolean; }) => boolean;
keystroke: (keys: string, e?: Event) => any;
complete_: Function;
latex: (text: string) => string;
perform: (command: any) => any;
render: Function;
revertToOriginalContent: Function;
selectedText: (format?: string) => string;
selectionAtEnd: () => boolean;
selectionAtStart: () => boolean;
selectionDepth: () => number;
selectionIsCollapsed: () => boolean;
setConfig: (conf?: any) => any;
text: (format?: 'latex' | 'latex-expanded' | 'spoken' | 'mathML') => string;
typedText: (text: string) => any;
mathlist: any;
}