diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx index e2eab354dc..0c127c93b9 100644 --- a/packages/excalidraw/components/App.tsx +++ b/packages/excalidraw/components/App.tsx @@ -2339,31 +2339,36 @@ class App extends React.Component { return (
{ const { onExport, + className, onChange, onThemeChange, onIncrement, @@ -207,6 +208,7 @@ const ExcalidrawBase = (props: ExcalidrawProps) => { ", () => { const contextMenu = document.querySelector(".context-menu"); fireEvent.click(queryByText(contextMenu as HTMLElement, "Zen mode")!); expect(h.state.zenModeEnabled).toBe(true); + expect(container.querySelector(".excalidraw")).toHaveClass( + "excalidraw--zen-mode", + ); expect( container.getElementsByClassName("disable-zen-mode--visible").length, ).toBe(1); @@ -484,4 +487,14 @@ describe("", () => { expect(h.state.theme).toBe(THEME.LIGHT); }); }); + + it("should apply a custom class name to the editor root", async () => { + const { container } = await render( + , + ); + + expect(container.querySelector(".excalidraw")).toHaveClass( + "custom-excalidraw", + ); + }); }); diff --git a/packages/excalidraw/types.ts b/packages/excalidraw/types.ts index a9cb64b3d0..f215168999 100644 --- a/packages/excalidraw/types.ts +++ b/packages/excalidraw/types.ts @@ -769,6 +769,7 @@ export type UIConfig = { }; export interface ExcalidrawProps { + className?: string; onChange?: ( elements: readonly OrderedExcalidrawElement[], appState: AppState,