excalidraw/src/components/panels/PanelCanvas.tsx
Gasim Gasimzada f465121f9b Feature: Action System (#298)
* Add Action System

- Add keyboard test
- Add context menu label
- Add PanelComponent

* Show context menu items based on actions

* Add render action feature

- Replace bringForward etc buttons with action manager render functions

* Move all property changes and canvas into actions

* Remove unnecessary functions and add forgotten force update when elements array change

* Extract export operations into actions

* Add elements and app state as arguments to `keyTest` function

* Add key priorities

- Sort actions by key priority when handling key presses

* Extract copy/paste styles

* Add Context Menu Item order

- Sort context menu items based on menu item order parameter

* Remove unnecessary functions from App component
2020-01-11 14:22:03 -08:00

40 lines
871 B
TypeScript

import React from "react";
import { Panel } from "../Panel";
import { ActionManager } from "../../actions";
import { ExcalidrawElement } from "../../element/types";
import { AppState } from "../../types";
import { UpdaterFn } from "../../actions/types";
interface PanelCanvasProps {
actionManager: ActionManager;
elements: readonly ExcalidrawElement[];
appState: AppState;
syncActionResult: UpdaterFn;
}
export const PanelCanvas: React.FC<PanelCanvasProps> = ({
actionManager,
elements,
appState,
syncActionResult
}) => {
return (
<Panel title="Canvas">
{actionManager.renderAction(
"changeViewBackgroundColor",
elements,
appState,
syncActionResult
)}
{actionManager.renderAction(
"clearCanvas",
elements,
appState,
syncActionResult
)}
</Panel>
);
};