Merged
Conversation
This allow the output of very large tables to be scrollable instead of extending their view.
samuelpecher
approved these changes
Jan 9, 2026
Collaborator
samuelpecher
left a comment
There was a problem hiding this comment.
Nice. Lexical solution for Lexical issues.
I like that this prevents the issue down-stream. If users don't like it it's simple to pop the table out of its wrapper.
As a comment to future me: this would be nicely collapsed into a Lexical extension
test/system/table_test.rb
Outdated
| find_editor.toggle_command("insertTable") | ||
|
|
||
| html = find_editor.value | ||
| assert_match(/<figure[^>]*class=["'][^"']*lexxy-content__table-wrapper[^"']*["'][^>]*>\s*<table>.*?<\/table>\s*<\/figure>/m, html, "Table should be wrapped in figure.lexxy-content__table-wrapper") |
Collaborator
There was a problem hiding this comment.
This can use Rails' selectors
assert_select "figure.lexxy-content__table-wrapper > table, "Table should..."edit for posterity: No you can't since it's not a Capybara::Node. Yet.
bba5775 to
5ba3897
Compare
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.
Tables are weird creatures of HTML. No matter how you force them to have a max-width of 100%, if their content is larger, they flow out of their container. So adding a wrapper element around them with
overflow-x: autoallows us to limit this to a scrollable container.We can easily wrap them in a container inside the editor with
setScrollableTablesActive(this.editor, true), but that doesn't change the output.Previously we didn't include a wrapper around the tables to leave it for the rendering to handle it, but decided with @samuelpecher that we probably should, to ease the use of pure Lexxy outputs.
With this PR tables are now getting wrapped within a
<figure class="lexxy-content__table-wrapper">element.