[lexical-playground] Feature: HTML conversion button#8379
[lexical-playground] Feature: HTML conversion button#8379etrepum merged 5 commits intofacebook:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
left a comment
There was a problem hiding this comment.
All of these look like positive changes, but maybe since it enables adding tests we should write a test or two to confirm that it does the expected thing (convert to html and then convert back from html). We should probably make some sort of change while it's in html view so we can confirm that it's the actual import.
etrepum
left a comment
There was a problem hiding this comment.
I think this is a great idea but we probably want to integrate something like prettier in here so that it's more usable. The node-state-style example does something like that for its html view
| await toggleItalic(page); | ||
| await insertDateTime(page); | ||
|
|
||
| const expectedViewHtml = `<h1 class="PlaygroundEditorTheme__h1" dir="auto"> |
There was a problem hiding this comment.
why not use the html template string here?
| const expectedViewHtml = `<h1 class="PlaygroundEditorTheme__h1" dir="auto"> | |
| const expectedViewHtml = html`<h1 class="PlaygroundEditorTheme__h1" dir="auto"> |
We could automatically run Prettier when switching to HTML mode, but since text elements with the inline style {
htmlWhitespaceSensitivity: 'css',
printWidth: Number.MAX_SAFE_INTEGER
}It will look like this. It's not very convenient, but it's better than cramming everything into a single line
Another question is which specific Prettier to run. I could try running the Prettier that’s already in the CodeActionPlugin Or run it as a separate instance within the current ActionsPlugin. But then we'll have to set the same Prettier settings in both places so that the result is consistent |
|
We can also normalize the html a bit first to make it less sensitive to whitespace and export fewer theme classes |
|
If this is done via DOMExtension, it will mislead users, as it may appear to be a original export of built-in nodes |
|
Well if it was used in a normal way it would affect all exports, unless it was dispatching based on some render context that was only set for the html view |
commit 5d1bc33 Author: Sathvik Veerapaneni <98241593+Sathvik-Chowdary-Veerapaneni@users.noreply.github.com> Date: Thu Apr 23 13:12:21 2026 -0400 [lexical-list] Bug Fix: Merge nested list into parent <li> during HTML export (facebook#8313) Co-authored-by: Bob Ippolito <bob@redivi.com> commit 2c37dc2 Author: Bob Ippolito <bob@redivi.com> Date: Thu Apr 23 07:14:14 2026 -0700 [lexical-clipboard][lexical-rich-text][lexical-plain-text] Bug Fix: Drag-and-drop within the same block (facebook#8373) Co-authored-by: Claude <noreply@anthropic.com> commit ca2aa31 Author: Bob Ippolito <bob@redivi.com> Date: Thu Apr 23 07:12:43 2026 -0700 [lexical][lexical-utils][lexical-list] Bug Fix: Clean up and test $insertNodeToNearestRootAtCaret edge cases (facebook#8384) commit 207648e Author: Bob Ippolito <bob@redivi.com> Date: Thu Apr 23 07:11:52 2026 -0700 [lexical-html][lexical-playground] Feature: Implement a well-defined ordering for DOMRenderExtension overrides and add $decorateDOM (facebook#8368) commit 1ca42f1 Author: Agyei Holy <agyeiholy978@gmail.com> Date: Wed Apr 22 15:39:37 2026 -0500 [lexical][lexical-code-core][lexical-list][lexical-table][lexical-yjs] Refactor: make runtime style updates CSP-safe (facebook#8372) commit ca0ce82 Author: Bob Ippolito <bob@redivi.com> Date: Wed Apr 22 12:57:28 2026 -0700 [lexical-list] Bug Fix: Ensure that ListItemNode always has a ListItem parent (facebook#8382) commit f4c44e1 Author: Sherry <potatowagon@meta.com> Date: Thu Apr 23 00:28:54 2026 +0530 [lexical-markdown] Bug Fix: Code spans take precedence over inline formatting in shortcuts (facebook#8381) commit 4a43cb0 Author: Sergey Gorbachev <grbchv.s@gmail.com> Date: Wed Apr 22 18:31:21 2026 +0300 [lexical-playground] Feature: HTML conversion button (facebook#8379)
commit 5d1bc33 Author: Sathvik Veerapaneni <98241593+Sathvik-Chowdary-Veerapaneni@users.noreply.github.com> Date: Thu Apr 23 13:12:21 2026 -0400 [lexical-list] Bug Fix: Merge nested list into parent <li> during HTML export (facebook#8313) Co-authored-by: Bob Ippolito <bob@redivi.com> commit 2c37dc2 Author: Bob Ippolito <bob@redivi.com> Date: Thu Apr 23 07:14:14 2026 -0700 [lexical-clipboard][lexical-rich-text][lexical-plain-text] Bug Fix: Drag-and-drop within the same block (facebook#8373) Co-authored-by: Claude <noreply@anthropic.com> commit ca2aa31 Author: Bob Ippolito <bob@redivi.com> Date: Thu Apr 23 07:12:43 2026 -0700 [lexical][lexical-utils][lexical-list] Bug Fix: Clean up and test $insertNodeToNearestRootAtCaret edge cases (facebook#8384) commit 207648e Author: Bob Ippolito <bob@redivi.com> Date: Thu Apr 23 07:11:52 2026 -0700 [lexical-html][lexical-playground] Feature: Implement a well-defined ordering for DOMRenderExtension overrides and add $decorateDOM (facebook#8368) commit 1ca42f1 Author: Agyei Holy <agyeiholy978@gmail.com> Date: Wed Apr 22 15:39:37 2026 -0500 [lexical][lexical-code-core][lexical-list][lexical-table][lexical-yjs] Refactor: make runtime style updates CSP-safe (facebook#8372) commit ca0ce82 Author: Bob Ippolito <bob@redivi.com> Date: Wed Apr 22 12:57:28 2026 -0700 [lexical-list] Bug Fix: Ensure that ListItemNode always has a ListItem parent (facebook#8382) commit f4c44e1 Author: Sherry <potatowagon@meta.com> Date: Thu Apr 23 00:28:54 2026 +0530 [lexical-markdown] Bug Fix: Code spans take precedence over inline formatting in shortcuts (facebook#8381) commit 4a43cb0 Author: Sergey Gorbachev <grbchv.s@gmail.com> Date: Wed Apr 22 18:31:21 2026 +0300 [lexical-playground] Feature: HTML conversion button (facebook#8379)

Description
Here are some minor UI improvements to the lexical-playground:
I also added a button for converting to and from HTML, similar to Markdown. Unlike the "export DOM" button in the "debug view" panel, this mode clearly demonstrates how serialization to and from HTML works, enabling debugging of
exportDOM/importDOMoperations and providing a new way to write tests.Test plan
Before
Screen.Recording.2026-04-21.at.02.22.24.mov
After
Screen.Recording.2026-04-21.at.02.21.03.mov