[lexical-table][lexical-playground] Feature: Implement "fit nested tables" for nested table pasting#8097
Merged
etrepum merged 14 commits intofacebook:mainfrom Feb 3, 2026
Conversation
…OARD_NODES command handler
…ted in also, tightening naming and adding test for proportional resizing (currently failing)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
randal-atticus
commented
Jan 27, 2026
randal-atticus
commented
Jan 27, 2026
randal-atticus
commented
Jan 27, 2026
| } | ||
|
|
||
| export function wrapTableHtml(expected, {ignoreClasses = false} = {}) { | ||
| export function wrapTableHtml( |
Contributor
Author
There was a problem hiding this comment.
For whatever reason, "dir="auto" wasn't being applied on the nested table when it was pasted. Instead of debugging that, I just added ignoreDir. Then I tried to make it a bit more explicit about what it was doing (moving "dir" up to the div, and optionally adding the scrollable wrapper class).
randal-atticus
commented
Jan 28, 2026
| ); | ||
| } | ||
|
|
||
| // If we reached this point, there's a table in the selection and nested tables are not allowed - reject the paste. |
Contributor
Author
There was a problem hiding this comment.
I'm aware this behaviour is different from #8082. In that PR, tables are stripped from the payload. The non-nested-table case isn't a focus of this specific PR so I didn't try to replicate that - but there will be a merge conflict.
etrepum
reviewed
Jan 30, 2026
packages/lexical-table/src/__tests__/unit/LexicalTableExtension.test.ts
Outdated
Show resolved
Hide resolved
packages/lexical-table/src/__tests__/unit/LexicalTableExtension.test.ts
Outdated
Show resolved
Hide resolved
etrepum
approved these changes
Feb 3, 2026
rayterion
pushed a commit
to rayterion/lexical
that referenced
this pull request
Feb 8, 2026
…bles" for nested table pasting (facebook#8097)
rayterion
pushed a commit
to rayterion/lexical
that referenced
this pull request
Feb 8, 2026
…bles" for nested table pasting (facebook#8097)
rayterion
pushed a commit
to rayterion/lexical
that referenced
this pull request
Feb 9, 2026
…bles" for nested table pasting (facebook#8097)
rayterion
pushed a commit
to rayterion/lexical
that referenced
this pull request
Feb 13, 2026
…bles" for nested table pasting (facebook#8097)
rayterion
pushed a commit
to rayterion/lexical
that referenced
this pull request
Feb 18, 2026
…bles" for nested table pasting (facebook#8097)
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a
hasFitNestedTablesflag toTablePluginthat resizes nested tables when pasted into table cells. This is optional, because if you havehasHorizontalScroll(scrollable tables) or scrollable table cells (as in Playground), you don't really need this. However, we do need this for a use case that is designed to be closer to MS Word's tables, and I imagine this could be useful in core.Screen.Recording.2026-01-28.at.12.31.02.am.mov
Test plan
Before
Tables are pasted at full width. This looks okay with
hasHorizontalScroll, but not all Lexical users will be using this flag.Screen.Recording.2026-01-28.at.12.34.49.am.mov
After
The pasted table is resized to fit inside the parent cell, accounting for "insets" (padding + border). This is done recursively.
Basic case:
Screen.Recording.2026-01-28.at.12.31.02.am.mov
Deeply nested tables are also resized:
Screen.Recording.2026-01-28.at.12.33.34.am.mov
Pasting into a merged cell:
Screen.Recording.2026-01-28.at.1.12.10.pm.mov