Skip to content
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(Lexical): HTML to lexical parser #3569

Merged
merged 33 commits into from
Oct 23, 2023
Merged

feat(Lexical): HTML to lexical parser #3569

merged 33 commits into from
Oct 23, 2023

Conversation

mihajlovco
Copy link
Contributor

@mihajlovco mihajlovco commented Oct 2, 2023

This PR introduce a new package, lexical-converter, which supports:

  • parsing of HTML into a valid Lexical editor state
  • conversion of Lexical state to a flattened representation with the top-level elements being output to HTML
  • conversion of Lexical state to a plain HTML string

This feature will allow the users to convert their HTML content to a Lexical editor state and import the editor state into our PB and HCMS apps.

Both the HTML parser and state transformer rely on the headless Lexical editor. This not only keeps the transformation consistent in all directions, but also allows you to configure the tool with your own Lexical nodes which you might need, and which you might already be using in the Webiny Admin app.

image

image

How Has This Been Tested?

Jest tests.

Documentation

To see the usage as well as advanced mapping examples, consult the test files in the package.

@mihajlovco mihajlovco self-assigned this Oct 6, 2023
@mihajlovco mihajlovco added this to the 5.38.0 milestone Oct 6, 2023
@mihajlovco mihajlovco changed the title wip: html to lexical parser PoC Wip: html to lexical parser PoC Oct 6, 2023
@mihajlovco mihajlovco changed the title Wip: html to lexical parser PoC feat(Lexical): HTML to lexical parser Oct 10, 2023
@mihajlovco mihajlovco marked this pull request as ready for review October 10, 2023 11:39
@Pavel910 Pavel910 self-assigned this Oct 22, 2023
@Pavel910 Pavel910 merged commit e45379d into next Oct 23, 2023
59 checks passed
@Pavel910 Pavel910 linked an issue Nov 5, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

There should be a lexical state to html converter for backend
2 participants