feat: Support customising canvas actions 🎉 (#3364)
* feat: Support hiding save, save as, clear & export * Remove canvasActions from state & minor changes * Rename prop to UIOptions & pass default value * Make requested changes * better type checking so that optional check not needed at every point * remove optional checks * Add few tests * Add describe block for canvasActions & use snapshot tests * Add support for hiding canvas background picker * Take snapshot of canvasActions instead of the whole app * Add support for hiding dark mode toggle * Update README.md * Rename table heading * Update changelog * Make requested changes * Update test name * tweaks Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
21
src/types.ts
21
src/types.ts
@ -189,6 +189,7 @@ export interface ExcalidrawProps {
|
||||
elements: readonly NonDeletedExcalidrawElement[],
|
||||
appState: AppState,
|
||||
) => JSX.Element;
|
||||
UIOptions?: UIOptions;
|
||||
}
|
||||
|
||||
export type SceneData = {
|
||||
@ -203,3 +204,23 @@ export enum UserIdleState {
|
||||
AWAY = "away",
|
||||
IDLE = "idle",
|
||||
}
|
||||
|
||||
type CanvasActions = {
|
||||
changeViewBackgroundColor?: boolean;
|
||||
clearCanvas?: boolean;
|
||||
export?: boolean;
|
||||
loadScene?: boolean;
|
||||
saveAsScene?: boolean;
|
||||
saveScene?: boolean;
|
||||
theme?: boolean;
|
||||
};
|
||||
|
||||
export type UIOptions = {
|
||||
canvasActions?: CanvasActions;
|
||||
};
|
||||
|
||||
export type AppProps = ExcalidrawProps & {
|
||||
UIOptions: {
|
||||
canvasActions: Required<CanvasActions>;
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user