1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 07:04:22 +00:00
festa/components/editable/EditableMarkdown.tsx

15 lines
500 B
TypeScript
Raw Normal View History

2022-06-04 03:13:19 +00:00
import { HTMLProps } from "react";
import { EditingContext } from "../../contexts/editing";
import { useDefinedContext } from "../../utils/definedContext";
import { FestaMarkdown } from "../extensions/FestaMarkdown";
export function EditableMarkdown({value, ...props}: HTMLProps<HTMLTextAreaElement>) {
const [editing,] = useDefinedContext(EditingContext)
return editing ? (
<textarea value={value} {...props}/>
) : (
<FestaMarkdown markdown={value as string}/>
)
}