move footer into layerUI & refactor ActionManager (#729)

This commit is contained in:
David Luzar
2020-02-07 23:46:19 +01:00
committed by GitHub
parent 88eacc9da7
commit d79293de06
7 changed files with 164 additions and 179 deletions

View File

@ -3,8 +3,8 @@ import { ExcalidrawElement } from "../element/types";
import { AppState } from "../types";
export type ActionResult = {
elements?: readonly ExcalidrawElement[];
appState?: AppState;
elements?: readonly ExcalidrawElement[] | null;
appState?: AppState | null;
};
type ActionFn = (
@ -13,7 +13,7 @@ type ActionFn = (
formData: any,
) => ActionResult;
export type UpdaterFn = (res: ActionResult) => void;
export type UpdaterFn = (res: ActionResult, commitToHistory?: boolean) => void;
export type ActionFilterFn = (action: Action) => void;
export interface Action {
@ -43,7 +43,7 @@ export interface ActionsManagerInterface {
[keyProp: string]: Action;
};
registerAction: (action: Action) => void;
handleKeyDown: (event: KeyboardEvent) => ActionResult | null;
handleKeyDown: (event: KeyboardEvent) => boolean;
getContextMenuItems: (
actionFilter: ActionFilterFn,
) => { label: string; action: () => void }[];