Skip to content
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][lexical-clipboard] Bug Fix: Race condition in table CUT_COMMAND #6550

Merged
merged 1 commit into from
Aug 24, 2024

Conversation

etrepum
Copy link
Collaborator

@etrepum etrepum commented Aug 24, 2024

Description

@lexical/clipboard:

  • Added new type LexicalClipboardData, $getClipboardDataFromSelection and setLexicalClipboardDataTransfer to make it possible to serialize a selection outside of the async event handling flow
  • Added optional selection parameter to $getHtmlContent, $getLexicalContent
  • Added optional data parameter to copyToClipboard so that $getClipboardDataFromSelection can be called to capture the selection's clipboard data at the right time

@lexical/table:

Fix race condition in CUT_COMMAND listener where the selection was deleted before the contents are copied, using the new @lexical/clipboard functionality to ensure that the clipboard data is captured before asynchronous processing of the copy event in copyToClipboard

Closes #6544

Test plan

Before

See #6544, this solves the same problem in a different way

Screen.Recording.2024-08-23.at.23.09.49.mov

After

Cutting pure text from a table cell puts that text on the clipboard

Copy link

vercel bot commented Aug 24, 2024

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 Aug 24, 2024 7:17pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 24, 2024 7:17pm

Copy link

size-limit report 📦

Path Size
lexical - cjs 29.38 KB (0%)
lexical - esm 29.24 KB (0%)
@lexical/rich-text - cjs 37.74 KB (0%)
@lexical/rich-text - esm 31.05 KB (0%)
@lexical/plain-text - cjs 36.41 KB (0%)
@lexical/plain-text - esm 28.42 KB (0%)
@lexical/react - cjs 39.61 KB (0%)
@lexical/react - esm 32.52 KB (0%)

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Aug 24, 2024
@etrepum etrepum added this pull request to the merge queue Aug 24, 2024
Merged via the queue into facebook:main with commit 149806b Aug 24, 2024
43 checks passed
@etrepum etrepum deleted the table-selection-cut-fix branch August 24, 2024 21:18
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. extended-tests Run extended e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants