mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-23 15:14:23 +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}/>
|
||
|
)
|
||
|
}
|