AlessioGr / payload-plugin-lexical

Extends payload CMS with Meta's lexical RichText editor - a much more advanced and customizable richtext editor
MIT License
144 stars 6 forks source link

Text-align styles conflict with font styles from editor data #45

Closed jddunn closed 1 year ago

jddunn commented 1 year ago

Problem:

If you're using Lexical editor in Payload CMS, and you want to give your text a style, if you do anything like bold or italicize the text, it wraps the text content in an object and assigns the key format some number like 0 or 1. This works, but the text alignment styles also use the same key format, so if you do both a text style and an alignment style, they overwrite each other and it outputs nothing, or the default value (0) for format.

Solution:

Change the text-alignment value that gets dynamically edited so it uses another key besides format. Maybe call it alignment?

Seems like it'd be a straightforward thing to fix.

Edit: Looks like I was doing something wrong, sorry