-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown Code/CodeBlock -> Lexical doesn't work #9138
Comments
Please add a reproduction in order for us to be able to investigate. Depending on the quality of reproduction steps, this issue may be closed if no reproduction is provided. Why was this issue marked with the
|
Like i suspected. this fixes it import { CodeNode } from '@lexical/code'
const headlessEditor = createHeadlessEditor({
nodes: [
...getEnabledNodes({
editorConfig: yourSanitizedEditorConfig,
}),
CodeNode,
],
}) if (node.type === 'code') {
console.log(node)
return <Code key={index} code={node.children[0].text} language={node.language} />
} This should be standard in the payload package |
Describe the Bug
We have some old string MD files where we have a lot of code examples.
Either using single line small Code sections
like so
or CodeBlocks
Using
The code parts of the md file just get converted to strings. If we add in the CODE export from '@lexical/markdown' we get the correct nodes but then payload isn't able to interprete these so it errors out. I'm guessing we'd need to build a custom lexical feature but this should really be covered out of the box.
Link to the code that reproduces this issue
You can reproduce with the above
Reproduction Steps
copy paste whats above.
Thats it
Which area(s) are affected? (Select all that apply)
plugin: richtext-lexical
Environment Info
The text was updated successfully, but these errors were encountered: