-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Close link preview if collapsed selection when creating link #58896
Conversation
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +52 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
This adds the caret at the end of the link, but inside it. I think it should be outside so I can easily keep writing. |
Updated to return the caret to the position outside of it. This felt like more code than it should have. Maybe there's a simpler way to move the caret position? |
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.
This looks good to me.
Custom fields UI breaks this PR too: custom-fields-caret.mp4 |
@jeryj Also a small friendly reminder about this #58896 (comment) Read this post in case you missed it. https://make.wordpress.org/core/2024/02/01/new-commit-message-requirements-in-git-hello-props-bot/ |
Ah, yup. Thanks for the reminder @youknowriad. Haven't built it into my merge habits yet. |
* trunk: (273 commits) Remove preffered style variations legacy support (#58930) Style theme variations: add property extraction and merge utils (#58803) Migrate `change-detection` to Playwright (#58767) Update Changelog for 17.6.6 Docs: Clarify the status of the wp-block-styles theme support, and its intent (#58915) Use `data_wp_context` helper in core blocks and remove `data-wp-interactive` object (#58943) Try double enter for details block. (#58903) Template revisions API: move from experimental to compat/6.4 (#58920) Editor: Remove inline toolbar preference (#58945) Clean up link control CSS. (#58934) Font Library: Show error message when no fonts found to install (#58914) Block Bindings: lock editing of blocks by default (#58787) Editor: Remove the 'all' rendering mode (#58935) Pagination Numbers: Add `data-wp-key` to pagination numbers if enhanced pagination is enabled (#58189) Close link preview if collapsed selection when creating link (#58896) Fix incorrect useAnchor positioning when switching from virtual to rich text elements (#58900) Upgrade Floating UI packages, fix nested iframe positioning bug (#58932) Site editor: fix start patterns store selector (#58813) Revert "Rich text: pad multiple spaces through en/em replacement (#56341)" (#58792) Documentation: Clarify the performance reference commit and how to pick it (#58927) ...
Return caret to after the link boundary so typing can continue if no text is selected when creating a link.
I just cherry-picked this PR to the backports/beta1 branch to get it included in the next release: d1155e0 |
Return caret to after the link boundary so typing can continue if no text is selected when creating a link.
Return caret to after the link boundary so typing can continue if no text is selected when creating a link.
What?
Closes the link preview after adding a link.
Why?
This is the behavior that was added in #58771, but the approach it used doesn't work alongside #58863 because #58771 relies on a previous bug where no active format were present when inserting a link via a collapsed (no selected text) selection.
How?
Call the passed the
stopAddingLink
method when adding a link with a collapsed (no selected text) selection. This follows the pattern further down theonChangeLink
.Testing Instructions