#Need help with lexical -> markdown

8 messages · Page 1 of 1 (latest)

cobalt quail
frozen turretBOT
cobalt quail
#

@reef spoke ^

reef spoke
#

Where exactly do we do the transformation for lexical -> markdown.
You decide! Wherever you want. You can run the code snippet for transforming => markdown anywhere.

If you want it outputted as a field, alongside the normal editor field, you could create a new field, add an afterRead hook to it, and then run the markdown transformation within that afterRead hook

cloud skiff
# reef spoke > Where exactly do we do the transformation for lexical -> markdown. You decide...

Hi, Alessio.

So I've crafted this code, but it seems that EditorState is null, so it throws an error during build. Can you please point out what's wrong with implementation?

Here is implementation and error - https://gist.github.com/yevarizhko/a7232170bd0f168c8a2655e787bc5d09

Gist

Lexico → Markdown Implementation error. GitHub Gist: instantly share code, notes, and snippets.

reef spoke
#

You probably want to initialize it with value which you get from your afterRead hook

#

So I would move the entire logic of creating and initializing the headless editor into your afterRead hook