-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[lexical-table] Return inserted node from $insertTableRow__EXPERIMENTAL
and $insertTableColumn__EXPERIMENTAL
#6741
[lexical-table] Return inserted node from $insertTableRow__EXPERIMENTAL
and $insertTableColumn__EXPERIMENTAL
#6741
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
$insertTableRow__EXPERIMENTAL
size-limit report 📦
|
$insertTableRow__EXPERIMENTAL
$insertTableRow__EXPERIMENTAL
and $insertTableColumn__EXPERIMENTAL
Would this actually work the way you intend to use it though? When you insert the row, the updated state needs to be commited, before using it, so you would need to do another editor.update(), at which point you could now get the just appended node key, etc after the committed state. Maybe @etrepum could confirm if I'm right or wrong here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be perfectly reasonable to do something with the result, e.g. populate some default content into the cells. The update commit concern is only relevant if you're trying to do something with the DOM after it's rendered.
Description
Currently, the
$insertTableRow__EXPERIMENTAL
function doesn't return anything, so if you want to insert a table row using it and do something with the inserted row, you'll have to do all the calculations again to find the inserted row.With this PR, the function will return the inserted row node if it was successful and undefined if not. This removes the need for rewriting all the logic regarding spans just to find the inserted row.
Also returns the first inserted cell from
$insertTableColumn__EXPERIMENTAL