import './chunk-QJTFKQBI.js';
import { MDXEditor, diffSourcePlugin, headingsPlugin, listsPlugin, quotePlugin, thematicBreakPlugin, frontmatterPlugin, markdownShortcutPlugin } from '@mdxeditor/editor';
import clsx from 'clsx';
import { useRef, useEffect } from 'react';
import { jsx } from 'react/jsx-runtime';

var MarkdownEditor = ({
  markdown,
  onChange,
  initMarkdown
}) => {
  const ref = useRef(null);
  useEffect(() => {
    if (ref.current && initMarkdown) {
      ref.current.setMarkdown(initMarkdown);
    }
  }, [initMarkdown]);
  return /* @__PURE__ */ jsx(
    MDXEditor,
    {
      className: clsx("prose mdxeditor mdx-editor"),
      ref,
      plugins: [
        diffSourcePlugin({
          diffMarkdown: "An older version",
          viewMode: "source"
        }),
        // Example Plugin Usage
        headingsPlugin(),
        listsPlugin(),
        quotePlugin(),
        thematicBreakPlugin(),
        frontmatterPlugin(),
        markdownShortcutPlugin()
      ],
      markdown,
      onChange,
      contentEditableClassName: "mdx-editor-content prose"
    }
  );
};
var markdown_editor_default = MarkdownEditor;

export { markdown_editor_default as default };
//# sourceMappingURL=markdown-editor-3VTDYSX5.js.map
//# sourceMappingURL=markdown-editor-3VTDYSX5.js.map