ToolJet/frontend/src/Editor/EditorKeyHooks.jsx
Kavin Venkatachalam 4c94de899d
Updated React to 18.2.0 (#5555)
* updated react to 18.2.0

* Updated Frontend Packages (#5569)

* Updated tabler icon and fixed react hot keys issue

* Fixed vulnerabilities

* Updated dom purify and yjs

* Reverted Eslint update

* React-big-calendar update

* Updated and fixed changes related to react-bootstrap

* Updated eslint package

* Fixes react-select-search ui

* Updated packages in root

* Updated & Fixed React-tooltip changes

* Updated and fixed changes related to react-router-dom

* Fixed copyToClipboard bug on usersTable

* Fixed folder popover issue and comment issue

* Fixed flickering issue on Editor

* Fixed routing and dark mode bugs

* Fixed app crash on page options click

* Fixed SVG issues in data sources

* Fixed calendar widget crash

* Fixed popover issue in table

* Fixed dark mode issue on react-select-search

* Fixed popover issue in tooljetdb table

* Fixed popover issue in pages

* Fixed search bar crash

* Fixes dark mode issue on react-select-search

* Resolved conflicts
2023-03-20 17:04:24 +05:30

41 lines
899 B
JavaScript

import React from 'react';
import useKeyHooks from '@/_hooks/useKeyHooks';
export const EditorKeyHooks = ({
moveComponents,
copyComponents,
cutComponents,
cloneComponents,
handleEditorEscapeKeyPress,
removeMultipleComponents,
}) => {
const handleHotKeysCallback = (key) => {
switch (key) {
case 'Escape':
handleEditorEscapeKeyPress();
break;
case 'Backspace':
removeMultipleComponents();
break;
case 'KeyD':
cloneComponents();
break;
case 'KeyC':
console.log('copyComponent');
copyComponents();
break;
case 'KeyX':
cutComponents();
break;
default:
moveComponents(key);
}
};
useKeyHooks(
['up, down, left, right', 'esc', 'backspace', 'meta+d, ctrl+d, meta+c, ctrl+c, meta+x, ctrl+x'],
handleHotKeysCallback
);
return <></>;
};