Repository navigation
[lexical-table] Feature: Add $moveTableRow function & Add missing export for $unmergeCellNode - #8833
Merged
Merged
Conversation
hamo-o
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
July 14, 2026 08:18
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
reviewed
Jul 15, 2026
Comment on lines
+520
to
+530
| beforeEach(() => { | ||
| editor = createEditor({ | ||
| namespace: 'test', | ||
| nodes: [TableNode, TableCellNode, TableRowNode], | ||
| onError: (error: Error) => { | ||
| throw error; | ||
| }, | ||
| theme: {}, | ||
| }); | ||
| editor._headless = true; | ||
| }); |
Collaborator
There was a problem hiding this comment.
It'd be better to use the newer style of tests using buildEditorFromExtensions for this to ensure that all of the expected transforms and other code are also running. It also has better defaults, like an onError that throws.
Contributor
Author
There was a problem hiding this comment.
Fixed in 8f0fa11 — since all four describe blocks needed the exact same setup, I hoisted the shared beforeEach/afterEach to the top of the file.
Comment on lines
+543
to
+546
| const table = $getRoot().getFirstChild(); | ||
| if (!$isTableNode(table)) { | ||
| throw new Error('Expected table node'); | ||
| } |
Collaborator
There was a problem hiding this comment.
Suggested change
| const table = $getRoot().getFirstChild(); | |
| if (!$isTableNode(table)) { | |
| throw new Error('Expected table node'); | |
| } | |
| const table = $assertNodeType($getRoot().getFirstChild(), $isTableNode); |
these can all be a little shorter with the $assertNodeType helper
Contributor
Author
There was a problem hiding this comment.
Fixed in bf41069 — I also modified the rest of the same pattern.
… LexicalTableUtils tests and dedupe setup
etrepum
approved these changes
Jul 15, 2026
This was referenced Jul 16, 2026
Closed
Merged
This branch was successfully deployed
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
1. Adds
$moveTableRow(tableNode, originRow, targetRow)to@lexical/table, the row counterpart of$moveTableColumn(added in #8063).flow/LexicalTable.js.flow, and documented with JSDoc.2. Fixes a missing export while touching the entry point:
$unmergeCellNode(added in #7408) was never re-exported fromsrc/index.tssame issue as
$insertTableRowAtNode/$insertTableColumnAtNode, which were fixed in #8791.Without it, unmerging a specific cell requires moving the selection into the cell first (
cellNode.selectEnd()+$unmergeCell()). This PR adds the export, the Flow declaration, and JSDoc.Test plan
Added unit tests for
$moveTableRow(12 cases inLexicalTableUtils.test.ts):originRow === targetRow, out-of-bounds or negative indices, tables with merged cellsBefore
Rows can only be reordered by removing and re-inserting them manually.
After
npm run test-unit -- LexicalTableUtils.test— 38 tests pass (12 new, 26 existing).