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

Changed linkification on paste to match URL parsing within the linkification reaction (Resolves #2031) #2045

Merged
merged 2 commits into from
May 28, 2024

Conversation

matthew-carroll
Copy link
Contributor

Changed linkification on paste to match URL parsing within the linkification reaction (Resolves #2031)

Linkification when pasting content wasn't recognizing URLs without www and https. This is because we have two different linkification paths. One for pasting, which happens at the moment the text is pasted. Another for reacting to user input.

This PR alters the existing pasting behavior to match the link extraction of the linkification reaction.

I'd like to move linkification entirely into the reaction, but it's not completely clear how to determine whether or not the user pasted the content vs got it some other way. I filed a proposal to add such details to all changes: #2044

This PR solves the problem without doing a much larger refactor as described in that proposal.

Copy link
Collaborator

@angelosilvestre angelosilvestre left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 1173 to 1174
// Type text with two URLs
await tester.typeImeText("https://www.google.com and https://flutter.dev ");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please end the comment with a dot.

// Place the caret at the beginning of the empty document.
await tester.placeCaretInParagraph("1", 0);

// Paste text with a URL
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please end the comment with a dot.

await tester.pressCtlV();
}

// Ensure the URL is linkified
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please end the comment with a dot.

// Place the caret at the beginning of the empty document.
await tester.placeCaretInParagraph("1", 0);

// Paste text with a URL
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please end the comment with a dot.

await tester.pressCtlV();
}

// Ensure the URL is linkified
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please end the comment with a dot.

@matthew-carroll matthew-carroll merged commit de1e7e5 into main May 28, 2024
11 checks passed
@matthew-carroll matthew-carroll deleted the 2031_fix-linkification-on-paste branch May 28, 2024 00:42
github-actions bot pushed a commit that referenced this pull request May 28, 2024
matthew-carroll added a commit that referenced this pull request May 28, 2024
quaaantumdev pushed a commit to quaaantumdev/super_editor that referenced this pull request Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent linkifying behaviour
2 participants