support making transform handles optional

This commit is contained in:
ad1992 2022-03-23 23:24:25 +05:30
parent 61699ff3c2
commit 3d0a1106ff
9 changed files with 133 additions and 48 deletions

View file

@ -11,7 +11,7 @@ import {
WINDOWS_EMOJI_FALLBACK_FONT,
} from "./constants";
import { FontFamilyValues, FontString } from "./element/types";
import { AppState, DataURL, Zoom } from "./types";
import { AppState, DataURL, ExcalidrawProps, Zoom } from "./types";
import { unstable_batchedUpdates } from "react-dom";
import { isDarwin } from "./keys";
@ -612,3 +612,13 @@ export const updateObject = <T extends Record<string, any>>(
...updates,
};
};
export const getCustomElementConfig = (
customElementConfig: ExcalidrawProps["customElementsConfig"],
name: string,
) => {
if (!customElementConfig) {
return null;
}
return customElementConfig.find((config) => config.name === name);
};