Repository navigation
Auto embed fix #4530 - #4535
Merged
Merged
Auto embed fix #4530#4535
Conversation
fantactuka
requested review from
acywatson,
thegreatercurve,
tylerjbainbridge and
zurfyx
as code owners
May 23, 2023 17:37
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
acywatson
approved these changes
May 23, 2023
zurfyx
approved these changes
May 23, 2023
Om-singhaI
added a commit
to Om-singhaI/lexical
that referenced
this pull request
Aug 23, 2026
…ed paste gate The dirtyLeaves.size <= 3 check in the link mutation listener came from meta#4535, where it kept pasted prose that happens to contain a link from opening the embed menu. The single token paste flag now inspects the clipboard text directly and covers that case, so the count no longer adds anything. It did produce a false negative. When a bare URL is pasted into a paragraph that already holds bold, italic or other inline content, the paste marks the formatted siblings dirty and the auto link transform splits the surrounding text, which pushes the dirty leaf count past 3 and the menu never opens. This is the case the reporter showed on video in the review of this change. The mutation listener now checks only the paste tag and the single token paste flag. A unit test pastes a bare URL over a word between a bold run and an italic run, records the dirty leaf count of the paste update to show it exceeds 3, and checks that the embed check runs once with the URL and that the menu opens. Against the previous code the test fails because the embed check never runs. Refs meta#9087
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.
Pasting enbeddable url can trigger mutation listener with up to 3 dirty leaves: new node itself and (optional) siblings on both sides of the node:
Before:
See #4530
After:
Screen.Recording.2023-05-23.at.1.36.52.PM.mov