2022-06-04 03:13:19 +00:00
|
|
|
import { HTMLProps } from "react";
|
|
|
|
import { FestaMarkdown } from "../extensions/FestaMarkdown";
|
2022-06-08 17:14:00 +00:00
|
|
|
import { Editable } from "./Editable";
|
2022-06-04 03:13:19 +00:00
|
|
|
|
2022-06-08 16:00:39 +00:00
|
|
|
/**
|
|
|
|
* Controlled input component which displays a `textarea` in editing mode, and renders the input in Markdown using {@link FestaMarkdown} in preview mode.
|
|
|
|
*/
|
2022-06-08 17:14:00 +00:00
|
|
|
export function EditableMarkdown(props: HTMLProps<HTMLTextAreaElement> & { value: string }) {
|
|
|
|
return (
|
|
|
|
<Editable
|
|
|
|
editing={
|
|
|
|
<textarea {...props} />
|
|
|
|
}
|
|
|
|
preview={
|
|
|
|
<FestaMarkdown markdown={props.value} />
|
|
|
|
}
|
|
|
|
/>
|
2022-06-04 03:13:19 +00:00
|
|
|
)
|
|
|
|
}
|