fix: Better legibility when editing some math elements.

This commit is contained in:
Daniel J. Geiger 2023-03-13 12:57:33 -05:00
parent 089aaa8792
commit b988f67759
3 changed files with 22 additions and 1 deletions

View file

@ -220,6 +220,7 @@ export type SubtypeMethods = {
"id" | "version" | "versionNonce"
>,
) => Omit<Partial<ExcalidrawElement>, "id" | "version" | "versionNonce">;
getEditorStyle: (element: ExcalidrawTextElement) => Record<string, any>;
ensureLoaded: (callback?: () => void) => Promise<void>;
measureText: (
element: Pick<
@ -261,7 +262,9 @@ type MethodMap = { subtype: Subtype; methods: Partial<SubtypeMethods> };
const methodMaps = [] as Array<MethodMap>;
// Use `getSubtypeMethods` to call subtype-specialized methods, like `render`.
export const getSubtypeMethods = (subtype: Subtype | undefined) => {
export const getSubtypeMethods = (
subtype: Subtype | undefined,
): Partial<SubtypeMethods> | undefined => {
const map = methodMaps.find((method) => method.subtype === subtype);
return map?.methods;
};