'use client'; import React from 'react'; import Loading from './Loading'; import { Tab } from '@headlessui/react'; import clsx from 'clsx'; import { MarkdownContext } from '../lib/context/MarkdownProvider'; const MDPreview = React.lazy(() => import('./MDPreview')); export default function MD() { const { markdown, handleMarkdownUpdate } = React.useContext(MarkdownContext); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); // write regex to get the header from markdown // const header = markdown.match(/# .*/g); //const title = header ? header[0].replace('# ', '') : 'Untitled'; // rest is the body // const body = markdown.replace(/# .*/g, ''); // serialize markdown and html // const serialize = JSON.stringify({ markdown, html }); // create a new comment }; return (
{({ selected }) => ( )} {({ selected }) => ( )}