-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat(richtext-lexical): add indent and align converter utilities #8030
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to do this @SimYunSup and sorry for the delay in responding.
Since you made that PR, we're now using 40px multipliers for indents, just like Lexical, to follow the spacing the W3 spec uses for list-items (reference).
As Alessio said, the style attribute is highly opinionated so we want to make sure that the converter only considers these two inline styles:
- text-align
- padding-inline-start
- I have added tests that prove my fix is effective or that my feature works
It seems that tests are missing. If possible, some comments explaining the changes would also be very helpful in speeding up the review!
I would say that we should have tests in both directions:
Lexical -> HTML and HTML <- Lexical.
Okay, I'll add a test for this within 2 days and update this PR. |
4b6bdf2
to
d3227d3
Compare
Add tests with some fixes.
|
Ok I've done my research and I think we need to reconsider whether this should be addressed in the Lexical repository. The Lexical team has decided not to support highly opinionated styles such as text background-color, but they seem to be on the same page with us regarding text-align and indent. If it hasn't been fully implemented by now, it's probably due to lack of time. Here I have documented some of the milestones in this issue.
Note that the two issues (4243 and 6082) are still open. If the solution was a small patch it would be easier for me to consider addressing it in Payload, but I think we can agree that overwriting the original nodes is a big deal. Sorry for the time it took me to come to this conclusion, but on the bright side I think the time you've spent on this can be partially transferred to Lexical if you decide to address the problem there. |
It seems wrong to implement Lexical's issue detection first, when it should have been done first. sorry. If we don't overwrite the node, I think we should implement to block AlignFeature/IndentFeature in quote and list-item until lexical teams are implemented about quote/list-item in lexical. I agree it's a big deal, but I think the issue that AlignFeature/IndentFeature is not working from the output HTML will come up constantly, and I think it should be documented or some other workaround. Once payload teams decided on a workaround, I'll delete the wrapper node and change the code in that direction. |
Indeed it is an issue with a lot of demand so it is very high on my priority list. The correct plan of action would be to do the PR in Lexical, making sure that all nodes properly convert indents and text-align. If you want, you can try it yourself. Otherwise, I think I can do it on Monday. |
I deleted the Wrapper Node. I'll be working on inserting Indent logic into the |
I've opened a PR fixing the indent issue here: facebook/lexical#6693 I'll do the same for text-align soon. If you're interested, contributions are still welcome to make HTML serialization take into account custom indentation values in |
I have a question: I think this PR is the PR that implements exportDOM and importDOM, but currently I don't think the PR should be closed because the original issue was about HTMLConverter not applying align and indent CSS in Additonal: I'm sorry I didn't get back to you sooner, I'm not making PRs. |
You are correct that Payload is not using Lexical's serializer. I've spoken to @AlessioGr about this, and we'll probably change it. |
Description
Add utilities for indent and align converter.
getElementNodeDefaultStyle.ts
infeatures\shared
folder because it seems to be used only inside thefeatures
folder. If I'm misinterpreting this, you can change the folder location.EditorTheme.scss
because--lexical-indent-base-value
compiles tobase(2)
nowType of change
Checklist: