Accessing Frontmatter Individual Field #488
Replies: 1 comment 2 replies
-
No offense taken. Making such editor is a specific task, and it needed some less than common patterns. Pulling the frontmatter management out of the Lexical state is theoretically possible but far too complicated - you will have two concurrent sources for the construction of the final markdown output. I don't understand your technical constraints or goals, so I can't comment on the reasons behind them, but you can certainly make an editor that is visually located above or besides the editor without having to pull it out of the MDX context. In general, I would recommend that you reconsider your approach and take the current frontmatter plugin as the base for your custom plugin. |
Beta Was this translation helpful? Give feedback.
-
First of all, thank you for making MDX Editor. It's been a long time that I tried to find a solution for WYSIWYG editor that incorporates markdown when writing, and this is just one of the best one out there. Everything so far has been great, but still always have room for improvements.
That being said, currently I'm using the Frontmatter plugin and although it works fine, I want to find a way to expose the individual fields to React, so there could be like an additional view outside the MDX editor context where I can show the current frontmatter fields. As I've read the docs and source code, the current implementation stores the state directly in the editor buffer, and for now possibly the only way to extract those outside MDX context is by getting the raw text data, take the frontmatter part, and parse it by ourselves. My question to this are:
title
) doesn't have the same data in the database. Any way to accomplish this?I am trying to fiddle with the source myself to see if I can extend the plugin, by lets say adding some hooks to the plugin init params. Might gonna take a while since Gurx is a little bit hard to grasp (no offense).
Beta Was this translation helpful? Give feedback.
All reactions