add hotkeys

This commit is contained in:
Fedor Katurov 2024-10-02 20:50:30 +07:00
parent 6d00bffbec
commit db911e51e4
14 changed files with 91 additions and 73 deletions

View file

@ -1,42 +0,0 @@
import { ChangeEvent, FC, useCallback, useMemo } from "react";
import styles from "./styles.module.scss";
import { useTheme } from "~/modules/theme/context/ThemeContext";
interface ReactMarkdownEditorProps {
value: string;
onChange: (val: string) => void;
}
const ReactMarkdownEditor: FC<ReactMarkdownEditorProps> = ({
value,
onChange,
}) => {
const changeHandler = useCallback(
(event: ChangeEvent<HTMLTextAreaElement>) => {
onChange(event.target.value);
},
[onChange]
);
const { paddingHorizontal, paddingVertical } = useTheme();
const style = useMemo(
() => ({
padding: `${paddingVertical}px ${paddingHorizontal}px`,
}),
[paddingHorizontal, paddingVertical]
);
return (
<textarea
onChange={changeHandler}
className={styles.textarea}
style={style}
placeholder="Start typing here..."
value={value}
rows={1}
/>
);
};
export { ReactMarkdownEditor };