react-mathlive
Version:
An interactive math input for react.
35 lines (34 loc) • 1.11 kB
TypeScript
import * as React from "react";
import Mathlive from "mathlive";
import "mathlive/dist/mathlive-fonts.css";
interface BaseProps {
onChange?: (latex: string) => void;
/**
* The raw options of mathlive's makeMathField.
* */
mathfieldConfig?: Mathlive.MathfieldConfig;
/**
* The mathfield object returned by makeMathField.
*/
mathfieldRef?: (mathfield: Mathlive.Mathfield) => void;
}
interface ControlledProps extends BaseProps {
latex: string;
initialLatex?: undefined;
}
interface UncontrolledProps extends BaseProps {
latex?: undefined;
initialLatex: string;
}
export declare type Props = ControlledProps | UncontrolledProps;
export declare function combineConfig(props: Props): Mathlive.MathfieldConfig;
/** A react-control that hosts a mathlive-mathfield in it. */
export declare class MathfieldComponent extends React.Component<Props> {
private insertElement;
private readonly combinedConfiguration;
private mathfield;
componentDidUpdate(prevProps: Props): void;
render(): JSX.Element;
componentDidMount(): void;
}
export {};