mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-22 22:54:22 +00:00
15 lines
500 B
TypeScript
15 lines
500 B
TypeScript
|
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}/>
|
||
|
)
|
||
|
}
|