Supply custom markdown construct for specific JSX component? #12
Replies: 4 comments
-
This file seems to define how to use JSX components https://github.com/mdx-editor/editor/blob/main/src/types/JsxComponentDescriptors.ts#L22 |
Beta Was this translation helpful? Give feedback.
-
Tried to get it working with this and only end up with an editable region in the editor. <MDXEditor
markdown={markdown}
onChange={(md) => {
setMarkdown(md);
}}
toolbarComponents={[ToolbarComponents.BlockTypeSelect]}
contentEditableClassName="prose"
jsxComponentDescriptors={[
{
name: "Test",
kind: "flow",
source: "./Test",
defaultExport: true,
props: [],
},
]}
/> |
Beta Was this translation helpful? Give feedback.
-
Hey @Bryce-Davidson , Thank you very much for giving the component a try. My assumption is that you would like to implement a custom editor for a specific JSX component. That's possible, and I would like to make it more convenient as the component evolves. Let me outline the steps necessary right now:
I'm happy to help you further in your implementation process, the component is in its early stage, and there are plenty of things to improve in the API and in the docs. Cheers! |
Beta Was this translation helpful? Give feedback.
-
The JSX element handling has received a lot of attention in v0.11.0. Take a look at this document. |
Beta Was this translation helpful? Give feedback.
-
Hi there 👋
Saw this library on Reddit and was thrilled!
I'm trying to allow the user to write reference a JSX component in the editor such as
<ImageGrid links={[...]} />
and have the specified JSX component render in the rich text editor, just as using theWarning
block functions in the example.I noticed this excerpt in the docs, but am not quite sure where to start. Any guidance would be greatly appreciated 🙏
Thanks,
Bryce
Beta Was this translation helpful? Give feedback.
All reactions