mirror of
https://github.com/muerwre/markdown-home-tab.git
synced 2025-05-04 21:36:40 +07:00
add hotkeys
This commit is contained in:
parent
6d00bffbec
commit
db911e51e4
14 changed files with 91 additions and 73 deletions
|
@ -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 };
|
Loading…
Add table
Add a link
Reference in a new issue