Repository navigation
Replies: 3 comments 5 replies
|
fwiw, I don't think the built-in Lexical richText field can be turned into a “store HTML as the field value” editor. The actual richText value is still Lexical JSON. The closest built-in helper is fields: [
{
name: 'content',
type: 'richText',
editor: lexicalEditor(),
},
lexicalHTMLField({
lexicalFieldName: 'content',
htmlFieldName: 'content_html',
}),
]I tried this on Small gotcha: |
|
Short answer: if you need the canonical stored value to be HTML, use a custom
A minimal hook approach for pattern #1 is usually the least invasive migration path. If you need, I can share a concrete If this solved it, please mark the answer so others can find it faster. |
|
If you still need this, I’ve built Payload HTML Editor, a Tiptap-powered WYSIWYG field for Payload CMS 3. It stores the editor content as an HTML string in a regular Payload textarea field rather than as Lexical JSON. It supports formatting, links, and optional features such as images, tables, and HTML source editing. You can find installation instructions and examples in the README, or install it from npm. Tiptap parses HTML through an editor schema, so it may normalize equivalent tags (for example, b to strong). If you need to preserve the exact markup, please test it with your content first. I’d be glad to hear whether it fits your use case. |
Uh oh!
There was an error while loading. Please reload this page.
I need to create an HTML markup field with a WYSIWYG editor that will be stored in the database as an HTML string. Plan to use there only simple markup like
<p>,<b>,<i>,<a>and that's all.I see that Payload provides the Rich Text Field field type, but it stores in the database not HTML, but an object.
So, is there any option or workaround to make this field store in the database the HTML code instead of the object, like a classic WYSIWYG editor like CKEditor or TinyMCE?
Or, maybe, use CKEditor or TinyMCE directly?
All reactions