mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: customise export dialog with UIOptions.canvasActions.export prop (#3658)
* refactor: update UIOptions.canvasActions.export to be a an object * fix * fix * dnt show export icon when false * fix * inline * memoize UIOptions * update docs * fix * tweak readme Co-authored-by: David Luzar <luzar.david@gmail.com>
This commit is contained in:
parent
6c3e4417e1
commit
ba48974351
13 changed files with 140 additions and 68 deletions
19
src/types.ts
19
src/types.ts
|
@ -178,11 +178,6 @@ export interface ExcalidrawProps {
|
|||
button: "down" | "up";
|
||||
pointersMap: Gesture["pointers"];
|
||||
}) => void;
|
||||
onExportToBackend?: (
|
||||
exportedElements: readonly NonDeletedExcalidrawElement[],
|
||||
appState: AppState,
|
||||
canvas: HTMLCanvasElement | null,
|
||||
) => void;
|
||||
onPaste?: (
|
||||
data: ClipboardData,
|
||||
event: ClipboardEvent | null,
|
||||
|
@ -219,12 +214,20 @@ export enum UserIdleState {
|
|||
IDLE = "idle",
|
||||
}
|
||||
|
||||
export type ExportOpts = {
|
||||
saveFileToDisk?: boolean;
|
||||
onExportToBackend?: (
|
||||
exportedElements: readonly NonDeletedExcalidrawElement[],
|
||||
appState: AppState,
|
||||
canvas: HTMLCanvasElement | null,
|
||||
) => void;
|
||||
};
|
||||
|
||||
type CanvasActions = {
|
||||
changeViewBackgroundColor?: boolean;
|
||||
clearCanvas?: boolean;
|
||||
export?: boolean;
|
||||
export?: false | ExportOpts;
|
||||
loadScene?: boolean;
|
||||
saveAsScene?: boolean;
|
||||
saveToActiveFile?: boolean;
|
||||
theme?: boolean;
|
||||
};
|
||||
|
@ -235,7 +238,7 @@ export type UIOptions = {
|
|||
|
||||
export type AppProps = ExcalidrawProps & {
|
||||
UIOptions: {
|
||||
canvasActions: Required<CanvasActions>;
|
||||
canvasActions: Required<CanvasActions> & { export: ExportOpts };
|
||||
};
|
||||
detectScroll: boolean;
|
||||
handleKeyboardGlobally: boolean;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue