Skip to content

Add columns next to selection - #4663

Merged
zurfyx merged 4 commits into
meta:mainfrom
PeterBul:add-column-next-to-selection
Jun 15, 2023
Merged

zurfyx merged 4 commits into
meta:mainfrom
PeterBul:add-column-next-to-selection

Conversation

@PeterBul

Copy link
Copy Markdown
Contributor

Retrieves selection anchor node in addition to focus node in order to find the start or end of table selection when inserting columns.

Fixes issue #4661

The start of selection is used as target for inserting columns if we want to insert columns before.
The end of selection is used as target if we want to insert after.

Before:

Insert.columns.not.working.mp4

After:

Insert.columns.working.mp4

@vercel

vercel Bot commented Jun 15, 2023 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 15, 2023 1:28pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 15, 2023 1:28pm

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 15, 2023
@PeterBul PeterBul changed the title Add columns next to selection (#4661) Add columns next to selection Jun 15, 2023

@zurfyx zurfyx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, LGTM!

(shouldInsertAfter: boolean) => {
editor.update(() => {
$insertTableColumn__EXPERIMENTAL(shouldInsertAfter);
for (let i = 0; i < selectionCounts.columns; i++) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the ideal case scenario, this would be built-in into the same $insertTableColumn function (which would make it faster and also available for others) but given the complexity this will do for now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely agree. Just didn't have the time to do it in the same go.

This branch was successfully deployed

2 active deployments
Preview – lexical-playground — 60dc6b9a Deployed Jun 15, 2023 by vercel[bot]
Preview – lexical — 60dc6b9a Deployed Jun 15, 2023 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants