* 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
20 lines
573 B
TypeScript
20 lines
573 B
TypeScript
import React from "react";
|
|
import { Action } from "./types";
|
|
import { deleteSelectedElements } from "../scene";
|
|
import { KEYS } from "../keys";
|
|
|
|
export const actionDeleteSelected: Action = {
|
|
name: "deleteSelectedElements",
|
|
perform: elements => {
|
|
return {
|
|
elements: deleteSelectedElements(elements)
|
|
};
|
|
},
|
|
contextItemLabel: "Delete",
|
|
contextMenuOrder: 3,
|
|
keyTest: event => event.key === KEYS.BACKSPACE || event.key === KEYS.DELETE,
|
|
PanelComponent: ({ updateData }) => (
|
|
<button onClick={() => updateData(null)}>Delete selected</button>
|
|
)
|
|
};
|