fix/[#21440] Copy/cut input values copying entire block#21457
fix/[#21440] Copy/cut input values copying entire block#21457youknowriad merged 1 commit intoWordPress:masterfrom
Conversation
| return true; | ||
| } | ||
|
|
||
| if ( isNumberInput( document.activeElement ) ) { |
There was a problem hiding this comment.
Should we add this inside isTextField or should it be a separate function? Or more precisely, do we consider a "number" input as a text field? I might think yes but curious what others think?
There was a problem hiding this comment.
Initially I extended isTextField but later I asked myself the same question and to me it makes more sense to have them separated. I don't consider numbers as text per se. Also curious what others think : )
youknowriad
left a comment
There was a problem hiding this comment.
Code looks good to me, I'll do some testing
youknowriad
left a comment
There was a problem hiding this comment.
This seems to work very well :) Thanks for the fix.
|
Congratulations on your first merged pull request, @kirilzh! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: https://profiles.wordpress.org/me/profile/edit/ And if you don't have a WordPress.org account, you can create one on this page: https://login.wordpress.org/register Kudos! |
|
This has fixed the copying part of the issue, but I'm still seeing an issue once the value is pasted back into the field. The pasted value replaces the block itself, instead of being added to the field. |
Description
In
block-editor/src/components/copy-handler/index.jsthis check does not passbecause
documentHasSelection()returns false. Going deeper we see there’s a check if a text fields has a selectionI then stumbled upon this. Hence I added a function checking only
<input type="number" />.How has this been tested?
In both Chrome and FF on MacOS.
Types of changes
Bug fix (non-breaking change) which fixes #21440 .
Checklist: